From: "Darrick J. Wong" <djwong@kernel.org>
To: aalbersh@kernel.org
Cc: linux-xfs@vger.kernel.org, hch@lst.de
Subject: [PATCH] xfs_scrub: fix spacemap scan for internal rt devices
Date: Wed, 1 Jul 2026 07:51:24 -0700 [thread overview]
Message-ID: <20260701145124.GE6526@frogsfrogsfrogs> (raw)
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;
next reply other threads:[~2026-07-01 14:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 14:51 Darrick J. Wong [this message]
2026-07-02 10:27 ` [PATCH] xfs_scrub: fix spacemap scan for internal rt devices Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701145124.GE6526@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox