From: Darrick J. Wong Date: Mon, 15 Apr 2024 23:07:46 +0000 (-0700) Subject: xfs_scrub: fix threadcount estimates for phase 6 X-Git-Tag: v6.8.0~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13eedd45afb39354a9fe5089d86f4eff1a94ac79;p=thirdparty%2Fxfsprogs-dev.git xfs_scrub: fix threadcount estimates for phase 6 If a filesystem has a realtime device or an external log device, the media scan can start up a separate readverify controller (and workqueue) to handle that. Each of those controllers can call progress_add, so we need to bump up nr_threads so that the progress reports controller knows to make its ptvar big enough to handle all these threads. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- diff --git a/scrub/phase6.c b/scrub/phase6.c index 99a32bc7..393d9eaa 100644 --- a/scrub/phase6.c +++ b/scrub/phase6.c @@ -743,7 +743,17 @@ phase6_estimate( *items = cvt_off_fsb_to_b(&ctx->mnt, (d_blocks - d_bfree) + (r_blocks - r_bfree)); + + /* + * Each read-verify pool starts a thread pool, and each worker thread + * can contribute to the progress counter. Hence we need to set + * nr_threads appropriately to handle that many threads. + */ *nr_threads = disk_heads(ctx->datadev); + if (ctx->rtdev) + *nr_threads += disk_heads(ctx->rtdev); + if (ctx->logdev) + *nr_threads += disk_heads(ctx->logdev); *rshift = 20; return 0; }