tests: add test cases for inode badness
LU-5949 e2fsck: simplify inode badness handling
Move the badness increment into fix_problem() so that code does
not need to be spread across the code and explicitly set. Instead,
take advantage of the fact that pctx->ino is almost always pointing
at the bad inode and increment badness whenever fix_problem() is
called on the inode. This also handles new problems in the future.
That leaves only a handful of places in the code that need special
handling to either set a higher badness (e.g. inode blocks that are
directly referencing filesystem metadata or have wildly incorrect
timestamps), or should not contribute to inode badness at all.
The main exceptions are when reprocessing duplicate blocks in the
inode (badness already set), and cleaning bad entries in a directory
leaf block in check_dir_block(), which uses pctx->ino to reference
the parent directory inode number. In such cases, fix_problem_bad()
is called with 0 badness, since the leaf block was been repaired,
and clearing the directory inode in this case is unnecessary.
This patch should be merged into original badness patch on rebase.
Fixes:
92a85a3ced2c ("e2fsck: track errors/badness found for each inode")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I96cd21b5976991f0bb1c63fc99857c80e23ebbe5
Reviewed-on: https://review.whamcloud.com/41328
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Artem Blagodarenko <artem.blagodarenko@hpe.com>
Change-Id: Ie3f1f33a1e227cd241632e1506344f53788b3109
Signed-off-by: Girish Shilamkar <girish@clusterfs.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>