]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs_scrub: fix work estimation for rtgroups filesystems
authorDarrick J. Wong <djwong@kernel.org>
Thu, 4 Jun 2026 06:06:40 +0000 (23:06 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Thu, 11 Jun 2026 10:26:04 +0000 (12:26 +0200)
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" <djwong@kernel.org>
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
scrub/phase2.c
scrub/scrub.c
scrub/xfs_scrub.h

index c7828c332e7c3a786cda2c4726bc884b686d7870..8de77429f05d60981d63724dcc47bc30ed68ced6 100644 (file)
@@ -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;
index 12ed87f07d9f6c6654b223321c1ad3c802e85907..c9b75eb041e46045bd5a853ea77e1bc00cf8247d 100644 (file)
@@ -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;
 }
 
index 851b4f37db48e411bfde050fd6464602b26a5cfe..ce98693a674d9db59dfaeb67f53432ced8d28b3f 100644 (file)
@@ -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);