From: Darrick J. Wong Date: Mon, 29 Jul 2024 23:23:06 +0000 (-0700) Subject: xfs_scrub: clean up repair_item_difficulty a little X-Git-Tag: v6.10.0~18^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8ec1014d8b7f47aa2333b88f16c18ac89945b236;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: clean up repair_item_difficulty a little Document the flags handling in repair_item_difficulty. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/scrub/repair.c b/scrub/repair.c index 5f13f3c7..d4521f50 100644 --- a/scrub/repair.c +++ b/scrub/repair.c @@ -340,6 +340,15 @@ repair_item_mustfix( } } +/* + * These scrub item states correspond to metadata that is inconsistent in some + * way and must be repaired. If too many metadata objects share these states, + * this can make repairs difficult. + */ +#define HARDREPAIR_STATES (SCRUB_ITEM_CORRUPT | \ + SCRUB_ITEM_XCORRUPT | \ + SCRUB_ITEM_XFAIL) + /* Determine if primary or secondary metadata are inconsistent. */ unsigned int repair_item_difficulty( @@ -349,9 +358,10 @@ repair_item_difficulty( unsigned int ret = 0; foreach_scrub_type(scrub_type) { - if (!(sri->sri_state[scrub_type] & (XFS_SCRUB_OFLAG_CORRUPT | - XFS_SCRUB_OFLAG_XCORRUPT | - XFS_SCRUB_OFLAG_XFAIL))) + unsigned int state; + + state = sri->sri_state[scrub_type] & HARDREPAIR_STATES; + if (!state) continue; switch (scrub_type) {