public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
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 13/45] FIXUP: xfs: allow internal RT devices for zoned mode
Date: Wed, 9 Apr 2025 08:55:48 -0700	[thread overview]
Message-ID: <20250409155548.GV6283@frogsfrogsfrogs> (raw)
In-Reply-To: <20250409075557.3535745-14-hch@lst.de>

On Wed, Apr 09, 2025 at 09:55:16AM +0200, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  include/libxfs.h    |  6 ++++++
>  include/xfs_mount.h |  7 +++++++
>  libfrog/fsgeom.c    |  2 +-
>  libxfs/init.c       | 13 +++++++++----
>  libxfs/rdwr.c       |  2 ++
>  repair/agheader.c   |  4 +++-
>  6 files changed, 28 insertions(+), 6 deletions(-)
> 
> diff --git a/include/libxfs.h b/include/libxfs.h
> index 82b34b9d81c3..b968a2b88da3 100644
> --- a/include/libxfs.h
> +++ b/include/libxfs.h
> @@ -293,4 +293,10 @@ static inline bool xfs_sb_version_hassparseinodes(struct xfs_sb *sbp)
>  		xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_SPINODES);
>  }
>  
> +static inline bool xfs_sb_version_haszoned(struct xfs_sb *sbp)
> +{
> +	return XFS_SB_VERSION_NUM(sbp) == XFS_SB_VERSION_5 &&
> +		xfs_sb_has_incompat_feature(sbp, XFS_SB_FEAT_INCOMPAT_ZONED);
> +}
> +
>  #endif	/* __LIBXFS_H__ */
> diff --git a/include/xfs_mount.h b/include/xfs_mount.h
> index 7856acfb9f8e..bf9ebc25fc79 100644
> --- a/include/xfs_mount.h
> +++ b/include/xfs_mount.h
> @@ -53,6 +53,13 @@ struct xfs_groups {
>  	 * rtgroup, so this mask must be 64-bit.
>  	 */
>  	uint64_t		blkmask;
> +
> +	/*
> +	 * Start of the first group in the device.  This is used to support a
> +	 * RT device following the data device on the same block device for
> +	 * SMR hard drives.
> +	 */
> +	xfs_fsblock_t		start_fsb;
>  };
>  
>  /*
> diff --git a/libfrog/fsgeom.c b/libfrog/fsgeom.c
> index b5220d2d6ffd..13df88ae43a7 100644
> --- a/libfrog/fsgeom.c
> +++ b/libfrog/fsgeom.c
> @@ -81,7 +81,7 @@ xfs_report_geom(
>  		isint ? _("internal log") : logname ? logname : _("external"),
>  			geo->blocksize, geo->logblocks, logversion,
>  		"", geo->logsectsize, geo->logsunit / geo->blocksize, lazycount,
> -		!geo->rtblocks ? _("none") : rtname ? rtname : _("external"),
> +		!geo->rtblocks ? _("none") : rtname ? rtname : _("internal"),

Hum.  This change means that if you call xfs_db -c info without
supplying a realtime device, the info command output will claim an
internal rt device:

$ truncate -s 3g /tmp/a
$ truncate -s 3g /tmp/b
$ mkfs.xfs -f /tmp/a -r rtdev=/tmp/b
$ xfs_db -c info /tmp/a
meta-data=/tmp/a                 isize=512    agcount=4, agsize=196608 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=0    bigtime=1 inobtcount=1 nrext64=1
         =                       exchange=0   metadir=0
data     =                       bsize=4096   blocks=786432, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =internal               extsz=4096   blocks=786432, rtextents=786432
         =                       rgcount=0    rgsize=0 extents
         =                       zoned=0      start=0 reserved=0

The realtime device is external, you just haven't supplied one.  How
about:

static inline const char *
rtdev_name(
	const struct xfs_fsop_geo	*geo,
	const char			*rtname)
{
	if (!geo->rtblocks)
		return _("none");
	if (geo->rtstart)
		return _("internal");
	if (!rtname)
		return _("external");
	return rtname;
}

instead?

--D

>  		geo->rtextsize * geo->blocksize, (unsigned long long)geo->rtblocks,
>  			(unsigned long long)geo->rtextents,
>  		"", geo->rgcount, geo->rgextents);
> diff --git a/libxfs/init.c b/libxfs/init.c
> index 5b45ed347276..a186369f3fd8 100644
> --- a/libxfs/init.c
> +++ b/libxfs/init.c
> @@ -560,7 +560,7 @@ libxfs_buftarg_init(
>  				progname);
>  			exit(1);
>  		}
> -		if (xi->rt.dev &&
> +		if ((xi->rt.dev || xi->rt.dev == xi->data.dev) &&
>  		    (mp->m_rtdev_targp->bt_bdev != xi->rt.dev ||
>  		     mp->m_rtdev_targp->bt_mount != mp)) {
>  			fprintf(stderr,
> @@ -577,7 +577,11 @@ libxfs_buftarg_init(
>  	else
>  		mp->m_logdev_targp = libxfs_buftarg_alloc(mp, xi, &xi->log,
>  				lfail);
> -	mp->m_rtdev_targp = libxfs_buftarg_alloc(mp, xi, &xi->rt, rfail);
> +	if (!xi->rt.dev || xi->rt.dev == xi->data.dev)
> +		mp->m_rtdev_targp = mp->m_ddev_targp;
> +	else
> +		mp->m_rtdev_targp = libxfs_buftarg_alloc(mp, xi, &xi->rt,
> +				rfail);
>  }
>  
>  /* Compute maximum possible height for per-AG btree types for this fs. */
> @@ -978,7 +982,7 @@ libxfs_flush_mount(
>  			error = err2;
>  	}
>  
> -	if (mp->m_rtdev_targp) {
> +	if (mp->m_rtdev_targp && mp->m_rtdev_targp != mp->m_ddev_targp) {
>  		err2 = libxfs_flush_buftarg(mp->m_rtdev_targp,
>  				_("realtime device"));
>  		if (!error)
> @@ -1031,7 +1035,8 @@ libxfs_umount(
>  	free(mp->m_fsname);
>  	mp->m_fsname = NULL;
>  
> -	libxfs_buftarg_free(mp->m_rtdev_targp);
> +	if (mp->m_rtdev_targp != mp->m_ddev_targp)
> +		libxfs_buftarg_free(mp->m_rtdev_targp);
>  	if (mp->m_logdev_targp != mp->m_ddev_targp)
>  		libxfs_buftarg_free(mp->m_logdev_targp);
>  	libxfs_buftarg_free(mp->m_ddev_targp);
> diff --git a/libxfs/rdwr.c b/libxfs/rdwr.c
> index 35be785c435a..f06763b38bd8 100644
> --- a/libxfs/rdwr.c
> +++ b/libxfs/rdwr.c
> @@ -175,6 +175,8 @@ libxfs_getrtsb(
>  	if (!mp->m_rtdev_targp->bt_bdev)
>  		return NULL;
>  
> +	ASSERT(!mp->m_sb.sb_rtstart);
> +
>  	error = libxfs_buf_read_uncached(mp->m_rtdev_targp, XFS_RTSB_DADDR,
>  			XFS_FSB_TO_BB(mp, 1), 0, &bp, &xfs_rtsb_buf_ops);
>  	if (error)
> diff --git a/repair/agheader.c b/repair/agheader.c
> index 327ba041671f..5bb4e47e0c5b 100644
> --- a/repair/agheader.c
> +++ b/repair/agheader.c
> @@ -485,7 +485,9 @@ secondary_sb_whack(
>  	 *
>  	 * size is the size of data which is valid for this sb.
>  	 */
> -	if (xfs_sb_version_hasmetadir(sb))
> +	if (xfs_sb_version_haszoned(sb))
> +		size = offsetofend(struct xfs_dsb, sb_rtstart);
> +	else if (xfs_sb_version_hasmetadir(sb))
>  		size = offsetofend(struct xfs_dsb, sb_pad);
>  	else if (xfs_sb_version_hasmetauuid(sb))
>  		size = offsetofend(struct xfs_dsb, sb_meta_uuid);
> -- 
> 2.47.2
> 
> 

  reply	other threads:[~2025-04-09 15:55 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  7:55 xfsprogs support for zoned devices Christoph Hellwig
2025-04-09  7:55 ` [PATCH 01/45] xfs: generalize the freespace and reserved blocks handling Christoph Hellwig
2025-04-09  7:55 ` [PATCH 02/45] FIXUP: " Christoph Hellwig
2025-04-09 15:32   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 03/45] xfs: make metabtree reservations global Christoph Hellwig
2025-04-09  7:55 ` [PATCH 04/45] FIXUP: " Christoph Hellwig
2025-04-09 15:43   ` Darrick J. Wong
2025-04-10  6:00     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 05/45] xfs: reduce metafile reservations Christoph Hellwig
2025-04-09  7:55 ` [PATCH 06/45] xfs: add a rtg_blocks helper Christoph Hellwig
2025-04-09  7:55 ` [PATCH 07/45] xfs: move xfs_bmapi_reserve_delalloc to xfs_iomap.c Christoph Hellwig
2025-04-09  7:55 ` [PATCH 08/45] xfs: support XFS_BMAPI_REMAP in xfs_bmap_del_extent_delay Christoph Hellwig
2025-04-09  7:55 ` [PATCH 09/45] xfs: add a xfs_rtrmap_highest_rgbno helper Christoph Hellwig
2025-04-09  7:55 ` [PATCH 10/45] xfs: define the zoned on-disk format Christoph Hellwig
2025-04-09  7:55 ` [PATCH 11/45] FIXUP: " Christoph Hellwig
2025-04-09 15:47   ` Darrick J. Wong
2025-04-09 16:04     ` Darrick J. Wong
2025-04-10  6:01     ` Christoph Hellwig
2025-04-10 16:31       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 12/45] xfs: allow internal RT devices for zoned mode Christoph Hellwig
2025-04-09  7:55 ` [PATCH 13/45] FIXUP: " Christoph Hellwig
2025-04-09 15:55   ` Darrick J. Wong [this message]
2025-04-10  6:09     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 14/45] xfs: export zoned geometry via XFS_FSOP_GEOM Christoph Hellwig
2025-04-09  7:55 ` [PATCH 15/45] xfs: disable sb_frextents for zoned file systems Christoph Hellwig
2025-04-09  7:55 ` [PATCH 16/45] xfs: parse and validate hardware zone information Christoph Hellwig
2025-04-09  7:55 ` [PATCH 17/45] FIXUP: " Christoph Hellwig
2025-04-09 15:56   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 18/45] xfs: add the zoned space allocator Christoph Hellwig
2025-04-09  7:55 ` [PATCH 19/45] xfs: add support for zoned space reservations Christoph Hellwig
2025-04-09  7:55 ` [PATCH 20/45] FIXUP: " Christoph Hellwig
2025-04-09 15:56   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 21/45] xfs: implement zoned garbage collection Christoph Hellwig
2025-04-09  7:55 ` [PATCH 22/45] xfs: enable fsmap reporting for internal RT devices Christoph Hellwig
2025-04-09  7:55 ` [PATCH 23/45] xfs: enable the zoned RT device feature Christoph Hellwig
2025-04-09  7:55 ` [PATCH 24/45] xfs: support zone gaps Christoph Hellwig
2025-04-09  7:55 ` [PATCH 25/45] FIXUP: " Christoph Hellwig
2025-04-09 15:57   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 26/45] libfrog: report the zoned flag Christoph Hellwig
2025-04-09 15:58   ` Darrick J. Wong
2025-04-10  6:14     ` Christoph Hellwig
2025-04-10 16:36       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 27/45] xfs_repair: support repairing zoned file systems Christoph Hellwig
2025-04-09 16:10   ` Darrick J. Wong
2025-04-10  6:27     ` Christoph Hellwig
2025-04-10 16:41       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 28/45] xfs_repair: fix the RT device check in process_dinode_int Christoph Hellwig
2025-04-09 16:11   ` Darrick J. Wong
2025-04-10  6:29     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 29/45] xfs_repair: validate rt groups vs reported hardware zones Christoph Hellwig
2025-04-09 18:41   ` Darrick J. Wong
2025-04-10  6:34     ` Christoph Hellwig
2025-04-10 16:43       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 30/45] xfs_mkfs: support creating zoned file systems Christoph Hellwig
2025-04-09 18:54   ` Darrick J. Wong
2025-04-10  6:45     ` Christoph Hellwig
2025-04-10 16:45       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 31/45] xfs_mkfs: calculate zone overprovisioning when specifying size Christoph Hellwig
2025-04-09 19:06   ` Darrick J. Wong
2025-04-10  7:00     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 32/45] xfs_mkfs: default to rtinherit=1 for zoned file systems Christoph Hellwig
2025-04-09 18:59   ` Darrick J. Wong
2025-04-10  6:45     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 33/45] xfs_mkfs: reflink conflicts with zoned file systems for now Christoph Hellwig
2025-04-09 19:00   ` Darrick J. Wong
2025-04-10  6:46     ` Christoph Hellwig
2025-04-10 16:47       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 34/45] xfs_mkfs: document the new zoned options in the man page Christoph Hellwig
2025-04-09 19:00   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 35/45] libfrog: report the zoned geometry Christoph Hellwig
2025-04-09 19:01   ` Darrick J. Wong
2025-04-10  7:02     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 36/45] man: document XFS_FSOP_GEOM_FLAGS_ZONED Christoph Hellwig
2025-04-09 19:13   ` Darrick J. Wong
2025-04-10  6:53     ` Christoph Hellwig
2025-04-10 16:47       ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 37/45] xfs_io: correctly report RGs with internal rt dev in bmap output Christoph Hellwig
2025-04-09 22:22   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 38/45] xfs_io: don't re-query fs_path information in fsmap_f Christoph Hellwig
2025-04-09 20:48   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 39/45] xfs_io: don't re-query geometry " Christoph Hellwig
2025-04-09 20:46   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 40/45] xfs_io: handle internal RT devices in fsmap output Christoph Hellwig
2025-04-09 21:48   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 41/45] xfs_spaceman: handle internal RT devices Christoph Hellwig
2025-04-09 19:29   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 42/45] xfs_scrub: support internal RT sections Christoph Hellwig
2025-04-09 19:30   ` Darrick J. Wong
2025-04-10  6:57     ` Christoph Hellwig
2025-04-09  7:55 ` [PATCH 43/45] xfs_scrub: handle internal RT devices Christoph Hellwig
2025-04-09 19:34   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 44/45] xfs_mdrestore: support " Christoph Hellwig
2025-04-09 19:36   ` Darrick J. Wong
2025-04-09  7:55 ` [PATCH 45/45] xfs_growfs: " Christoph Hellwig
2025-04-09 19:35   ` Darrick J. Wong

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=20250409155548.GV6283@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