summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-07-10 21:21:29 +0000
committeriedowse <iedowse@FreeBSD.org>2001-07-10 21:21:29 +0000
commitecbac42d619c707d6a486fce56cdff49cd9c5367 (patch)
tree39774deb25357214b53b9f3012524f48622713aa /sys/gnu
parent9101af193bf74231b579ce35f5801eab014212aa (diff)
downloadFreeBSD-src-ecbac42d619c707d6a486fce56cdff49cd9c5367.zip
FreeBSD-src-ecbac42d619c707d6a486fce56cdff49cd9c5367.tar.gz
Bring in dirhash, a simple hash-based lookup optimisation for large
directories. When enabled via "options UFS_DIRHASH", in-core hash arrays are maintained for large directories. These allow all directory operations to take place quickly instead of requiring long linear searches. For now anyway, dirhash is not enabled by default. The in-core hash arrays have a memory requirement that is approximately half the size of the size of the on-disk directory file. A number of new sysctl variables allow control over which directories get hashed and over the maximum amount of memory that dirhash will use: vfs.ufs.dirhash_minsize The minimum on-disk directory size for which hashing should be used. The default is 2560 (2.5k). vfs.ufs.dirhash_maxmem The system-wide maximum total memory to be used by dirhash data structures. The default is 2097152 (2MB). The current amount of memory being used by dirhash is visible through the read-only sysctl variable vfs.ufs.dirhash_maxmem. Finally, some extra sanity checks that are enabled by default, but which may have an impact on performance, can be disabled by setting vfs.ufs.dirhash_docheck to 0. Discussed on: -fs, -hackers
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/ext2fs/inode.h2
-rw-r--r--sys/gnu/fs/ext2fs/inode.h2
2 files changed, 4 insertions, 0 deletions
diff --git a/sys/gnu/ext2fs/inode.h b/sys/gnu/ext2fs/inode.h
index 0fdaee2..968d950 100644
--- a/sys/gnu/ext2fs/inode.h
+++ b/sys/gnu/ext2fs/inode.h
@@ -94,6 +94,8 @@ struct inode {
ino_t i_ino; /* Inode number of found directory. */
u_int32_t i_reclen; /* Size of found directory entry. */
u_int32_t i_spare[4]; /* XXX actually non-spare (for ext2fs). */
+
+ struct dirhash *i_dirhash; /* Hashing for large directories */
/*
* The on-disk dinode itself.
*/
diff --git a/sys/gnu/fs/ext2fs/inode.h b/sys/gnu/fs/ext2fs/inode.h
index 0fdaee2..968d950 100644
--- a/sys/gnu/fs/ext2fs/inode.h
+++ b/sys/gnu/fs/ext2fs/inode.h
@@ -94,6 +94,8 @@ struct inode {
ino_t i_ino; /* Inode number of found directory. */
u_int32_t i_reclen; /* Size of found directory entry. */
u_int32_t i_spare[4]; /* XXX actually non-spare (for ext2fs). */
+
+ struct dirhash *i_dirhash; /* Hashing for large directories */
/*
* The on-disk dinode itself.
*/
OpenPOWER on IntegriCloud