]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
NFS: Add tracepoints for debugging generic file create events
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 21 Aug 2013 14:53:09 +0000 (10:53 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Thu, 22 Aug 2013 12:58:18 +0000 (08:58 -0400)
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/dir.c
fs/nfs/nfstrace.h

index 2263a6ba36af8e8eeaea4641c282a25cd42fc726..9c0781265425f62a1c10d30c22704f34fa9b0e07 100644 (file)
@@ -1612,7 +1612,9 @@ int nfs_create(struct inode *dir, struct dentry *dentry,
        attr.ia_mode = mode;
        attr.ia_valid = ATTR_MODE;
 
+       trace_nfs_create_enter(dir, dentry, open_flags);
        error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags);
+       trace_nfs_create_exit(dir, dentry, open_flags, error);
        if (error != 0)
                goto out_err;
        return 0;
index fba194b7002760a46be777645664112f61d960ad..2963a050ceff0bce09fa8c589bec7c823ce45061 100644 (file)
@@ -352,6 +352,76 @@ TRACE_EVENT(nfs_atomic_open_exit,
                )
 );
 
+TRACE_EVENT(nfs_create_enter,
+               TP_PROTO(
+                       const struct inode *dir,
+                       const struct dentry *dentry,
+                       unsigned int flags
+               ),
+
+               TP_ARGS(dir, dentry, flags),
+
+               TP_STRUCT__entry(
+                       __field(unsigned int, flags)
+                       __field(dev_t, dev)
+                       __field(u64, dir)
+                       __string(name, dentry->d_name.name)
+               ),
+
+               TP_fast_assign(
+                       __entry->dev = dir->i_sb->s_dev;
+                       __entry->dir = NFS_FILEID(dir);
+                       __entry->flags = flags;
+                       __assign_str(name, dentry->d_name.name);
+               ),
+
+               TP_printk(
+                       "flags=%u (%s) name=%02x:%02x:%llu/%s",
+                       __entry->flags,
+                       show_open_flags(__entry->flags),
+                       MAJOR(__entry->dev), MINOR(__entry->dev),
+                       (unsigned long long)__entry->dir,
+                       __get_str(name)
+               )
+);
+
+TRACE_EVENT(nfs_create_exit,
+               TP_PROTO(
+                       const struct inode *dir,
+                       const struct dentry *dentry,
+                       unsigned int flags,
+                       int error
+               ),
+
+               TP_ARGS(dir, dentry, flags, error),
+
+               TP_STRUCT__entry(
+                       __field(int, error)
+                       __field(unsigned int, flags)
+                       __field(dev_t, dev)
+                       __field(u64, dir)
+                       __string(name, dentry->d_name.name)
+               ),
+
+               TP_fast_assign(
+                       __entry->error = error;
+                       __entry->dev = dir->i_sb->s_dev;
+                       __entry->dir = NFS_FILEID(dir);
+                       __entry->flags = flags;
+                       __assign_str(name, dentry->d_name.name);
+               ),
+
+               TP_printk(
+                       "error=%d flags=%u (%s) name=%02x:%02x:%llu/%s",
+                       __entry->error,
+                       __entry->flags,
+                       show_open_flags(__entry->flags),
+                       MAJOR(__entry->dev), MINOR(__entry->dev),
+                       (unsigned long long)__entry->dir,
+                       __get_str(name)
+               )
+);
+
 #endif /* _TRACE_NFS_H */
 
 #undef TRACE_INCLUDE_PATH