[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241107084602.185986-1-alexjlzheng@tencent.com>
Date: Thu, 7 Nov 2024 16:46:02 +0800
From: Jinliang Zheng <alexjlzheng@...il.com>
To: alexjlzheng@...il.com
Cc: alexjlzheng@...cent.com,
chandanbabu@...nel.org,
dchinner@...hat.com,
djwong@...nel.org,
linux-kernel@...r.kernel.org,
linux-xfs@...r.kernel.org
Subject: Re: [PATCH] xfs: fix extent length after xfs_alloc_compute_diff()
On Thu, 7 Nov 2024 15:03:00 +0800, alexjlzheng@...il.com wrote:
> 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
Sorry, I must have misunderstood the intent of the code when sending this
patch. In fact, args->len should not be changed.
But my starting point is I was wondering what will happen if
xfs_alloc_compute_diff()'s changes to bnew cause the extent's remaining
length to be less than args->len? So I have send a new patch:
https://lore.kernel.org/linux-xfs/20241107084044.182463-1-alexjlzheng@tencent.com/T/#u
Also, am I missing some key code to ensure that the above situation does
not occur?
Jinliang Zheng :)
Powered by blists - more mailing lists