[PATCH 1/2] vfs: add tracepoints in inode_set_ctime_deleg
From: Jeff Layton
Date: Tue Jul 22 2025 - 14:53:08 EST
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@xxxxxxxxxx>
---
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