Date: Wed, 05 Nov 2008 04:31:26 +0200 From: Giorgos Keramidas <keramida@freebsd.org> To: Max Laier <max@love2party.net> Cc: freebsd-hackers@freebsd.org, koitsu@freebsd.org, pjd@freebsd.org, Pete French <petefrench@ticketswitch.com>, lhmwzy@gmail.com Subject: Re: du -A / -B options [Re: zfs quota question] Message-ID: <87prlagayp.fsf@kobe.laptop> In-Reply-To: <200811042342.49827.max@love2party.net> (Max Laier's message of "Tue, 4 Nov 2008 23:42:49 %2B0100") References: <E1KnA2b-0007ls-8u@dilbert.ticketswitch.com> <200810071314.45922.max@love2party.net> <200811012114.43137.max@love2party.net> <200811042342.49827.max@love2party.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 4 Nov 2008 23:42:49 +0100, Max Laier <max@love2party.net> 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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87prlagayp.fsf>