From: Jeff Layton <jlayton@kernel.org>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Chuck Lever <chuck.lever@oracle.com>,
NeilBrown <neil@brown.name>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
Jeff Layton <jlayton@kernel.org>
Subject: [PATCH 1/2] vfs: add tracepoints in inode_set_ctime_deleg
Date: Tue, 22 Jul 2025 14:52:27 -0400 [thread overview]
Message-ID: <20250722-nfsd-testing-v1-1-31321c7fc97f@kernel.org> (raw)
In-Reply-To: <20250722-nfsd-testing-v1-0-31321c7fc97f@kernel.org>
Add tracepoints in inode_set_ctime_deleg() that show the existing ctime,
the requested ctime and the current_time().
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/inode.c | 5 ++++-
include/trace/events/timestamp.h | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
diff --git a/fs/inode.c b/fs/inode.c
index 99318b157a9a13b3dd8dad0f5f90951f08ef64de..6a8bf57d649aa0909b85f09e3b5b0fbc81efe303 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -2811,10 +2811,13 @@ struct timespec64 inode_set_ctime_deleg(struct inode *inode, struct timespec64 u
cur_ts.tv_sec = inode->i_ctime_sec;
/* If the update is older than the existing value, skip it. */
- if (timespec64_compare(&update, &cur_ts) <= 0)
+ if (timespec64_compare(&update, &cur_ts) <= 0) {
+ trace_inode_set_ctime_deleg(inode, &cur_ts, &update, NULL);
return cur_ts;
+ }
ktime_get_coarse_real_ts64_mg(&now);
+ trace_inode_set_ctime_deleg(inode, &cur_ts, &update, &now);
/* Clamp the update to "now" if it's in the future */
if (timespec64_compare(&update, &now) > 0)
diff --git a/include/trace/events/timestamp.h b/include/trace/events/timestamp.h
index c9e5ec930054887a6a7bae8e487611b5ded33d71..e66161d8e14d9b74b0c875f0b324d24895403c18 100644
--- a/include/trace/events/timestamp.h
+++ b/include/trace/events/timestamp.h
@@ -118,6 +118,46 @@ TRACE_EVENT(fill_mg_cmtime,
__entry->mtime_s, __entry->mtime_ns
)
);
+
+TRACE_EVENT(inode_set_ctime_deleg,
+ TP_PROTO(struct inode *inode,
+ struct timespec64 *old,
+ struct timespec64 *req,
+ struct timespec64 *now),
+
+ TP_ARGS(inode, old, req, now),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(ino_t, ino)
+ __field(time64_t, old_s)
+ __field(time64_t, req_s)
+ __field(time64_t, now_s)
+ __field(u32, old_ns)
+ __field(u32, req_ns)
+ __field(u32, now_ns)
+ __field(u32, gen)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->ino = inode->i_ino;
+ __entry->gen = inode->i_generation;
+ __entry->old_s = old->tv_sec;
+ __entry->req_s = req->tv_sec;
+ __entry->now_s = now ? now->tv_sec : 0;
+ __entry->old_ns = old->tv_nsec;
+ __entry->req_ns = req->tv_nsec;
+ __entry->now_ns = now ? now->tv_nsec : 0;
+ ),
+
+ TP_printk("ino=%d:%d:%ld:%u old=%lld.%u req=%lld.%u now=%lld.%u",
+ MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
+ __entry->old_s, __entry->old_ns,
+ __entry->req_s, __entry->req_ns,
+ __entry->now_s, __entry->now_ns
+ )
+);
#endif /* _TRACE_TIMESTAMP_H */
/* This part must be outside protection */
--
2.50.1
next prev parent reply other threads:[~2025-07-22 18:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-22 18:52 [PATCH 0/2] vfs: fix delegated timestamp updates Jeff Layton
2025-07-22 18:52 ` Jeff Layton [this message]
2025-07-23 1:10 ` [PATCH 1/2] vfs: add tracepoints in inode_set_ctime_deleg Steven Rostedt
2025-07-24 13:49 ` Chuck Lever
2025-07-22 18:52 ` [PATCH 2/2] vfs: fix delegated timestamp handling in setattr_copy() Jeff Layton
2025-07-22 22:19 ` Jeff Layton
2025-07-23 11:51 ` Christian Brauner
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=20250722-nfsd-testing-v1-1-31321c7fc97f@kernel.org \
--to=jlayton@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=rostedt@goodmis.org \
--cc=tom@talpey.com \
--cc=viro@zeniv.linux.org.uk \
/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).