]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: add write pointer to xfs_rtgroup_geometry
authorWilfred Mallawa <wilfred.mallawa@wdc.com>
Thu, 2 Jul 2026 19:59:19 +0000 (12:59 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Jul 2026 08:40:42 +0000 (10:40 +0200)
Source kernel commit: c6ce65cb17aa9321687d1b8a842487f839e1a548

There is currently no XFS ioctl that allows userspace to retrieve the
write pointer for a specific realtime group block for zoned XFS. On zoned
block devices, userspace can obtain this information via zone reports from
the underlying device. However, for zoned XFS operating on regular block
devices, no equivalent mechanism exists.

Access to the realtime group write pointer is useful to userspace
development and analysis tools such as Zonar [1]. So extend the existing
struct xfs_rtgroup_geometry to add a new rg_writepointer field. This field
is valid if XFS_RTGROUP_GEOM_WRITEPOINTER flag is set. The rg_writepointer
field specifies the location of the current writepointer as a block offset
into the respective rtgroup.

[1] https://lwn.net/Articles/1059364/

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
libxfs/xfs_fs.h

index d165de607d179ed18e57cd021336af05c08a9cd5..185f09f327c00c33fbb58aee03770107d31cb028 100644 (file)
@@ -995,7 +995,8 @@ struct xfs_rtgroup_geometry {
        __u32 rg_sick;          /* o: sick things in ag */
        __u32 rg_checked;       /* o: checked metadata in ag */
        __u32 rg_flags;         /* i/o: flags for this ag */
-       __u32 rg_reserved[27];  /* o: zero */
+       __u32 rg_writepointer;  /* o: write pointer block offset for zoned */
+       __u32 rg_reserved[26];  /* o: zero */
 };
 #define XFS_RTGROUP_GEOM_SICK_SUPER    (1U << 0)  /* superblock */
 #define XFS_RTGROUP_GEOM_SICK_BITMAP   (1U << 1)  /* rtbitmap */
@@ -1003,6 +1004,8 @@ struct xfs_rtgroup_geometry {
 #define XFS_RTGROUP_GEOM_SICK_RMAPBT   (1U << 3)  /* reverse mappings */
 #define XFS_RTGROUP_GEOM_SICK_REFCNTBT (1U << 4)  /* reference counts */
 
+#define XFS_RTGROUP_GEOM_WRITEPOINTER  (1U << 0)  /* write pointer */
+
 /* Health monitor event domains */
 
 /* affects the whole fs */