* [PATCH v2 0/4] Zoned XFS code improvements
@ 2026-03-16 11:40 Damien Le Moal
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Damien Le Moal @ 2026-03-16 11:40 UTC (permalink / raw)
To: linux-xfs, Carlos Maiolino; +Cc: Christoph Hellwig, Hans Holmberg
All,
Here are 4 simple patches to cleanup the code for zoned XFS.
Overall, there is no functional changes introduced beside the change
of information displayed in /proc/self/mountstats (patch 3).
Changes from v1:
- Split former patch 1 into patch 1 and 2.
- Changed patch 3 to add new lines of information instead of changing
the existing lines.
- Reworked commit titles and messages.
Damien Le Moal (4):
xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
xfs: fix a comment typo in xfs_select_zone_nowait()
xfs: display more zone related information in mountstats
xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
fs/xfs/xfs_zone_alloc.c | 9 +++++----
fs/xfs/xfs_zone_gc.c | 24 ++++++++++++++++++------
fs/xfs/xfs_zone_info.c | 7 ++++++-
3 files changed, 29 insertions(+), 11 deletions(-)
base-commit: f8544b654f22b1138ba12bc0971a96963b20311d
--
2.53.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
@ 2026-03-16 11:40 ` Damien Le Moal
2026-03-16 15:55 ` Christoph Hellwig
2026-03-17 12:18 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Damien Le Moal @ 2026-03-16 11:40 UTC (permalink / raw)
To: linux-xfs, Carlos Maiolino; +Cc: Christoph Hellwig, Hans Holmberg
When xfs_select_zone_nowait() is called with pack_tight equal to true,
the function xfs_select_open_zone_mru() is called if no open zone is
returned by xfs_select_open_zone_lru(), that is, when oz is NULL. The
open zone pointer return of xfs_select_zone_nowait() is then checked,
but this check is outside of the "if (pack_tight)" that trigered the
call to xfs_select_open_zone_mru(). In other word, this check is
unnecessarily done even when pack_tight is false.
Move the check for the return value of the call to
xfs_select_open_zone_mru() inside the if that controls the call to this
function, so that we do not uselessly test again the value of oz when
pack_tight is false.
No functional changes.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
fs/xfs/xfs_zone_alloc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 7d712d5a5ce0..8435ccb018dc 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -675,10 +675,11 @@ xfs_select_zone_nowait(
if (oz)
goto out_unlock;
- if (pack_tight)
+ if (pack_tight) {
oz = xfs_select_open_zone_mru(zi, write_hint);
- if (oz)
- goto out_unlock;
+ if (oz)
+ goto out_unlock;
+ }
/*
* See if we can open a new zone and use that so that data for different
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 2/4] xfs: fix a comment typo in xfs_select_zone_nowait()
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
@ 2026-03-16 11:40 ` Damien Le Moal
2026-03-16 15:56 ` Christoph Hellwig
2026-03-17 12:19 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
` (2 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Damien Le Moal @ 2026-03-16 11:40 UTC (permalink / raw)
To: linux-xfs, Carlos Maiolino; +Cc: Christoph Hellwig, Hans Holmberg
Fix a typo in the comment describing the second call to
xfs_select_open_zone_lru() in xfs_select_zone_nowait().
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
fs/xfs/xfs_zone_alloc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 8435ccb018dc..a05418ac6a95 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -690,7 +690,7 @@ xfs_select_zone_nowait(
goto out_unlock;
/*
- * Try to find an zone that is an ok match to colocate data with.
+ * Try to find a zone that is an ok match to colocate data with.
*/
oz = xfs_select_open_zone_lru(zi, write_hint, XFS_ZONE_ALLOC_OK);
if (oz)
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 3/4] xfs: display more zone related information in mountstats
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
@ 2026-03-16 11:40 ` Damien Le Moal
2026-03-16 15:57 ` Christoph Hellwig
2026-03-17 12:21 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
2026-03-18 10:12 ` [PATCH v2 0/4] Zoned XFS code improvements Carlos Maiolino
4 siblings, 2 replies; 14+ messages in thread
From: Damien Le Moal @ 2026-03-16 11:40 UTC (permalink / raw)
To: linux-xfs, Carlos Maiolino; +Cc: Christoph Hellwig, Hans Holmberg
Modify xfs_zoned_show_stats() to add to the information displayed with
/proc/self/mountstats the total number of zones (RT groups) and the
number of open zones together with the maximum number of open zones.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
fs/xfs/xfs_zone_info.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_zone_info.c b/fs/xfs/xfs_zone_info.c
index 53eabbc3334c..a2af44011654 100644
--- a/fs/xfs/xfs_zone_info.c
+++ b/fs/xfs/xfs_zone_info.c
@@ -90,9 +90,14 @@ xfs_zoned_show_stats(
seq_printf(m, "\tRT GC required: %d\n",
xfs_zoned_need_gc(mp));
+ seq_printf(m, "\ttotal number of zones: %u\n",
+ mp->m_sb.sb_rgcount);
seq_printf(m, "\tfree zones: %d\n", atomic_read(&zi->zi_nr_free_zones));
- seq_puts(m, "\topen zones:\n");
+
spin_lock(&zi->zi_open_zones_lock);
+ seq_printf(m, "\tnumber of open zones: %u / %u\n",
+ zi->zi_nr_open_zones, mp->m_max_open_zones);
+ seq_puts(m, "\topen zones:\n");
list_for_each_entry(oz, &zi->zi_open_zones, oz_entry)
xfs_show_open_zone(m, oz);
if (zi->zi_open_gc_zone) {
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
` (2 preceding siblings ...)
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
@ 2026-03-16 11:40 ` Damien Le Moal
2026-03-16 15:58 ` Christoph Hellwig
2026-03-17 12:25 ` Hans Holmberg
2026-03-18 10:12 ` [PATCH v2 0/4] Zoned XFS code improvements Carlos Maiolino
4 siblings, 2 replies; 14+ messages in thread
From: Damien Le Moal @ 2026-03-16 11:40 UTC (permalink / raw)
To: linux-xfs, Carlos Maiolino; +Cc: Christoph Hellwig, Hans Holmberg
If zonegc_low_space is set to zero (which is the default), the second
condition in xfs_zoned_need_gc() that triggers GC never evaluates to
true because the calculated threshold will always be 0. So there is no
need to calculate the threshold and to evaluate that condition. Return
early when zonegc_low_space is zero.
While at it, add comments to document the intent of each of the 3 tests
used to determine the return value to control the execution of garbage
collection.
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
fs/xfs/xfs_zone_gc.c | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index 309f70098524..0ff710fa0ee7 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -170,25 +170,37 @@ xfs_zoned_need_gc(
s64 available, free, threshold;
s32 remainder;
+ /* If we have no reclaimable blocks, running GC is useless. */
if (!xfs_zoned_have_reclaimable(mp->m_zone_info))
return false;
+ /*
+ * In order to avoid file fragmentation as much as possible, we should
+ * make sure that we can open enough zones. So trigger GC if the number
+ * of blocks immediately available for writes is lower than the total
+ * number of blocks from all possible open zones.
+ */
available = xfs_estimate_freecounter(mp, XC_FREE_RTAVAILABLE);
-
if (available <
xfs_rtgs_to_rfsbs(mp, mp->m_max_open_zones - XFS_OPEN_GC_ZONES))
return true;
- free = xfs_estimate_freecounter(mp, XC_FREE_RTEXTENTS);
+ /*
+ * For cases where the user wants to be more aggressive with GC,
+ * the sysfs attribute zonegc_low_space may be set to a non zero value,
+ * to indicate that GC should try to maintain at least zonegc_low_space
+ * percent of the free space to be directly available for writing. Check
+ * this here.
+ */
+ if (!mp->m_zonegc_low_space)
+ return false;
+ free = xfs_estimate_freecounter(mp, XC_FREE_RTEXTENTS);
threshold = div_s64_rem(free, 100, &remainder);
threshold = threshold * mp->m_zonegc_low_space +
remainder * div_s64(mp->m_zonegc_low_space, 100);
- if (available < threshold)
- return true;
-
- return false;
+ return available < threshold;
}
static struct xfs_zone_gc_data *
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
@ 2026-03-16 15:55 ` Christoph Hellwig
2026-03-17 12:18 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-16 15:55 UTC (permalink / raw)
To: Damien Le Moal
Cc: linux-xfs, Carlos Maiolino, Christoph Hellwig, Hans Holmberg
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/4] xfs: fix a comment typo in xfs_select_zone_nowait()
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
@ 2026-03-16 15:56 ` Christoph Hellwig
2026-03-17 12:19 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-16 15:56 UTC (permalink / raw)
To: Damien Le Moal
Cc: linux-xfs, Carlos Maiolino, Christoph Hellwig, Hans Holmberg
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/4] xfs: display more zone related information in mountstats
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
@ 2026-03-16 15:57 ` Christoph Hellwig
2026-03-17 12:21 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-16 15:57 UTC (permalink / raw)
To: Damien Le Moal
Cc: linux-xfs, Carlos Maiolino, Christoph Hellwig, Hans Holmberg
Looks good:
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
@ 2026-03-16 15:58 ` Christoph Hellwig
2026-03-17 12:25 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-16 15:58 UTC (permalink / raw)
To: Damien Le Moal
Cc: linux-xfs, Carlos Maiolino, Christoph Hellwig, Hans Holmberg
On Mon, Mar 16, 2026 at 08:40:20PM +0900, Damien Le Moal wrote:
> If zonegc_low_space is set to zero (which is the default), the second
> condition in xfs_zoned_need_gc() that triggers GC never evaluates to
> true because the calculated threshold will always be 0. So there is no
> need to calculate the threshold and to evaluate that condition. Return
> early when zonegc_low_space is zero.
>
> While at it, add comments to document the intent of each of the 3 tests
> used to determine the return value to control the execution of garbage
> collection.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
2026-03-16 15:55 ` Christoph Hellwig
@ 2026-03-17 12:18 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Hans Holmberg @ 2026-03-17 12:18 UTC (permalink / raw)
To: Damien Le Moal, linux-xfs@vger.kernel.org, Carlos Maiolino
Cc: Christoph Hellwig
On 16/03/2026 12:45, Damien Le Moal wrote:
> When xfs_select_zone_nowait() is called with pack_tight equal to true,
> the function xfs_select_open_zone_mru() is called if no open zone is
> returned by xfs_select_open_zone_lru(), that is, when oz is NULL. The
> open zone pointer return of xfs_select_zone_nowait() is then checked,
> but this check is outside of the "if (pack_tight)" that trigered the
> call to xfs_select_open_zone_mru(). In other word, this check is
> unnecessarily done even when pack_tight is false.
>
> Move the check for the return value of the call to
> xfs_select_open_zone_mru() inside the if that controls the call to this
> function, so that we do not uselessly test again the value of oz when
> pack_tight is false.
>
> No functional changes.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> fs/xfs/xfs_zone_alloc.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index 7d712d5a5ce0..8435ccb018dc 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -675,10 +675,11 @@ xfs_select_zone_nowait(
> if (oz)
> goto out_unlock;
>
> - if (pack_tight)
> + if (pack_tight) {
> oz = xfs_select_open_zone_mru(zi, write_hint);
> - if (oz)
> - goto out_unlock;
> + if (oz)
> + goto out_unlock;
> + }
>
> /*
> * See if we can open a new zone and use that so that data for different
Looks good,
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 2/4] xfs: fix a comment typo in xfs_select_zone_nowait()
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
2026-03-16 15:56 ` Christoph Hellwig
@ 2026-03-17 12:19 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Hans Holmberg @ 2026-03-17 12:19 UTC (permalink / raw)
To: Damien Le Moal, linux-xfs@vger.kernel.org, Carlos Maiolino
Cc: Christoph Hellwig
On 16/03/2026 12:46, Damien Le Moal wrote:
> Fix a typo in the comment describing the second call to
> xfs_select_open_zone_lru() in xfs_select_zone_nowait().
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> fs/xfs/xfs_zone_alloc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index 8435ccb018dc..a05418ac6a95 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -690,7 +690,7 @@ xfs_select_zone_nowait(
> goto out_unlock;
>
> /*
> - * Try to find an zone that is an ok match to colocate data with.
> + * Try to find a zone that is an ok match to colocate data with.
> */
> oz = xfs_select_open_zone_lru(zi, write_hint, XFS_ZONE_ALLOC_OK);
> if (oz)
Looks good,
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 3/4] xfs: display more zone related information in mountstats
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
2026-03-16 15:57 ` Christoph Hellwig
@ 2026-03-17 12:21 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Hans Holmberg @ 2026-03-17 12:21 UTC (permalink / raw)
To: Damien Le Moal, linux-xfs@vger.kernel.org, Carlos Maiolino
Cc: Christoph Hellwig
On 16/03/2026 12:46, Damien Le Moal wrote:
> Modify xfs_zoned_show_stats() to add to the information displayed with
> /proc/self/mountstats the total number of zones (RT groups) and the
> number of open zones together with the maximum number of open zones.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> fs/xfs/xfs_zone_info.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_zone_info.c b/fs/xfs/xfs_zone_info.c
> index 53eabbc3334c..a2af44011654 100644
> --- a/fs/xfs/xfs_zone_info.c
> +++ b/fs/xfs/xfs_zone_info.c
> @@ -90,9 +90,14 @@ xfs_zoned_show_stats(
> seq_printf(m, "\tRT GC required: %d\n",
> xfs_zoned_need_gc(mp));
>
> + seq_printf(m, "\ttotal number of zones: %u\n",
> + mp->m_sb.sb_rgcount);
> seq_printf(m, "\tfree zones: %d\n", atomic_read(&zi->zi_nr_free_zones));
> - seq_puts(m, "\topen zones:\n");
> +
> spin_lock(&zi->zi_open_zones_lock);
> + seq_printf(m, "\tnumber of open zones: %u / %u\n",
> + zi->zi_nr_open_zones, mp->m_max_open_zones);
> + seq_puts(m, "\topen zones:\n");
> list_for_each_entry(oz, &zi->zi_open_zones, oz_entry)
> xfs_show_open_zone(m, oz);
> if (zi->zi_open_gc_zone) {
Awesome, i've been wanting to have the current number of open zones
as part of these stats for a while :)
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
2026-03-16 15:58 ` Christoph Hellwig
@ 2026-03-17 12:25 ` Hans Holmberg
1 sibling, 0 replies; 14+ messages in thread
From: Hans Holmberg @ 2026-03-17 12:25 UTC (permalink / raw)
To: Damien Le Moal, linux-xfs@vger.kernel.org, Carlos Maiolino
Cc: Christoph Hellwig
On 16/03/2026 12:46, Damien Le Moal wrote:
> If zonegc_low_space is set to zero (which is the default), the second
> condition in xfs_zoned_need_gc() that triggers GC never evaluates to
> true because the calculated threshold will always be 0. So there is no
> need to calculate the threshold and to evaluate that condition. Return
> early when zonegc_low_space is zero.
>
> While at it, add comments to document the intent of each of the 3 tests
> used to determine the return value to control the execution of garbage
> collection.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> fs/xfs/xfs_zone_gc.c | 24 ++++++++++++++++++------
> 1 file changed, 18 insertions(+), 6 deletions(-)
>
> diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
> index 309f70098524..0ff710fa0ee7 100644
> --- a/fs/xfs/xfs_zone_gc.c
> +++ b/fs/xfs/xfs_zone_gc.c
> @@ -170,25 +170,37 @@ xfs_zoned_need_gc(
> s64 available, free, threshold;
> s32 remainder;
>
> + /* If we have no reclaimable blocks, running GC is useless. */
> if (!xfs_zoned_have_reclaimable(mp->m_zone_info))
> return false;
>
> + /*
> + * In order to avoid file fragmentation as much as possible, we should
> + * make sure that we can open enough zones. So trigger GC if the number
> + * of blocks immediately available for writes is lower than the total
> + * number of blocks from all possible open zones.
> + */
> available = xfs_estimate_freecounter(mp, XC_FREE_RTAVAILABLE);
> -
> if (available <
> xfs_rtgs_to_rfsbs(mp, mp->m_max_open_zones - XFS_OPEN_GC_ZONES))
> return true;
>
> - free = xfs_estimate_freecounter(mp, XC_FREE_RTEXTENTS);
> + /*
> + * For cases where the user wants to be more aggressive with GC,
> + * the sysfs attribute zonegc_low_space may be set to a non zero value,
> + * to indicate that GC should try to maintain at least zonegc_low_space
> + * percent of the free space to be directly available for writing. Check
> + * this here.
> + */
> + if (!mp->m_zonegc_low_space)
> + return false;
>
> + free = xfs_estimate_freecounter(mp, XC_FREE_RTEXTENTS);
> threshold = div_s64_rem(free, 100, &remainder);
> threshold = threshold * mp->m_zonegc_low_space +
> remainder * div_s64(mp->m_zonegc_low_space, 100);
>
> - if (available < threshold)
> - return true;
> -
> - return false;
> + return available < threshold;
> }
>
> static struct xfs_zone_gc_data *
The optimization makes sense & thanks for providing the documentation!
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2 0/4] Zoned XFS code improvements
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
` (3 preceding siblings ...)
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
@ 2026-03-18 10:12 ` Carlos Maiolino
4 siblings, 0 replies; 14+ messages in thread
From: Carlos Maiolino @ 2026-03-18 10:12 UTC (permalink / raw)
To: linux-xfs, Damien Le Moal; +Cc: Christoph Hellwig, Hans Holmberg
On Mon, 16 Mar 2026 20:40:16 +0900, Damien Le Moal wrote:
> All,
>
> Here are 4 simple patches to cleanup the code for zoned XFS.
> Overall, there is no functional changes introduced beside the change
> of information displayed in /proc/self/mountstats (patch 3).
>
> Changes from v1:
> - Split former patch 1 into patch 1 and 2.
> - Changed patch 3 to add new lines of information instead of changing
> the existing lines.
> - Reworked commit titles and messages.
>
> [...]
Applied to for-next, thanks!
[1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait()
commit: 770323d418ed5848cc21af172f77377b2cc0542d
[2/4] xfs: fix a comment typo in xfs_select_zone_nowait()
commit: 6a82a691b08070ad03b237d7db89aa0bfef389e2
[3/4] xfs: display more zone related information in mountstats
commit: 68aa101bf2046aa8365333a3768cece07975ca5f
[4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
commit: c1f955437440f92632e2efca4b591371bb3caefc
Best regards,
--
Carlos Maiolino <cem@kernel.org>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-18 10:12 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-16 11:40 [PATCH v2 0/4] Zoned XFS code improvements Damien Le Moal
2026-03-16 11:40 ` [PATCH v2 1/4] xfs: avoid unnecessary open zone check in xfs_select_zone_nowait() Damien Le Moal
2026-03-16 15:55 ` Christoph Hellwig
2026-03-17 12:18 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 2/4] xfs: fix a comment typo " Damien Le Moal
2026-03-16 15:56 ` Christoph Hellwig
2026-03-17 12:19 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 3/4] xfs: display more zone related information in mountstats Damien Le Moal
2026-03-16 15:57 ` Christoph Hellwig
2026-03-17 12:21 ` Hans Holmberg
2026-03-16 11:40 ` [PATCH v2 4/4] xfs: avoid unnecessary calculations in xfs_zoned_need_gc() Damien Le Moal
2026-03-16 15:58 ` Christoph Hellwig
2026-03-17 12:25 ` Hans Holmberg
2026-03-18 10:12 ` [PATCH v2 0/4] Zoned XFS code improvements Carlos Maiolino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox