From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
avi@scylladb.com, Dave Chinner <dchinner@redhat.com>
Subject: Re: [PATCH 05/11] xfs: simplify the read/write tracepoints
Date: Wed, 20 Jan 2021 10:45:01 -0800 [thread overview]
Message-ID: <20210120184501.GG3134581@magnolia> (raw)
In-Reply-To: <20210118193516.2915706-6-hch@lst.de>
On Mon, Jan 18, 2021 at 08:35:10PM +0100, Christoph Hellwig wrote:
> Pass the iocb and iov_iter to the tracepoints and leave decoding of
> actual arguments to the code only run when tracing is enabled.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
I've been thinking for a while that we really should be pushing
structure decoding and whatnot to the tracepoint code to keep it out of
the callers, so I like this:
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> fs/xfs/xfs_file.c | 20 ++++++++------------
> fs/xfs/xfs_trace.h | 18 +++++++++---------
> 2 files changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index 97836ec53397d4..aa64e78fc3c467 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -220,12 +220,11 @@ xfs_file_dio_read(
> struct iov_iter *to)
> {
> struct xfs_inode *ip = XFS_I(file_inode(iocb->ki_filp));
> - size_t count = iov_iter_count(to);
> ssize_t ret;
>
> - trace_xfs_file_direct_read(ip, count, iocb->ki_pos);
> + trace_xfs_file_direct_read(iocb, to);
>
> - if (!count)
> + if (!iov_iter_count(to))
> return 0; /* skip atime */
>
> file_accessed(iocb->ki_filp);
> @@ -246,12 +245,11 @@ xfs_file_dax_read(
> struct iov_iter *to)
> {
> struct xfs_inode *ip = XFS_I(iocb->ki_filp->f_mapping->host);
> - size_t count = iov_iter_count(to);
> ssize_t ret = 0;
>
> - trace_xfs_file_dax_read(ip, count, iocb->ki_pos);
> + trace_xfs_file_dax_read(iocb, to);
>
> - if (!count)
> + if (!iov_iter_count(to))
> return 0; /* skip atime */
>
> ret = xfs_ilock_iocb(iocb, XFS_IOLOCK_SHARED);
> @@ -272,7 +270,7 @@ xfs_file_buffered_read(
> struct xfs_inode *ip = XFS_I(file_inode(iocb->ki_filp));
> ssize_t ret;
>
> - trace_xfs_file_buffered_read(ip, iov_iter_count(to), iocb->ki_pos);
> + trace_xfs_file_buffered_read(iocb, to);
>
> ret = xfs_ilock_iocb(iocb, XFS_IOLOCK_SHARED);
> if (ret)
> @@ -599,7 +597,7 @@ xfs_file_dio_write(
> iolock = XFS_IOLOCK_SHARED;
> }
>
> - trace_xfs_file_direct_write(ip, count, iocb->ki_pos);
> + trace_xfs_file_direct_write(iocb, from);
> /*
> * If unaligned, this is the only IO in-flight. Wait on it before we
> * release the iolock to prevent subsequent overlapping IO.
> @@ -622,7 +620,6 @@ xfs_file_dax_write(
> struct xfs_inode *ip = XFS_I(inode);
> int iolock = XFS_IOLOCK_EXCL;
> ssize_t ret, error = 0;
> - size_t count;
> loff_t pos;
>
> ret = xfs_ilock_iocb(iocb, iolock);
> @@ -633,9 +630,8 @@ xfs_file_dax_write(
> goto out;
>
> pos = iocb->ki_pos;
> - count = iov_iter_count(from);
>
> - trace_xfs_file_dax_write(ip, count, pos);
> + trace_xfs_file_dax_write(iocb, from);
> ret = dax_iomap_rw(iocb, from, &xfs_direct_write_iomap_ops);
> if (ret > 0 && iocb->ki_pos > i_size_read(inode)) {
> i_size_write(inode, iocb->ki_pos);
> @@ -683,7 +679,7 @@ xfs_file_buffered_write(
> /* We can write back this queue in page reclaim */
> current->backing_dev_info = inode_to_bdi(inode);
>
> - trace_xfs_file_buffered_write(ip, iov_iter_count(from), iocb->ki_pos);
> + trace_xfs_file_buffered_write(iocb, from);
> ret = iomap_file_buffered_write(iocb, from,
> &xfs_buffered_write_iomap_ops);
> if (likely(ret >= 0))
> diff --git a/fs/xfs/xfs_trace.h b/fs/xfs/xfs_trace.h
> index 5a263ae3d4f008..a6d04d860a565e 100644
> --- a/fs/xfs/xfs_trace.h
> +++ b/fs/xfs/xfs_trace.h
> @@ -1287,8 +1287,8 @@ TRACE_EVENT(xfs_log_assign_tail_lsn,
> )
>
> DECLARE_EVENT_CLASS(xfs_file_class,
> - TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
> - TP_ARGS(ip, count, offset),
> + TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
> + TP_ARGS(iocb, iter),
> TP_STRUCT__entry(
> __field(dev_t, dev)
> __field(xfs_ino_t, ino)
> @@ -1297,11 +1297,11 @@ DECLARE_EVENT_CLASS(xfs_file_class,
> __field(size_t, count)
> ),
> TP_fast_assign(
> - __entry->dev = VFS_I(ip)->i_sb->s_dev;
> - __entry->ino = ip->i_ino;
> - __entry->size = ip->i_d.di_size;
> - __entry->offset = offset;
> - __entry->count = count;
> + __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
> + __entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
> + __entry->size = XFS_I(file_inode(iocb->ki_filp))->i_d.di_size;
> + __entry->offset = iocb->ki_pos;
> + __entry->count = iov_iter_count(iter);
> ),
> TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
> MAJOR(__entry->dev), MINOR(__entry->dev),
> @@ -1313,8 +1313,8 @@ DECLARE_EVENT_CLASS(xfs_file_class,
>
> #define DEFINE_RW_EVENT(name) \
> DEFINE_EVENT(xfs_file_class, name, \
> - TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
> - TP_ARGS(ip, count, offset))
> + TP_PROTO(struct kiocb *iocb, struct iov_iter *iter), \
> + TP_ARGS(iocb, iter))
> DEFINE_RW_EVENT(xfs_file_buffered_read);
> DEFINE_RW_EVENT(xfs_file_direct_read);
> DEFINE_RW_EVENT(xfs_file_dax_read);
> --
> 2.29.2
>
next prev parent reply other threads:[~2021-01-20 19:22 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-18 19:35 reduce sub-block DIO serialisation v2 Christoph Hellwig
2021-01-18 19:35 ` [PATCH 01/11] xfs: factor out a xfs_ilock_iocb helper Christoph Hellwig
2021-01-20 18:41 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 02/11] xfs: make xfs_file_aio_write_checks IOCB_NOWAIT-aware Christoph Hellwig
[not found] ` <CACz=WeeaqMrGM53pJF0C_Wt2JuavTOnOV26-osPviYLUpqUmFw@mail.gmail.com>
2021-01-20 16:28 ` Christoph Hellwig
2021-01-20 18:42 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 03/11] xfs: cleanup the read/write helper naming Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:43 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 04/11] xfs: remove the buffered I/O fallback assert Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:43 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 05/11] xfs: simplify the read/write tracepoints Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:45 ` Darrick J. Wong [this message]
2021-01-18 19:35 ` [PATCH 06/11] xfs: improve the reflink_bounce_dio_write tracepoint Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:45 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 07/11] xfs: split unaligned DIO write code out Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:46 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 08/11] iomap: rename the flags variable in __iomap_dio_rw Christoph Hellwig
2021-01-18 20:34 ` Dave Chinner
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:46 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 09/11] iomap: pass a flags argument to iomap_dio_rw Christoph Hellwig
2021-01-19 15:23 ` Brian Foster
2021-01-20 18:17 ` Darrick J. Wong
2021-01-20 18:35 ` Christoph Hellwig
2021-01-18 19:35 ` [PATCH 10/11] iomap: add a IOMAP_DIO_UNALIGNED flag Christoph Hellwig
2021-01-18 20:45 ` Dave Chinner
2021-01-18 21:41 ` Matthew Wilcox
2021-01-20 16:40 ` Christoph Hellwig
2021-01-20 18:47 ` Darrick J. Wong
2021-01-18 19:35 ` [PATCH 11/11] xfs: reduce exclusive locking on unaligned dio Christoph Hellwig
2021-01-18 20:55 ` Dave Chinner
2021-01-20 16:36 ` Christoph Hellwig
2021-01-20 18:40 ` Darrick J. Wong
2021-01-20 18:44 ` Christoph Hellwig
2021-01-20 19:58 ` Darrick J. Wong
2021-01-21 8:58 reduce sub-block DIO serialisation v3 Christoph Hellwig
2021-01-21 8:59 ` [PATCH 05/11] xfs: simplify the read/write tracepoints Christoph Hellwig
2021-01-22 16:20 reduce sub-block DIO serialisation v4 Christoph Hellwig
2021-01-22 16:20 ` [PATCH 05/11] xfs: simplify the read/write tracepoints Christoph Hellwig
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=20210120184501.GG3134581@magnolia \
--to=djwong@kernel.org \
--cc=avi@scylladb.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).