]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xfs: avoid unnecessary calculations in xfs_zoned_need_gc()
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 16 Mar 2026 11:40:20 +0000 (20:40 +0900)
committerCarlos Maiolino <cem@kernel.org>
Wed, 18 Mar 2026 09:08:07 +0000 (10:08 +0100)
commitc1f955437440f92632e2efca4b591371bb3caefc
tree96f7e6dd37365a02e36f7e331715c6b83e9f53f7
parent68aa101bf2046aa8365333a3768cece07975ca5f
xfs: avoid unnecessary calculations in xfs_zoned_need_gc()

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>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_zone_gc.c