* [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
2026-07-06 6:50 ` Christoph Hellwig
0 siblings, 2 replies; 4+ 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] 4+ 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
2026-07-06 6:50 ` Christoph Hellwig
1 sibling, 0 replies; 4+ 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] 4+ 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
@ 2026-07-06 6:50 ` Christoph Hellwig
2026-07-07 16:42 ` Darrick J. Wong
1 sibling, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2026-07-06 6:50 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: aalbersh, linux-xfs
Btw, the current xfsprogs for-next fails a lot of xfstests without
this. So it would be great to get it in ASAP.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xfs_scrub: fix spacemap scan for internal rt devices
2026-07-06 6:50 ` Christoph Hellwig
@ 2026-07-07 16:42 ` Darrick J. Wong
0 siblings, 0 replies; 4+ messages in thread
From: Darrick J. Wong @ 2026-07-07 16:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: aalbersh, linux-xfs
On Mon, Jul 06, 2026 at 08:50:35AM +0200, Christoph Hellwig wrote:
> Btw, the current xfsprogs for-next fails a lot of xfstests without
> this. So it would be great to get it in ASAP.
I'm assuming Andrey saw my most recent PRs:
3. [GIT PULL 3/3] xfs_scrub: codex-inspired bug fixes, part 5
- by Darrick J. Wong @ 2026-07-02 19:42 UTC [8%]
2. [GIT PULL 2/3] mkfs.xfs: codex-inspired bug fixes, part 2
- by Darrick J. Wong @ 2026-07-02 19:41 UTC [8%]
1. [GIT PULL 1/3] mkfs.xfs: codex-inspired bug fixes
- by Darrick J. Wong @ 2026-07-02 19:41 UTC [8%]
I promise not to send any more xfsprogs bugfixes until after 7.1 is
tagged, to avoid holding up the release any further. :)
--D
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-07 16:42 UTC | newest]
Thread overview: 4+ 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
2026-07-06 6:50 ` Christoph Hellwig
2026-07-07 16:42 ` Darrick J. Wong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.