hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
[20050125] Dirhash: Speeding up handling of large directories
Directories in Unix are usually tables with two columns, file/directory name and inode-number, the latter of which contains all information about the file's metadata like size, modification times, pointers to actual data blocks etc. The problem with large directories is access, as the table is usually even unsorted. One possible optimisation to speed things up is using a better data structure for the on-disk data, like the tree structures used in XFS. An alternative that doesn't require changing the on-disk data is to maintain hashes in memory to speed up access, which is what was ported from FreeBSD to NetBSD now with the name dirhash. It is off by default, you can enable it in -current by setting options "UFS_DIRHASH" in your kernel config. See also David Malone's overview on UFS/FFS optimisation.

[Tags: ]

Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 24541117
Copyright (c) Hubert Feyrer