]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: remove ALP_* flags namespace
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:02 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:06 +0000 (17:01 -0700)
In preparation to move all the repair code to repair.[ch], remove the
ALP_* flags namespace since it mostly overlaps with XRM_*.  Rename the
clunky "COMPLAIN_IF_UNFIXED" flag to "FINAL_WARNING", because that's
what it really means.

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

index 4235c228c0e8545cb9cf78cdc9c490e12bee340e..9a26b92036c6c2e37886440dbecf05d8ecc315d1 100644 (file)
@@ -88,7 +88,7 @@ try_inode_repair(
                return 0;
 
        ret = action_list_process(ictx->ctx, fd, alist,
-                       ALP_REPAIR_ONLY | ALP_NOPROGRESS);
+                       XRM_REPAIR_ONLY | XRM_NOPROGRESS);
        if (ret)
                return ret;
 
index 8807f147aed1e9edcb62c41cbd4842ee0ab91d4b..d42e67637d81651b2f7772185c456c351a331550 100644 (file)
@@ -54,7 +54,7 @@ repair_ag(
        } while (unfixed > 0);
 
        /* Try once more, but this time complain if we can't fix things. */
-       flags |= ALP_COMPLAIN_IF_UNFIXED;
+       flags |= XRM_FINAL_WARNING;
        ret = action_list_process(ctx, -1, alist, flags);
        if (ret)
                *aborted = true;
index b4c635d3452b305de0f439a80465a937eb6dfe3e..940e434c3cd93cb7d31f746600596dbb78b61001 100644 (file)
@@ -422,7 +422,7 @@ fs_scan_worker(
        }
 
        ret = action_list_process(ctx, ctx->mnt.fd, &item->alist,
-                       ALP_COMPLAIN_IF_UNFIXED | ALP_NOPROGRESS);
+                       XRM_FINAL_WARNING | XRM_NOPROGRESS);
        if (ret) {
                str_liberror(ctx, ret, _("repairing fs scan metadata"));
                *item->abortedp = true;
index 93a074f1151387fe74abd44a565f78600cd58812..820a68f99a478d68c20d4011e9e50b31b0625729 100644 (file)
@@ -122,7 +122,7 @@ phase7_func(
        if (error)
                return error;
        error = action_list_process(ctx, -1, &alist,
-                       ALP_COMPLAIN_IF_UNFIXED | ALP_NOPROGRESS);
+                       XRM_FINAL_WARNING | XRM_NOPROGRESS);
        if (error)
                return error;
 
index 9ade805e1b64463f8b03248b500148517455ea77..61d62ab6b49287588ded101be465de1c0126c75a 100644 (file)
@@ -274,7 +274,7 @@ action_list_process(
                fix = xfs_repair_metadata(ctx, xfdp, aitem, repair_flags);
                switch (fix) {
                case CHECK_DONE:
-                       if (!(repair_flags & ALP_NOPROGRESS))
+                       if (!(repair_flags & XRM_NOPROGRESS))
                                progress_add(1);
                        alist->nr--;
                        list_del(&aitem->list);
@@ -316,7 +316,7 @@ action_list_process_or_defer(
        int                             ret;
 
        ret = action_list_process(ctx, -1, alist,
-                       ALP_REPAIR_ONLY | ALP_NOPROGRESS);
+                       XRM_REPAIR_ONLY | XRM_NOPROGRESS);
        if (ret)
                return ret;
 
index aa3ea13615f2811a02eba0b3a00b862e6ddd382d..6b6f64691a36d52bc5dbbfdfa7ac9431ef62af94 100644 (file)
@@ -32,10 +32,18 @@ void action_list_find_mustfix(struct action_list *actions,
                unsigned long long *broken_primaries,
                unsigned long long *broken_secondaries);
 
-/* Passed through to xfs_repair_metadata() */
-#define ALP_REPAIR_ONLY                (XRM_REPAIR_ONLY)
-#define ALP_COMPLAIN_IF_UNFIXED        (XRM_COMPLAIN_IF_UNFIXED)
-#define ALP_NOPROGRESS         (1U << 31)
+/*
+ * Only ask the kernel to repair this object if the kernel directly told us it
+ * was corrupt.  Objects that are only flagged as having cross-referencing
+ * errors or flagged as eligible for optimization are left for later.
+ */
+#define XRM_REPAIR_ONLY                (1U << 0)
+
+/* This is the last repair attempt; complain if still broken even after fix. */
+#define XRM_FINAL_WARNING      (1U << 1)
+
+/* Don't call progress_add after repairing an item. */
+#define XRM_NOPROGRESS         (1U << 2)
 
 int action_list_process(struct scrub_ctx *ctx, int fd,
                struct action_list *alist, unsigned int repair_flags);
index 7cb94af3d15f188ba5dcd934b88284a1cef1c8cb..f4b152a1c9ca795418c6bfc808fd97234ec2886d 100644 (file)
@@ -743,7 +743,7 @@ _("Filesystem is shut down, aborting."));
                 * could fix this, it's at least worth trying the scan
                 * again to see if another repair fixed it.
                 */
-               if (!(repair_flags & XRM_COMPLAIN_IF_UNFIXED))
+               if (!(repair_flags & XRM_FINAL_WARNING))
                        return CHECK_RETRY;
                fallthrough;
        case EINVAL:
@@ -773,13 +773,13 @@ _("Read-only filesystem; cannot make changes."));
                 * to requeue the repair for later and don't say a
                 * thing.  Otherwise, print error and bail out.
                 */
-               if (!(repair_flags & XRM_COMPLAIN_IF_UNFIXED))
+               if (!(repair_flags & XRM_FINAL_WARNING))
                        return CHECK_RETRY;
                str_liberror(ctx, error, descr_render(&dsc));
                return CHECK_DONE;
        }
 
-       if (repair_flags & XRM_COMPLAIN_IF_UNFIXED)
+       if (repair_flags & XRM_FINAL_WARNING)
                scrub_warn_incomplete_scrub(ctx, &dsc, &meta);
        if (needs_repair(&meta)) {
                /*
@@ -787,7 +787,7 @@ _("Read-only filesystem; cannot make changes."));
                 * just requeue this and try again later.  Otherwise we
                 * log the error loudly and don't try again.
                 */
-               if (!(repair_flags & XRM_COMPLAIN_IF_UNFIXED))
+               if (!(repair_flags & XRM_FINAL_WARNING))
                        return CHECK_RETRY;
                str_corrupt(ctx, descr_render(&dsc),
 _("Repair unsuccessful; offline repair required."));
@@ -799,7 +799,7 @@ _("Repair unsuccessful; offline repair required."));
                 * caller to run xfs_repair; otherwise, we'll keep trying to
                 * reverify the cross-referencing as repairs progress.
                 */
-               if (repair_flags & XRM_COMPLAIN_IF_UNFIXED) {
+               if (repair_flags & XRM_FINAL_WARNING) {
                        str_info(ctx, descr_render(&dsc),
  _("Seems correct but cross-referencing failed; offline repair recommended."));
                } else {
index cb33ddb46f35d7c6b633c74bd8ed94fce9a08cf1..5359548b06f7a018128cc70dea92ce441d37dd07 100644 (file)
@@ -54,16 +54,6 @@ struct action_item {
        __u32                   agno;
 };
 
-/*
- * Only ask the kernel to repair this object if the kernel directly told us it
- * was corrupt.  Objects that are only flagged as having cross-referencing
- * errors or flagged as eligible for optimization are left for later.
- */
-#define XRM_REPAIR_ONLY                (1U << 0)
-
-/* Complain if still broken even after fix. */
-#define XRM_COMPLAIN_IF_UNFIXED        (1U << 1)
-
 enum check_outcome xfs_repair_metadata(struct scrub_ctx *ctx,
                struct xfs_fd *xfdp, struct action_item *aitem,
                unsigned int repair_flags);