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