[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241107070300.13535-1-alexjlzheng@tencent.com>
Date: Thu, 7 Nov 2024 15:03:00 +0800
From: Jinliang Zheng <alexjlzheng@...il.com>
To: dchinner@...hat.com
Cc: djwong@...nel.org,
chandanbabu@...nel.org,
linux-xfs@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jinliang Zheng <alexjlzheng@...cent.com>
Subject: [PATCH] xfs: fix extent length after xfs_alloc_compute_diff()
After xfs_alloc_compute_diff(), the length of the candidate extent
may change, so make necessary corrections to args->len.
Signed-off-by: Jinliang Zheng <alexjlzheng@...cent.com>
---
fs/xfs/libxfs/xfs_alloc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
index 22bdbb3e9980..6a5e6cc7a259 100644
--- a/fs/xfs/libxfs/xfs_alloc.c
+++ b/fs/xfs/libxfs/xfs_alloc.c
@@ -1069,6 +1069,10 @@ xfs_alloc_cur_check(
if (bnew == NULLAGBLOCK)
goto out;
+ args->len = XFS_EXTLEN_MIN(bnoa + lena - bnew, args->maxlen);
+ if (args->len < acur->len)
+ goto out;
+
/*
* Deactivate a bnobt cursor with worse locality than the current best.
*/
--
2.41.1
Powered by blists - more mailing lists