* [PATCH] xfs_scrub: fix spacemap scan for internal rt devices
@ 2026-07-01 14:51 Darrick J. Wong
2026-07-02 10:27 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2026-07-01 14:51 UTC (permalink / raw)
To: aalbersh; +Cc: linux-xfs, hch
From: Darrick J. Wong <djwong@kernel.org>
The scrub media scan on a filesystem with an internal rt volume still
fails with:
# xfs_scrub -dTvnx /mnt
Phase 6: Verify data file integrity.
Error: dev 7:0 rtgroup 1 fsmap: Invalid argument. (spacemap.c line 162)
Error: dev 7:0 rtgroup 0 fsmap: Invalid argument. (spacemap.c line 162)
Info: /mnt: Scrub aborted after phase 6. (xfs_scrub.c line 522)
(this was from xfs/586)
When I tried to add support for internal rt devices in commit
37591ef3f4f14c ("xfs_scrub: support internal RT device"), I forgot that
fsmap reports physical offsets into the underlying block device, and
therefore expects the query keys to reflect that. Put another way, to
scan a single rtgroup, one must add @rtstart to the fmr_physical field
of the query keys.
This hasn't been reported until now because we inadvertently also
disabled spacemap scans of internal rt volumes until commit
3e4bb144f657b1 ("xfs_scrub: handle media scans of internal rt devices
correctly").
Cc: <linux-xfs@vger.kernel.org> # v6.15.0
Fixes: 37591ef3f4f14c ("xfs_scrub: support internal RT device")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
sorry, I missed this one earlier :(
---
scrub/spacemap.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/scrub/spacemap.c b/scrub/spacemap.c
index 45ac61d0942ccb..65d716374c9eb3 100644
--- a/scrub/spacemap.c
+++ b/scrub/spacemap.c
@@ -148,6 +148,19 @@ scan_rtg_rmaps(
keys[1].fmr_offset = ULLONG_MAX;
keys[1].fmr_flags = UINT_MAX;
+ /*
+ * fsmap for an internal rt volume treats physical ranges as offsets
+ * into the underlying block device. Shift the query range up by
+ * @rtstart here to skip the synthetic "internal filesystem" fsmap.
+ */
+ if (ctx->mnt.fsgeom.rtstart) {
+ uint64_t offset = ctx->mnt.fsgeom.rtstart *
+ ctx->mnt.fsgeom.blocksize;
+
+ keys[0].fmr_physical += offset;
+ keys[1].fmr_physical += offset;
+ }
+
if (sbx->aborted)
return;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs_scrub: fix spacemap scan for internal rt devices
2026-07-01 14:51 [PATCH] xfs_scrub: fix spacemap scan for internal rt devices Darrick J. Wong
@ 2026-07-02 10:27 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2026-07-02 10:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: aalbersh, linux-xfs, hch
Looks good and thanks!
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-02 10:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 14:51 [PATCH] xfs_scrub: fix spacemap scan for internal rt devices Darrick J. Wong
2026-07-02 10:27 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox