]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: get rid of trivial fs metadata scanner helpers
authorDarrick J. Wong <djwong@kernel.org>
Mon, 29 Jul 2024 23:23:04 +0000 (16:23 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:07 +0000 (17:01 -0700)
Get rid of these pointless wrappers.

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

index 81b0918a1c8a4dc9da99a322ad3dddbeb0525fa2..a61e154a84aabdab86a378b324d9ce580c1feef4 100644 (file)
@@ -61,7 +61,7 @@ report_to_kernel(
                return 0;
 
        action_list_init(&alist);
-       ret = scrub_clean_health(ctx, &alist);
+       ret = scrub_meta_type(ctx, XFS_SCRUB_TYPE_HEALTHY, 0, &alist);
        if (ret)
                return ret;
 
index 0c67abf64a3e012a3a97a630978ef3df23c2b4e3..d01dc89f44fc0ff10a3bc5c049cb4ad3a77806eb 100644 (file)
@@ -136,14 +136,14 @@ phase4_func(
                goto maybe_trim;
 
        /*
-        * Check the summary counters early.  Normally we do this during phase
-        * seven, but some of the cross-referencing requires fairly accurate
+        * Check the resource usage counters early.  Normally we do this during
+        * phase 7, but some of the cross-referencing requires fairly accurate
         * summary counters.  Check and try to repair them now to minimize the
         * chance that repairs of primary metadata fail due to secondary
         * metadata.  If repairs fails, we'll come back during phase 7.
         */
        action_list_init(&alist);
-       ret = scrub_fs_counters(ctx, &alist);
+       ret = scrub_meta_type(ctx, XFS_SCRUB_TYPE_FSCOUNTERS, 0, &alist);
        if (ret)
                return ret;
 
@@ -158,7 +158,8 @@ phase4_func(
                return ret;
 
        if (fsgeom.sick & XFS_FSOP_GEOM_SICK_QUOTACHECK) {
-               ret = scrub_quotacheck(ctx, &alist);
+               ret = scrub_meta_type(ctx, XFS_SCRUB_TYPE_QUOTACHECK, 0,
+                               &alist);
                if (ret)
                        return ret;
        }
index 940e434c3cd93cb7d31f746600596dbb78b61001..68d35cd58528def4dcd8a79959a12280f62384c4 100644 (file)
@@ -384,12 +384,10 @@ out:
        return error;
 }
 
-typedef int (*fs_scan_item_fn)(struct scrub_ctx *, struct action_list *);
-
 struct fs_scan_item {
        struct action_list      alist;
        bool                    *abortedp;
-       fs_scan_item_fn         scrub_fn;
+       unsigned int            scrub_type;
 };
 
 /* Run one full-fs scan scrubber in this thread. */
@@ -414,7 +412,7 @@ fs_scan_worker(
                nanosleep(&tv, NULL);
        }
 
-       ret = item->scrub_fn(ctx, &item->alist);
+       ret = scrub_meta_type(ctx, item->scrub_type, 0, &item->alist);
        if (ret) {
                str_liberror(ctx, ret, _("checking fs scan metadata"));
                *item->abortedp = true;
@@ -440,7 +438,7 @@ queue_fs_scan(
        struct workqueue        *wq,
        bool                    *abortedp,
        xfs_agnumber_t          nr,
-       fs_scan_item_fn         scrub_fn)
+       unsigned int            scrub_type)
 {
        struct fs_scan_item     *item;
        struct scrub_ctx        *ctx = wq->wq_ctx;
@@ -453,7 +451,7 @@ queue_fs_scan(
                return ret;
        }
        action_list_init(&item->alist);
-       item->scrub_fn = scrub_fn;
+       item->scrub_type = scrub_type;
        item->abortedp = abortedp;
 
        ret = -workqueue_add(wq, fs_scan_worker, nr, item);
@@ -485,14 +483,15 @@ run_kernel_fs_scan_scrubbers(
         * The nlinks scanner is much faster than quotacheck because it only
         * walks directories, so we start it first.
         */
-       ret = queue_fs_scan(&wq_fs_scan, &aborted, nr, scrub_nlinks);
+       ret = queue_fs_scan(&wq_fs_scan, &aborted, nr, XFS_SCRUB_TYPE_NLINKS);
        if (ret)
                goto wait;
 
        if (nr_threads > 1)
                nr++;
 
-       ret = queue_fs_scan(&wq_fs_scan, &aborted, nr, scrub_quotacheck);
+       ret = queue_fs_scan(&wq_fs_scan, &aborted, nr,
+                       XFS_SCRUB_TYPE_QUOTACHECK);
        if (ret)
                goto wait;
 
index c2e56e5f1cbc4cd1d1c97967f9936b9929c01b73..6e857c79dfb8a6d007c630371335ee7b033c608a 100644 (file)
@@ -366,42 +366,6 @@ scrub_summary_metadata(
        return scrub_group(ctx, XFROG_SCRUB_GROUP_SUMMARY, 0, alist);
 }
 
-/* Scrub /only/ the superblock summary counters. */
-int
-scrub_fs_counters(
-       struct scrub_ctx                *ctx,
-       struct action_list              *alist)
-{
-       return scrub_meta_type(ctx, XFS_SCRUB_TYPE_FSCOUNTERS, 0, alist);
-}
-
-/* Scrub /only/ the quota counters. */
-int
-scrub_quotacheck(
-       struct scrub_ctx                *ctx,
-       struct action_list              *alist)
-{
-       return scrub_meta_type(ctx, XFS_SCRUB_TYPE_QUOTACHECK, 0, alist);
-}
-
-/* Scrub /only/ the file link counters. */
-int
-scrub_nlinks(
-       struct scrub_ctx                *ctx,
-       struct action_list              *alist)
-{
-       return scrub_meta_type(ctx, XFS_SCRUB_TYPE_NLINKS, 0, alist);
-}
-
-/* Update incore health records if we were clean. */
-int
-scrub_clean_health(
-       struct scrub_ctx                *ctx,
-       struct action_list              *alist)
-{
-       return scrub_meta_type(ctx, XFS_SCRUB_TYPE_HEALTHY, 0, alist);
-}
-
 /* How many items do we have to check? */
 unsigned int
 scrub_estimate_ag_work(
index fef8a596049b7cef712b025606dffa68f9110a56..98819a25b621f6b376ed94d08fb877a0deed13a2 100644 (file)
@@ -25,10 +25,6 @@ int scrub_fs_metadata(struct scrub_ctx *ctx, unsigned int scrub_type,
                struct action_list *alist);
 int scrub_iscan_metadata(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);
-int scrub_quotacheck(struct scrub_ctx *ctx, struct action_list *alist);
-int scrub_nlinks(struct scrub_ctx *ctx, struct action_list *alist);
-int scrub_clean_health(struct scrub_ctx *ctx, struct action_list *alist);
 int scrub_meta_type(struct scrub_ctx *ctx, unsigned int type,
                xfs_agnumber_t agno, struct action_list *alist);