Message ID | 20241211085636.1380516-19-hch@lst.de (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [01/43] xfs: constify feature checks | expand |
On Wed, Dec 11, 2024 at 09:54:43AM +0100, Christoph Hellwig wrote: > Export the zoned geometry information so that userspace can query it. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > fs/xfs/libxfs/xfs_fs.h | 5 ++++- > fs/xfs/libxfs/xfs_sb.c | 6 ++++++ > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h > index 2c3171262b44..5e66fb2b2cc7 100644 > --- a/fs/xfs/libxfs/xfs_fs.h > +++ b/fs/xfs/libxfs/xfs_fs.h > @@ -189,7 +189,9 @@ struct xfs_fsop_geom { > uint32_t checked; /* o: checked fs & rt metadata */ > __u32 rgextents; /* rt extents in a realtime group */ > __u32 rgcount; /* number of realtime groups */ > - __u64 reserved[16]; /* reserved space */ > + __u64 rtstart; /* start of internal rt section */ > + __u64 rtreserved; /* RT (zoned) reserved blocks */ > + __u64 reserved[14]; /* reserved space */ > }; > > #define XFS_FSOP_GEOM_SICK_COUNTERS (1 << 0) /* summary counters */ > @@ -247,6 +249,7 @@ typedef struct xfs_fsop_resblks { > #define XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGE (1 << 24) /* exchange range */ > #define XFS_FSOP_GEOM_FLAGS_PARENT (1 << 25) /* linux parent pointers */ > #define XFS_FSOP_GEOM_FLAGS_METADIR (1 << 26) /* metadata directories */ > +#define XFS_FSOP_GEOM_FLAGS_ZONED (1 << 27) /* zoned rt device */ > > /* > * Minimum and maximum sizes need for growth checks. > diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c > index 20b8318d4a59..6fc21c0a332b 100644 > --- a/fs/xfs/libxfs/xfs_sb.c > +++ b/fs/xfs/libxfs/xfs_sb.c > @@ -1541,6 +1541,8 @@ xfs_fs_geometry( > geo->flags |= XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGE; > if (xfs_has_metadir(mp)) > geo->flags |= XFS_FSOP_GEOM_FLAGS_METADIR; > + if (xfs_has_zoned(mp)) > + geo->flags |= XFS_FSOP_GEOM_FLAGS_ZONED; > geo->rtsectsize = sbp->sb_blocksize; > geo->dirblocksize = xfs_dir2_dirblock_bytes(sbp); > > @@ -1561,6 +1563,10 @@ xfs_fs_geometry( > geo->rgcount = sbp->sb_rgcount; > geo->rgextents = sbp->sb_rgextents; > } > + if (xfs_has_zoned(mp)) { > + geo->rtstart = XFS_FSB_TO_BB(mp, sbp->sb_rtstart); Not sure why this is reported in units of 512b, everything else set by xfs_fs_geometry is in units of fsblocks. --D > + geo->rtreserved = sbp->sb_rtreserved; > + } > } > > /* Read a secondary superblock. */ > -- > 2.45.2 > >
On Thu, Dec 12, 2024 at 02:09:13PM -0800, Darrick J. Wong wrote: > > + if (xfs_has_zoned(mp)) { > > + geo->rtstart = XFS_FSB_TO_BB(mp, sbp->sb_rtstart); > > Not sure why this is reported in units of 512b, everything else set by > xfs_fs_geometry is in units of fsblocks. Because I didn't update it when switching the sb field to FSBs per a pre-review request :) That being said the sectors actually work pretty well for the users in xfsprogs, so this will create move code. But I guess that's worth it to be consistent.
diff --git a/fs/xfs/libxfs/xfs_fs.h b/fs/xfs/libxfs/xfs_fs.h index 2c3171262b44..5e66fb2b2cc7 100644 --- a/fs/xfs/libxfs/xfs_fs.h +++ b/fs/xfs/libxfs/xfs_fs.h @@ -189,7 +189,9 @@ struct xfs_fsop_geom { uint32_t checked; /* o: checked fs & rt metadata */ __u32 rgextents; /* rt extents in a realtime group */ __u32 rgcount; /* number of realtime groups */ - __u64 reserved[16]; /* reserved space */ + __u64 rtstart; /* start of internal rt section */ + __u64 rtreserved; /* RT (zoned) reserved blocks */ + __u64 reserved[14]; /* reserved space */ }; #define XFS_FSOP_GEOM_SICK_COUNTERS (1 << 0) /* summary counters */ @@ -247,6 +249,7 @@ typedef struct xfs_fsop_resblks { #define XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGE (1 << 24) /* exchange range */ #define XFS_FSOP_GEOM_FLAGS_PARENT (1 << 25) /* linux parent pointers */ #define XFS_FSOP_GEOM_FLAGS_METADIR (1 << 26) /* metadata directories */ +#define XFS_FSOP_GEOM_FLAGS_ZONED (1 << 27) /* zoned rt device */ /* * Minimum and maximum sizes need for growth checks. diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index 20b8318d4a59..6fc21c0a332b 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -1541,6 +1541,8 @@ xfs_fs_geometry( geo->flags |= XFS_FSOP_GEOM_FLAGS_EXCHANGE_RANGE; if (xfs_has_metadir(mp)) geo->flags |= XFS_FSOP_GEOM_FLAGS_METADIR; + if (xfs_has_zoned(mp)) + geo->flags |= XFS_FSOP_GEOM_FLAGS_ZONED; geo->rtsectsize = sbp->sb_blocksize; geo->dirblocksize = xfs_dir2_dirblock_bytes(sbp); @@ -1561,6 +1563,10 @@ xfs_fs_geometry( geo->rgcount = sbp->sb_rgcount; geo->rgextents = sbp->sb_rgextents; } + if (xfs_has_zoned(mp)) { + geo->rtstart = XFS_FSB_TO_BB(mp, sbp->sb_rtstart); + geo->rtreserved = sbp->sb_rtreserved; + } } /* Read a secondary superblock. */
Export the zoned geometry information so that userspace can query it. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/libxfs/xfs_fs.h | 5 ++++- fs/xfs/libxfs/xfs_sb.c | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-)