]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
libfrog: promote XFROG_SCRUB_DESCR_SUMMARY to a scrub type
authorDarrick J. Wong <djwong@kernel.org>
Mon, 15 Apr 2024 23:07:48 +0000 (16:07 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 17 Apr 2024 21:06:27 +0000 (14:06 -0700)
"Summary" metadata, at least in the scrub context, are metadata whose
values depend on some kind of computation and therefore can only be
checked after we've looked at all the other metadata.  Currently, the
superblock summary counters are the only thing that are like this, but
since they run in a totally separate xfs_scrub phase (7 vs. 2), make
them their own group and remove the group+flag mix.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
io/scrub.c
libfrog/scrub.c
libfrog/scrub.h
scrub/phase4.c
scrub/phase7.c
scrub/scrub.c
scrub/scrub.h

index d6eda5bea5388e09ae00b2af673da56e45fe881f..70301c0676c4b27939b4f7899b0209d349f80362 100644 (file)
@@ -183,6 +183,7 @@ parse_args(
                break;
        case XFROG_SCRUB_GROUP_FS:
        case XFROG_SCRUB_GROUP_NONE:
+       case XFROG_SCRUB_GROUP_SUMMARY:
                if (!parse_none(argc, optind)) {
                        exitcode = 1;
                        return command_usage(cmdinfo);
index 90fc2b1a40cd4a5f79d9cd43fd43b656f0827a02..5a5f522a42581681c35f01baec1ba30484d8cbad 100644 (file)
@@ -132,8 +132,7 @@ const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR] = {
        [XFS_SCRUB_TYPE_FSCOUNTERS] = {
                .name   = "fscounters",
                .descr  = "filesystem summary counters",
-               .group  = XFROG_SCRUB_GROUP_FS,
-               .flags  = XFROG_SCRUB_DESCR_SUMMARY,
+               .group  = XFROG_SCRUB_GROUP_SUMMARY,
        },
 };
 
index 43a882321f996bd8868f10d80a5dd334efff8381..68f1a968103eb2783860e12666adc84df7897a75 100644 (file)
@@ -13,6 +13,7 @@ enum xfrog_scrub_group {
        XFROG_SCRUB_GROUP_PERAG,        /* per-AG metadata */
        XFROG_SCRUB_GROUP_FS,           /* per-FS metadata */
        XFROG_SCRUB_GROUP_INODE,        /* per-inode metadata */
+       XFROG_SCRUB_GROUP_SUMMARY,      /* summary metadata */
 };
 
 /* Catalog of scrub types and names, indexed by XFS_SCRUB_TYPE_* */
@@ -20,15 +21,8 @@ struct xfrog_scrub_descr {
        const char              *name;
        const char              *descr;
        enum xfrog_scrub_group  group;
-       unsigned int            flags;
 };
 
-/*
- * The type of metadata checked by this scrubber is a summary of other types
- * of metadata.  This scrubber should be run after all the others.
- */
-#define XFROG_SCRUB_DESCR_SUMMARY      (1 << 0)
-
 extern const struct xfrog_scrub_descr xfrog_scrubbers[XFS_SCRUB_TYPE_NR];
 
 int xfrog_scrub_metadata(struct xfs_fd *xfd, struct xfs_scrub_metadata *meta);
index 1228c7cb654535a126e273aa4fbfb57051234c05..5dfc3856b82f34754880611cb7d3d5878a5a4a8d 100644 (file)
@@ -139,7 +139,7 @@ phase4_func(
         * counters, so counter repairs have to be put on the list now so that
         * they get fixed before we stop retrying unfixed metadata repairs.
         */
-       ret = scrub_fs_summary(ctx, &ctx->action_lists[0]);
+       ret = scrub_fs_counters(ctx, &ctx->action_lists[0]);
        if (ret)
                return ret;
 
index 2fd96053f6cc5285e9f22f9d9b61eb45a69feb96..93a074f1151387fe74abd44a565f78600cd58812 100644 (file)
@@ -116,9 +116,9 @@ phase7_func(
        int                     ip;
        int                     error;
 
-       /* Check and fix the fs summary counters. */
+       /* Check and fix the summary metadata. */
        action_list_init(&alist);
-       error = scrub_fs_summary(ctx, &alist);
+       error = scrub_summary_metadata(ctx, &alist);
        if (error)
                return error;
        error = action_list_process(ctx, -1, &alist,
index cde9babc55746d3dffac41bfac59807d6551f731..c7ee074fd36c64324a3468e4807a5fecd7f0bc8b 100644 (file)
@@ -46,6 +46,7 @@ format_scrub_descr(
                                _(sc->descr));
                break;
        case XFROG_SCRUB_GROUP_FS:
+       case XFROG_SCRUB_GROUP_SUMMARY:
                return snprintf(buf, buflen, _("%s"), _(sc->descr));
                break;
        case XFROG_SCRUB_GROUP_NONE:
@@ -356,8 +357,6 @@ scrub_group(
 
                if (sc->group != group)
                        continue;
-               if (sc->flags & XFROG_SCRUB_DESCR_SUMMARY)
-                       continue;
 
                ret = scrub_meta_type(ctx, type, agno, alist);
                if (ret)
@@ -410,9 +409,18 @@ scrub_fs_metadata(
        return scrub_group(ctx, XFROG_SCRUB_GROUP_FS, 0, alist);
 }
 
-/* Scrub FS summary metadata. */
+/* Scrub all FS summary metadata. */
+int
+scrub_summary_metadata(
+       struct scrub_ctx                *ctx,
+       struct action_list              *alist)
+{
+       return scrub_group(ctx, XFROG_SCRUB_GROUP_SUMMARY, 0, alist);
+}
+
+/* Scrub /only/ the superblock summary counters. */
 int
-scrub_fs_summary(
+scrub_fs_counters(
        struct scrub_ctx                *ctx,
        struct action_list              *alist)
 {
index f7e66bb614b4ca02a5a2edb65f016487aa6e48f0..35d609f283a4f41bd940770bee635e35c1dd7f7c 100644 (file)
@@ -23,7 +23,8 @@ int scrub_ag_headers(struct scrub_ctx *ctx, xfs_agnumber_t agno,
 int scrub_ag_metadata(struct scrub_ctx *ctx, xfs_agnumber_t agno,
                struct action_list *alist);
 int scrub_fs_metadata(struct scrub_ctx *ctx, struct action_list *alist);
-int scrub_fs_summary(struct scrub_ctx *ctx, struct action_list *alist);
+int scrub_summary_metadata(struct scrub_ctx *ctx, struct action_list *alist);
+int scrub_fs_counters(struct scrub_ctx *ctx, struct action_list *alist);
 
 bool can_scrub_fs_metadata(struct scrub_ctx *ctx);
 bool can_scrub_inode(struct scrub_ctx *ctx);