diff mbox series

xfs: trigger zone GC when out of available rt blocks

Message ID 20250310133848.9856-1-hans.holmberg@wdc.com (mailing list archive)
State Accepted
Headers show
Series xfs: trigger zone GC when out of available rt blocks | expand

Commit Message

Hans Holmberg March 10, 2025, 1:39 p.m. UTC
We periodically check the available rt blocks when filling up zones
and start GC if needed, but we may run completely out in between
filling zones, so start GC(unless already running) if we can't reserve
writable space.

This should only happen as a corner case in setups with very few
backing zones.

Fixes: 080d01c41d44 ("xfs: implement zoned garbage collection")
Signed-off-by: Hans Holmberg <hans.holmberg@wdc.com>
---

This issue was found in a yet-to-be-upstreamed xfstest.

 fs/xfs/xfs_zone_space_resv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Christoph Hellwig March 10, 2025, 2:02 p.m. UTC | #1
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Carlos Maiolino March 11, 2025, 12:14 p.m. UTC | #2
On Mon, 10 Mar 2025 13:39:59 +0000, Hans Holmberg wrote:
> We periodically check the available rt blocks when filling up zones
> and start GC if needed, but we may run completely out in between
> filling zones, so start GC(unless already running) if we can't reserve
> writable space.
> 
> This should only happen as a corner case in setups with very few
> backing zones.
> 
> [...]

Applied to for-next, thanks!

[1/1] xfs: trigger zone GC when out of available rt blocks
      commit: b7bc85480b03765a7993262f2c333628c36fbc45

Best regards,
diff mbox series

Patch

diff --git a/fs/xfs/xfs_zone_space_resv.c b/fs/xfs/xfs_zone_space_resv.c
index 4bf1b18aa7a7..4433a060b7ff 100644
--- a/fs/xfs/xfs_zone_space_resv.c
+++ b/fs/xfs/xfs_zone_space_resv.c
@@ -159,6 +159,16 @@  xfs_zoned_reserve_available(
 		if (error != -ENOSPC)
 			break;
 
+		/*
+		 * Make sure to start GC if it is not running already. As we
+		 * check the rtavailable count when filling up zones, GC is
+		 * normally already running at this point, but in some setups
+		 * with very few zones we may completely run out of non-
+		 * reserved blocks in between filling zones.
+		 */
+		if (!xfs_is_zonegc_running(mp))
+			wake_up_process(zi->zi_gc_thread);
+
 		/*
 		 * If there is no reclaimable group left and we aren't still
 		 * processing a pending GC request give up as we're fully out