From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@kernel.org>, Anna Schumaker <anna@kernel.org>
Cc: linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH 2/5] nfs: add tracepoints to nfs_file_read() and nfs_file_write()
Date: Fri, 08 Aug 2025 07:40:31 -0400 [thread overview]
Message-ID: <20250808-nfs-tracepoints-v1-2-f8fdebb195c9@kernel.org> (raw)
In-Reply-To: <20250808-nfs-tracepoints-v1-0-f8fdebb195c9@kernel.org>
Add some tracepoints to the I/O submission codepaths.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/nfs/file.c | 4 ++++
fs/nfs/nfstrace.h | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 86e36c630f09eac84f42bbee18dcace415d680ca..1e89801abed626ea64cd79722fad8720b2485d32 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -160,6 +160,8 @@ nfs_file_read(struct kiocb *iocb, struct iov_iter *to)
struct inode *inode = file_inode(iocb->ki_filp);
ssize_t result;
+ trace_nfs_file_read(iocb, to);
+
if (iocb->ki_flags & IOCB_DIRECT)
return nfs_file_direct_read(iocb, to, false);
@@ -656,6 +658,8 @@ ssize_t nfs_file_write(struct kiocb *iocb, struct iov_iter *from)
errseq_t since;
int error;
+ trace_nfs_file_write(iocb, from);
+
result = nfs_key_timeout_notify(file, inode);
if (result)
return result;
diff --git a/fs/nfs/nfstrace.h b/fs/nfs/nfstrace.h
index 9ebfb220e94a5389e633210519a9a1f21a052d76..d7d25cdf0060b3fa7c5889752a1bd193d0e8ca92 100644
--- a/fs/nfs/nfstrace.h
+++ b/fs/nfs/nfstrace.h
@@ -1045,6 +1045,58 @@ DEFINE_NFS_FOLIO_EVENT_DONE(nfs_writeback_folio_done);
DEFINE_NFS_FOLIO_EVENT(nfs_invalidate_folio);
DEFINE_NFS_FOLIO_EVENT_DONE(nfs_launder_folio_done);
+DECLARE_EVENT_CLASS(nfs_kiocb_event,
+ TP_PROTO(
+ const struct kiocb *iocb,
+ const struct iov_iter *iter
+ ),
+
+ TP_ARGS(iocb, iter),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u32, fhandle)
+ __field(u64, fileid)
+ __field(u64, version)
+ __field(loff_t, offset)
+ __field(size_t, count)
+ __field(int, flags)
+ ),
+
+ TP_fast_assign(
+ const struct inode *inode = file_inode(iocb->ki_filp);
+ const struct nfs_inode *nfsi = NFS_I(inode);
+
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->fileid = nfsi->fileid;
+ __entry->fhandle = nfs_fhandle_hash(&nfsi->fh);
+ __entry->version = inode_peek_iversion_raw(inode);
+ __entry->offset = iocb->ki_pos;
+ __entry->count = iov_iter_count(iter);
+ __entry->flags = iocb->ki_flags;
+ ),
+
+ TP_printk(
+ "fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu offset=%lld count=%zu ki_flags=%s",
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long long)__entry->fileid,
+ __entry->fhandle, __entry->version,
+ __entry->offset, __entry->count,
+ __print_flags(__entry->flags, "|", TRACE_IOCB_STRINGS)
+ )
+);
+
+#define DEFINE_NFS_KIOCB_EVENT(name) \
+ DEFINE_EVENT(nfs_kiocb_event, name, \
+ TP_PROTO( \
+ const struct kiocb *iocb, \
+ const struct iov_iter *iter \
+ ), \
+ TP_ARGS(iocb, iter))
+
+DEFINE_NFS_KIOCB_EVENT(nfs_file_read);
+DEFINE_NFS_KIOCB_EVENT(nfs_file_write);
+
TRACE_EVENT(nfs_aop_readahead,
TP_PROTO(
const struct inode *inode,
--
2.50.1
next prev parent reply other threads:[~2025-08-08 11:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 11:40 [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Jeff Layton
2025-08-08 11:40 ` [PATCH 1/5] nfs: remove trailing space from tracepoint Jeff Layton
2025-08-11 12:32 ` Jeff Layton
2025-08-08 11:40 ` Jeff Layton [this message]
2025-08-08 11:40 ` [PATCH 3/5] nfs: new tracepoints around write handling Jeff Layton
2025-08-08 11:40 ` [PATCH 4/5] nfs: more in-depth tracing of writepage events Jeff Layton
2025-08-08 11:40 ` [PATCH 5/5] nfs: add tracepoints to nfs_writepages() Jeff Layton
2025-08-08 12:38 ` [PATCH 0/5] nfs: more client side tracepoints in write and writeback codepaths Benjamin Coddington
2025-08-29 14:45 ` Jeff Layton
2025-09-02 17:56 ` Anna Schumaker
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=20250808-nfs-tracepoints-v1-2-f8fdebb195c9@kernel.org \
--to=jlayton@kernel.org \
--cc=anna@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@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).