From: Christoph Hellwig <hch@infradead.org>
To: alexjlzheng@gmail.com
Cc: cem@kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jinliang Zheng <alexjlzheng@tencent.com>,
John Garry <john.g.garry@oracle.com>
Subject: Re: [PATCH] xfs: fix confused tracepoints in xfs_reflink_end_atomic_cow()
Date: Mon, 24 Nov 2025 01:34:26 -0800 [thread overview]
Message-ID: <aSQmomhODBHTip8j@infradead.org> (raw)
In-Reply-To: <20251121115656.8796-1-alexjlzheng@tencent.com>
On Fri, Nov 21, 2025 at 07:56:56PM +0800, alexjlzheng@gmail.com wrote:
> From: Jinliang Zheng <alexjlzheng@tencent.com>
>
> The commit b1e09178b73a ("xfs: commit CoW-based atomic writes atomically")
> introduced xfs_reflink_end_atomic_cow() for atomic CoW-based writes, but
> it used the same tracepoint as xfs_reflink_end_cow(), making trace logs
> ambiguous.
>
> This patch adds two new tracepoints trace_xfs_reflink_end_atomic_cow() and
> trace_xfs_reflink_end_atomic_cow_error() to distinguish them.
Confused sounds a bit strong, but otherwise this looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
Semi-related: back when this code was added I asked why we're not
using the transaction / defer ops chaining even for normale reflink
completions, as it should be just as efficient and that way we have
less code to maintain and less diverging code paths. Or am I missing
something?
>
> Signed-off-by: Jinliang Zheng <alexjlzheng@tencent.com>
> ---
> fs/xfs/xfs_reflink.c | 4 ++--
> fs/xfs/xfs_trace.h | 2 ++
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
> index 3f177b4ec131..47f532fd46e0 100644
> --- a/fs/xfs/xfs_reflink.c
> +++ b/fs/xfs/xfs_reflink.c
> @@ -1003,7 +1003,7 @@ xfs_reflink_end_atomic_cow(
> struct xfs_trans *tp;
> unsigned int resblks;
>
> - trace_xfs_reflink_end_cow(ip, offset, count);
> + trace_xfs_reflink_end_atomic_cow(ip, offset, count);
>
> offset_fsb = XFS_B_TO_FSBT(mp, offset);
> end_fsb = XFS_B_TO_FSB(mp, offset + count);
> @@ -1028,7 +1028,7 @@ xfs_reflink_end_atomic_cow(
> end_fsb);
> }
> if (error) {
> - trace_xfs_reflink_end_cow_error(ip, error, _RET_IP_);
> + trace_xfs_reflink_end_atomic_cow_error(ip, error, _RET_IP_);
> goto out_cancel;
> }
> error = xfs_trans_commit(tp);
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 79b8641880ab..29eefacb8226 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -4186,12 +4186,14 @@ DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
>
> DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
> DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
> +DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_atomic_cow);
> DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
> DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
> DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_skip);
>
> DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
> DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
> +DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_atomic_cow_error);
>
>
> DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
> --
> 2.49.0
>
>
---end quoted text---
next prev parent reply other threads:[~2025-11-24 9:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 11:56 [PATCH] xfs: fix confused tracepoints in xfs_reflink_end_atomic_cow() alexjlzheng
2025-11-24 9:34 ` Christoph Hellwig [this message]
2025-11-24 10:57 ` John Garry
2025-11-24 14:04 ` Christoph Hellwig
2025-11-24 14:25 ` John Garry
2025-11-25 2:18 ` Darrick J. Wong
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=aSQmomhODBHTip8j@infradead.org \
--to=hch@infradead.org \
--cc=alexjlzheng@gmail.com \
--cc=alexjlzheng@tencent.com \
--cc=cem@kernel.org \
--cc=john.g.garry@oracle.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