xfs: kick off inodegc when failing to reserve zoned blocks

XFS processes truncating unlinked inodes asynchronously and thus the free
space pool only sees them with a delay. The non-zoned write path thus
calls into inodegc to accelerate this processing before failing an
allocation due the lack of free blocks. Do the same for the zoned space
reservation.

Fixes: 0bb2193056b5 ("xfs: add support for zoned space reservations")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>

authored by Christoph Hellwig and committed by Carlos Maiolino 7d523255 d004d70d

+6
+6
fs/xfs/xfs_zone_space_resv.c
··· 10 10 #include "xfs_mount.h" 11 11 #include "xfs_inode.h" 12 12 #include "xfs_rtbitmap.h" 13 + #include "xfs_icache.h" 13 14 #include "xfs_zone_alloc.h" 14 15 #include "xfs_zone_priv.h" 15 16 #include "xfs_zones.h" ··· 231 230 232 231 error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb, 233 232 flags & XFS_ZR_RESERVED); 233 + if (error == -ENOSPC && !(flags & XFS_ZR_NOWAIT)) { 234 + xfs_inodegc_flush(mp); 235 + error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb, 236 + flags & XFS_ZR_RESERVED); 237 + } 234 238 if (error == -ENOSPC && (flags & XFS_ZR_GREEDY) && count_fsb > 1) 235 239 error = xfs_zoned_reserve_extents_greedy(mp, &count_fsb, flags); 236 240 if (error)