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