summaryrefslogtreecommitdiff
path: root/e2fsck/dirinfo.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-11-29 11:24:52 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-11-29 11:24:52 -0500
commit4e523bbe00cfa0240b4581eeca0c097b05c9fe3e (patch)
tree167abb1aa7df66296ae83c08e440ac6a71b7f687 /e2fsck/dirinfo.c
parentdb40c20e3fd66d90d29a41bef9eb20d1e0745906 (diff)
downloade2fsprogs-4e523bbe00cfa0240b4581eeca0c097b05c9fe3e.tar.gz
e2fsck: speed up runs when using tdb for large atypical filesystems
Optimize how the tdb library so that running with [scratch_files] in /etc/e2fsck.conf is more efficient. Use a better hash function, supplied by Rogier Wolff, and supply an estimate of the size of the hash table to tdb_open instead of using the default (which is way too small in most cases). Also, disable the tdb locking and fsync calls, since it's not necessary for our use in this case (which is essentially as cheap swap space; the tdb files do not contain persistent data.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'e2fsck/dirinfo.c')
-rw-r--r--e2fsck/dirinfo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/e2fsck/dirinfo.c b/e2fsck/dirinfo.c
index e98795cf..c81777a5 100644
--- a/e2fsck/dirinfo.c
+++ b/e2fsck/dirinfo.c
@@ -67,7 +67,11 @@ static void setup_tdb(e2fsck_t ctx, ext2_ino_t num_dirs)
db->tdb = NULL;
return;
}
- db->tdb = tdb_open(db->tdb_fn, 0, TDB_CLEAR_IF_FIRST,
+
+ if (num_dirs < 99991)
+ num_dirs = 99991; /* largest 5 digit prime */
+
+ db->tdb = tdb_open(db->tdb_fn, num_dirs, TDB_NOLOCK | TDB_NOSYNC,
O_RDWR | O_CREAT | O_TRUNC, 0600);
close(fd);
}