From: "Darrick J. Wong" <djwong@kernel.org>
To: Gao Xiang <hsiangkao@linux.alibaba.com>
Cc: xfs <linux-xfs@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] xfs: add missing cmap->br_state = XFS_EXT_NORM update
Date: Thu, 17 Feb 2022 21:40:32 -0800 [thread overview]
Message-ID: <20220218054032.GO8313@magnolia> (raw)
In-Reply-To: <20220217095542.68085-1-hsiangkao@linux.alibaba.com>
On Thu, Feb 17, 2022 at 05:55:42PM +0800, Gao Xiang wrote:
> COW extents are already converted into written real extents after
> xfs_reflink_convert_cow_locked(), therefore cmap->br_state should
> reflect it.
>
> Otherwise, there is another necessary unwritten convertion
> triggered in xfs_dio_write_end_io() for direct I/O cases.
>
> Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
I /think/ this looks ok. Does it test ok too? AFAICT nothing in the
iomap/writeback machinery cares the incorrect state because we always
set IOMAP_F_SHARED (which triggers COW) so I think this is simply a fix
for directio, like you said?
--D
> ---
> From the logic itself and runtime tracing, IMO, it seems true.
> Kindly correct me here if my understanding is wrong.
>
> fs/xfs/xfs_reflink.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 75bd2e03cd5b..5f0a364739a5 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -424,7 +424,10 @@ xfs_reflink_allocate_cow(
> if (!convert_now || cmap->br_state == XFS_EXT_NORM)
> return 0;
> trace_xfs_reflink_convert_cow(ip, cmap);
> - return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
> + error = xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb);
> + if (!error)
> + cmap->br_state = XFS_EXT_NORM;
> + return error;
>
> out_trans_cancel:
> xfs_trans_cancel(tp);
> --
> 2.24.4
>
next prev parent reply other threads:[~2022-02-18 5:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-17 9:55 Gao Xiang
2022-02-18 5:40 ` Darrick J. Wong [this message]
2022-02-18 5:55 ` Gao Xiang
2022-02-18 11:30 ` Gao Xiang
2022-03-01 2:48 ` Gao Xiang
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=20220218054032.GO8313@magnolia \
--to=djwong@kernel.org \
--cc=hsiangkao@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/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
all inboxes | Powered by JetHome®