xref: /linux/include/trace/events/nbd.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM nbd
4 
5 #if !defined(_TRACE_NBD_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_NBD_H
7 
8 #include <linux/tracepoint.h>
9 
10 DECLARE_EVENT_CLASS(nbd_transport_event,
11 
12 	TP_PROTO(struct request *req, u64 handle),
13 
14 	TP_ARGS(req, handle),
15 
16 	TP_STRUCT__entry(
17 		__field(struct request *, req)
18 		__field(u64, handle)
19 	),
20 
21 	TP_fast_assign(
22 		__entry->req = req;
23 		__entry->handle = handle;
24 	),
25 
26 	TP_printk(
27 		"nbd transport event: request %p, handle 0x%016llx",
28 		__entry->req,
29 		__entry->handle
30 	)
31 );
32 
33 DEFINE_EVENT(nbd_transport_event, nbd_header_sent,
34 
35 	TP_PROTO(struct request *req, u64 handle),
36 
37 	TP_ARGS(req, handle)
38 );
39 
40 DEFINE_EVENT(nbd_transport_event, nbd_payload_sent,
41 
42 	TP_PROTO(struct request *req, u64 handle),
43 
44 	TP_ARGS(req, handle)
45 );
46 
47 DEFINE_EVENT(nbd_transport_event, nbd_header_received,
48 
49 	TP_PROTO(struct request *req, u64 handle),
50 
51 	TP_ARGS(req, handle)
52 );
53 
54 DEFINE_EVENT(nbd_transport_event, nbd_payload_received,
55 
56 	TP_PROTO(struct request *req, u64 handle),
57 
58 	TP_ARGS(req, handle)
59 );
60 
61 DECLARE_EVENT_CLASS(nbd_send_request,
62 
63 	TP_PROTO(struct nbd_request *nbd_request, int index,
64 		 struct request *rq),
65 
66 	TP_ARGS(nbd_request, index, rq),
67 
68 	TP_STRUCT__entry(
69 		__field(struct nbd_request *, nbd_request)
70 		__field(u64, dev_index)
71 		__field(struct request *, request)
72 	),
73 
74 	TP_fast_assign(
75 		__entry->nbd_request = NULL;
76 		__entry->dev_index = index;
77 		__entry->request = rq;
78 	),
79 
80 	TP_printk("nbd%lld: request %p", __entry->dev_index, __entry->request)
81 );
82 
83 #ifdef DEFINE_EVENT_WRITABLE
84 #undef NBD_DEFINE_EVENT
85 #define NBD_DEFINE_EVENT(template, call, proto, args, size)		\
86 	DEFINE_EVENT_WRITABLE(template, call, PARAMS(proto),		\
87 			      PARAMS(args), size)
88 #else
89 #undef NBD_DEFINE_EVENT
90 #define NBD_DEFINE_EVENT(template, call, proto, args, size)		\
91 	DEFINE_EVENT(template, call, PARAMS(proto), PARAMS(args))
92 #endif
93 
94 NBD_DEFINE_EVENT(nbd_send_request, nbd_send_request,
95 
96 	TP_PROTO(struct nbd_request *nbd_request, int index,
97 		 struct request *rq),
98 
99 	TP_ARGS(nbd_request, index, rq),
100 
101 	sizeof(struct nbd_request)
102 );
103 
104 #endif
105 
106 /* This part must be outside protection */
107 #include <trace/define_trace.h>
108