Re: [RESEND PATCH v3] xfs: fix the entry condition of exact EOF block allocation optimization

From: Dave Chinner
Date: Wed Jan 15 2025 - 14:52:26 EST


On Wed, Jan 15, 2025 at 08:35:25PM +0800, Jinliang Zheng wrote:
> When we call create(), lseek() and write() sequentially, offset != 0
> cannot be used as a judgment condition for whether the file already
> has extents.
>
> Furthermore, when xfs_bmap_adjacent() has not given a better blkno,
> it is not necessary to use exact EOF block allocation.
>
> Suggested-by: Dave Chinner <david@xxxxxxxxxxxxx>
> Signed-off-by: Jinliang Zheng <alexjlzheng@xxxxxxxxxxx>
> ---
> Changelog:
> - V3: use ap->eof to mark whether to use the EXACT allocation algorithm
> - V2: https://lore.kernel.org/linux-xfs/Z1I74KeyZRv2pBBT@xxxxxxxxxxxxxxxxxxx/
> - V1: https://lore.kernel.org/linux-xfs/ZyFJm7xg7Msd6eVr@xxxxxxxxxxxxxxxxxxx/T/#t
> ---
> fs/xfs/libxfs/xfs_bmap.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)

Looks fine.

Reviewed-by: Dave Chinner <dchinner@xxxxxxxxxx>

--
Dave Chinner
david@xxxxxxxxxxxxx