summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-04-25 09:37:21 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2025-04-25 09:37:21 -0700
commitb22a194c52b2c146d57b6c291e8a37329a8d08a1 (patch)
treedc7416aefb68a381513c5a5b01b581e46225d7b1
parenteef0dc0bd432885b2bd4fc7f410ed039bf028e37 (diff)
parentf0447f80aec83f1699d599c94618bb5c323963e6 (diff)
Merge tag 'xfs-fixes-6.15-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
Pull xfs fixes from Carlos Maiolino: "This contains a fix for a build failure on some 32-bit architectures and a warning generating docs" * tag 'xfs-fixes-6.15-rc4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux: xfs: remove duplicate Zoned Filesystems sections in admin-guide XFS: fix zoned gc threshold math for 32-bit arches
-rw-r--r--Documentation/admin-guide/xfs.rst29
-rw-r--r--fs/xfs/xfs_zone_gc.c10
2 files changed, 16 insertions, 23 deletions
diff --git a/Documentation/admin-guide/xfs.rst b/Documentation/admin-guide/xfs.rst
index 3e76276bd488..5becb441c3cb 100644
--- a/Documentation/admin-guide/xfs.rst
+++ b/Documentation/admin-guide/xfs.rst
@@ -562,7 +562,7 @@ The interesting knobs for XFS workqueues are as follows:
Zoned Filesystems
=================
-For zoned file systems, the following attribute is exposed in:
+For zoned file systems, the following attributes are exposed in:
/sys/fs/xfs/<dev>/zoned/
@@ -572,23 +572,10 @@ For zoned file systems, the following attribute is exposed in:
is limited by the capabilities of the backing zoned device, file system
size and the max_open_zones mount option.
-Zoned Filesystems
-=================
-
-For zoned file systems, the following attributes are exposed in:
-
- /sys/fs/xfs/<dev>/zoned/
-
- max_open_zones (Min: 1 Default: Varies Max: UINTMAX)
- This read-only attribute exposes the maximum number of open zones
- available for data placement. The value is determined at mount time and
- is limited by the capabilities of the backing zoned device, file system
- size and the max_open_zones mount option.
-
- zonegc_low_space (Min: 0 Default: 0 Max: 100)
- Define a percentage for how much of the unused space that GC should keep
- available for writing. A high value will reclaim more of the space
- occupied by unused blocks, creating a larger buffer against write
- bursts at the cost of increased write amplification. Regardless
- of this value, garbage collection will always aim to free a minimum
- amount of blocks to keep max_open_zones open for data placement purposes.
+ zonegc_low_space (Min: 0 Default: 0 Max: 100)
+ Define a percentage for how much of the unused space that GC should keep
+ available for writing. A high value will reclaim more of the space
+ occupied by unused blocks, creating a larger buffer against write
+ bursts at the cost of increased write amplification. Regardless
+ of this value, garbage collection will always aim to free a minimum
+ amount of blocks to keep max_open_zones open for data placement purposes.
diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index 8c541ca71872..81c94dd1d596 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -170,7 +170,8 @@ bool
xfs_zoned_need_gc(
struct xfs_mount *mp)
{
- s64 available, free;
+ s64 available, free, threshold;
+ s32 remainder;
if (!xfs_group_marked(mp, XG_TYPE_RTG, XFS_RTG_RECLAIMABLE))
return false;
@@ -183,7 +184,12 @@ xfs_zoned_need_gc(
return true;
free = xfs_estimate_freecounter(mp, XC_FREE_RTEXTENTS);
- if (available < mult_frac(free, mp->m_zonegc_low_space, 100))
+
+ 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;