]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_scrub: remove moveon from progress report helpers
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 6 Nov 2019 22:29:15 +0000 (17:29 -0500)
committerEric Sandeen <sandeen@sandeen.net>
Wed, 6 Nov 2019 22:29:15 +0000 (17:29 -0500)
Replace the moveon returns in the scrub process reporting helpers
with a direct integer error return.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
scrub/progress.c
scrub/progress.h
scrub/xfs_scrub.c

index e93b607f388247830a3f5612a6e49c387a54c442..d8130ca5f93c284524766abc8c366cafbf6e084f 100644 (file)
@@ -167,8 +167,11 @@ progress_end_phase(void)
        pt.fp = NULL;
 }
 
-/* Set ourselves up to report progress. */
-bool
+/*
+ * Set ourselves up to report progress.  If errors are encountered, this
+ * function will log them and return nonzero.
+ */
+int
 progress_init_phase(
        struct scrub_ctx        *ctx,
        FILE                    *fp,
@@ -182,7 +185,7 @@ progress_init_phase(
        assert(pt.fp == NULL);
        if (fp == NULL || max == 0) {
                pt.fp = NULL;
-               return true;
+               return 0;
        }
        pt.fp = fp;
        pt.isatty = isatty(fileno(fp));
@@ -205,7 +208,7 @@ progress_init_phase(
                goto out_ptcounter;
        }
 
-       return true;
+       return 0;
 
 out_ptcounter:
        ptcounter_free(pt.ptc);
@@ -213,5 +216,5 @@ out_ptcounter:
 out_max:
        pt.max = 0;
        pt.fp = NULL;
-       return false;
+       return ret;
 }
index 9144770ea0e765fa2a1b98d60472ace024b7b88f..c1a115cbe8062a563fa0e94ce30a79cd9c1bae36 100644 (file)
@@ -10,7 +10,7 @@
 #define START_IGNORE   '\001'
 #define END_IGNORE     '\002'
 
-bool progress_init_phase(struct scrub_ctx *ctx, FILE *progress_fp,
+int progress_init_phase(struct scrub_ctx *ctx, FILE *progress_fp,
                         unsigned int phase, uint64_t max, int rshift,
                         unsigned int nr_threads);
 void progress_end_phase(void);
index 9945c7f4f26377f9aaec2f8e0000ab5b08d47e29..4639d3520f339de82f30b6495a028b2d1193f02a 100644 (file)
@@ -423,6 +423,7 @@ run_scrub_phases(
        unsigned int            debug_phase = 0;
        unsigned int            phase;
        int                     rshift;
+       int                     ret;
 
        if (debug_tweak_on("XFS_SCRUB_PHASE"))
                debug_phase = atoi(getenv("XFS_SCRUB_PHASE"));
@@ -466,15 +467,19 @@ run_scrub_phases(
                         * whatever other per-thread data we need to allocate.
                         */
                        work_threads++;
-                       moveon = progress_init_phase(ctx, progress_fp, phase,
+                       ret = progress_init_phase(ctx, progress_fp, phase,
                                        max_work, rshift, work_threads);
-                       if (!moveon)
+                       if (ret) {
+                               moveon = false;
                                break;
+                       }
                        moveon = descr_init_phase(ctx, work_threads) == 0;
                } else {
-                       moveon = progress_init_phase(ctx, NULL, phase, 0, 0, 0);
-                       if (!moveon)
+                       ret = progress_init_phase(ctx, NULL, phase, 0, 0, 0);
+                       if (ret) {
+                               moveon = false;
                                break;
+                       }
                        moveon = descr_init_phase(ctx, 1) == 0;
                }
                if (!moveon)