config/dracut/90zfs: handle cases where hostid(1) returns all zeros
[zfs.git] / include / os / linux / zfs / sys / trace_vdev.h
blob50711446ffa4be12e8bd6c88e311678b8434e62c
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 #if defined(_KERNEL)
23 #if defined(HAVE_DECLARE_EVENT_CLASS)
26 * If tracepoints are available define dtrace_probe events for vdev
27 * related probes. Definitions in include/os/linux/spl/sys/trace.h
28 * will map DTRACE_PROBE* calls to tracepoints.
31 #undef TRACE_SYSTEM
32 #define TRACE_SYSTEM zfs
34 #undef TRACE_SYSTEM_VAR
35 #define TRACE_SYSTEM_VAR zfs_vdev
37 #if !defined(_TRACE_VDEV_H) || defined(TRACE_HEADER_MULTI_READ)
38 #define _TRACE_VDEV_H
40 #include <linux/tracepoint.h>
41 #include <sys/types.h>
44 * Generic support for three argument tracepoints of the form:
46 * DTRACE_PROBE3(...,
47 * spa_t *, ...,
48 * uint64_t, ...,
49 * uint64_t, ...);
51 /* BEGIN CSTYLED */
52 DECLARE_EVENT_CLASS(zfs_removing_class_3,
53 TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size),
54 TP_ARGS(spa, offset, size),
55 TP_STRUCT__entry(
56 __field(spa_t *, vdev_spa)
57 __field(uint64_t, vdev_offset)
58 __field(uint64_t, vdev_size)
60 TP_fast_assign(
61 __entry->vdev_spa = spa;
62 __entry->vdev_offset = offset;
63 __entry->vdev_size = size;
65 TP_printk("spa %p offset %llu size %llu",
66 __entry->vdev_spa, __entry->vdev_offset,
67 __entry->vdev_size)
69 /* END CSTYLED */
71 /* BEGIN CSTYLED */
72 #define DEFINE_REMOVE_FREE_EVENT(name) \
73 DEFINE_EVENT(zfs_removing_class_3, name, \
74 TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size), \
75 TP_ARGS(spa, offset, size))
76 /* END CSTYLED */
77 DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__synced);
78 DEFINE_REMOVE_FREE_EVENT(zfs_remove__free__unvisited);
81 * Generic support for four argument tracepoints of the form:
83 * DTRACE_PROBE4(...,
84 * spa_t *, ...,
85 * uint64_t, ...,
86 * uint64_t, ...,
87 * uint64_t, ...);
89 /* BEGIN CSTYLED */
90 DECLARE_EVENT_CLASS(zfs_removing_class_4,
91 TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size, uint64_t txg),
92 TP_ARGS(spa, offset, size, txg),
93 TP_STRUCT__entry(
94 __field(spa_t *, vdev_spa)
95 __field(uint64_t, vdev_offset)
96 __field(uint64_t, vdev_size)
97 __field(uint64_t, vdev_txg)
99 TP_fast_assign(
100 __entry->vdev_spa = spa;
101 __entry->vdev_offset = offset;
102 __entry->vdev_size = size;
103 __entry->vdev_txg = txg;
105 TP_printk("spa %p offset %llu size %llu txg %llu",
106 __entry->vdev_spa, __entry->vdev_offset,
107 __entry->vdev_size, __entry->vdev_txg)
110 /* BEGIN CSTYLED */
111 #define DEFINE_REMOVE_FREE_EVENT_TXG(name) \
112 DEFINE_EVENT(zfs_removing_class_4, name, \
113 TP_PROTO(spa_t *spa, uint64_t offset, uint64_t size,uint64_t txg), \
114 TP_ARGS(spa, offset, size, txg))
115 /* END CSTYLED */
116 DEFINE_REMOVE_FREE_EVENT_TXG(zfs_remove__free__inflight);
118 #endif /* _TRACE_VDEV_H */
120 #undef TRACE_INCLUDE_PATH
121 #undef TRACE_INCLUDE_FILE
122 #define TRACE_INCLUDE_PATH sys
123 #define TRACE_INCLUDE_FILE trace_vdev
124 #include <trace/define_trace.h>
126 #else
129 * When tracepoints are not available, a DEFINE_DTRACE_PROBE* macro is
130 * needed for each DTRACE_PROBE. These will be used to generate stub
131 * tracing functions and prototypes for those functions. See
132 * include/os/linux/spl/sys/trace.h.
135 DEFINE_DTRACE_PROBE3(remove__free__synced);
136 DEFINE_DTRACE_PROBE3(remove__free__unvisited);
137 DEFINE_DTRACE_PROBE4(remove__free__inflight);
139 #endif /* HAVE_DECLARE_EVENT_CLASS */
140 #endif /* _KERNEL */