Adding tracepoint to cached open
authorOlga Kornievskaia <kolga@netapp.com>
Tue, 24 Nov 2015 18:29:42 +0000 (13:29 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Mon, 28 Dec 2015 14:57:14 +0000 (09:57 -0500)
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4proc.c
fs/nfs/nfs4trace.h

index 492d30303c4f30e379fd8ac1c857be4f94e1baf4..e941261527144860cc19a887af75ee0524c9fd1d 100644 (file)
@@ -1598,6 +1598,7 @@ _nfs4_opendata_to_nfs4_state(struct nfs4_opendata *data)
 
        if (!data->rpc_done) {
                state = nfs4_try_open_cached(data);
+               trace_nfs4_cached_open(data->state);
                goto out;
        }
 
@@ -2015,6 +2016,7 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
        }
        return;
 unlock_no_action:
+       trace_nfs4_cached_open(data->state);
        rcu_read_unlock();
 out_no_action:
        task->tk_action = NULL;
index 9058aecc248efef030ca37ccf9ae85943a8ffb7e..8704372ac38fcda84959d3246482bf80475d43b9 100644 (file)
@@ -473,6 +473,45 @@ DEFINE_NFS4_OPEN_EVENT(nfs4_open_reclaim);
 DEFINE_NFS4_OPEN_EVENT(nfs4_open_expired);
 DEFINE_NFS4_OPEN_EVENT(nfs4_open_file);
 
+TRACE_EVENT(nfs4_cached_open,
+               TP_PROTO(
+                       const struct nfs4_state *state
+               ),
+               TP_ARGS(state),
+               TP_STRUCT__entry(
+                       __field(dev_t, dev)
+                       __field(u32, fhandle)
+                       __field(u64, fileid)
+                       __field(unsigned int, fmode)
+                       __field(int, stateid_seq)
+                       __field(u32, stateid_hash)
+               ),
+
+               TP_fast_assign(
+                       const struct inode *inode = state->inode;
+
+                       __entry->dev = inode->i_sb->s_dev;
+                       __entry->fileid = NFS_FILEID(inode);
+                       __entry->fhandle = nfs_fhandle_hash(NFS_FH(inode));
+                       __entry->fmode = (__force unsigned int)state->state;
+                       __entry->stateid_seq =
+                               be32_to_cpu(state->stateid.seqid);
+                       __entry->stateid_hash =
+                               nfs_stateid_hash(&state->stateid);
+               ),
+
+               TP_printk(
+                       "fmode=%s fileid=%02x:%02x:%llu "
+                       "fhandle=0x%08x stateid=%d:0x%08x",
+                       __entry->fmode ?  show_fmode_flags(__entry->fmode) :
+                                         "closed",
+                       MAJOR(__entry->dev), MINOR(__entry->dev),
+                       (unsigned long long)__entry->fileid,
+                       __entry->fhandle,
+                       __entry->stateid_seq, __entry->stateid_hash
+               )
+);
+
 TRACE_EVENT(nfs4_close,
                TP_PROTO(
                        const struct nfs4_state *state,