]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/os/linux/zfs/sys/trace_zrlock.h
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / include / os / linux / zfs / sys / trace_zrlock.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21
22 #if defined(_KERNEL)
23 #if defined(HAVE_DECLARE_EVENT_CLASS)
24
25 #undef TRACE_SYSTEM
26 #define TRACE_SYSTEM zfs
27
28 #undef TRACE_SYSTEM_VAR
29 #define TRACE_SYSTEM_VAR zfs_zrlock
30
31 #if !defined(_TRACE_ZRLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
32 #define _TRACE_ZRLOCK_H
33
34 #include <linux/tracepoint.h>
35 #include <sys/types.h>
36
37 /*
38  * Generic support for two argument tracepoints of the form:
39  *
40  * DTRACE_PROBE2(...,
41  *     zrlock_t *, ...,
42  *     uint32_t, ...);
43  */
44 /* BEGIN CSTYLED */
45 DECLARE_EVENT_CLASS(zfs_zrlock_class,
46         TP_PROTO(zrlock_t *zrl, kthread_t *owner, uint32_t n),
47         TP_ARGS(zrl, owner, n),
48         TP_STRUCT__entry(
49             __field(int32_t,            refcount)
50 #ifdef  ZFS_DEBUG
51             __field(pid_t,              owner_pid)
52             __field(const char *,       caller)
53 #endif
54             __field(uint32_t,           n)
55         ),
56         TP_fast_assign(
57             __entry->refcount   = zrl->zr_refcount;
58 #ifdef  ZFS_DEBUG
59             __entry->owner_pid  = owner ? owner->pid : 0;
60             __entry->caller = zrl->zr_caller ? zrl->zr_caller : "(null)";
61 #endif
62             __entry->n          = n;
63         ),
64 #ifdef  ZFS_DEBUG
65         TP_printk("zrl { refcount %d owner_pid %d caller %s } n %u",
66             __entry->refcount, __entry->owner_pid, __entry->caller,
67             __entry->n)
68 #else
69         TP_printk("zrl { refcount %d } n %u",
70             __entry->refcount, __entry->n)
71 #endif
72 );
73 /* END_CSTYLED */
74
75 #define DEFINE_ZRLOCK_EVENT(name) \
76 DEFINE_EVENT(zfs_zrlock_class, name, \
77         TP_PROTO(zrlock_t *zrl, kthread_t *owner, uint32_t n), \
78         TP_ARGS(zrl, owner, n))
79 DEFINE_ZRLOCK_EVENT(zfs_zrlock__reentry);
80
81 #endif /* _TRACE_ZRLOCK_H */
82
83 #undef TRACE_INCLUDE_PATH
84 #undef TRACE_INCLUDE_FILE
85 #define TRACE_INCLUDE_PATH sys
86 #define TRACE_INCLUDE_FILE trace_zrlock
87 #include <trace/define_trace.h>
88
89 #else
90
91 DEFINE_DTRACE_PROBE3(zrlock__reentry);
92
93 #endif /* HAVE_DECLARE_EVENT_CLASS */
94 #endif /* _KERNEL */