xref: /linux/include/trace/events/dlm.h (revision 4b132aacb0768ac1e652cf517097ea6f237214b9)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM dlm
4 
5 #if !defined(_TRACE_DLM_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_DLM_H
7 
8 #include <linux/dlm.h>
9 #include <linux/dlmconstants.h>
10 #include <uapi/linux/dlm_plock.h>
11 #include <linux/tracepoint.h>
12 
13 #include "../../../fs/dlm/dlm_internal.h"
14 
15 #define show_lock_flags(flags) __print_flags(flags, "|",	\
16 	{ DLM_LKF_NOQUEUE,	"NOQUEUE" },			\
17 	{ DLM_LKF_CANCEL,	"CANCEL" },			\
18 	{ DLM_LKF_CONVERT,	"CONVERT" },			\
19 	{ DLM_LKF_VALBLK,	"VALBLK" },			\
20 	{ DLM_LKF_QUECVT,	"QUECVT" },			\
21 	{ DLM_LKF_IVVALBLK,	"IVVALBLK" },			\
22 	{ DLM_LKF_CONVDEADLK,	"CONVDEADLK" },			\
23 	{ DLM_LKF_PERSISTENT,	"PERSISTENT" },			\
24 	{ DLM_LKF_NODLCKWT,	"NODLCKWT" },			\
25 	{ DLM_LKF_NODLCKBLK,	"NODLCKBLK" },			\
26 	{ DLM_LKF_EXPEDITE,	"EXPEDITE" },			\
27 	{ DLM_LKF_NOQUEUEBAST,	"NOQUEUEBAST" },		\
28 	{ DLM_LKF_HEADQUE,	"HEADQUE" },			\
29 	{ DLM_LKF_NOORDER,	"NOORDER" },			\
30 	{ DLM_LKF_ORPHAN,	"ORPHAN" },			\
31 	{ DLM_LKF_ALTPR,	"ALTPR" },			\
32 	{ DLM_LKF_ALTCW,	"ALTCW" },			\
33 	{ DLM_LKF_FORCEUNLOCK,	"FORCEUNLOCK" },		\
34 	{ DLM_LKF_TIMEOUT,	"TIMEOUT" })
35 
36 #define show_lock_mode(mode) __print_symbolic(mode,		\
37 	{ DLM_LOCK_IV,		"IV"},				\
38 	{ DLM_LOCK_NL,		"NL"},				\
39 	{ DLM_LOCK_CR,		"CR"},				\
40 	{ DLM_LOCK_CW,		"CW"},				\
41 	{ DLM_LOCK_PR,		"PR"},				\
42 	{ DLM_LOCK_PW,		"PW"},				\
43 	{ DLM_LOCK_EX,		"EX"})
44 
45 #define show_dlm_sb_flags(flags) __print_flags(flags, "|",	\
46 	{ DLM_SBF_DEMOTED,	"DEMOTED" },			\
47 	{ DLM_SBF_VALNOTVALID,	"VALNOTVALID" },		\
48 	{ DLM_SBF_ALTMODE,	"ALTMODE" })
49 
50 #define show_lkb_flags(flags) __print_flags(flags, "|",		\
51 	{ BIT(DLM_DFL_USER_BIT), "USER" },			\
52 	{ BIT(DLM_DFL_ORPHAN_BIT), "ORPHAN" })
53 
54 #define show_header_cmd(cmd) __print_symbolic(cmd,		\
55 	{ DLM_MSG,		"MSG"},				\
56 	{ DLM_RCOM,		"RCOM"},			\
57 	{ DLM_OPTS,		"OPTS"},			\
58 	{ DLM_ACK,		"ACK"},				\
59 	{ DLM_FIN,		"FIN"})
60 
61 #define show_message_version(version) __print_symbolic(version,	\
62 	{ DLM_VERSION_3_1,	"3.1"},				\
63 	{ DLM_VERSION_3_2,	"3.2"})
64 
65 #define show_message_type(type) __print_symbolic(type,		\
66 	{ DLM_MSG_REQUEST,	"REQUEST"},			\
67 	{ DLM_MSG_CONVERT,	"CONVERT"},			\
68 	{ DLM_MSG_UNLOCK,	"UNLOCK"},			\
69 	{ DLM_MSG_CANCEL,	"CANCEL"},			\
70 	{ DLM_MSG_REQUEST_REPLY, "REQUEST_REPLY"},		\
71 	{ DLM_MSG_CONVERT_REPLY, "CONVERT_REPLY"},		\
72 	{ DLM_MSG_UNLOCK_REPLY,	"UNLOCK_REPLY"},		\
73 	{ DLM_MSG_CANCEL_REPLY,	"CANCEL_REPLY"},		\
74 	{ DLM_MSG_GRANT,	"GRANT"},			\
75 	{ DLM_MSG_BAST,		"BAST"},			\
76 	{ DLM_MSG_LOOKUP,	"LOOKUP"},			\
77 	{ DLM_MSG_REMOVE,	"REMOVE"},			\
78 	{ DLM_MSG_LOOKUP_REPLY,	"LOOKUP_REPLY"},		\
79 	{ DLM_MSG_PURGE,	"PURGE"})
80 
81 #define show_rcom_type(type) __print_symbolic(type,            \
82 	{ DLM_RCOM_STATUS,              "STATUS"},              \
83 	{ DLM_RCOM_NAMES,               "NAMES"},               \
84 	{ DLM_RCOM_LOOKUP,              "LOOKUP"},              \
85 	{ DLM_RCOM_LOCK,                "LOCK"},                \
86 	{ DLM_RCOM_STATUS_REPLY,        "STATUS_REPLY"},        \
87 	{ DLM_RCOM_NAMES_REPLY,         "NAMES_REPLY"},         \
88 	{ DLM_RCOM_LOOKUP_REPLY,        "LOOKUP_REPLY"},        \
89 	{ DLM_RCOM_LOCK_REPLY,          "LOCK_REPLY"})
90 
91 
92 /* note: we begin tracing dlm_lock_start() only if ls and lkb are found */
93 TRACE_EVENT(dlm_lock_start,
94 
95 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name,
96 		 unsigned int namelen, int mode, __u32 flags),
97 
98 	TP_ARGS(ls, lkb, name, namelen, mode, flags),
99 
100 	TP_STRUCT__entry(
101 		__field(__u32, ls_id)
102 		__field(__u32, lkb_id)
103 		__field(int, mode)
104 		__field(__u32, flags)
105 		__dynamic_array(unsigned char, res_name,
106 				lkb->lkb_resource ? lkb->lkb_resource->res_length : namelen)
107 	),
108 
109 	TP_fast_assign(
110 		struct dlm_rsb *r;
111 
112 		__entry->ls_id = ls->ls_global_id;
113 		__entry->lkb_id = lkb->lkb_id;
114 		__entry->mode = mode;
115 		__entry->flags = flags;
116 
117 		r = lkb->lkb_resource;
118 		if (r)
119 			memcpy(__get_dynamic_array(res_name), r->res_name,
120 			       __get_dynamic_array_len(res_name));
121 		else if (name)
122 			memcpy(__get_dynamic_array(res_name), name,
123 			       __get_dynamic_array_len(res_name));
124 	),
125 
126 	TP_printk("ls_id=%u lkb_id=%x mode=%s flags=%s res_name=%s",
127 		  __entry->ls_id, __entry->lkb_id,
128 		  show_lock_mode(__entry->mode),
129 		  show_lock_flags(__entry->flags),
130 		  __print_hex_str(__get_dynamic_array(res_name),
131 				  __get_dynamic_array_len(res_name)))
132 
133 );
134 
135 TRACE_EVENT(dlm_lock_end,
136 
137 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name,
138 		 unsigned int namelen, int mode, __u32 flags, int error,
139 		 bool kernel_lock),
140 
141 	TP_ARGS(ls, lkb, name, namelen, mode, flags, error, kernel_lock),
142 
143 	TP_STRUCT__entry(
144 		__field(__u32, ls_id)
145 		__field(__u32, lkb_id)
146 		__field(int, mode)
147 		__field(__u32, flags)
148 		__field(int, error)
149 		__dynamic_array(unsigned char, res_name,
150 				lkb->lkb_resource ? lkb->lkb_resource->res_length : namelen)
151 	),
152 
153 	TP_fast_assign(
154 		struct dlm_rsb *r;
155 
156 		__entry->ls_id = ls->ls_global_id;
157 		__entry->lkb_id = lkb->lkb_id;
158 		__entry->mode = mode;
159 		__entry->flags = flags;
160 		__entry->error = error;
161 
162 		r = lkb->lkb_resource;
163 		if (r)
164 			memcpy(__get_dynamic_array(res_name), r->res_name,
165 			       __get_dynamic_array_len(res_name));
166 		else if (name)
167 			memcpy(__get_dynamic_array(res_name), name,
168 			       __get_dynamic_array_len(res_name));
169 
170 		if (kernel_lock) {
171 			/* return value will be zeroed in those cases by dlm_lock()
172 			 * we do it here again to not introduce more overhead if
173 			 * trace isn't running and error reflects the return value.
174 			 */
175 			if (error == -EAGAIN || error == -EDEADLK)
176 				__entry->error = 0;
177 		}
178 
179 	),
180 
181 	TP_printk("ls_id=%u lkb_id=%x mode=%s flags=%s error=%d res_name=%s",
182 		  __entry->ls_id, __entry->lkb_id,
183 		  show_lock_mode(__entry->mode),
184 		  show_lock_flags(__entry->flags), __entry->error,
185 		  __print_hex_str(__get_dynamic_array(res_name),
186 				  __get_dynamic_array_len(res_name)))
187 
188 );
189 
190 TRACE_EVENT(dlm_bast,
191 
192 	TP_PROTO(__u32 ls_id, __u32 lkb_id, int mode,
193 		 const char *res_name, size_t res_length),
194 
195 	TP_ARGS(ls_id, lkb_id, mode, res_name, res_length),
196 
197 	TP_STRUCT__entry(
198 		__field(__u32, ls_id)
199 		__field(__u32, lkb_id)
200 		__field(int, mode)
201 		__dynamic_array(unsigned char, res_name, res_length)
202 	),
203 
204 	TP_fast_assign(
205 		__entry->ls_id = ls_id;
206 		__entry->lkb_id = lkb_id;
207 		__entry->mode = mode;
208 
209 		memcpy(__get_dynamic_array(res_name), res_name,
210 		       __get_dynamic_array_len(res_name));
211 	),
212 
213 	TP_printk("ls_id=%u lkb_id=%x mode=%s res_name=%s",
214 		  __entry->ls_id, __entry->lkb_id,
215 		  show_lock_mode(__entry->mode),
216 		  __print_hex_str(__get_dynamic_array(res_name),
217 				  __get_dynamic_array_len(res_name)))
218 
219 );
220 
221 TRACE_EVENT(dlm_ast,
222 
223 	TP_PROTO(__u32 ls_id, __u32 lkb_id, __u8 sb_flags, int sb_status,
224 		 const char *res_name, size_t res_length),
225 
226 	TP_ARGS(ls_id, lkb_id, sb_flags, sb_status, res_name, res_length),
227 
228 	TP_STRUCT__entry(
229 		__field(__u32, ls_id)
230 		__field(__u32, lkb_id)
231 		__field(__u8, sb_flags)
232 		__field(int, sb_status)
233 		__dynamic_array(unsigned char, res_name, res_length)
234 	),
235 
236 	TP_fast_assign(
237 		__entry->ls_id = ls_id;
238 		__entry->lkb_id = lkb_id;
239 		__entry->sb_flags = sb_flags;
240 		__entry->sb_status = sb_status;
241 
242 		memcpy(__get_dynamic_array(res_name), res_name,
243 		       __get_dynamic_array_len(res_name));
244 	),
245 
246 	TP_printk("ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d res_name=%s",
247 		  __entry->ls_id, __entry->lkb_id,
248 		  show_dlm_sb_flags(__entry->sb_flags), __entry->sb_status,
249 		  __print_hex_str(__get_dynamic_array(res_name),
250 				  __get_dynamic_array_len(res_name)))
251 
252 );
253 
254 /* note: we begin tracing dlm_unlock_start() only if ls and lkb are found */
255 TRACE_EVENT(dlm_unlock_start,
256 
257 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags),
258 
259 	TP_ARGS(ls, lkb, flags),
260 
261 	TP_STRUCT__entry(
262 		__field(__u32, ls_id)
263 		__field(__u32, lkb_id)
264 		__field(__u32, flags)
265 		__dynamic_array(unsigned char, res_name,
266 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
267 	),
268 
269 	TP_fast_assign(
270 		struct dlm_rsb *r;
271 
272 		__entry->ls_id = ls->ls_global_id;
273 		__entry->lkb_id = lkb->lkb_id;
274 		__entry->flags = flags;
275 
276 		r = lkb->lkb_resource;
277 		if (r)
278 			memcpy(__get_dynamic_array(res_name), r->res_name,
279 			       __get_dynamic_array_len(res_name));
280 	),
281 
282 	TP_printk("ls_id=%u lkb_id=%x flags=%s res_name=%s",
283 		  __entry->ls_id, __entry->lkb_id,
284 		  show_lock_flags(__entry->flags),
285 		  __print_hex_str(__get_dynamic_array(res_name),
286 				  __get_dynamic_array_len(res_name)))
287 
288 );
289 
290 TRACE_EVENT(dlm_unlock_end,
291 
292 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags,
293 		 int error),
294 
295 	TP_ARGS(ls, lkb, flags, error),
296 
297 	TP_STRUCT__entry(
298 		__field(__u32, ls_id)
299 		__field(__u32, lkb_id)
300 		__field(__u32, flags)
301 		__field(int, error)
302 		__dynamic_array(unsigned char, res_name,
303 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
304 	),
305 
306 	TP_fast_assign(
307 		struct dlm_rsb *r;
308 
309 		__entry->ls_id = ls->ls_global_id;
310 		__entry->lkb_id = lkb->lkb_id;
311 		__entry->flags = flags;
312 		__entry->error = error;
313 
314 		r = lkb->lkb_resource;
315 		if (r)
316 			memcpy(__get_dynamic_array(res_name), r->res_name,
317 			       __get_dynamic_array_len(res_name));
318 	),
319 
320 	TP_printk("ls_id=%u lkb_id=%x flags=%s error=%d res_name=%s",
321 		  __entry->ls_id, __entry->lkb_id,
322 		  show_lock_flags(__entry->flags), __entry->error,
323 		  __print_hex_str(__get_dynamic_array(res_name),
324 				  __get_dynamic_array_len(res_name)))
325 
326 );
327 
328 DECLARE_EVENT_CLASS(dlm_rcom_template,
329 
330 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
331 
332 	TP_ARGS(dst, h_seq, rc),
333 
334 	TP_STRUCT__entry(
335 		__field(uint32_t, dst)
336 		__field(uint32_t, h_seq)
337 		__field(uint32_t, h_version)
338 		__field(uint32_t, h_lockspace)
339 		__field(uint32_t, h_nodeid)
340 		__field(uint16_t, h_length)
341 		__field(uint8_t, h_cmd)
342 		__field(uint32_t, rc_type)
343 		__field(int32_t, rc_result)
344 		__field(uint64_t, rc_id)
345 		__field(uint64_t, rc_seq)
346 		__field(uint64_t, rc_seq_reply)
347 		__dynamic_array(unsigned char, rc_buf,
348 				le16_to_cpu(rc->rc_header.h_length) - sizeof(*rc))
349 	),
350 
351 	TP_fast_assign(
352 		__entry->dst = dst;
353 		__entry->h_seq = h_seq;
354 		__entry->h_version = le32_to_cpu(rc->rc_header.h_version);
355 		__entry->h_lockspace = le32_to_cpu(rc->rc_header.u.h_lockspace);
356 		__entry->h_nodeid = le32_to_cpu(rc->rc_header.h_nodeid);
357 		__entry->h_length = le16_to_cpu(rc->rc_header.h_length);
358 		__entry->h_cmd = rc->rc_header.h_cmd;
359 		__entry->rc_type = le32_to_cpu(rc->rc_type);
360 		__entry->rc_result = le32_to_cpu(rc->rc_result);
361 		__entry->rc_id = le64_to_cpu(rc->rc_id);
362 		__entry->rc_seq = le64_to_cpu(rc->rc_seq);
363 		__entry->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply);
364 		memcpy(__get_dynamic_array(rc_buf), rc->rc_buf,
365 		       __get_dynamic_array_len(rc_buf));
366 	),
367 
368 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
369 		  "h_length=%u h_cmd=%s rc_type=%s rc_result=%d "
370 		  "rc_id=%llu rc_seq=%llu rc_seq_reply=%llu "
371 		  "rc_buf=0x%s", __entry->dst, __entry->h_seq,
372 		  show_message_version(__entry->h_version),
373 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
374 		  show_header_cmd(__entry->h_cmd),
375 		  show_rcom_type(__entry->rc_type),
376 		  __entry->rc_result, __entry->rc_id, __entry->rc_seq,
377 		  __entry->rc_seq_reply,
378 		  __print_hex_str(__get_dynamic_array(rc_buf),
379 				  __get_dynamic_array_len(rc_buf)))
380 
381 );
382 
383 DEFINE_EVENT(dlm_rcom_template, dlm_send_rcom,
384 	     TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
385 	     TP_ARGS(dst, h_seq, rc));
386 
387 DEFINE_EVENT(dlm_rcom_template, dlm_recv_rcom,
388 	     TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
389 	     TP_ARGS(dst, h_seq, rc));
390 
391 TRACE_EVENT(dlm_send_message,
392 
393 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_message *ms,
394 		 const void *name, int namelen),
395 
396 	TP_ARGS(dst, h_seq, ms, name, namelen),
397 
398 	TP_STRUCT__entry(
399 		__field(uint32_t, dst)
400 		__field(uint32_t, h_seq)
401 		__field(uint32_t, h_version)
402 		__field(uint32_t, h_lockspace)
403 		__field(uint32_t, h_nodeid)
404 		__field(uint16_t, h_length)
405 		__field(uint8_t, h_cmd)
406 		__field(uint32_t, m_type)
407 		__field(uint32_t, m_nodeid)
408 		__field(uint32_t, m_pid)
409 		__field(uint32_t, m_lkid)
410 		__field(uint32_t, m_remid)
411 		__field(uint32_t, m_parent_lkid)
412 		__field(uint32_t, m_parent_remid)
413 		__field(uint32_t, m_exflags)
414 		__field(uint32_t, m_sbflags)
415 		__field(uint32_t, m_flags)
416 		__field(uint32_t, m_lvbseq)
417 		__field(uint32_t, m_hash)
418 		__field(int32_t, m_status)
419 		__field(int32_t, m_grmode)
420 		__field(int32_t, m_rqmode)
421 		__field(int32_t, m_bastmode)
422 		__field(int32_t, m_asts)
423 		__field(int32_t, m_result)
424 		__dynamic_array(unsigned char, m_extra,
425 				le16_to_cpu(ms->m_header.h_length) - sizeof(*ms))
426 		__dynamic_array(unsigned char, res_name, namelen)
427 	),
428 
429 	TP_fast_assign(
430 		__entry->dst = dst;
431 		__entry->h_seq = h_seq;
432 		__entry->h_version = le32_to_cpu(ms->m_header.h_version);
433 		__entry->h_lockspace = le32_to_cpu(ms->m_header.u.h_lockspace);
434 		__entry->h_nodeid = le32_to_cpu(ms->m_header.h_nodeid);
435 		__entry->h_length = le16_to_cpu(ms->m_header.h_length);
436 		__entry->h_cmd = ms->m_header.h_cmd;
437 		__entry->m_type = le32_to_cpu(ms->m_type);
438 		__entry->m_nodeid = le32_to_cpu(ms->m_nodeid);
439 		__entry->m_pid = le32_to_cpu(ms->m_pid);
440 		__entry->m_lkid = le32_to_cpu(ms->m_lkid);
441 		__entry->m_remid = le32_to_cpu(ms->m_remid);
442 		__entry->m_parent_lkid = le32_to_cpu(ms->m_parent_lkid);
443 		__entry->m_parent_remid = le32_to_cpu(ms->m_parent_remid);
444 		__entry->m_exflags = le32_to_cpu(ms->m_exflags);
445 		__entry->m_sbflags = le32_to_cpu(ms->m_sbflags);
446 		__entry->m_flags = le32_to_cpu(ms->m_flags);
447 		__entry->m_lvbseq = le32_to_cpu(ms->m_lvbseq);
448 		__entry->m_hash = le32_to_cpu(ms->m_hash);
449 		__entry->m_status = le32_to_cpu(ms->m_status);
450 		__entry->m_grmode = le32_to_cpu(ms->m_grmode);
451 		__entry->m_rqmode = le32_to_cpu(ms->m_rqmode);
452 		__entry->m_bastmode = le32_to_cpu(ms->m_bastmode);
453 		__entry->m_asts = le32_to_cpu(ms->m_asts);
454 		__entry->m_result = le32_to_cpu(ms->m_result);
455 		memcpy(__get_dynamic_array(m_extra), ms->m_extra,
456 		       __get_dynamic_array_len(m_extra));
457 		memcpy(__get_dynamic_array(res_name), name,
458 		       __get_dynamic_array_len(res_name));
459 	),
460 
461 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
462 		  "h_length=%u h_cmd=%s m_type=%s m_nodeid=%u "
463 		  "m_pid=%u m_lkid=%u m_remid=%u m_parent_lkid=%u "
464 		  "m_parent_remid=%u m_exflags=%s m_sbflags=%s m_flags=%s "
465 		  "m_lvbseq=%u m_hash=%u m_status=%d m_grmode=%s "
466 		  "m_rqmode=%s m_bastmode=%s m_asts=%d m_result=%d "
467 		  "m_extra=0x%s res_name=0x%s", __entry->dst,
468 		  __entry->h_seq, show_message_version(__entry->h_version),
469 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
470 		  show_header_cmd(__entry->h_cmd),
471 		  show_message_type(__entry->m_type),
472 		  __entry->m_nodeid, __entry->m_pid, __entry->m_lkid,
473 		  __entry->m_remid, __entry->m_parent_lkid,
474 		  __entry->m_parent_remid, show_lock_flags(__entry->m_exflags),
475 		  show_dlm_sb_flags(__entry->m_sbflags),
476 		  show_lkb_flags(__entry->m_flags), __entry->m_lvbseq,
477 		  __entry->m_hash, __entry->m_status,
478 		  show_lock_mode(__entry->m_grmode),
479 		  show_lock_mode(__entry->m_rqmode),
480 		  show_lock_mode(__entry->m_bastmode),
481 		  __entry->m_asts, __entry->m_result,
482 		  __print_hex_str(__get_dynamic_array(m_extra),
483 				  __get_dynamic_array_len(m_extra)),
484 		  __print_hex_str(__get_dynamic_array(res_name),
485 				  __get_dynamic_array_len(res_name)))
486 
487 );
488 
489 TRACE_EVENT(dlm_recv_message,
490 
491 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_message *ms),
492 
493 	TP_ARGS(dst, h_seq, ms),
494 
495 	TP_STRUCT__entry(
496 		__field(uint32_t, dst)
497 		__field(uint32_t, h_seq)
498 		__field(uint32_t, h_version)
499 		__field(uint32_t, h_lockspace)
500 		__field(uint32_t, h_nodeid)
501 		__field(uint16_t, h_length)
502 		__field(uint8_t, h_cmd)
503 		__field(uint32_t, m_type)
504 		__field(uint32_t, m_nodeid)
505 		__field(uint32_t, m_pid)
506 		__field(uint32_t, m_lkid)
507 		__field(uint32_t, m_remid)
508 		__field(uint32_t, m_parent_lkid)
509 		__field(uint32_t, m_parent_remid)
510 		__field(uint32_t, m_exflags)
511 		__field(uint32_t, m_sbflags)
512 		__field(uint32_t, m_flags)
513 		__field(uint32_t, m_lvbseq)
514 		__field(uint32_t, m_hash)
515 		__field(int32_t, m_status)
516 		__field(int32_t, m_grmode)
517 		__field(int32_t, m_rqmode)
518 		__field(int32_t, m_bastmode)
519 		__field(int32_t, m_asts)
520 		__field(int32_t, m_result)
521 		__dynamic_array(unsigned char, m_extra,
522 				le16_to_cpu(ms->m_header.h_length) - sizeof(*ms))
523 	),
524 
525 	TP_fast_assign(
526 		__entry->dst = dst;
527 		__entry->h_seq = h_seq;
528 		__entry->h_version = le32_to_cpu(ms->m_header.h_version);
529 		__entry->h_lockspace = le32_to_cpu(ms->m_header.u.h_lockspace);
530 		__entry->h_nodeid = le32_to_cpu(ms->m_header.h_nodeid);
531 		__entry->h_length = le16_to_cpu(ms->m_header.h_length);
532 		__entry->h_cmd = ms->m_header.h_cmd;
533 		__entry->m_type = le32_to_cpu(ms->m_type);
534 		__entry->m_nodeid = le32_to_cpu(ms->m_nodeid);
535 		__entry->m_pid = le32_to_cpu(ms->m_pid);
536 		__entry->m_lkid = le32_to_cpu(ms->m_lkid);
537 		__entry->m_remid = le32_to_cpu(ms->m_remid);
538 		__entry->m_parent_lkid = le32_to_cpu(ms->m_parent_lkid);
539 		__entry->m_parent_remid = le32_to_cpu(ms->m_parent_remid);
540 		__entry->m_exflags = le32_to_cpu(ms->m_exflags);
541 		__entry->m_sbflags = le32_to_cpu(ms->m_sbflags);
542 		__entry->m_flags = le32_to_cpu(ms->m_flags);
543 		__entry->m_lvbseq = le32_to_cpu(ms->m_lvbseq);
544 		__entry->m_hash = le32_to_cpu(ms->m_hash);
545 		__entry->m_status = le32_to_cpu(ms->m_status);
546 		__entry->m_grmode = le32_to_cpu(ms->m_grmode);
547 		__entry->m_rqmode = le32_to_cpu(ms->m_rqmode);
548 		__entry->m_bastmode = le32_to_cpu(ms->m_bastmode);
549 		__entry->m_asts = le32_to_cpu(ms->m_asts);
550 		__entry->m_result = le32_to_cpu(ms->m_result);
551 		memcpy(__get_dynamic_array(m_extra), ms->m_extra,
552 		       __get_dynamic_array_len(m_extra));
553 	),
554 
555 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
556 		  "h_length=%u h_cmd=%s m_type=%s m_nodeid=%u "
557 		  "m_pid=%u m_lkid=%u m_remid=%u m_parent_lkid=%u "
558 		  "m_parent_remid=%u m_exflags=%s m_sbflags=%s m_flags=%s "
559 		  "m_lvbseq=%u m_hash=%u m_status=%d m_grmode=%s "
560 		  "m_rqmode=%s m_bastmode=%s m_asts=%d m_result=%d "
561 		  "m_extra=0x%s", __entry->dst,
562 		  __entry->h_seq, show_message_version(__entry->h_version),
563 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
564 		  show_header_cmd(__entry->h_cmd),
565 		  show_message_type(__entry->m_type),
566 		  __entry->m_nodeid, __entry->m_pid, __entry->m_lkid,
567 		  __entry->m_remid, __entry->m_parent_lkid,
568 		  __entry->m_parent_remid, show_lock_flags(__entry->m_exflags),
569 		  show_dlm_sb_flags(__entry->m_sbflags),
570 		  show_lkb_flags(__entry->m_flags), __entry->m_lvbseq,
571 		  __entry->m_hash, __entry->m_status,
572 		  show_lock_mode(__entry->m_grmode),
573 		  show_lock_mode(__entry->m_rqmode),
574 		  show_lock_mode(__entry->m_bastmode),
575 		  __entry->m_asts, __entry->m_result,
576 		  __print_hex_str(__get_dynamic_array(m_extra),
577 				  __get_dynamic_array_len(m_extra)))
578 
579 );
580 
581 DECLARE_EVENT_CLASS(dlm_plock_template,
582 
583 	TP_PROTO(const struct dlm_plock_info *info),
584 
585 	TP_ARGS(info),
586 
587 	TP_STRUCT__entry(
588 		__field(uint8_t, optype)
589 		__field(uint8_t, ex)
590 		__field(uint8_t, wait)
591 		__field(uint8_t, flags)
592 		__field(uint32_t, pid)
593 		__field(int32_t, nodeid)
594 		__field(int32_t, rv)
595 		__field(uint32_t, fsid)
596 		__field(uint64_t, number)
597 		__field(uint64_t, start)
598 		__field(uint64_t, end)
599 		__field(uint64_t, owner)
600 	),
601 
602 	TP_fast_assign(
603 		__entry->optype = info->optype;
604 		__entry->ex = info->ex;
605 		__entry->wait = info->wait;
606 		__entry->flags = info->flags;
607 		__entry->pid = info->pid;
608 		__entry->nodeid = info->nodeid;
609 		__entry->rv = info->rv;
610 		__entry->fsid = info->fsid;
611 		__entry->number = info->number;
612 		__entry->start = info->start;
613 		__entry->end = info->end;
614 		__entry->owner = info->owner;
615 	),
616 
617 	TP_printk("fsid=%u number=%llx owner=%llx optype=%d ex=%d wait=%d flags=%x pid=%u nodeid=%d rv=%d start=%llx end=%llx",
618 		  __entry->fsid, __entry->number, __entry->owner,
619 		  __entry->optype, __entry->ex, __entry->wait,
620 		  __entry->flags, __entry->pid, __entry->nodeid,
621 		  __entry->rv, __entry->start, __entry->end)
622 
623 );
624 
625 DEFINE_EVENT(dlm_plock_template, dlm_plock_read,
626 	     TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
627 
628 DEFINE_EVENT(dlm_plock_template, dlm_plock_write,
629 	     TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
630 
631 TRACE_EVENT(dlm_send,
632 
633 	TP_PROTO(int nodeid, int ret),
634 
635 	TP_ARGS(nodeid, ret),
636 
637 	TP_STRUCT__entry(
638 		__field(int, nodeid)
639 		__field(int, ret)
640 	),
641 
642 	TP_fast_assign(
643 		__entry->nodeid = nodeid;
644 		__entry->ret = ret;
645 	),
646 
647 	TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret)
648 
649 );
650 
651 TRACE_EVENT(dlm_recv,
652 
653 	TP_PROTO(int nodeid, int ret),
654 
655 	TP_ARGS(nodeid, ret),
656 
657 	TP_STRUCT__entry(
658 		__field(int, nodeid)
659 		__field(int, ret)
660 	),
661 
662 	TP_fast_assign(
663 		__entry->nodeid = nodeid;
664 		__entry->ret = ret;
665 	),
666 
667 	TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret)
668 
669 );
670 
671 #endif /* if !defined(_TRACE_DLM_H) || defined(TRACE_HEADER_MULTI_READ) */
672 
673 /* This part must be outside protection */
674 #include <trace/define_trace.h>
675