xref: /linux/include/trace/events/dlm.h (revision afca12e35e711ae8f97e835a3704cc305592eac9)
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(struct dlm_ls *ls, struct dlm_lkb *lkb, int mode),
193 
194 	TP_ARGS(ls, lkb, mode),
195 
196 	TP_STRUCT__entry(
197 		__field(__u32, ls_id)
198 		__field(__u32, lkb_id)
199 		__field(int, mode)
200 		__dynamic_array(unsigned char, res_name,
201 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
202 	),
203 
204 	TP_fast_assign(
205 		struct dlm_rsb *r;
206 
207 		__entry->ls_id = ls->ls_global_id;
208 		__entry->lkb_id = lkb->lkb_id;
209 		__entry->mode = mode;
210 
211 		r = lkb->lkb_resource;
212 		if (r)
213 			memcpy(__get_dynamic_array(res_name), r->res_name,
214 			       __get_dynamic_array_len(res_name));
215 	),
216 
217 	TP_printk("ls_id=%u lkb_id=%x mode=%s res_name=%s",
218 		  __entry->ls_id, __entry->lkb_id,
219 		  show_lock_mode(__entry->mode),
220 		  __print_hex_str(__get_dynamic_array(res_name),
221 				  __get_dynamic_array_len(res_name)))
222 
223 );
224 
225 TRACE_EVENT(dlm_ast,
226 
227 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb),
228 
229 	TP_ARGS(ls, lkb),
230 
231 	TP_STRUCT__entry(
232 		__field(__u32, ls_id)
233 		__field(__u32, lkb_id)
234 		__field(u8, sb_flags)
235 		__field(int, sb_status)
236 		__dynamic_array(unsigned char, res_name,
237 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
238 	),
239 
240 	TP_fast_assign(
241 		struct dlm_rsb *r;
242 
243 		__entry->ls_id = ls->ls_global_id;
244 		__entry->lkb_id = lkb->lkb_id;
245 		__entry->sb_flags = lkb->lkb_lksb->sb_flags;
246 		__entry->sb_status = lkb->lkb_lksb->sb_status;
247 
248 		r = lkb->lkb_resource;
249 		if (r)
250 			memcpy(__get_dynamic_array(res_name), r->res_name,
251 			       __get_dynamic_array_len(res_name));
252 	),
253 
254 	TP_printk("ls_id=%u lkb_id=%x sb_flags=%s sb_status=%d res_name=%s",
255 		  __entry->ls_id, __entry->lkb_id,
256 		  show_dlm_sb_flags(__entry->sb_flags), __entry->sb_status,
257 		  __print_hex_str(__get_dynamic_array(res_name),
258 				  __get_dynamic_array_len(res_name)))
259 
260 );
261 
262 /* note: we begin tracing dlm_unlock_start() only if ls and lkb are found */
263 TRACE_EVENT(dlm_unlock_start,
264 
265 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags),
266 
267 	TP_ARGS(ls, lkb, flags),
268 
269 	TP_STRUCT__entry(
270 		__field(__u32, ls_id)
271 		__field(__u32, lkb_id)
272 		__field(__u32, flags)
273 		__dynamic_array(unsigned char, res_name,
274 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
275 	),
276 
277 	TP_fast_assign(
278 		struct dlm_rsb *r;
279 
280 		__entry->ls_id = ls->ls_global_id;
281 		__entry->lkb_id = lkb->lkb_id;
282 		__entry->flags = flags;
283 
284 		r = lkb->lkb_resource;
285 		if (r)
286 			memcpy(__get_dynamic_array(res_name), r->res_name,
287 			       __get_dynamic_array_len(res_name));
288 	),
289 
290 	TP_printk("ls_id=%u lkb_id=%x flags=%s res_name=%s",
291 		  __entry->ls_id, __entry->lkb_id,
292 		  show_lock_flags(__entry->flags),
293 		  __print_hex_str(__get_dynamic_array(res_name),
294 				  __get_dynamic_array_len(res_name)))
295 
296 );
297 
298 TRACE_EVENT(dlm_unlock_end,
299 
300 	TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, __u32 flags,
301 		 int error),
302 
303 	TP_ARGS(ls, lkb, flags, error),
304 
305 	TP_STRUCT__entry(
306 		__field(__u32, ls_id)
307 		__field(__u32, lkb_id)
308 		__field(__u32, flags)
309 		__field(int, error)
310 		__dynamic_array(unsigned char, res_name,
311 				lkb->lkb_resource ? lkb->lkb_resource->res_length : 0)
312 	),
313 
314 	TP_fast_assign(
315 		struct dlm_rsb *r;
316 
317 		__entry->ls_id = ls->ls_global_id;
318 		__entry->lkb_id = lkb->lkb_id;
319 		__entry->flags = flags;
320 		__entry->error = error;
321 
322 		r = lkb->lkb_resource;
323 		if (r)
324 			memcpy(__get_dynamic_array(res_name), r->res_name,
325 			       __get_dynamic_array_len(res_name));
326 	),
327 
328 	TP_printk("ls_id=%u lkb_id=%x flags=%s error=%d res_name=%s",
329 		  __entry->ls_id, __entry->lkb_id,
330 		  show_lock_flags(__entry->flags), __entry->error,
331 		  __print_hex_str(__get_dynamic_array(res_name),
332 				  __get_dynamic_array_len(res_name)))
333 
334 );
335 
336 DECLARE_EVENT_CLASS(dlm_rcom_template,
337 
338 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
339 
340 	TP_ARGS(dst, h_seq, rc),
341 
342 	TP_STRUCT__entry(
343 		__field(uint32_t, dst)
344 		__field(uint32_t, h_seq)
345 		__field(uint32_t, h_version)
346 		__field(uint32_t, h_lockspace)
347 		__field(uint32_t, h_nodeid)
348 		__field(uint16_t, h_length)
349 		__field(uint8_t, h_cmd)
350 		__field(uint32_t, rc_type)
351 		__field(int32_t, rc_result)
352 		__field(uint64_t, rc_id)
353 		__field(uint64_t, rc_seq)
354 		__field(uint64_t, rc_seq_reply)
355 		__dynamic_array(unsigned char, rc_buf,
356 				le16_to_cpu(rc->rc_header.h_length) - sizeof(*rc))
357 	),
358 
359 	TP_fast_assign(
360 		__entry->dst = dst;
361 		__entry->h_seq = h_seq;
362 		__entry->h_version = le32_to_cpu(rc->rc_header.h_version);
363 		__entry->h_lockspace = le32_to_cpu(rc->rc_header.u.h_lockspace);
364 		__entry->h_nodeid = le32_to_cpu(rc->rc_header.h_nodeid);
365 		__entry->h_length = le16_to_cpu(rc->rc_header.h_length);
366 		__entry->h_cmd = rc->rc_header.h_cmd;
367 		__entry->rc_type = le32_to_cpu(rc->rc_type);
368 		__entry->rc_result = le32_to_cpu(rc->rc_result);
369 		__entry->rc_id = le64_to_cpu(rc->rc_id);
370 		__entry->rc_seq = le64_to_cpu(rc->rc_seq);
371 		__entry->rc_seq_reply = le64_to_cpu(rc->rc_seq_reply);
372 		memcpy(__get_dynamic_array(rc_buf), rc->rc_buf,
373 		       __get_dynamic_array_len(rc_buf));
374 	),
375 
376 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
377 		  "h_length=%u h_cmd=%s rc_type=%s rc_result=%d "
378 		  "rc_id=%llu rc_seq=%llu rc_seq_reply=%llu "
379 		  "rc_buf=0x%s", __entry->dst, __entry->h_seq,
380 		  show_message_version(__entry->h_version),
381 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
382 		  show_header_cmd(__entry->h_cmd),
383 		  show_rcom_type(__entry->rc_type),
384 		  __entry->rc_result, __entry->rc_id, __entry->rc_seq,
385 		  __entry->rc_seq_reply,
386 		  __print_hex_str(__get_dynamic_array(rc_buf),
387 				  __get_dynamic_array_len(rc_buf)))
388 
389 );
390 
391 DEFINE_EVENT(dlm_rcom_template, dlm_send_rcom,
392 	     TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
393 	     TP_ARGS(dst, h_seq, rc));
394 
395 DEFINE_EVENT(dlm_rcom_template, dlm_recv_rcom,
396 	     TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_rcom *rc),
397 	     TP_ARGS(dst, h_seq, rc));
398 
399 TRACE_EVENT(dlm_send_message,
400 
401 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_message *ms,
402 		 const void *name, int namelen),
403 
404 	TP_ARGS(dst, h_seq, ms, name, namelen),
405 
406 	TP_STRUCT__entry(
407 		__field(uint32_t, dst)
408 		__field(uint32_t, h_seq)
409 		__field(uint32_t, h_version)
410 		__field(uint32_t, h_lockspace)
411 		__field(uint32_t, h_nodeid)
412 		__field(uint16_t, h_length)
413 		__field(uint8_t, h_cmd)
414 		__field(uint32_t, m_type)
415 		__field(uint32_t, m_nodeid)
416 		__field(uint32_t, m_pid)
417 		__field(uint32_t, m_lkid)
418 		__field(uint32_t, m_remid)
419 		__field(uint32_t, m_parent_lkid)
420 		__field(uint32_t, m_parent_remid)
421 		__field(uint32_t, m_exflags)
422 		__field(uint32_t, m_sbflags)
423 		__field(uint32_t, m_flags)
424 		__field(uint32_t, m_lvbseq)
425 		__field(uint32_t, m_hash)
426 		__field(int32_t, m_status)
427 		__field(int32_t, m_grmode)
428 		__field(int32_t, m_rqmode)
429 		__field(int32_t, m_bastmode)
430 		__field(int32_t, m_asts)
431 		__field(int32_t, m_result)
432 		__dynamic_array(unsigned char, m_extra,
433 				le16_to_cpu(ms->m_header.h_length) - sizeof(*ms))
434 		__dynamic_array(unsigned char, res_name, namelen)
435 	),
436 
437 	TP_fast_assign(
438 		__entry->dst = dst;
439 		__entry->h_seq = h_seq;
440 		__entry->h_version = le32_to_cpu(ms->m_header.h_version);
441 		__entry->h_lockspace = le32_to_cpu(ms->m_header.u.h_lockspace);
442 		__entry->h_nodeid = le32_to_cpu(ms->m_header.h_nodeid);
443 		__entry->h_length = le16_to_cpu(ms->m_header.h_length);
444 		__entry->h_cmd = ms->m_header.h_cmd;
445 		__entry->m_type = le32_to_cpu(ms->m_type);
446 		__entry->m_nodeid = le32_to_cpu(ms->m_nodeid);
447 		__entry->m_pid = le32_to_cpu(ms->m_pid);
448 		__entry->m_lkid = le32_to_cpu(ms->m_lkid);
449 		__entry->m_remid = le32_to_cpu(ms->m_remid);
450 		__entry->m_parent_lkid = le32_to_cpu(ms->m_parent_lkid);
451 		__entry->m_parent_remid = le32_to_cpu(ms->m_parent_remid);
452 		__entry->m_exflags = le32_to_cpu(ms->m_exflags);
453 		__entry->m_sbflags = le32_to_cpu(ms->m_sbflags);
454 		__entry->m_flags = le32_to_cpu(ms->m_flags);
455 		__entry->m_lvbseq = le32_to_cpu(ms->m_lvbseq);
456 		__entry->m_hash = le32_to_cpu(ms->m_hash);
457 		__entry->m_status = le32_to_cpu(ms->m_status);
458 		__entry->m_grmode = le32_to_cpu(ms->m_grmode);
459 		__entry->m_rqmode = le32_to_cpu(ms->m_rqmode);
460 		__entry->m_bastmode = le32_to_cpu(ms->m_bastmode);
461 		__entry->m_asts = le32_to_cpu(ms->m_asts);
462 		__entry->m_result = le32_to_cpu(ms->m_result);
463 		memcpy(__get_dynamic_array(m_extra), ms->m_extra,
464 		       __get_dynamic_array_len(m_extra));
465 		memcpy(__get_dynamic_array(res_name), name,
466 		       __get_dynamic_array_len(res_name));
467 	),
468 
469 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
470 		  "h_length=%u h_cmd=%s m_type=%s m_nodeid=%u "
471 		  "m_pid=%u m_lkid=%u m_remid=%u m_parent_lkid=%u "
472 		  "m_parent_remid=%u m_exflags=%s m_sbflags=%s m_flags=%s "
473 		  "m_lvbseq=%u m_hash=%u m_status=%d m_grmode=%s "
474 		  "m_rqmode=%s m_bastmode=%s m_asts=%d m_result=%d "
475 		  "m_extra=0x%s res_name=0x%s", __entry->dst,
476 		  __entry->h_seq, show_message_version(__entry->h_version),
477 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
478 		  show_header_cmd(__entry->h_cmd),
479 		  show_message_type(__entry->m_type),
480 		  __entry->m_nodeid, __entry->m_pid, __entry->m_lkid,
481 		  __entry->m_remid, __entry->m_parent_lkid,
482 		  __entry->m_parent_remid, show_lock_flags(__entry->m_exflags),
483 		  show_dlm_sb_flags(__entry->m_sbflags),
484 		  show_lkb_flags(__entry->m_flags), __entry->m_lvbseq,
485 		  __entry->m_hash, __entry->m_status,
486 		  show_lock_mode(__entry->m_grmode),
487 		  show_lock_mode(__entry->m_rqmode),
488 		  show_lock_mode(__entry->m_bastmode),
489 		  __entry->m_asts, __entry->m_result,
490 		  __print_hex_str(__get_dynamic_array(m_extra),
491 				  __get_dynamic_array_len(m_extra)),
492 		  __print_hex_str(__get_dynamic_array(res_name),
493 				  __get_dynamic_array_len(res_name)))
494 
495 );
496 
497 TRACE_EVENT(dlm_recv_message,
498 
499 	TP_PROTO(uint32_t dst, uint32_t h_seq, const struct dlm_message *ms),
500 
501 	TP_ARGS(dst, h_seq, ms),
502 
503 	TP_STRUCT__entry(
504 		__field(uint32_t, dst)
505 		__field(uint32_t, h_seq)
506 		__field(uint32_t, h_version)
507 		__field(uint32_t, h_lockspace)
508 		__field(uint32_t, h_nodeid)
509 		__field(uint16_t, h_length)
510 		__field(uint8_t, h_cmd)
511 		__field(uint32_t, m_type)
512 		__field(uint32_t, m_nodeid)
513 		__field(uint32_t, m_pid)
514 		__field(uint32_t, m_lkid)
515 		__field(uint32_t, m_remid)
516 		__field(uint32_t, m_parent_lkid)
517 		__field(uint32_t, m_parent_remid)
518 		__field(uint32_t, m_exflags)
519 		__field(uint32_t, m_sbflags)
520 		__field(uint32_t, m_flags)
521 		__field(uint32_t, m_lvbseq)
522 		__field(uint32_t, m_hash)
523 		__field(int32_t, m_status)
524 		__field(int32_t, m_grmode)
525 		__field(int32_t, m_rqmode)
526 		__field(int32_t, m_bastmode)
527 		__field(int32_t, m_asts)
528 		__field(int32_t, m_result)
529 		__dynamic_array(unsigned char, m_extra,
530 				le16_to_cpu(ms->m_header.h_length) - sizeof(*ms))
531 	),
532 
533 	TP_fast_assign(
534 		__entry->dst = dst;
535 		__entry->h_seq = h_seq;
536 		__entry->h_version = le32_to_cpu(ms->m_header.h_version);
537 		__entry->h_lockspace = le32_to_cpu(ms->m_header.u.h_lockspace);
538 		__entry->h_nodeid = le32_to_cpu(ms->m_header.h_nodeid);
539 		__entry->h_length = le16_to_cpu(ms->m_header.h_length);
540 		__entry->h_cmd = ms->m_header.h_cmd;
541 		__entry->m_type = le32_to_cpu(ms->m_type);
542 		__entry->m_nodeid = le32_to_cpu(ms->m_nodeid);
543 		__entry->m_pid = le32_to_cpu(ms->m_pid);
544 		__entry->m_lkid = le32_to_cpu(ms->m_lkid);
545 		__entry->m_remid = le32_to_cpu(ms->m_remid);
546 		__entry->m_parent_lkid = le32_to_cpu(ms->m_parent_lkid);
547 		__entry->m_parent_remid = le32_to_cpu(ms->m_parent_remid);
548 		__entry->m_exflags = le32_to_cpu(ms->m_exflags);
549 		__entry->m_sbflags = le32_to_cpu(ms->m_sbflags);
550 		__entry->m_flags = le32_to_cpu(ms->m_flags);
551 		__entry->m_lvbseq = le32_to_cpu(ms->m_lvbseq);
552 		__entry->m_hash = le32_to_cpu(ms->m_hash);
553 		__entry->m_status = le32_to_cpu(ms->m_status);
554 		__entry->m_grmode = le32_to_cpu(ms->m_grmode);
555 		__entry->m_rqmode = le32_to_cpu(ms->m_rqmode);
556 		__entry->m_bastmode = le32_to_cpu(ms->m_bastmode);
557 		__entry->m_asts = le32_to_cpu(ms->m_asts);
558 		__entry->m_result = le32_to_cpu(ms->m_result);
559 		memcpy(__get_dynamic_array(m_extra), ms->m_extra,
560 		       __get_dynamic_array_len(m_extra));
561 	),
562 
563 	TP_printk("dst=%u h_seq=%u h_version=%s h_lockspace=%u h_nodeid=%u "
564 		  "h_length=%u h_cmd=%s m_type=%s m_nodeid=%u "
565 		  "m_pid=%u m_lkid=%u m_remid=%u m_parent_lkid=%u "
566 		  "m_parent_remid=%u m_exflags=%s m_sbflags=%s m_flags=%s "
567 		  "m_lvbseq=%u m_hash=%u m_status=%d m_grmode=%s "
568 		  "m_rqmode=%s m_bastmode=%s m_asts=%d m_result=%d "
569 		  "m_extra=0x%s", __entry->dst,
570 		  __entry->h_seq, show_message_version(__entry->h_version),
571 		  __entry->h_lockspace, __entry->h_nodeid, __entry->h_length,
572 		  show_header_cmd(__entry->h_cmd),
573 		  show_message_type(__entry->m_type),
574 		  __entry->m_nodeid, __entry->m_pid, __entry->m_lkid,
575 		  __entry->m_remid, __entry->m_parent_lkid,
576 		  __entry->m_parent_remid, show_lock_flags(__entry->m_exflags),
577 		  show_dlm_sb_flags(__entry->m_sbflags),
578 		  show_lkb_flags(__entry->m_flags), __entry->m_lvbseq,
579 		  __entry->m_hash, __entry->m_status,
580 		  show_lock_mode(__entry->m_grmode),
581 		  show_lock_mode(__entry->m_rqmode),
582 		  show_lock_mode(__entry->m_bastmode),
583 		  __entry->m_asts, __entry->m_result,
584 		  __print_hex_str(__get_dynamic_array(m_extra),
585 				  __get_dynamic_array_len(m_extra)))
586 
587 );
588 
589 DECLARE_EVENT_CLASS(dlm_plock_template,
590 
591 	TP_PROTO(const struct dlm_plock_info *info),
592 
593 	TP_ARGS(info),
594 
595 	TP_STRUCT__entry(
596 		__field(uint8_t, optype)
597 		__field(uint8_t, ex)
598 		__field(uint8_t, wait)
599 		__field(uint8_t, flags)
600 		__field(uint32_t, pid)
601 		__field(int32_t, nodeid)
602 		__field(int32_t, rv)
603 		__field(uint32_t, fsid)
604 		__field(uint64_t, number)
605 		__field(uint64_t, start)
606 		__field(uint64_t, end)
607 		__field(uint64_t, owner)
608 	),
609 
610 	TP_fast_assign(
611 		__entry->optype = info->optype;
612 		__entry->ex = info->ex;
613 		__entry->wait = info->wait;
614 		__entry->flags = info->flags;
615 		__entry->pid = info->pid;
616 		__entry->nodeid = info->nodeid;
617 		__entry->rv = info->rv;
618 		__entry->fsid = info->fsid;
619 		__entry->number = info->number;
620 		__entry->start = info->start;
621 		__entry->end = info->end;
622 		__entry->owner = info->owner;
623 	),
624 
625 	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",
626 		  __entry->fsid, __entry->number, __entry->owner,
627 		  __entry->optype, __entry->ex, __entry->wait,
628 		  __entry->flags, __entry->pid, __entry->nodeid,
629 		  __entry->rv, __entry->start, __entry->end)
630 
631 );
632 
633 DEFINE_EVENT(dlm_plock_template, dlm_plock_read,
634 	     TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
635 
636 DEFINE_EVENT(dlm_plock_template, dlm_plock_write,
637 	     TP_PROTO(const struct dlm_plock_info *info), TP_ARGS(info));
638 
639 TRACE_EVENT(dlm_send,
640 
641 	TP_PROTO(int nodeid, int ret),
642 
643 	TP_ARGS(nodeid, ret),
644 
645 	TP_STRUCT__entry(
646 		__field(int, nodeid)
647 		__field(int, ret)
648 	),
649 
650 	TP_fast_assign(
651 		__entry->nodeid = nodeid;
652 		__entry->ret = ret;
653 	),
654 
655 	TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret)
656 
657 );
658 
659 TRACE_EVENT(dlm_recv,
660 
661 	TP_PROTO(int nodeid, int ret),
662 
663 	TP_ARGS(nodeid, ret),
664 
665 	TP_STRUCT__entry(
666 		__field(int, nodeid)
667 		__field(int, ret)
668 	),
669 
670 	TP_fast_assign(
671 		__entry->nodeid = nodeid;
672 		__entry->ret = ret;
673 	),
674 
675 	TP_printk("nodeid=%d ret=%d", __entry->nodeid, __entry->ret)
676 
677 );
678 
679 #endif /* if !defined(_TRACE_DLM_H) || defined(TRACE_HEADER_MULTI_READ) */
680 
681 /* This part must be outside protection */
682 #include <trace/define_trace.h>
683