diff options
| author | Dave Airlie <airlied@redhat.com> | 2025-05-06 16:39:25 +1000 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2025-05-06 16:39:25 +1000 |
| commit | 5e0c67998152bdb91b056160449ee542b86271a5 (patch) | |
| tree | dff9fd979b0319dd2ed873a77246950d7ed95ceb /fs/xfs/xfs_zone_gc.c | |
| parent | 135130db6ee6500e6c82cf44dd831c3fe15f7b5f (diff) | |
| parent | 92a09c47464d040866cf2b4cd052bc60555185fb (diff) | |
BackMerge tag 'v6.15-rc5' into drm-next
Linux 6.15-rc5, requested by tzimmerman for fixes required in drm-next.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'fs/xfs/xfs_zone_gc.c')
| -rw-r--r-- | fs/xfs/xfs_zone_gc.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c index c5136ea9bb1d..81c94dd1d596 100644 --- a/fs/xfs/xfs_zone_gc.c +++ b/fs/xfs/xfs_zone_gc.c @@ -162,18 +162,36 @@ struct xfs_zone_gc_data { /* * We aim to keep enough zones free in stock to fully use the open zone limit - * for data placement purposes. + * for data placement purposes. Additionally, the m_zonegc_low_space tunable + * can be set to make sure a fraction of the unused blocks are available for + * writing. */ bool xfs_zoned_need_gc( struct xfs_mount *mp) { + s64 available, free, threshold; + s32 remainder; + if (!xfs_group_marked(mp, XG_TYPE_RTG, XFS_RTG_RECLAIMABLE)) return false; - if (xfs_estimate_freecounter(mp, XC_FREE_RTAVAILABLE) < + + available = xfs_estimate_freecounter(mp, XC_FREE_RTAVAILABLE); + + if (available < mp->m_groups[XG_TYPE_RTG].blocks * (mp->m_max_open_zones - XFS_OPEN_GC_ZONES)) return true; + + 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; } |