From: Dave Chinner <david@fromorbit.com>
To: alexjlzheng@gmail.com
Cc: cem@kernel.org, djwong@kernel.org, chandanbabu@kernel.org,
dchinner@redhat.com, zhangjiachen.jaycee@bytedance.com,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Jinliang Zheng <alexjlzheng@tencent.com>
Subject: Re: [PATCH] xfs: fix the judgment of whether the file already has extents
Date: Wed, 30 Oct 2024 07:46:19 +1100 [thread overview]
Message-ID: <ZyFJm7xg7Msd6eVr@dread.disaster.area> (raw)
In-Reply-To: <20241026180116.10536-1-alexjlzheng@tencent.com>
On Sun, Oct 27, 2024 at 02:01:16AM +0800, alexjlzheng@gmail.com wrote:
> From: Jinliang Zheng <alexjlzheng@tencent.com>
>
> When we call create(), lseek() and write() sequentially, offset != 0
> cannot be used as a judgment condition for whether the file already
> has extents.
>
> This patch uses prev.br_startoff instead of offset != 0.
>
> Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
> ---
> fs/xfs/libxfs/xfs_bmap.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 36dd08d13293..94e7aeed9e95 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -3536,7 +3536,7 @@ xfs_bmap_btalloc_at_eof(
> * or it's the first allocation in a file, just try for a stripe aligned
> * allocation.
> */
> - if (ap->offset) {
> + if (ap->prev.br_startoff != NULLFILEOFF) {
> xfs_extlen_t nextminlen = 0;
Makes sense, but the logic is not correct. See xfs_bmap_adjacent()
on how it sets up the ap->blkno target for exact eof bno allocation.
-Dave.
--
Dave Chinner
david@fromorbit.com
prev parent reply other threads:[~2024-10-29 20:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-26 18:01 [PATCH] xfs: fix the judgment of whether the file already has extents alexjlzheng
2024-10-28 9:41 ` Christoph Hellwig
2024-10-28 10:33 ` Jinliang Zheng
2024-10-28 10:42 ` Jinliang Zheng
2024-10-29 20:46 ` Dave Chinner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZyFJm7xg7Msd6eVr@dread.disaster.area \
--to=david@fromorbit.com \
--cc=alexjlzheng@gmail.com \
--cc=alexjlzheng@tencent.com \
--cc=cem@kernel.org \
--cc=chandanbabu@kernel.org \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=zhangjiachen.jaycee@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox