Skip to contentSkip to conversation

Some minor improvements for zoned mode

PATCH Superseded Damien Le Moal 3 participants 7 messages Sep 17, 2025 – Sep 18, 2025 XFS filesystem

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Some minor improvements for zoned mode

A couple of patches to improve a mount meaasge and to improve (reduce) the default maximum number of open zones for large capacity regular devices using the zoned allocatror.

Damien Le Moal (2):
xfs: Improve zone statistics message
xfs: Improve default maximum number of open zones

 fs/xfs/libxfs/xfs_zones.h | 7 +++++++
 fs/xfs/xfs_zone_alloc.c   | 4 ++--
 2 files changed, 9 insertions(+), 2 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/2 xfs: Improve zone statistics message

Reword the information message displayed in xfs_mount_zones() indicating the total zone count and maximum number of open zones.

---
 fs/xfs/xfs_zone_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_zone_alloc.c +1 -1
index 23a027387933..f152b2182004 100644
@@ -1244,7 +1244,7 @@ xfs_mount_zones(
 	if (!mp->m_zone_info)
 		return -ENOMEM;
 
-	xfs_info(mp, "%u zones of %u blocks size (%u max open)",
+	xfs_info(mp, "%u zones of %u blocks (%u max open zones)",
 		 mp->m_sb.sb_rgcount, mp->m_groups[XG_TYPE_RTG].blocks,
 		 mp->m_max_open_zones);
 	trace_xfs_zones_mount(mp);
Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] xfs: Improve zone statistics message

In reply to Damien Le Moal
Quoted 13 lines · Damien Le Moal

Reword the information message displayed in xfs_mount_zones() indicating the total zone count and maximum number of open zones.

---
 fs/xfs/xfs_zone_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_zone_alloc.c +0 -0
index 23a027387933..f152b2182004 100644

fs/xfs/xfs_zone_alloc.c xfs_mount_zones( · line 1250

Quoted 8 lines
fs/xfs/xfs_zone_alloc.c +1 -1
@@ -1244,7 +1244,7 @@ xfs_mount_zones(
 	if (!mp->m_zone_info)
 		return -ENOMEM;
 
-	xfs_info(mp, "%u zones of %u blocks size (%u max open)",
+	xfs_info(mp, "%u zones of %u blocks (%u max open zones)",
 		 mp->m_sb.sb_rgcount, mp->m_groups[XG_TYPE_RTG].blocks,
 		 mp->m_max_open_zones);
 	trace_xfs_zones_mount(mp);
Quoted 3 lines

--
2.51.0

#4 lore raw

PATCH 2/2 xfs: Improve default maximum number of open zones

In reply to Damien Le Moal

For regular block devices using the zoned allocator, the default maximum number of open zones is set to 1/4 of the number of realtime groups. For a large capacity device, this leads to a very large limit. E.g. with a 26 TB HDD:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks size (23959 max open)

In turn such large limit on the number of open zones can lead, depending on the workload, on a very large number of concurrent write streams which devices generally do not handle well, leading to poor performance.

Introduce the default limit XFS_DEFAULT_MAX_OPEN_ZONES, defined as 128 to match the hardware limit of most SMR HDDs available today, and use this limit to set mp->m_max_open_zones in xfs_calc_open_zones() instead of calling xfs_max_open_zones(), when the user did not specify a limit with the max_open_zones mount option.

For the 26 TB HDD example, we now get:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (128 max open zones)

This change does not prevent the user from specifying a lareger number for the open zones limit. E.g.

mount -o max_open_zones=4096 /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (4096 max open zones)

Finally, since xfs_calc_open_zones() checks and caps the mp->m_max_open_zones limit against the value calculated by xfs_max_open_zones() for any type of device, this new default limit does not increase m_max_open_zones for small capacity devices.

---
 fs/xfs/libxfs/xfs_zones.h | 7 +++++++
 fs/xfs/xfs_zone_alloc.c   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_zones.h +7 -0
index c4f1367b2cca..6005f5412363 100644
@@ -29,6 +29,13 @@ struct xfs_rtgroup;
 #define XFS_OPEN_GC_ZONES	1U
 #define XFS_MIN_OPEN_ZONES	(XFS_OPEN_GC_ZONES + 1U)
 
+/*
+ * For zoned device that do not have a limit on the number of open zones, and
+ * for reguilar devices using the zoned allocator, use this value as the default
+ * limit on the number of open zones.
+ */
+#define XFS_DEFAULT_MAX_OPEN_ZONES	128
+
 bool xfs_zone_validate(struct blk_zone *zone, struct xfs_rtgroup *rtg,
 	xfs_rgblock_t *write_pointer);
 
fs/xfs/xfs_zone_alloc.c +1 -1
index f152b2182004..1147bacb2da8 100644
@@ -1131,7 +1131,7 @@ xfs_calc_open_zones(
 		if (bdev_open_zones)
 			mp->m_max_open_zones = bdev_open_zones;
 		else
-			mp->m_max_open_zones = xfs_max_open_zones(mp);
+			mp->m_max_open_zones = XFS_DEFAULT_MAX_OPEN_ZONES;
 	}
 
 	if (mp->m_max_open_zones < XFS_MIN_OPEN_ZONES) {
Signature · 1 line
2.51.0
maintainer Reviewed-by on v1 2/2
#6 lore raw

Re: [PATCH 2/2] xfs: Improve default maximum number of open zones

In reply to Damien Le Moal
Quoted 48 lines · Damien Le Moal

For regular block devices using the zoned allocator, the default maximum number of open zones is set to 1/4 of the number of realtime groups. For a large capacity device, this leads to a very large limit. E.g. with a 26 TB HDD:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks size (23959 max open)

In turn such large limit on the number of open zones can lead, depending on the workload, on a very large number of concurrent write streams which devices generally do not handle well, leading to poor performance.

Introduce the default limit XFS_DEFAULT_MAX_OPEN_ZONES, defined as 128 to match the hardware limit of most SMR HDDs available today, and use this limit to set mp->m_max_open_zones in xfs_calc_open_zones() instead of calling xfs_max_open_zones(), when the user did not specify a limit with the max_open_zones mount option.

For the 26 TB HDD example, we now get:

mount /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (128 max open zones)

This change does not prevent the user from specifying a lareger number for the open zones limit. E.g.

mount -o max_open_zones=4096 /dev/sdb /mnt
...
XFS (sdb): 95836 zones of 65536 blocks (4096 max open zones)

Finally, since xfs_calc_open_zones() checks and caps the mp->m_max_open_zones limit against the value calculated by xfs_max_open_zones() for any type of device, this new default limit does not increase m_max_open_zones for small capacity devices.

---
 fs/xfs/libxfs/xfs_zones.h | 7 +++++++
 fs/xfs/xfs_zone_alloc.c   | 2 +-
 2 files changed, 8 insertions(+), 1 deletion(-)
fs/xfs/libxfs/xfs_zones.h +0 -0
index c4f1367b2cca..6005f5412363 100644

fs/xfs/libxfs/xfs_zones.h struct xfs_rtgroup; · line 33

Quoted 5 lines
fs/xfs/libxfs/xfs_zones.h +2 -0
@@ -29,6 +29,13 @@ struct xfs_rtgroup;
 #define XFS_OPEN_GC_ZONES	1U
 #define XFS_MIN_OPEN_ZONES	(XFS_OPEN_GC_ZONES + 1U)
 
+/*
+ * For zoned device that do not have a limit on the number of open zones, and

'For a zoned device' perhaps?

fs/xfs/libxfs/xfs_zones.h struct xfs_rtgroup; · line 34

Quoted 1 line
fs/xfs/libxfs/xfs_zones.h +1 -0
+ * for reguilar devices using the zoned allocator, use this value as the default

regular

fs/xfs/libxfs/xfs_zones.h struct xfs_rtgroup; · line 35

Quoted 1 line
fs/xfs/libxfs/xfs_zones.h +1 -0
+ * limit on the number of open zones.

Perhaps it's also worth to mention you picked 128 for being the most common limit on available SMR HDDs today, otherwise it would look as a randomly chosen magic number (unless somebody bothers to check the git log).

Quoted 11 lines
fs/xfs/libxfs/xfs_zones.h +3 -0
+ */
+#define XFS_DEFAULT_MAX_OPEN_ZONES	128
+
 bool xfs_zone_validate(struct blk_zone *zone, struct xfs_rtgroup *rtg,
 	xfs_rgblock_t *write_pointer);
 
fs/xfs/xfs_zone_alloc.c +0 -0
index f152b2182004..1147bacb2da8 100644

fs/xfs/xfs_zone_alloc.c xfs_calc_open_zones( · line 1137

Quoted 8 lines
fs/xfs/xfs_zone_alloc.c +1 -1
@@ -1131,7 +1131,7 @@ xfs_calc_open_zones(
 		if (bdev_open_zones)
 			mp->m_max_open_zones = bdev_open_zones;
 		else
-			mp->m_max_open_zones = xfs_max_open_zones(mp);
+			mp->m_max_open_zones = XFS_DEFAULT_MAX_OPEN_ZONES;
 	}
 
 	if (mp->m_max_open_zones < XFS_MIN_OPEN_ZONES) {

Other than the nitpicks above, you can add:

Quoted 3 lines

--
2.51.0