Skip to contentSkip to conversation

xfs: add write pointer to xfs_rtgroup_geometry

PATCH In review Wilfred Mallawa 6 participants 11 messages Mar 13 – Sep 22

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 xfs: add write pointer to xfs_rtgroup_geometry

From: Wilfred Mallawa <[email protected]>

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/

---
 libxfs/xfs_fs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
libxfs/xfs_fs.h +4 -1
index d165de607..185f09f32 100644
@@ -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 */
Signature · 1 line
2.53.0
#1 lore raw

PATCH 2/3 man/xfs_rtgroup_geometry: add rg_writepointer field description

From: Wilfred Mallawa <[email protected]>

Update the man/man2/ioctl_xfs_rtgroup_geometry.2 to add a description for the new rg_writepointer field.

---
 man/man2/ioctl_xfs_rtgroup_geometry.2 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
man/man2/ioctl_xfs_rtgroup_geometry.2 +7 -1
index 37e229b43..5d264acac 100644
@@ -23,7 +23,8 @@ struct xfs_rtgroup_geometry {
 	__u32  rg_sick;
 	__u32  rg_checked;
 	__u32  rg_flags;
-	__u32  rg_reserved[27];
+	__u32  rg_writepointer;
+	__u32  rg_reserved[26];
 };
 .fi
 .in
@@ -39,6 +40,11 @@ filesystem blocks.
 The caller can set this field to change the operational behavior of the ioctl.
 Currently no flags are defined, so this field must be zero.
 .TP
+.I rg_writepointer
+For zoned devices, return the writepointer block offset into the respective
+realtime group. This field is valid only if the XFS_RTGROUP_GEOM_WRITEPOINTER
+flag is set in rg_flags.
+.TP
 .IR rg_reserved " and " rg_pad
 All reserved fields will be set to zero on return.
 .PP
Signature · 1 line
2.53.0
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] man/xfs_rtgroup_geometry: add rg_writepointer field description

Quoted 25 lines · Wilfred Mallawa

From: Wilfred Mallawa <[email protected]>

Update the man/man2/ioctl_xfs_rtgroup_geometry.2 to add a description for the new rg_writepointer field.

---
 man/man2/ioctl_xfs_rtgroup_geometry.2 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
man/man2/ioctl_xfs_rtgroup_geometry.2 +2 -1
index 37e229b43..5d264acac 100644
@@ -23,7 +23,8 @@ struct xfs_rtgroup_geometry {
 	__u32  rg_sick;
 	__u32  rg_checked;
 	__u32  rg_flags;
-	__u32  rg_reserved[27];
+	__u32  rg_writepointer;
+	__u32  rg_reserved[26];
 };
 .fi
 .in

man/man2/ioctl_xfs_rtgroup_geometry.2 filesystem blocks. · line 47

Quoted 8 lines
man/man2/ioctl_xfs_rtgroup_geometry.2 +5 -0
@@ -39,6 +40,11 @@ filesystem blocks.
 The caller can set this field to change the operational behavior of the ioctl.
 Currently no flags are defined, so this field must be zero.
 .TP
+.I rg_writepointer
+For zoned devices, return the writepointer block offset into the respective
+realtime group. This field is valid only if the XFS_RTGROUP_GEOM_WRITEPOINTER
+flag is set in rg_flags.
+.TP

Oooh a docs update ❤️

--D

Quoted 7 lines
man/man2/ioctl_xfs_rtgroup_geometry.2 +0 -0
 .IR rg_reserved " and " rg_pad
 All reserved fields will be set to zero on return.
 .PP
Signature · 1 line
2.53.0
#4 lore raw

PATCH 3/3 xfs_io: report rg_writepointer in report rg_info()

In reply to Wilfred Mallawa

From: Wilfred Mallawa <[email protected]>

If the XFS_RTGROUP_GEOM_WRITEPOINTER field is set, then print the writepointer in struct xfs_rtgroup_geometry.

---
 io/aginfo.c | 3 +++
 1 file changed, 3 insertions(+)
io/aginfo.c +3 -0
index f81986f0d..978f0f3b8 100644
@@ -132,6 +132,9 @@ report_rginfo(
 	printf(_("Checked: 0x%x\n"),	rgeo.rg_checked);
 	printf(_("Flags: 0x%x\n"),	rgeo.rg_flags);
 
+	if (rgeo.rg_flags & XFS_RTGROUP_GEOM_WRITEPOINTER)
+		printf(_("Writepointer: 0x%u\n"), rgeo.rg_writepointer);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH 3/3] xfs_io: report rg_writepointer in report rg_info()

Quoted 8 lines · Wilfred Mallawa

From: Wilfred Mallawa <[email protected]>

If the XFS_RTGROUP_GEOM_WRITEPOINTER field is set, then print the writepointer in struct xfs_rtgroup_geometry.

---
 io/aginfo.c | 3 +++

Looks good to me!

--D

Quoted 20 lines
 1 file changed, 3 insertions(+)
io/aginfo.c +3 -0
index f81986f0d..978f0f3b8 100644
@@ -132,6 +132,9 @@ report_rginfo(
 	printf(_("Checked: 0x%x\n"),	rgeo.rg_checked);
 	printf(_("Flags: 0x%x\n"),	rgeo.rg_flags);
 
+	if (rgeo.rg_flags & XFS_RTGROUP_GEOM_WRITEPOINTER)
+		printf(_("Writepointer: 0x%u\n"), rgeo.rg_writepointer);
+
 	return 0;
 }
 
Signature · 1 line
2.53.0
#7 lore raw
In reply to Wilfred Mallawa

It looks like patches 2 and 3 in this series never made it into the xfsprogs repository despite being fully reviewed. Can we get them picked up?

Quoted 55 lines · Wilfred Mallawa

From: Wilfred Mallawa <[email protected]>

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/

---
 libxfs/xfs_fs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
libxfs/xfs_fs.h +4 -1
index d165de607..185f09f32 100644
@@ -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 */
Signature · 1 line
2.53.0

---end quoted text---

#8 lore raw
Quoted 3 lines · Christoph Hellwig

It looks like patches 2 and 3 in this series never made it into the xfsprogs repository despite being fully reviewed. Can we get them picked up?

Cc'ing Andrey here.

Quoted 59 lines · Wilfred Mallawa
Quoted 55 lines

From: Wilfred Mallawa <[email protected]>

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/

---
 libxfs/xfs_fs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
libxfs/xfs_fs.h +4 -1
index d165de607..185f09f32 100644
@@ -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 */
Signature · 1 line
2.53.0

---end quoted text---

#9 lore raw
Quoted 6 lines · Carlos Maiolino
Quoted 3 lines · Christoph Hellwig

It looks like patches 2 and 3 in this series never made it into the xfsprogs repository despite being fully reviewed. Can we get them picked up?

Cc'ing Andrey here.

That might help indeed :)

#10 lore raw
In reply to Carlos Maiolino
Quoted 6 lines · Carlos Maiolino
Quoted 3 lines · Christoph Hellwig

It looks like patches 2 and 3 in this series never made it into the xfsprogs repository despite being fully reviewed. Can we get them picked up?

Cc'ing Andrey here.

Thanks, I will pull this, I've missed it

Signature · 1 line
- Andrey