xref: /openbmc/linux/fs/nfsd/trace.h (revision 1c2dd16a)
1 /*
2  * Copyright (c) 2014 Christoph Hellwig.
3  */
4 #undef TRACE_SYSTEM
5 #define TRACE_SYSTEM nfsd
6 
7 #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
8 #define _NFSD_TRACE_H
9 
10 #include <linux/tracepoint.h>
11 #include "nfsfh.h"
12 
13 DECLARE_EVENT_CLASS(nfsd_io_class,
14 	TP_PROTO(struct svc_rqst *rqstp,
15 		 struct svc_fh	*fhp,
16 		 loff_t		offset,
17 		 int		len),
18 	TP_ARGS(rqstp, fhp, offset, len),
19 	TP_STRUCT__entry(
20 		__field(__be32, xid)
21 		__field_struct(struct knfsd_fh, fh)
22 		__field(loff_t, offset)
23 		__field(int, len)
24 	),
25 	TP_fast_assign(
26 		__entry->xid = rqstp->rq_xid,
27 		fh_copy_shallow(&__entry->fh, &fhp->fh_handle);
28 		__entry->offset = offset;
29 		__entry->len = len;
30 	),
31 	TP_printk("xid=0x%x fh=0x%x offset=%lld len=%d",
32 		  __be32_to_cpu(__entry->xid), knfsd_fh_hash(&__entry->fh),
33 		  __entry->offset, __entry->len)
34 )
35 
36 #define DEFINE_NFSD_IO_EVENT(name)		\
37 DEFINE_EVENT(nfsd_io_class, name,		\
38 	TP_PROTO(struct svc_rqst *rqstp,	\
39 		 struct svc_fh	*fhp,		\
40 		 loff_t		offset,		\
41 		 int		len),		\
42 	TP_ARGS(rqstp, fhp, offset, len))
43 
44 DEFINE_NFSD_IO_EVENT(read_start);
45 DEFINE_NFSD_IO_EVENT(read_opened);
46 DEFINE_NFSD_IO_EVENT(read_io_done);
47 DEFINE_NFSD_IO_EVENT(read_done);
48 DEFINE_NFSD_IO_EVENT(write_start);
49 DEFINE_NFSD_IO_EVENT(write_opened);
50 DEFINE_NFSD_IO_EVENT(write_io_done);
51 DEFINE_NFSD_IO_EVENT(write_done);
52 
53 #include "state.h"
54 
55 DECLARE_EVENT_CLASS(nfsd_stateid_class,
56 	TP_PROTO(stateid_t *stp),
57 	TP_ARGS(stp),
58 	TP_STRUCT__entry(
59 		__field(u32, cl_boot)
60 		__field(u32, cl_id)
61 		__field(u32, si_id)
62 		__field(u32, si_generation)
63 	),
64 	TP_fast_assign(
65 		__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
66 		__entry->cl_id = stp->si_opaque.so_clid.cl_id;
67 		__entry->si_id = stp->si_opaque.so_id;
68 		__entry->si_generation = stp->si_generation;
69 	),
70 	TP_printk("client %08x:%08x stateid %08x:%08x",
71 		__entry->cl_boot,
72 		__entry->cl_id,
73 		__entry->si_id,
74 		__entry->si_generation)
75 )
76 
77 #define DEFINE_STATEID_EVENT(name) \
78 DEFINE_EVENT(nfsd_stateid_class, name, \
79 	TP_PROTO(stateid_t *stp), \
80 	TP_ARGS(stp))
81 DEFINE_STATEID_EVENT(layoutstate_alloc);
82 DEFINE_STATEID_EVENT(layoutstate_unhash);
83 DEFINE_STATEID_EVENT(layoutstate_free);
84 DEFINE_STATEID_EVENT(layout_get_lookup_fail);
85 DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
86 DEFINE_STATEID_EVENT(layout_return_lookup_fail);
87 DEFINE_STATEID_EVENT(layout_recall);
88 DEFINE_STATEID_EVENT(layout_recall_done);
89 DEFINE_STATEID_EVENT(layout_recall_fail);
90 DEFINE_STATEID_EVENT(layout_recall_release);
91 
92 #endif /* _NFSD_TRACE_H */
93 
94 #undef TRACE_INCLUDE_PATH
95 #define TRACE_INCLUDE_PATH .
96 #define TRACE_INCLUDE_FILE trace
97 #include <trace/define_trace.h>
98