ZFS directory with a large number of files

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue Aug 2 12:55:40 UTC 2011


On 02/08/2011 11:10, Daniel Kalchev wrote:
> Other than that, perhaps in ZFS it would be easier to prune the unused
> directory entries, than it is in UFS. It looks like this is not
> implemented.

Remember that ZFS uses copy-on-write for all filesystem updates.  Any
change to a directory contents means the whole directory data is
rewritten.  In which case, there's no benefit to retaining a large data
structure with lots of empty slots (as happened on Unix FSes in the
past.)  I'd expect, and I see in my (admittedly fairly cursory) testing
that ZFS directory data sizes update immediately whenever files are
added or removed from the directory.

Where this gets interesting is when the directory gets sufficiently
large that the directory data is larger than the 128kB block size used
by ZFS.  As that takes many more files than any sensible person would
put into one directory it's possible there's a bug in handling such
large structures which is only rarely tickled.  But this is all
speculation on my behalf, and I have no evidence to back it up.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                   7 Priory Courtyard
                                                  Flat 3
PGP: http://www.infracaninophile.co.uk/pgpkey     Ramsgate
JID: matthew at infracaninophile.co.uk               Kent, CT11 9PW

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 267 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20110802/1d9663ad/signature.pgp


More information about the freebsd-stable mailing list