]> git.proxmox.com Git - mirror_zfs.git/blame - include/sys/trace_zil.h
OpenZFS 9075 - Improve ZFS pool import/load process and corrupted pool recovery
[mirror_zfs.git] / include / sys / trace_zil.h
CommitLineData
49ee64e5
NB
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) && defined(HAVE_DECLARE_EVENT_CLASS)
23
24#undef TRACE_SYSTEM
25#define TRACE_SYSTEM zfs
26
c1718e95
FV
27#undef TRACE_SYSTEM_VAR
28#define TRACE_SYSTEM_VAR zfs_zil
29
49ee64e5
NB
30#if !defined(_TRACE_ZIL_H) || defined(TRACE_HEADER_MULTI_READ)
31#define _TRACE_ZIL_H
32
33#include <linux/tracepoint.h>
34#include <sys/types.h>
35
1ce23dca
PS
36#define ZILOG_TP_STRUCT_ENTRY \
37 __field(uint64_t, zl_lr_seq) \
38 __field(uint64_t, zl_commit_lr_seq) \
39 __field(uint64_t, zl_destroy_txg) \
40 __field(uint64_t, zl_replaying_seq) \
41 __field(uint32_t, zl_suspend) \
42 __field(uint8_t, zl_suspending) \
43 __field(uint8_t, zl_keep_first) \
44 __field(uint8_t, zl_replay) \
45 __field(uint8_t, zl_stop_sync) \
46 __field(uint8_t, zl_logbias) \
47 __field(uint8_t, zl_sync) \
48 __field(int, zl_parse_error) \
49 __field(uint64_t, zl_parse_blk_seq) \
50 __field(uint64_t, zl_parse_lr_seq) \
51 __field(uint64_t, zl_parse_blk_count) \
52 __field(uint64_t, zl_parse_lr_count) \
53 __field(uint64_t, zl_cur_used) \
54 __field(clock_t, zl_replay_time) \
55 __field(uint64_t, zl_replay_blks)
56
57#define ZILOG_TP_FAST_ASSIGN \
58 __entry->zl_lr_seq = zilog->zl_lr_seq; \
59 __entry->zl_commit_lr_seq = zilog->zl_commit_lr_seq; \
60 __entry->zl_destroy_txg = zilog->zl_destroy_txg; \
61 __entry->zl_replaying_seq = zilog->zl_replaying_seq; \
62 __entry->zl_suspend = zilog->zl_suspend; \
63 __entry->zl_suspending = zilog->zl_suspending; \
64 __entry->zl_keep_first = zilog->zl_keep_first; \
65 __entry->zl_replay = zilog->zl_replay; \
66 __entry->zl_stop_sync = zilog->zl_stop_sync; \
67 __entry->zl_logbias = zilog->zl_logbias; \
68 __entry->zl_sync = zilog->zl_sync; \
69 __entry->zl_parse_error = zilog->zl_parse_error; \
70 __entry->zl_parse_blk_seq = zilog->zl_parse_blk_seq; \
71 __entry->zl_parse_lr_seq = zilog->zl_parse_lr_seq; \
72 __entry->zl_parse_blk_count = zilog->zl_parse_blk_count;\
73 __entry->zl_parse_lr_count = zilog->zl_parse_lr_count; \
74 __entry->zl_cur_used = zilog->zl_cur_used; \
75 __entry->zl_replay_time = zilog->zl_replay_time; \
76 __entry->zl_replay_blks = zilog->zl_replay_blks;
77
78#define ZILOG_TP_PRINTK_FMT \
79 "zl { lr_seq %llu commit_lr_seq %llu destroy_txg %llu " \
80 "replaying_seq %llu suspend %u suspending %u keep_first %u " \
81 "replay %u stop_sync %u logbias %u sync %u " \
82 "parse_error %u parse_blk_seq %llu parse_lr_seq %llu " \
83 "parse_blk_count %llu parse_lr_count %llu " \
84 "cur_used %llu replay_time %lu replay_blks %llu }"
85
86#define ZILOG_TP_PRINTK_ARGS \
87 __entry->zl_lr_seq, __entry->zl_commit_lr_seq, \
88 __entry->zl_destroy_txg, __entry->zl_replaying_seq, \
89 __entry->zl_suspend, __entry->zl_suspending, \
90 __entry->zl_keep_first, __entry->zl_replay, \
91 __entry->zl_stop_sync, __entry->zl_logbias, __entry->zl_sync, \
92 __entry->zl_parse_error, __entry->zl_parse_blk_seq, \
93 __entry->zl_parse_lr_seq, __entry->zl_parse_blk_count, \
94 __entry->zl_parse_lr_count, __entry->zl_cur_used, \
95 __entry->zl_replay_time, __entry->zl_replay_blks
96
97#define ITX_TP_STRUCT_ENTRY \
98 __field(itx_wr_state_t, itx_wr_state) \
99 __field(uint8_t, itx_sync) \
100 __field(zil_callback_t, itx_callback) \
101 __field(void *, itx_callback_data) \
102 __field(uint64_t, itx_oid) \
103 \
104 __field(uint64_t, lrc_txtype) \
105 __field(uint64_t, lrc_reclen) \
106 __field(uint64_t, lrc_txg) \
107 __field(uint64_t, lrc_seq)
108
109#define ITX_TP_FAST_ASSIGN \
110 __entry->itx_wr_state = itx->itx_wr_state; \
111 __entry->itx_sync = itx->itx_sync; \
112 __entry->itx_callback = itx->itx_callback; \
113 __entry->itx_callback_data = itx->itx_callback_data; \
114 __entry->itx_oid = itx->itx_oid; \
115 \
116 __entry->lrc_txtype = itx->itx_lr.lrc_txtype; \
117 __entry->lrc_reclen = itx->itx_lr.lrc_reclen; \
118 __entry->lrc_txg = itx->itx_lr.lrc_txg; \
119 __entry->lrc_seq = itx->itx_lr.lrc_seq;
120
121#define ITX_TP_PRINTK_FMT \
122 "itx { wr_state %u sync %u callback %p callback_data %p oid %llu" \
123 " { txtype %llu reclen %llu txg %llu seq %llu } }"
124
125#define ITX_TP_PRINTK_ARGS \
126 __entry->itx_wr_state, __entry->itx_sync, __entry->itx_callback,\
127 __entry->itx_callback_data, __entry->itx_oid, \
128 __entry->lrc_txtype, __entry->lrc_reclen, __entry->lrc_txg, \
129 __entry->lrc_seq
130
131#define ZCW_TP_STRUCT_ENTRY \
132 __field(lwb_t *, zcw_lwb) \
133 __field(boolean_t, zcw_done) \
134 __field(int, zcw_zio_error) \
135
136#define ZCW_TP_FAST_ASSIGN \
137 __entry->zcw_lwb = zcw->zcw_lwb; \
138 __entry->zcw_done = zcw->zcw_done; \
139 __entry->zcw_zio_error = zcw->zcw_zio_error;
140
141#define ZCW_TP_PRINTK_FMT \
142 "zcw { lwb %p done %u error %u }"
143
144#define ZCW_TP_PRINTK_ARGS \
145 __entry->zcw_lwb, __entry->zcw_done, __entry->zcw_zio_error
146
49ee64e5 147/*
1ce23dca 148 * Generic support for two argument tracepoints of the form:
49ee64e5 149 *
1ce23dca
PS
150 * DTRACE_PROBE2(...,
151 * zilog_t *, ...,
152 * itx_t *, ...);
49ee64e5 153 */
02730c33 154/* BEGIN CSTYLED */
1ce23dca
PS
155DECLARE_EVENT_CLASS(zfs_zil_process_itx_class,
156 TP_PROTO(zilog_t *zilog, itx_t *itx),
157 TP_ARGS(zilog, itx),
49ee64e5 158 TP_STRUCT__entry(
1ce23dca
PS
159 ZILOG_TP_STRUCT_ENTRY
160 ITX_TP_STRUCT_ENTRY
49ee64e5
NB
161 ),
162 TP_fast_assign(
1ce23dca
PS
163 ZILOG_TP_FAST_ASSIGN
164 ITX_TP_FAST_ASSIGN
49ee64e5 165 ),
1ce23dca
PS
166 TP_printk(
167 ZILOG_TP_PRINTK_FMT " " ITX_TP_PRINTK_FMT,
168 ZILOG_TP_PRINTK_ARGS, ITX_TP_PRINTK_ARGS)
49ee64e5 169);
02730c33 170/* END CSTYLED */
49ee64e5 171
4ea3f864 172/* BEGIN CSTYLED */
1ce23dca
PS
173#define DEFINE_ZIL_PROCESS_ITX_EVENT(name) \
174DEFINE_EVENT(zfs_zil_process_itx_class, name, \
175 TP_PROTO(zilog_t *zilog, itx_t *itx), \
176 TP_ARGS(zilog, itx))
177DEFINE_ZIL_PROCESS_ITX_EVENT(zfs_zil__process__commit__itx);
178DEFINE_ZIL_PROCESS_ITX_EVENT(zfs_zil__process__normal__itx);
179/* END CSTYLED */
180
181/*
182 * Generic support for two argument tracepoints of the form:
183 *
184 * DTRACE_PROBE2(...,
185 * zilog_t *, ...,
186 * zil_commit_waiter_t *, ...);
187 */
188/* BEGIN CSTYLED */
189DECLARE_EVENT_CLASS(zfs_zil_commit_io_error_class,
190 TP_PROTO(zilog_t *zilog, zil_commit_waiter_t *zcw),
191 TP_ARGS(zilog, zcw),
192 TP_STRUCT__entry(
193 ZILOG_TP_STRUCT_ENTRY
194 ZCW_TP_STRUCT_ENTRY
195 ),
196 TP_fast_assign(
197 ZILOG_TP_FAST_ASSIGN
198 ZCW_TP_FAST_ASSIGN
199 ),
200 TP_printk(
201 ZILOG_TP_PRINTK_FMT " " ZCW_TP_PRINTK_FMT,
202 ZILOG_TP_PRINTK_ARGS, ZCW_TP_PRINTK_ARGS)
203);
204
205/* BEGIN CSTYLED */
206#define DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(name) \
207DEFINE_EVENT(zfs_zil_commit_io_error_class, name, \
208 TP_PROTO(zilog_t *zilog, zil_commit_waiter_t *zcw), \
209 TP_ARGS(zilog, zcw))
210DEFINE_ZIL_COMMIT_IO_ERROR_EVENT(zfs_zil__commit__io__error);
4ea3f864 211/* END CSTYLED */
49ee64e5
NB
212
213#endif /* _TRACE_ZIL_H */
214
215#undef TRACE_INCLUDE_PATH
216#undef TRACE_INCLUDE_FILE
217#define TRACE_INCLUDE_PATH sys
218#define TRACE_INCLUDE_FILE trace_zil
219#include <trace/define_trace.h>
220
221#endif /* _KERNEL && HAVE_DECLARE_EVENT_CLASS */