[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: du: cache directory size
From: |
Pádraig Brady |
Subject: |
Re: du: cache directory size |
Date: |
Thu, 3 Jul 2008 14:46:46 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
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.