From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Andrey Albershteyn <aalbersh@kernel.org>,
Hans Holmberg <hans.holmberg@wdc.com>,
linux-xfs@vger.kernel.org
Subject: Re: [PATCH 41/43] xfs_scrub: support internal RT device
Date: Mon, 14 Apr 2025 17:35:58 -0700 [thread overview]
Message-ID: <20250415003558.GH25675@frogsfrogsfrogs> (raw)
In-Reply-To: <20250414053629.360672-42-hch@lst.de>
On Mon, Apr 14, 2025 at 07:36:24AM +0200, Christoph Hellwig wrote:
> Handle the synthetic fmr_device values, and deal with the fact that
> ctx->fsinfo.fs_rt is allowed to be non-NULL for internal RT devices as
> it is the same as the data device in this case.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good now,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> scrub/phase1.c | 3 ++-
> scrub/phase6.c | 65 ++++++++++++++++++++++++++++--------------------
> scrub/phase7.c | 28 +++++++++++++++------
> scrub/spacemap.c | 17 +++++++++----
> 4 files changed, 72 insertions(+), 41 deletions(-)
>
> diff --git a/scrub/phase1.c b/scrub/phase1.c
> index d03a9099a217..10e9aa1892b7 100644
> --- a/scrub/phase1.c
> +++ b/scrub/phase1.c
> @@ -341,7 +341,8 @@ _("Kernel metadata repair facility is not available. Use -n to scrub."));
> _("Unable to find log device path."));
> return ECANCELED;
> }
> - if (ctx->mnt.fsgeom.rtblocks && ctx->fsinfo.fs_rt == NULL) {
> + if (ctx->mnt.fsgeom.rtblocks && ctx->fsinfo.fs_rt == NULL &&
> + !ctx->mnt.fsgeom.rtstart) {
> str_error(ctx, ctx->mntpoint,
> _("Unable to find realtime device path."));
> return ECANCELED;
> diff --git a/scrub/phase6.c b/scrub/phase6.c
> index 2a52b2c92419..abf6f9713f1a 100644
> --- a/scrub/phase6.c
> +++ b/scrub/phase6.c
> @@ -56,12 +56,21 @@ dev_to_pool(
> struct media_verify_state *vs,
> dev_t dev)
> {
> - if (dev == ctx->fsinfo.fs_datadev)
> - return vs->rvp_data;
> - else if (dev == ctx->fsinfo.fs_logdev)
> - return vs->rvp_log;
> - else if (dev == ctx->fsinfo.fs_rtdev)
> - return vs->rvp_realtime;
> + if (ctx->mnt.fsgeom.rtstart) {
> + if (dev == XFS_DEV_DATA)
> + return vs->rvp_data;
> + if (dev == XFS_DEV_LOG)
> + return vs->rvp_log;
> + if (dev == XFS_DEV_RT)
> + return vs->rvp_realtime;
> + } else {
> + if (dev == ctx->fsinfo.fs_datadev)
> + return vs->rvp_data;
> + if (dev == ctx->fsinfo.fs_logdev)
> + return vs->rvp_log;
> + if (dev == ctx->fsinfo.fs_rtdev)
> + return vs->rvp_realtime;
> + }
> abort();
> }
>
> @@ -71,12 +80,21 @@ disk_to_dev(
> struct scrub_ctx *ctx,
> struct disk *disk)
> {
> - if (disk == ctx->datadev)
> - return ctx->fsinfo.fs_datadev;
> - else if (disk == ctx->logdev)
> - return ctx->fsinfo.fs_logdev;
> - else if (disk == ctx->rtdev)
> - return ctx->fsinfo.fs_rtdev;
> + if (ctx->mnt.fsgeom.rtstart) {
> + if (disk == ctx->datadev)
> + return XFS_DEV_DATA;
> + if (disk == ctx->logdev)
> + return XFS_DEV_LOG;
> + if (disk == ctx->rtdev)
> + return XFS_DEV_RT;
> + } else {
> + if (disk == ctx->datadev)
> + return ctx->fsinfo.fs_datadev;
> + if (disk == ctx->logdev)
> + return ctx->fsinfo.fs_logdev;
> + if (disk == ctx->rtdev)
> + return ctx->fsinfo.fs_rtdev;
> + }
> abort();
> }
>
> @@ -87,11 +105,9 @@ bitmap_for_disk(
> struct disk *disk,
> struct media_verify_state *vs)
> {
> - dev_t dev = disk_to_dev(ctx, disk);
> -
> - if (dev == ctx->fsinfo.fs_datadev)
> + if (disk == ctx->datadev)
> return vs->d_bad;
> - else if (dev == ctx->fsinfo.fs_rtdev)
> + if (disk == ctx->rtdev)
> return vs->r_bad;
> return NULL;
> }
> @@ -501,14 +517,11 @@ report_ioerr(
> .length = length,
> };
> struct disk_ioerr_report *dioerr = arg;
> - dev_t dev;
> -
> - dev = disk_to_dev(dioerr->ctx, dioerr->disk);
>
> /* Go figure out which blocks are bad from the fsmap. */
> - keys[0].fmr_device = dev;
> + keys[0].fmr_device = disk_to_dev(dioerr->ctx, dioerr->disk);
> keys[0].fmr_physical = start;
> - keys[1].fmr_device = dev;
> + keys[1].fmr_device = keys[0].fmr_device;
> keys[1].fmr_physical = start + length - 1;
> keys[1].fmr_owner = ULLONG_MAX;
> keys[1].fmr_offset = ULLONG_MAX;
> @@ -675,14 +688,12 @@ remember_ioerr(
> int ret;
>
> if (!length) {
> - dev_t dev = disk_to_dev(ctx, disk);
> -
> - if (dev == ctx->fsinfo.fs_datadev)
> + if (disk == ctx->datadev)
> vs->d_trunc = true;
> - else if (dev == ctx->fsinfo.fs_rtdev)
> - vs->r_trunc = true;
> - else if (dev == ctx->fsinfo.fs_logdev)
> + else if (disk == ctx->logdev)
> vs->l_trunc = true;
> + else if (disk == ctx->rtdev)
> + vs->r_trunc = true;
> return;
> }
>
> diff --git a/scrub/phase7.c b/scrub/phase7.c
> index 01097b678798..e25502668b1c 100644
> --- a/scrub/phase7.c
> +++ b/scrub/phase7.c
> @@ -68,25 +68,37 @@ count_block_summary(
> void *arg)
> {
> struct summary_counts *counts;
> + bool is_rt = false;
> unsigned long long len;
> int ret;
>
> + if (ctx->mnt.fsgeom.rtstart) {
> + if (fsmap->fmr_device == XFS_DEV_LOG)
> + return 0;
> + if (fsmap->fmr_device == XFS_DEV_RT)
> + is_rt = true;
> + } else {
> + if (fsmap->fmr_device == ctx->fsinfo.fs_logdev)
> + return 0;
> + if (fsmap->fmr_device == ctx->fsinfo.fs_rtdev)
> + is_rt = true;
> + }
> +
> counts = ptvar_get((struct ptvar *)arg, &ret);
> if (ret) {
> str_liberror(ctx, -ret, _("retrieving summary counts"));
> return -ret;
> }
> - if (fsmap->fmr_device == ctx->fsinfo.fs_logdev)
> - return 0;
> +
> if ((fsmap->fmr_flags & FMR_OF_SPECIAL_OWNER) &&
> fsmap->fmr_owner == XFS_FMR_OWN_FREE) {
> uint64_t blocks;
>
> blocks = cvt_b_to_off_fsbt(&ctx->mnt, fsmap->fmr_length);
> - if (fsmap->fmr_device == ctx->fsinfo.fs_datadev)
> - hist_add(&counts->datadev_hist, blocks);
> - else if (fsmap->fmr_device == ctx->fsinfo.fs_rtdev)
> + if (is_rt)
> hist_add(&counts->rtdev_hist, blocks);
> + else
> + hist_add(&counts->datadev_hist, blocks);
> return 0;
> }
>
> @@ -94,10 +106,10 @@ count_block_summary(
>
> /* freesp btrees live in free space, need to adjust counters later. */
> if ((fsmap->fmr_flags & FMR_OF_SPECIAL_OWNER) &&
> - fsmap->fmr_owner == XFS_FMR_OWN_AG) {
> + fsmap->fmr_owner == XFS_FMR_OWN_AG)
> counts->agbytes += fsmap->fmr_length;
> - }
> - if (fsmap->fmr_device == ctx->fsinfo.fs_rtdev) {
> +
> + if (is_rt) {
> /* Count realtime extents. */
> counts->rbytes += len;
> } else {
> diff --git a/scrub/spacemap.c b/scrub/spacemap.c
> index c293ab44a528..1ee4d1946d3d 100644
> --- a/scrub/spacemap.c
> +++ b/scrub/spacemap.c
> @@ -103,9 +103,12 @@ scan_ag_rmaps(
> bperag = (off_t)ctx->mnt.fsgeom.agblocks *
> (off_t)ctx->mnt.fsgeom.blocksize;
>
> - keys[0].fmr_device = ctx->fsinfo.fs_datadev;
> + if (ctx->mnt.fsgeom.rtstart)
> + keys[0].fmr_device = XFS_DEV_DATA;
> + else
> + keys[0].fmr_device = ctx->fsinfo.fs_datadev;
> keys[0].fmr_physical = agno * bperag;
> - keys[1].fmr_device = ctx->fsinfo.fs_datadev;
> + keys[1].fmr_device = keys[0].fmr_device;
> keys[1].fmr_physical = ((agno + 1) * bperag) - 1;
> keys[1].fmr_owner = ULLONG_MAX;
> keys[1].fmr_offset = ULLONG_MAX;
> @@ -140,9 +143,12 @@ scan_rtg_rmaps(
> off_t bperrg = bytes_per_rtgroup(&ctx->mnt.fsgeom);
> int ret;
>
> - keys[0].fmr_device = ctx->fsinfo.fs_rtdev;
> + if (ctx->mnt.fsgeom.rtstart)
> + keys[0].fmr_device = XFS_DEV_RT;
> + else
> + keys[0].fmr_device = ctx->fsinfo.fs_rtdev;
> keys[0].fmr_physical = (xfs_rtblock_t)rgno * bperrg;
> - keys[1].fmr_device = ctx->fsinfo.fs_rtdev;
> + keys[1].fmr_device = keys[0].fmr_device;
> keys[1].fmr_physical = ((rgno + 1) * bperrg) - 1;
> keys[1].fmr_owner = ULLONG_MAX;
> keys[1].fmr_offset = ULLONG_MAX;
> @@ -216,7 +222,8 @@ scan_log_rmaps(
> {
> struct scrub_ctx *ctx = (struct scrub_ctx *)wq->wq_ctx;
>
> - scan_dev_rmaps(ctx, ctx->fsinfo.fs_logdev, arg);
> + scan_dev_rmaps(ctx, ctx->mnt.fsgeom.rtstart ? 2 : ctx->fsinfo.fs_logdev,
> + arg);
> }
>
> /*
> --
> 2.47.2
>
>
next prev parent reply other threads:[~2025-04-15 0:35 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-14 5:35 xfsprogs support for zoned devices v2 Christoph Hellwig
2025-04-14 5:35 ` [PATCH 01/43] xfs: generalize the freespace and reserved blocks handling Christoph Hellwig
2025-04-14 5:35 ` [PATCH 02/43] FIXUP: " Christoph Hellwig
2025-04-14 5:35 ` [PATCH 03/43] xfs: make metabtree reservations global Christoph Hellwig
2025-04-14 5:35 ` [PATCH 04/43] FIXUP: " Christoph Hellwig
2025-04-14 5:35 ` [PATCH 05/43] xfs: reduce metafile reservations Christoph Hellwig
2025-04-14 5:35 ` [PATCH 06/43] xfs: add a rtg_blocks helper Christoph Hellwig
2025-04-14 5:35 ` [PATCH 07/43] xfs: move xfs_bmapi_reserve_delalloc to xfs_iomap.c Christoph Hellwig
2025-04-14 5:35 ` [PATCH 08/43] xfs: support XFS_BMAPI_REMAP in xfs_bmap_del_extent_delay Christoph Hellwig
2025-04-14 5:35 ` [PATCH 09/43] xfs: add a xfs_rtrmap_highest_rgbno helper Christoph Hellwig
2025-04-14 5:35 ` [PATCH 10/43] xfs: define the zoned on-disk format Christoph Hellwig
2025-04-14 5:35 ` [PATCH 11/43] FIXUP: " Christoph Hellwig
2025-04-14 5:35 ` [PATCH 12/43] xfs: allow internal RT devices for zoned mode Christoph Hellwig
2025-04-14 5:35 ` [PATCH 13/43] FIXUP: " Christoph Hellwig
2025-04-14 20:16 ` Darrick J. Wong
2025-04-14 5:35 ` [PATCH 14/43] xfs: export zoned geometry via XFS_FSOP_GEOM Christoph Hellwig
2025-04-14 5:35 ` [PATCH 15/43] xfs: disable sb_frextents for zoned file systems Christoph Hellwig
2025-04-14 5:35 ` [PATCH 16/43] xfs: parse and validate hardware zone information Christoph Hellwig
2025-04-14 5:36 ` [PATCH 17/43] FIXUP: " Christoph Hellwig
2025-04-14 5:36 ` [PATCH 18/43] xfs: add the zoned space allocator Christoph Hellwig
2025-04-14 5:36 ` [PATCH 19/43] xfs: add support for zoned space reservations Christoph Hellwig
2025-04-14 5:36 ` [PATCH 20/43] FIXUP: " Christoph Hellwig
2025-04-14 5:36 ` [PATCH 21/43] xfs: implement zoned garbage collection Christoph Hellwig
2025-04-14 5:36 ` [PATCH 22/43] xfs: enable fsmap reporting for internal RT devices Christoph Hellwig
2025-04-14 5:36 ` [PATCH 23/43] xfs: enable the zoned RT device feature Christoph Hellwig
2025-04-14 5:36 ` [PATCH 24/43] xfs: support zone gaps Christoph Hellwig
2025-04-14 5:36 ` [PATCH 25/43] FIXUP: " Christoph Hellwig
2025-04-14 5:36 ` [PATCH 26/43] libfrog: report the zoned geometry Christoph Hellwig
2025-04-14 22:16 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 27/43] xfs_repair: support repairing zoned file systems Christoph Hellwig
2025-04-15 0:38 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 28/43] xfs_repair: fix the RT device check in process_dinode_int Christoph Hellwig
2025-04-15 0:34 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 29/43] xfs_repair: validate rt groups vs reported hardware zones Christoph Hellwig
2025-04-15 0:39 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 30/43] xfs_mkfs: factor out a validate_rtgroup_geometry helper Christoph Hellwig
2025-04-15 0:40 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 31/43] xfs_mkfs: support creating file system with zoned RT devices Christoph Hellwig
2025-04-15 0:41 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 32/43] xfs_mkfs: calculate zone overprovisioning when specifying size Christoph Hellwig
2025-04-14 5:36 ` [PATCH 33/43] xfs_mkfs: default to rtinherit=1 for zoned file systems Christoph Hellwig
2025-04-15 0:37 ` Darrick J. Wong
2025-04-15 8:09 ` Christoph Hellwig
2025-04-14 5:36 ` [PATCH 34/43] xfs_mkfs: reflink conflicts with zoned file systems for now Christoph Hellwig
2025-04-14 5:36 ` [PATCH 35/43] xfs_mkfs: document the new zoned options in the man page Christoph Hellwig
2025-04-14 5:36 ` [PATCH 36/43] man: document XFS_FSOP_GEOM_FLAGS_ZONED Christoph Hellwig
2025-04-15 0:36 ` Darrick J. Wong
2025-04-14 5:36 ` [PATCH 37/43] xfs_io: correctly report RGs with internal rt dev in bmap output Christoph Hellwig
2025-04-14 5:36 ` [PATCH 38/43] xfs_io: don't re-query fs_path information in fsmap_f Christoph Hellwig
2025-04-14 5:36 ` [PATCH 39/43] xfs_io: handle internal RT devices in fsmap output Christoph Hellwig
2025-04-14 5:36 ` [PATCH 40/43] xfs_spaceman: handle internal RT devices Christoph Hellwig
2025-04-14 5:36 ` [PATCH 41/43] xfs_scrub: support internal RT device Christoph Hellwig
2025-04-15 0:35 ` Darrick J. Wong [this message]
2025-04-14 5:36 ` [PATCH 42/43] xfs_mdrestore: support internal RT devices Christoph Hellwig
2025-04-14 5:36 ` [PATCH 43/43] xfs_growfs: " Christoph Hellwig
2025-04-25 15:48 ` [PATCH 44/43] xfs_repair: fix libxfs abstraction mess Darrick J. Wong
2025-04-28 13:17 ` Christoph Hellwig
2025-04-28 16:28 ` Andrey Albershteyn
2025-04-29 12:24 ` Christoph Hellwig
2025-04-28 16:31 ` Andrey Albershteyn
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=20250415003558.GH25675@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=aalbersh@kernel.org \
--cc=hans.holmberg@wdc.com \
--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