du: cache directory size

2008-07-03 Thread Mildred
Hi,

I noticed that du takes a long time to scan directories and measure
disk usage.

I was thinking that perhaps caching the size of directories could bu
useful. Perhaps, after du computes the size of a directory, it could
write its size in its extended attributes (if the filesystem support
it). Next time, du would only compare the directory atime (or mtime
perhaps) with the time of the scan. That could possibly save some time
during the scan.

Perhaps this is not something to be included in du itself, but I
thought it could be a good idea to give the idea anyway.

Thanks for reading.

Mildred

-- 
Mildred Ki'lya
E-Mail: mildred593(at)online.fr

Site:   http://mildred632.free.fr/
XMPP:   [EMAIL PROTECTED] (GoogleTalk, Jabber)

GPG:197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: du: cache directory size

2008-07-03 Thread Andreas Schwab
Mildred [EMAIL PROTECTED] writes:

 I was thinking that perhaps caching the size of directories could bu
 useful. Perhaps, after du computes the size of a directory, it could
 write its size in its extended attributes (if the filesystem support
 it). Next time, du would only compare the directory atime (or mtime
 perhaps) with the time of the scan. That could possibly save some time
 during the scan.

Just because a directory is unchanged does not mean that all files and
subdirectories beneath it are unchanged as well.

Andreas.

-- 
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
And now for something completely different.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: du: cache directory size

2008-07-03 Thread Philip Rowlands

On Wed, 2 Jul 2008, Mildred wrote:

I was thinking that perhaps caching the size of directories could bu 
useful. Perhaps, after du computes the size of a directory, it could 
write its size in its extended attributes (if the filesystem support 
it). Next time, du would only compare the directory atime (or mtime 
perhaps) with the time of the scan.


Unfortunately neither the atime nor mtime of a directory would 
necessarily show a change to the disk usage of the enclosed files. 
Consider a logfile, for example; the filesize grows continuously, but 
makes no change to the directory.



Cheers,
Phil


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: du: cache directory size

2008-07-03 Thread Pádraig Brady
Mildred wrote:
 Hi,
 
 I noticed that du takes a long time to scan directories and measure
 disk usage.
 
 I was thinking that perhaps caching the size of directories could bu
 useful. Perhaps, after du computes the size of a directory, it could
 write its size in its extended attributes (if the filesystem support
 it). Next time, du would only compare the directory atime (or mtime
 perhaps) with the time of the scan. That could possibly save some time
 during the scan.

Those values would be invalidated though once a change
has been written anywhere in the tree under a directory.

 Perhaps this is not something to be included in du itself, but I
 thought it could be a good idea to give the idea anyway.

The idea might be appropriate on a per file basis.

For example, md5sum which needs to do significant processing
on all of a file's data, could cache the computed value in
an extended attribute. You would need support in the filesystem
though, to invalidate certain extended attributes on write.

Pádraig.


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils


Re: du: cache directory size

2008-07-03 Thread Mildred

Le Thu 03/07/2008 à 14:29 Philip Rowlands à écrit:

 Unfortunately neither the atime nor mtime of a directory would 
 necessarily show a change to the disk usage of the enclosed files. 
 Consider a logfile, for example; the filesize grows continuously, but 
 makes no change to the directory.


You're probably right. I thought a modification on a file would change
directories times but the test I made must have been incorrect.

Thanks everyone

Mildred


-- 
Mildred Ki'lya
E-Mail: mildred593(at)online.fr

Site:   http://mildred632.free.fr/
XMPP:   [EMAIL PROTECTED] (GoogleTalk, Jabber)

GPG:197C A7E6 645B 4299 6D37 684B 6F9D A8D6 [9A7D 2E2B]


___
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils