diff mbox series

[6/6] xfs: support lowmode allocations in xfs_bmap_exact_minlen_extent_alloc

Message ID 20240824034100.1163020-7-hch@lst.de (mailing list archive)
State Superseded, archived
Headers show
Series [1/6] xfs: merge xfs_attr_leaf_try_add into xfs_attr_leaf_addname | expand

Commit Message

Christoph Hellwig Aug. 24, 2024, 3:40 a.m. UTC
Currently the debug-only xfs_bmap_exact_minlen_extent_alloc allocation
variant fails to drop into the lowmode last resort allocator, and
thus can sometimes fail allocations for which the caller has a
transaction block reservation.

Fix this by using xfs_bmap_btalloc_low_space to do the actual allocation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/libxfs/xfs_bmap.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Chandan Babu R Aug. 27, 2024, 8:39 a.m. UTC | #1
On Sat, Aug 24, 2024 at 05:40:12 AM +0200, Christoph Hellwig wrote:
> Currently the debug-only xfs_bmap_exact_minlen_extent_alloc allocation
> variant fails to drop into the lowmode last resort allocator, and
> thus can sometimes fail allocations for which the caller has a
> transaction block reservation.
>
> Fix this by using xfs_bmap_btalloc_low_space to do the actual allocation.
>

The changes look good to me,

Acked-by: Chandan Babu R <chandanbabu@kernel.org>
diff mbox series

Patch

diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 73c5af9f0affed..f890d8dc25e47d 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -3493,7 +3493,13 @@  xfs_bmap_exact_minlen_extent_alloc(
 	 */
 	ap->blkno = XFS_AGB_TO_FSB(ap->ip->i_mount, 0, 0);
 
-	return xfs_alloc_vextent_first_ag(args, ap->blkno);
+	/*
+	 * Call xfs_bmap_btalloc_low_space here as it first does a "normal" AG
+	 * iteration and then drops args->total to args->minlen, which might be
+	 * required to find an allocation for the transaction reservation when
+	 * the file system is very full.
+	 */
+	return xfs_bmap_btalloc_low_space(ap, args);
 }
 #else