@@ -4983,7 +4983,7 @@ static int nfs4_proc_readdir(struct dentry *dentry, const struct cred *cred,
do {
err = _nfs4_proc_readdir(dentry, cred, cookie,
pages, count, plus);
- trace_nfs4_readdir(d_inode(dentry), err);
+ trace_nfs4_readdir(d_inode(dentry), cookie, count, plus, err);
err = nfs4_handle_exception(NFS_SERVER(d_inode(dentry)), err,
&exception);
} while (exception.retry);
@@ -1449,9 +1449,51 @@
DEFINE_NFS4_INODE_EVENT(nfs4_access);
DEFINE_NFS4_INODE_EVENT(nfs4_readlink);
-DEFINE_NFS4_INODE_EVENT(nfs4_readdir);
DEFINE_NFS4_INODE_EVENT(nfs4_get_acl);
DEFINE_NFS4_INODE_EVENT(nfs4_set_acl);
+
+TRACE_EVENT(nfs4_readdir,
+ TP_PROTO(
+ const struct inode *inode,
+ u64 cookie,
+ unsigned int count,
+ bool plus,
+ int error
+ ),
+
+ TP_ARGS(inode, cookie, count, plus, error),
+
+ TP_STRUCT__entry(
+ __field(dev_t, dev)
+ __field(u32, fhandle)
+ __field(u64, fileid)
+ __field(unsigned long, error)
+ __field(u64, cookie)
+ __field(u64, count)
+ __field(bool, plus)
+ ),
+
+ TP_fast_assign(
+ __entry->dev = inode->i_sb->s_dev;
+ __entry->fileid = NFS_FILEID(inode);
+ __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
+ __entry->error = error < 0 ? -error : 0;
+ __entry->cookie = cookie;
+ __entry->count = count;
+ __entry->plus = plus;
+ ),
+
+ TP_printk(
+ "error=%ld (%s) fileid=%02x:%02x:%llu fhandle=0x%08x cookie=0x%08llx count=%llu plus=%s",
+ -__entry->error,
+ show_nfsv4_errors(__entry->error),
+ MAJOR(__entry->dev), MINOR(__entry->dev),
+ (unsigned long long)__entry->fileid,
+ __entry->fhandle, __entry->cookie,
+ __entry->count, __entry->plus ? "true" : "false"
+ )
+);
+
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
DEFINE_NFS4_INODE_EVENT(nfs4_get_security_label);
DEFINE_NFS4_INODE_EVENT(nfs4_set_security_label);
When tracing NFSv4 readdir there are fields beyond the inode based information that are useful, such as the cookie, count, and whether readdirplus is enabled. Add these fields to the nfs4_readdir tracepoint which executes after a NFS4 readdir completes. Signed-off-by: Dave Wysochanski <dwysocha@redhat.com> --- fs/nfs/nfs4proc.c | 2 +- fs/nfs/nfs4trace.h | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 2 deletions(-)