Skip to content

Commit 7d52325

Browse files
Christoph Hellwigcmaiolino
authored andcommitted
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: 0bb2193 ("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>
1 parent d004d70 commit 7d52325

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

fs/xfs/xfs_zone_space_resv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "xfs_mount.h"
1111
#include "xfs_inode.h"
1212
#include "xfs_rtbitmap.h"
13+
#include "xfs_icache.h"
1314
#include "xfs_zone_alloc.h"
1415
#include "xfs_zone_priv.h"
1516
#include "xfs_zones.h"
@@ -230,6 +231,11 @@ xfs_zoned_space_reserve(
230231

231232
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
232233
flags & XFS_ZR_RESERVED);
234+
if (error == -ENOSPC && !(flags & XFS_ZR_NOWAIT)) {
235+
xfs_inodegc_flush(mp);
236+
error = xfs_dec_freecounter(mp, XC_FREE_RTEXTENTS, count_fsb,
237+
flags & XFS_ZR_RESERVED);
238+
}
233239
if (error == -ENOSPC && (flags & XFS_ZR_GREEDY) && count_fsb > 1)
234240
error = xfs_zoned_reserve_extents_greedy(mp, &count_fsb, flags);
235241
if (error)

0 commit comments

Comments
 (0)