From owner-freebsd-toolchain@FreeBSD.ORG Tue Nov 8 21:55:49 2011 Return-Path: Delivered-To: freebsd-toolchain@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1233) id 42EB71065673; Tue, 8 Nov 2011 21:55:49 +0000 (UTC) Date: Tue, 8 Nov 2011 21:55:49 +0000 From: Alexander Best To: Dimitry Andric Message-ID: <20111108215549.GA44260@freebsd.org> References: <20111108204912.GA34155@freebsd.org> <4EB9A268.5020805@FreeBSD.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4EB9A268.5020805@FreeBSD.org> Cc: freebsd-toolchain@freebsd.org Subject: Re: make cleanworld X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Nov 2011 21:55:49 -0000 On Tue Nov 8 11, Dimitry Andric wrote: > On 2011-11-08 21:49, Alexander Best wrote: > > any reason 'make cleanworld' does > > > > otaku% make cleanworld > > rm -rf /usr/obj/usr/git-freebsd-head/* > > chflags -R 0 /usr/obj/usr/git-freebsd-head > > rm -rf /usr/obj/usr/git-freebsd-head/* > > > > where > > > > otaku% make cleanworld > > chflags -R 0 /usr/obj/usr/git-freebsd-head > > rm -rf /usr/obj/usr/git-freebsd-head/* > > > > should be sufficient? > > The first method is more efficient, because there are usually just a few > files with schg flags set on them (zero even, if you build as a regular > user). > > Suppose you have 30,000 files in /usr/obj, of which 20 have schg flags. > > The first method will unlink 29,980 files, failing on 20 of them. Then > it will change flags on just 20 files, and lastly unlink those 20 files. > Total number of 'operations' is 30,000 + 20 + 20 = 30,040. > > The second method will change flags on all 30,000 files, then unlink all > 30,000 files. Total number of 'operations' is now 30,000 + 30,000 = > 60,000. maybe the comment in /usr/src/Makefile could be updated to mention the efficiency aspect? right now it only says: # # This 'cleanworld' target is not included in TGTS, because it is not a # recursive target. All of the work for it is done right here. It is # expected that BW_CANONICALOBJDIR == the CANONICALOBJDIR as would be # created by bsd.obj.mk, except that we don't want to .include that file # in this makefile. # # In the following, the first 'rm' in a series will usually remove all # files and directories. If it does not, then there are probably some # files with chflags set, so this unsets them and tries the 'rm' a # second time. There are situations where this target will be cleaning # some directories via more than one method, but that duplication is # needed to correctly handle all the possible situations. Also this # another tought would be to do the following: find -flags +XXX /usr/obj/usr/git-freebsd-head -exec chflags -R 0 {} + rm/obj/usr/git-freebsd-head/* that should only execute chflags(1) on those files with flags set. cheers. alex