From owner-freebsd-hackers@FreeBSD.ORG Sun Nov 2 00:46:58 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98DBE1065690 for ; Sun, 2 Nov 2008 00:46:58 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id C4DE68FC17 for ; Sun, 2 Nov 2008 00:46:57 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl158-209.kln.forthnet.gr [62.1.61.209]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mA20S3Jf017074 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sun, 2 Nov 2008 02:28:09 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id mA20S2uP006149; Sun, 2 Nov 2008 02:28:02 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id mA20S0LY006148; Sun, 2 Nov 2008 02:28:00 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Max Laier References: <200810071314.45922.max@love2party.net> <200811012114.43137.max@love2party.net> Date: Sun, 02 Nov 2008 02:27:59 +0200 Message-ID: <87zlkjvunk.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-MailScanner-ID: mA20S3Jf017074 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.501, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.10, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: freebsd-hackers@freebsd.org, koitsu@freebsd.org, pjd@freebsd.org, Pete French , lhmwzy@gmail.com Subject: Re: du -A / -B options [Re: zfs quota question] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Nov 2008 00:46:58 -0000 On Sat, 1 Nov 2008 21:14:42 +0100, Max Laier wrote: > Hi, > a thread on freebsd-stable@ [1] about problems with du(1) and > compressed zfs filesystems got me looking for a possible solution. > Attached is a diff for du(1) that adds two new options: > > -A to display the apparent size of the file instead of the used blocks. > -B bsize to specify a custom blocksize. In particular one <512byte That's nice :) % Index: du.1 % =================================================================== % --- du.1 (revision 184513) % +++ du.1 (working copy) % @@ -60,6 +61,14 @@ % .Pp % The options are as follows: % .Bl -tag -width indent % +.It Fl A % +Display the apparent size instead of the diskusage. 'disk usage' should be two words here. % +This can be helpful to find sparse files and when operating on % +compressed volumes. ``This can be helpful when operating on sparse files or compressed volumes'' maybe? The fact that a difference between plain `du' and `du -A' output may be a nice hack to find sparse files is a cool side-effect, but that's not really the main driving force behind the change, right? :) % Index: du.c % =================================================================== % --- du.c (revision 184513) % +++ du.c (working copy) % @@ -86,27 +86,39 @@ % FTS *fts; % FTSENT *p; % off_t savednumber = 0; % - long blocksize; % + long blocksize = 0; savednumber is one of the existing style bugs. We shouldn't copy it, but initialize `blocksize' further down, near `depth = INT_MAX' and the rest of the initializations. > Thoughts? FWIW, I like the new options :)