1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM lockd
5 #if !defined(_TRACE_LOCKD_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
9 #include <linux/crc32.h>
10 #include <linux/nfs.h>
11 #include <linux/lockd/lockd.h>
13 #ifdef CONFIG_LOCKD_V4
14 #define NLM_STATUS_LIST \
15 nlm_status_code(LCK_GRANTED) \
16 nlm_status_code(LCK_DENIED) \
17 nlm_status_code(LCK_DENIED_NOLOCKS) \
18 nlm_status_code(LCK_BLOCKED) \
19 nlm_status_code(LCK_DENIED_GRACE_PERIOD) \
20 nlm_status_code(DEADLCK) \
21 nlm_status_code(ROFS) \
22 nlm_status_code(STALE_FH) \
23 nlm_status_code(FBIG) \
24 nlm_status_code_end(FAILED)
26 #define NLM_STATUS_LIST \
27 nlm_status_code(LCK_GRANTED) \
28 nlm_status_code(LCK_DENIED) \
29 nlm_status_code(LCK_DENIED_NOLOCKS) \
30 nlm_status_code(LCK_BLOCKED) \
31 nlm_status_code_end(LCK_DENIED_GRACE_PERIOD)
34 #undef nlm_status_code
35 #undef nlm_status_code_end
36 #define nlm_status_code(x) TRACE_DEFINE_ENUM(NLM_##x);
37 #define nlm_status_code_end(x) TRACE_DEFINE_ENUM(NLM_##x);
41 #undef nlm_status_code
42 #undef nlm_status_code_end
43 #define nlm_status_code(x) { NLM_##x, #x },
44 #define nlm_status_code_end(x) { NLM_##x, #x }
46 #define show_nlm_status(x) __print_symbolic(x, NLM_STATUS_LIST)
48 DECLARE_EVENT_CLASS(nlmclnt_lock_event
,
50 const struct nlm_lock
*lock
,
51 const struct sockaddr
*addr
,
56 TP_ARGS(lock
, addr
, addrlen
, status
),
62 __field(unsigned long, status
)
65 __sockaddr(addr
, addrlen
)
69 __entry
->oh
= ~crc32_le(0xffffffff, lock
->oh
.data
, lock
->oh
.len
);
70 __entry
->svid
= lock
->svid
;
71 __entry
->fh
= nfs_fhandle_hash(&lock
->fh
);
72 __entry
->start
= lock
->lock_start
;
73 __entry
->len
= lock
->lock_len
;
74 __entry
->status
= be32_to_cpu(status
);
75 __assign_sockaddr(addr
, addr
, addrlen
);
79 "addr=%pISpc oh=0x%08x svid=0x%08x fh=0x%08x start=%llu len=%llu status=%s",
80 __get_sockaddr(addr
), __entry
->oh
, __entry
->svid
,
81 __entry
->fh
, __entry
->start
, __entry
->len
,
82 show_nlm_status(__entry
->status
)
86 #define DEFINE_NLMCLNT_EVENT(name) \
87 DEFINE_EVENT(nlmclnt_lock_event, name, \
89 const struct nlm_lock *lock, \
90 const struct sockaddr *addr, \
91 unsigned int addrlen, \
94 TP_ARGS(lock, addr, addrlen, status))
96 DEFINE_NLMCLNT_EVENT(nlmclnt_test
);
97 DEFINE_NLMCLNT_EVENT(nlmclnt_lock
);
98 DEFINE_NLMCLNT_EVENT(nlmclnt_unlock
);
99 DEFINE_NLMCLNT_EVENT(nlmclnt_grant
);
101 #endif /* _TRACE_LOCKD_H */
103 #undef TRACE_INCLUDE_PATH
104 #define TRACE_INCLUDE_PATH .
105 #define TRACE_INCLUDE_FILE trace
106 #include <trace/define_trace.h>