From: Darrick J. Wong Date: Wed, 6 Nov 2019 22:29:15 +0000 (-0500) Subject: xfs_scrub: remove moveon from progress report helpers X-Git-Tag: v5.3.0-rc2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d86e83b87fe48325adc4031cc98b6bb9f687ce24;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: remove moveon from progress report helpers Replace the moveon returns in the scrub process reporting helpers with a direct integer error return. Signed-off-by: Darrick J. Wong Reviewed-by: Eric Sandeen Signed-off-by: Eric Sandeen --- diff --git a/scrub/progress.c b/scrub/progress.c index e93b607f3..d8130ca5f 100644 --- a/scrub/progress.c +++ b/scrub/progress.c @@ -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; } diff --git a/scrub/progress.h b/scrub/progress.h index 9144770ea..c1a115cbe 100644 --- a/scrub/progress.h +++ b/scrub/progress.h @@ -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); diff --git a/scrub/xfs_scrub.c b/scrub/xfs_scrub.c index 9945c7f4f..4639d3520 100644 --- a/scrub/xfs_scrub.c +++ b/scrub/xfs_scrub.c @@ -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)