]> www.infradead.org Git - users/hch/misc.git/commitdiff
nfsd: add a tracepoint to nfsd_lookup_dentry
authorJeff Layton <jlayton@kernel.org>
Sat, 3 May 2025 19:59:22 +0000 (15:59 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Sun, 11 May 2025 23:48:31 +0000 (19:48 -0400)
Replace the dprintk in nfsd_lookup_dentry() with a trace point.
nfsd_lookup_dentry() is called frequently enough that enabling this
dprintk call site would result in log floods and performance issues.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/trace.h
fs/nfsd/vfs.c

index b435276a1aaaa880b8c9b10f332752dd7973d0b9..661a870d62f5fb7218e5ce434bb581397f200d66 100644 (file)
@@ -2394,6 +2394,29 @@ TRACE_EVENT(nfsd_vfs_setattr,
        )
 )
 
+TRACE_EVENT(nfsd_vfs_lookup,
+       TP_PROTO(
+               const struct svc_rqst *rqstp,
+               const struct svc_fh *fhp,
+               const char *name,
+               unsigned int len
+       ),
+       TP_ARGS(rqstp, fhp, name, len),
+       TP_STRUCT__entry(
+               NFSD_TRACE_PROC_CALL_FIELDS(rqstp)
+               __field(u32, fh_hash)
+               __string_len(name, name, len)
+       ),
+       TP_fast_assign(
+               NFSD_TRACE_PROC_CALL_ASSIGNMENTS(rqstp);
+               __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
+               __assign_str(name);
+       ),
+       TP_printk("xid=0x%08x fh_hash=0x%08x name=%s",
+               __entry->xid, __entry->fh_hash, __get_str(name)
+       )
+);
+
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH
index 9e0a858d21299c1373c24d9d719dff52159284fb..657ba0c2da1452f697aac2ddf1dd05584502e71a 100644 (file)
@@ -246,7 +246,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp,
        struct dentry           *dentry;
        int                     host_err;
 
-       dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name);
+       trace_nfsd_vfs_lookup(rqstp, fhp, name, len);
 
        dparent = fhp->fh_dentry;
        exp = exp_get(fhp->fh_export);