nfs: client-side tracepoints for delegations and cache coherency
Subsystems (2)
Jeff Layton
maintainerv2 cover nfs: client-side tracepoints for delegations and cache coherency
These patches add some tracepoints that I rolled a while back when working on the client-side pieces of the directory delegation patchset. I think that these are useful in their own right, even without dir delegations.
Please consider these for v6.17.
---
Changes in v2:
- add NFS4_FREED_STATEID_TYPE to match_stateid tracepoint
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Jeff Layton (4):
nfs: add cache_validity to the nfs_inode_event tracepoints
nfs: add a tracepoint to nfs_inode_detach_delegation_locked
nfs: new tracepoint in nfs_delegation_need_return
nfs: new tracepoint in match_stateid operation
fs/nfs/delegation.c | 4 ++ fs/nfs/nfs4proc.c | 4 ++ fs/nfs/nfs4trace.h | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfs/nfstrace.h | 8 +++- 4 files changed, 119 insertions(+), 2 deletions(-)
---
base-commit: 52da431bf03b5506203bca27fe14a97895c80faf
change-id: 20250603-nfs-tracepoints-034454716137
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerPATCH v2 1/4 nfs: add cache_validity to the nfs_inode_event tracepoints
Managing the cache_validity flags is the deep voodoo of NFS cache coherency. Let's have a little extra visibility into that value via the nfs_inode_event tracepoints.
--- fs/nfs/nfstrace.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/nfs/nfstrace.h +6 -2
@@ -56,6 +56,7 @@ DECLARE_EVENT_CLASS(nfs_inode_event, __field(u32, fhandle) __field(u64, fileid) __field(u64, version) + __field(unsigned long, cache_validity) ), TP_fast_assign(
@@ -64,14 +65,17 @@ DECLARE_EVENT_CLASS(nfs_inode_event, __entry->fileid = nfsi->fileid; __entry->fhandle =nfs_fhandle_hash (&nfsi->fh); __entry->version =inode_peek_iversion_raw (inode); + __entry->cache_validity = nfsi->cache_validity; ),TP_printk ( -"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu " , +"fileid=%02x:%02x:%llu fhandle=0x%08x version=%llu cache_validity=0x%lx (%s)" ,MAJOR (__entry->dev),MINOR (__entry->dev), (unsigned long long )__entry->fileid, __entry->fhandle, - (unsigned long long )__entry->version + (unsigned long long )__entry->version, + __entry->cache_validity, +nfs_show_cache_validity (__entry->cache_validity) ) );
Signature · 1 line
2.49.0
Jeff Layton
maintainerPATCH v2 2/4 nfs: add a tracepoint to nfs_inode_detach_delegation_locked
In reply to Jeff LaytonWe have tracepoints for setting a delegation and reclaiming them. Add a tracepoint for when the delegation is being detached from the inode.
--- fs/nfs/delegation.c | 2 ++ fs/nfs/nfs4trace.h | 1 + 2 files changed, 3 insertions(+)
fs/nfs/delegation.c +2 -0
@@ -355,6 +355,8 @@ nfs_detach_delegation_locked(struct nfs_inode *nfsi,rcu_dereference_protected (nfsi->delegation,lockdep_is_held (&clp->cl_lock)); +trace_nfs4_detach_delegation (&nfsi->vfs_inode, delegation->type); +if (deleg_cur ==NULL || delegation != deleg_cur)return NULL ;
fs/nfs/nfs4trace.h +1 -0
@@ -956,6 +956,7 @@ DECLARE_EVENT_CLASS(nfs4_set_delegation_event, TP_ARGS(inode, fmode))DEFINE_NFS4_SET_DELEGATION_EVENT (nfs4_set_delegation);DEFINE_NFS4_SET_DELEGATION_EVENT (nfs4_reclaim_delegation); +DEFINE_NFS4_SET_DELEGATION_EVENT (nfs4_detach_delegation); TRACE_EVENT(nfs4_delegreturn_exit, TP_PROTO(
Signature · 1 line
2.49.0
Jeff Layton
maintainerPATCH v2 3/4 nfs: new tracepoint in nfs_delegation_need_return
In reply to Jeff LaytonAdd a tracepoint in the function that decides whether to return a delegation to the server.
--- fs/nfs/delegation.c | 2 ++ fs/nfs/nfs4trace.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+)
fs/nfs/delegation.c +2 -0
@@ -594,6 +594,8 @@ static bool nfs_delegation_need_return(struct nfs_delegation *delegation) {bool ret = false; +trace_nfs_delegation_need_return (delegation); +if (test_and_clear_bit (NFS_DELEGATION_RETURN , &delegation->flags)) ret = true; if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags) ||
fs/nfs/nfs4trace.h +47 -0
59 lines not on this page · raw message
Signature · 1 line
2.49.0
Jeff Layton
maintainerPATCH v2 4/4 nfs: new tracepoint in match_stateid operation
In reply to Jeff LaytonAdd new tracepoints in the NFSv4 match_stateid minorversion op that show the info in both stateids.
--- fs/nfs/nfs4proc.c | 4 ++++ fs/nfs/nfs4trace.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+)
fs/nfs/nfs4proc.c +4 -0
@@ -10680,6 +10680,8 @@ nfs41_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp)static bool nfs41_match_stateid (const nfs4_stateid *s1,const nfs4_stateid *s2) { +trace_nfs41_match_stateid (s1, s2); +if (s1->type != s2->type)return false;
@@ -10697,6 +10699,8 @@ static bool nfs41_match_stateid(const nfs4_stateid *s1,static bool nfs4_match_stateid (const nfs4_stateid *s1,const nfs4_stateid *s2) { +trace_nfs4_match_stateid (s1, s2); +return nfs4_stateid_match (s1, s2); }
fs/nfs/nfs4trace.h +57 -0
63 lines not on this page · raw message
Signature · 1 line
2.49.0