From: Darrick J. Wong Date: Thu, 4 Jun 2026 06:06:40 +0000 (-0700) Subject: xfs_scrub: fix work estimation for rtgroups filesystems X-Git-Tag: v7.1.0~58 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=44eee006149b6333b48069abb848b04e8248e9c3;p=xfsprogs-dev.git xfs_scrub: fix work estimation for rtgroups filesystems Codex noticed that phase2_func queues up scrub work items for every rtgroup in the system and tracks progress towards that number of work items, but that it doesn't include the rtgroups in the estimate. This leads to the user-papercut of the progressbar quickly advancing to 100% and then wedging there for most of the rt metadata scan. Let's fix this by amending the group estimator function. Cc: linux-xfs@vger.kernel.org # v6.13.0 Fixes: 241d915d69d4ae ("xfs_scrub: scrub realtime allocation group metadata") Signed-off-by: "Darrick J. Wong" Reviewed-by: Andrey Albershteyn --- diff --git a/scrub/phase2.c b/scrub/phase2.c index c7828c33..8de77429 100644 --- a/scrub/phase2.c +++ b/scrub/phase2.c @@ -416,7 +416,7 @@ phase2_estimate( unsigned int *nr_threads, int *rshift) { - *items = scrub_estimate_ag_work(ctx); + *items = scrub_estimate_group_work(ctx); *nr_threads = scrub_nproc(ctx); *rshift = 0; return 0; diff --git a/scrub/scrub.c b/scrub/scrub.c index 12ed87f0..c9b75eb0 100644 --- a/scrub/scrub.c +++ b/scrub/scrub.c @@ -534,9 +534,9 @@ scrub_item_check_file( return 0; } -/* How many items do we have to check? */ +/* How many items do we have to check for per-AG and per-rtgroup work? */ unsigned int -scrub_estimate_ag_work( +scrub_estimate_group_work( struct scrub_ctx *ctx) { const struct xfrog_scrub_descr *sc; @@ -553,10 +553,21 @@ scrub_estimate_ag_work( case XFROG_SCRUB_GROUP_FS: estimate++; break; + case XFROG_SCRUB_GROUP_RTGROUP: + /* + * rtbitmap and rtsummary exist on non-rt/non-rtgroup + * filesystems, but we schedule the other rtgroup + * metadata for scanning (even if it won't do + * anything), so we must include those in the + * estimation as well. + */ + estimate += max(1, ctx->mnt.fsgeom.rgcount); + break; default: break; } } + return estimate; } diff --git a/scrub/xfs_scrub.h b/scrub/xfs_scrub.h index 851b4f37..ce98693a 100644 --- a/scrub/xfs_scrub.h +++ b/scrub/xfs_scrub.h @@ -131,7 +131,7 @@ int phase7_func(struct scrub_ctx *ctx); int phase8_func(struct scrub_ctx *ctx); /* Progress estimator functions */ -unsigned int scrub_estimate_ag_work(struct scrub_ctx *ctx); +unsigned int scrub_estimate_group_work(struct scrub_ctx *ctx); unsigned int scrub_estimate_iscan_work(struct scrub_ctx *ctx); int phase2_estimate(struct scrub_ctx *ctx, uint64_t *items, unsigned int *nr_threads, int *rshift);