sbin/fsck_hammer2: Add -c to cache subtree blockref stats for speed
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 29 Oct 2019 17:30:31 +0000 (02:30 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Tue, 29 Oct 2019 23:21:58 +0000 (08:21 +0900)
commit958de67287616dba143fd3ee1fd2e649e89138ab
treea6b5d8da09d3fa16771d4b687c1d7076b56e30e4
parente7bf3f778c8dcdc20295c8cd8797c87067f76274
sbin/fsck_hammer2: Add -c to cache subtree blockref stats for speed

If blockref scan succeeds and subtree blockref count exceeds a -c
value, cache subtree blockref stats and blockref itself.

This greatly improves speed when multiple PFSes share large parts
of blockrefs via snapshots. If blockrefs were somehow corrupted in
a weird way that exact same copies of blockref appear more than once,
this doesn't work, but should generally be useful.

Note that using a too small -c value may eat memory without much
performance improvement. Also note that using a too large -c value
saves memory but blockrefs may not be cached or used.

A suitable -c value depends on blockref tree structure since it's
a threshold for blockref count. A fs with more than a few GB of
consumption, should use a few thousand or more.
sbin/fsck_hammer2/fsck_hammer2.8
sbin/fsck_hammer2/fsck_hammer2.c
sbin/fsck_hammer2/fsck_hammer2.h
sbin/fsck_hammer2/test.c