]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blobdiff - scrub/phase7.c
xfs_scrub: remove moveon from repair action list helpers
[thirdparty/xfsprogs-dev.git] / scrub / phase7.c
index 6daf75b592f1c71c6ce7697278ed585d982e3c14..1e3cb058c999ef3b081cd94188112bed00d4776b 100644 (file)
@@ -27,10 +27,9 @@ struct summary_counts {
 };
 
 /* Record block usage. */
-static bool
-xfs_record_block_summary(
+static int
+count_block_summary(
        struct scrub_ctx        *ctx,
-       const char              *descr,
        struct fsmap            *fsmap,
        void                    *arg)
 {
@@ -41,13 +40,13 @@ xfs_record_block_summary(
        counts = ptvar_get((struct ptvar *)arg, &ret);
        if (ret) {
                str_liberror(ctx, ret, _("retrieving summary counts"));
-               return false;
+               return ret;
        }
        if (fsmap->fmr_device == ctx->fsinfo.fs_logdev)
-               return true;
+               return 0;
        if ((fsmap->fmr_flags & FMR_OF_SPECIAL_OWNER) &&
            fsmap->fmr_owner == XFS_FMR_OWN_FREE)
-               return true;
+               return 0;
 
        len = fsmap->fmr_length;
 
@@ -62,14 +61,14 @@ xfs_record_block_summary(
        } else {
                /* Count datadev extents. */
                if (counts->next_phys >= fsmap->fmr_physical + len)
-                       return true;
+                       return 0;
                else if (counts->next_phys > fsmap->fmr_physical)
                        len = counts->next_phys - fsmap->fmr_physical;
                counts->dbytes += len;
                counts->next_phys = fsmap->fmr_physical + fsmap->fmr_length;
        }
 
-       return true;
+       return 0;
 }
 
 /* Add all the summaries in the per-thread counter */
@@ -99,7 +98,7 @@ xfs_scan_summary(
        struct scrub_ctx        *ctx)
 {
        struct summary_counts   totalcount = {0};
-       struct xfs_action_list  alist;
+       struct action_list      alist;
        struct ptvar            *ptvar;
        unsigned long long      used_data;
        unsigned long long      used_rt;
@@ -120,14 +119,14 @@ xfs_scan_summary(
        int                     error;
 
        /* Check and fix the fs summary counters. */
-       xfs_action_list_init(&alist);
-       moveon = xfs_scrub_fs_summary(ctx, &alist);
-       if (!moveon)
+       action_list_init(&alist);
+       error = xfs_scrub_fs_summary(ctx, &alist);
+       if (error)
                return false;
-       moveon = xfs_action_list_process(ctx, ctx->mnt.fd, &alist,
+       error = action_list_process(ctx, ctx->mnt.fd, &alist,
                        ALP_COMPLAIN_IF_UNFIXED | ALP_NOPROGRESS);
-       if (!moveon)
-               return moveon;
+       if (error)
+               return false;
 
        /* Flush everything out to disk before we start counting. */
        error = syncfs(ctx->mnt.fd);
@@ -144,9 +143,11 @@ xfs_scan_summary(
        }
 
        /* Use fsmap to count blocks. */
-       moveon = xfs_scan_all_spacemaps(ctx, xfs_record_block_summary, ptvar);
-       if (!moveon)
+       error = scrub_scan_all_spacemaps(ctx, count_block_summary, ptvar);
+       if (error) {
+               moveon = false;
                goto out_free;
+       }
        error = ptvar_foreach(ptvar, xfs_add_summaries, &totalcount);
        if (error) {
                str_liberror(ctx, error, _("counting blocks"));