]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: clean up repair_item_difficulty a little
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:06 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:07 +0000 (17:01 -0700)
Document the flags handling in repair_item_difficulty.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
scrub/repair.c

index 5f13f3c7a5fd36f9d71214722b13b9719eabb21d..d4521f50c6872908ad7c0b0a73e3c83c108adffd 100644 (file)
@@ -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) {