From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 5 02:31:59 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 ACEEB10656A3; Wed, 5 Nov 2008 02:31: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 970948FC0A; Wed, 5 Nov 2008 02:31:57 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl92-78.kln.forthnet.gr [77.49.59.78]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-5) with ESMTP id mA52VdqA011613 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 5 Nov 2008 04:31:44 +0200 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id mA52VdnH001416; Wed, 5 Nov 2008 04:31:39 +0200 (EET) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id mA52Vcm7001415; Wed, 5 Nov 2008 04:31:38 +0200 (EET) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Max Laier In-Reply-To: <200811042342.49827.max@love2party.net> (Max Laier's message of "Tue, 4 Nov 2008 23:42:49 +0100") Date: Wed, 05 Nov 2008 04:31:26 +0200 Message-ID: <87prlagayp.fsf@kobe.laptop> References: <200810071314.45922.max@love2party.net> <200811012114.43137.max@love2party.net> <200811042342.49827.max@love2party.net> 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: mA52VdqA011613 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.306, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.09, 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: Wed, 05 Nov 2008 02:31:59 -0000 On Tue, 4 Nov 2008 23:42:49 +0100, Max Laier wrote: > Hi again, > > On Saturday 01 November 2008 21:14:42 I wrote: >> 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 >> >> The GNU du(1) has --apparent-size for -A, but we don't like long options. >> That's not to say that it couldn't be added for script compat. -B is >> probably not that interesting, but it can be helpful and came for free. > > Attached is an updated patch. This refines the -B option to something more > useful (and fixes a bug in the original patch). > > From the man page: > > -B blocksize > Calculate block counts in blocksize byte blocks. This is differ- > ent from the -k, -m options or setting BLOCKSIZE and gives an > estimate of how many space the examined file hierachy would > require on a filesystem with the given blocksize. Unless in -A > mode, blocksize is rounded up to the next multiple of 512. That looks nice! With a small fix (``how _much_ space'') I like the idea a lot :) The patch fails to apply on a recent /head snapshot of du though: : keramida@kobe:/ws/bsd/src/usr.bin/du$ patch -p0 -i ~/du.AB.diff : [...] : The text leading up to this was: : -------------------------- : |Index: du.c : |=================================================================== : |--- du.c (revision 184656) : |+++ du.c (working copy) : -------------------------- : Patching file du.c using Plan A... : Hunk #1 failed at 79. : Hunk #2 failed at 99. : Hunk #3 failed at 159. : Hunk #4 succeeded at 215 (offset -2 lines). : Hunk #5 failed at 236. : Hunk #6 failed at 259. : Hunk #7 failed at 292. : Hunk #8 failed at 317. : Hunk #9 succeeded at 465 (offset -5 lines). : Hunk #10 succeeded at 482 (offset -2 lines). : 7 out of 10 hunks failed--saving rejects to du.c.rej : done : keramida@kobe:/ws/bsd/src/usr.bin/du$ Can you please refresh and repost it?