Whamcloud - gitweb
e2fsck: add optimization for heavily hard-linked file systems
authorJaco Kroon <jaco@uls.co.za>
Wed, 23 Aug 2017 18:21:43 +0000 (14:21 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 26 Aug 2017 15:33:25 +0000 (11:33 -0400)
commit6304d212bea8368dcaeffc40ed120c2e89bae95a
tree0fcd68d4b5979f27dab95ed477b11cc949a0be74
parentee84bbc813b79fe948aa8d0ac1ad51969e167382
e2fsck: add optimization for heavily hard-linked file systems

In the case of file system with large number of hard links, e2fsck can
take a large amount of time in pass 2 due to binary search lookup of
inode numbers.  This implements a memory trade-off (storing 2 bytes
in-memory for each inode to store inode counts).

For a 40TB filesystem with 2.8bn inodes this map alone requires 5.7GB
of RAM.  For this reason, we don't enable this optimization by
default.  It can be enabled using either an extended option to e2fsck
or via a seting in e2fsck.conf.

Even when the fullmap optimization is enabled, we don't use this for
the icount structure in pass 1.  This is because the gain CPU gain is
nearly nil for that pass and the sacrificed memory does not justify
the increase in RAM.

(It could be that during pass 1, if more than 17% if possible inodes
has link_count>1 (466m inodes in the 40TB with 2.8bn possible inodes
case) then it becomes more memory efficient to use the full map
implementation in terms of memory.  However, this is extremely
unlikely given that most file systems are heavily over-provisioned in
terms of the number of inodes in the system.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/e2fsck.8.in
e2fsck/e2fsck.conf.5.in
e2fsck/e2fsck.h
e2fsck/pass1.c
e2fsck/unix.c
lib/ext2fs/ext2fs.h
lib/ext2fs/icount.c