]> git.proxmox.com Git - mirror_zfs.git/blame - include/os/linux/zfs/sys/trace_arc.h
Clean up CSTYLEDs
[mirror_zfs.git] / include / os / linux / zfs / sys / trace_arc.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#include <sys/list.h>
23
cb709642
BL
24#if defined(_KERNEL)
25#if defined(HAVE_DECLARE_EVENT_CLASS)
49ee64e5
NB
26
27#undef TRACE_SYSTEM
28#define TRACE_SYSTEM zfs
29
c1718e95
FV
30#undef TRACE_SYSTEM_VAR
31#define TRACE_SYSTEM_VAR zfs_arc
32
49ee64e5
NB
33#if !defined(_TRACE_ARC_H) || defined(TRACE_HEADER_MULTI_READ)
34#define _TRACE_ARC_H
35
36#include <linux/tracepoint.h>
37#include <sys/types.h>
26ef0cc7 38#include <sys/trace_common.h> /* For ZIO macros */
49ee64e5
NB
39
40/*
41 * Generic support for one argument tracepoints of the form:
42 *
43 * DTRACE_PROBE1(...,
44 * arc_buf_hdr_t *, ...);
45 */
02730c33 46/* BEGIN CSTYLED */
49ee64e5
NB
47DECLARE_EVENT_CLASS(zfs_arc_buf_hdr_class,
48 TP_PROTO(arc_buf_hdr_t *ab),
49 TP_ARGS(ab),
50 TP_STRUCT__entry(
51 __array(uint64_t, hdr_dva_word, 2)
52 __field(uint64_t, hdr_birth)
49ee64e5 53 __field(uint32_t, hdr_flags)
d3c2ae1c 54 __field(uint32_t, hdr_bufcnt)
49ee64e5 55 __field(arc_buf_contents_t, hdr_type)
d3c2ae1c
GW
56 __field(uint16_t, hdr_psize)
57 __field(uint16_t, hdr_lsize)
49ee64e5
NB
58 __field(uint64_t, hdr_spa)
59 __field(arc_state_type_t, hdr_state_type)
60 __field(clock_t, hdr_access)
61 __field(uint32_t, hdr_mru_hits)
62 __field(uint32_t, hdr_mru_ghost_hits)
63 __field(uint32_t, hdr_mfu_hits)
64 __field(uint32_t, hdr_mfu_ghost_hits)
65 __field(uint32_t, hdr_l2_hits)
66 __field(int64_t, hdr_refcount)
67 ),
68 TP_fast_assign(
69 __entry->hdr_dva_word[0] = ab->b_dva.dva_word[0];
70 __entry->hdr_dva_word[1] = ab->b_dva.dva_word[1];
71 __entry->hdr_birth = ab->b_birth;
49ee64e5 72 __entry->hdr_flags = ab->b_flags;
d3c2ae1c
GW
73 __entry->hdr_bufcnt = ab->b_l1hdr.b_bufcnt;
74 __entry->hdr_psize = ab->b_psize;
75 __entry->hdr_lsize = ab->b_lsize;
49ee64e5 76 __entry->hdr_spa = ab->b_spa;
b9541d6b
CW
77 __entry->hdr_state_type = ab->b_l1hdr.b_state->arcs_state;
78 __entry->hdr_access = ab->b_l1hdr.b_arc_access;
79 __entry->hdr_mru_hits = ab->b_l1hdr.b_mru_hits;
80 __entry->hdr_mru_ghost_hits = ab->b_l1hdr.b_mru_ghost_hits;
81 __entry->hdr_mfu_hits = ab->b_l1hdr.b_mfu_hits;
82 __entry->hdr_mfu_ghost_hits = ab->b_l1hdr.b_mfu_ghost_hits;
cfe8e960 83 __entry->hdr_l2_hits = ab->b_l2hdr.b_hits;
b9541d6b 84 __entry->hdr_refcount = ab->b_l1hdr.b_refcnt.rc_count;
49ee64e5 85 ),
b9541d6b 86 TP_printk("hdr { dva 0x%llx:0x%llx birth %llu "
d3c2ae1c 87 "flags 0x%x bufcnt %u type %u psize %u lsize %u spa %llu "
49ee64e5
NB
88 "state_type %u access %lu mru_hits %u mru_ghost_hits %u "
89 "mfu_hits %u mfu_ghost_hits %u l2_hits %u refcount %lli }",
90 __entry->hdr_dva_word[0], __entry->hdr_dva_word[1],
b9541d6b 91 __entry->hdr_birth, __entry->hdr_flags,
d3c2ae1c
GW
92 __entry->hdr_bufcnt, __entry->hdr_type, __entry->hdr_psize,
93 __entry->hdr_lsize, __entry->hdr_spa, __entry->hdr_state_type,
49ee64e5
NB
94 __entry->hdr_access, __entry->hdr_mru_hits,
95 __entry->hdr_mru_ghost_hits, __entry->hdr_mfu_hits,
96 __entry->hdr_mfu_ghost_hits, __entry->hdr_l2_hits,
97 __entry->hdr_refcount)
98);
02730c33 99/* END CSTYLED */
49ee64e5 100
e82dbae1 101#define DEFINE_ARC_BUF_HDR_EVENT(name) \
49ee64e5 102DEFINE_EVENT(zfs_arc_buf_hdr_class, name, \
7ada752a
AZ
103 TP_PROTO(arc_buf_hdr_t *ab), \
104 TP_ARGS(ab))
49ee64e5
NB
105DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__hit);
106DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__evict);
107DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__delete);
108DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mru);
109DEFINE_ARC_BUF_HDR_EVENT(zfs_new_state__mfu);
a8b2e306 110DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__async__upgrade__sync);
7f60329a 111DEFINE_ARC_BUF_HDR_EVENT(zfs_arc__demand__hit__predictive__prefetch);
49ee64e5
NB
112DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__hit);
113DEFINE_ARC_BUF_HDR_EVENT(zfs_l2arc__miss);
114
115/*
116 * Generic support for two argument tracepoints of the form:
117 *
118 * DTRACE_PROBE2(...,
119 * vdev_t *, ...,
120 * zio_t *, ...);
121 */
02730c33 122/* BEGIN CSTYLED */
49ee64e5
NB
123DECLARE_EVENT_CLASS(zfs_l2arc_rw_class,
124 TP_PROTO(vdev_t *vd, zio_t *zio),
125 TP_ARGS(vd, zio),
126 TP_STRUCT__entry(
127 __field(uint64_t, vdev_id)
128 __field(uint64_t, vdev_guid)
129 __field(uint64_t, vdev_state)
130 ZIO_TP_STRUCT_ENTRY
131 ),
132 TP_fast_assign(
133 __entry->vdev_id = vd->vdev_id;
134 __entry->vdev_guid = vd->vdev_guid;
135 __entry->vdev_state = vd->vdev_state;
136 ZIO_TP_FAST_ASSIGN
137 ),
138 TP_printk("vdev { id %llu guid %llu state %llu } "
139 ZIO_TP_PRINTK_FMT, __entry->vdev_id, __entry->vdev_guid,
140 __entry->vdev_state, ZIO_TP_PRINTK_ARGS)
141);
02730c33 142/* END CSTYLED */
49ee64e5 143
e82dbae1 144#define DEFINE_L2ARC_RW_EVENT(name) \
49ee64e5 145DEFINE_EVENT(zfs_l2arc_rw_class, name, \
7ada752a
AZ
146 TP_PROTO(vdev_t *vd, zio_t *zio), \
147 TP_ARGS(vd, zio))
49ee64e5
NB
148DEFINE_L2ARC_RW_EVENT(zfs_l2arc__read);
149DEFINE_L2ARC_RW_EVENT(zfs_l2arc__write);
150
151
152/*
153 * Generic support for two argument tracepoints of the form:
154 *
155 * DTRACE_PROBE2(...,
156 * zio_t *, ...,
157 * l2arc_write_callback_t *, ...);
158 */
02730c33 159/* BEGIN CSTYLED */
49ee64e5
NB
160DECLARE_EVENT_CLASS(zfs_l2arc_iodone_class,
161 TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb),
162 TP_ARGS(zio, cb),
163 TP_STRUCT__entry(ZIO_TP_STRUCT_ENTRY),
164 TP_fast_assign(ZIO_TP_FAST_ASSIGN),
165 TP_printk(ZIO_TP_PRINTK_FMT, ZIO_TP_PRINTK_ARGS)
166);
02730c33 167/* END CSTYLED */
49ee64e5 168
e82dbae1 169#define DEFINE_L2ARC_IODONE_EVENT(name) \
49ee64e5 170DEFINE_EVENT(zfs_l2arc_iodone_class, name, \
7ada752a
AZ
171 TP_PROTO(zio_t *zio, l2arc_write_callback_t *cb), \
172 TP_ARGS(zio, cb))
49ee64e5
NB
173DEFINE_L2ARC_IODONE_EVENT(zfs_l2arc__iodone);
174
175
176/*
177 * Generic support for four argument tracepoints of the form:
178 *
179 * DTRACE_PROBE4(...,
180 * arc_buf_hdr_t *, ...,
181 * const blkptr_t *,
182 * uint64_t,
183 * const zbookmark_phys_t *);
184 */
02730c33 185/* BEGIN CSTYLED */
49ee64e5
NB
186DECLARE_EVENT_CLASS(zfs_arc_miss_class,
187 TP_PROTO(arc_buf_hdr_t *hdr,
188 const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb),
189 TP_ARGS(hdr, bp, size, zb),
190 TP_STRUCT__entry(
191 __array(uint64_t, hdr_dva_word, 2)
192 __field(uint64_t, hdr_birth)
49ee64e5 193 __field(uint32_t, hdr_flags)
d3c2ae1c 194 __field(uint32_t, hdr_bufcnt)
49ee64e5 195 __field(arc_buf_contents_t, hdr_type)
d3c2ae1c
GW
196 __field(uint16_t, hdr_psize)
197 __field(uint16_t, hdr_lsize)
49ee64e5
NB
198 __field(uint64_t, hdr_spa)
199 __field(arc_state_type_t, hdr_state_type)
200 __field(clock_t, hdr_access)
201 __field(uint32_t, hdr_mru_hits)
202 __field(uint32_t, hdr_mru_ghost_hits)
203 __field(uint32_t, hdr_mfu_hits)
204 __field(uint32_t, hdr_mfu_ghost_hits)
205 __field(uint32_t, hdr_l2_hits)
206 __field(int64_t, hdr_refcount)
207
208 __array(uint64_t, bp_dva0, 2)
209 __array(uint64_t, bp_dva1, 2)
210 __array(uint64_t, bp_dva2, 2)
211 __array(uint64_t, bp_cksum, 4)
212
213 __field(uint64_t, bp_lsize)
214
215 __field(uint64_t, zb_objset)
216 __field(uint64_t, zb_object)
217 __field(int64_t, zb_level)
218 __field(uint64_t, zb_blkid)
219 ),
220 TP_fast_assign(
221 __entry->hdr_dva_word[0] = hdr->b_dva.dva_word[0];
222 __entry->hdr_dva_word[1] = hdr->b_dva.dva_word[1];
223 __entry->hdr_birth = hdr->b_birth;
49ee64e5 224 __entry->hdr_flags = hdr->b_flags;
d3c2ae1c
GW
225 __entry->hdr_bufcnt = hdr->b_l1hdr.b_bufcnt;
226 __entry->hdr_psize = hdr->b_psize;
227 __entry->hdr_lsize = hdr->b_lsize;
49ee64e5 228 __entry->hdr_spa = hdr->b_spa;
b9541d6b
CW
229 __entry->hdr_state_type = hdr->b_l1hdr.b_state->arcs_state;
230 __entry->hdr_access = hdr->b_l1hdr.b_arc_access;
231 __entry->hdr_mru_hits = hdr->b_l1hdr.b_mru_hits;
232 __entry->hdr_mru_ghost_hits = hdr->b_l1hdr.b_mru_ghost_hits;
233 __entry->hdr_mfu_hits = hdr->b_l1hdr.b_mfu_hits;
234 __entry->hdr_mfu_ghost_hits = hdr->b_l1hdr.b_mfu_ghost_hits;
cfe8e960 235 __entry->hdr_l2_hits = hdr->b_l2hdr.b_hits;
b9541d6b 236 __entry->hdr_refcount = hdr->b_l1hdr.b_refcnt.rc_count;
49ee64e5
NB
237
238 __entry->bp_dva0[0] = bp->blk_dva[0].dva_word[0];
239 __entry->bp_dva0[1] = bp->blk_dva[0].dva_word[1];
240 __entry->bp_dva1[0] = bp->blk_dva[1].dva_word[0];
241 __entry->bp_dva1[1] = bp->blk_dva[1].dva_word[1];
242 __entry->bp_dva2[0] = bp->blk_dva[2].dva_word[0];
243 __entry->bp_dva2[1] = bp->blk_dva[2].dva_word[1];
244 __entry->bp_cksum[0] = bp->blk_cksum.zc_word[0];
245 __entry->bp_cksum[1] = bp->blk_cksum.zc_word[1];
246 __entry->bp_cksum[2] = bp->blk_cksum.zc_word[2];
247 __entry->bp_cksum[3] = bp->blk_cksum.zc_word[3];
248
249 __entry->bp_lsize = size;
250
251 __entry->zb_objset = zb->zb_objset;
252 __entry->zb_object = zb->zb_object;
253 __entry->zb_level = zb->zb_level;
254 __entry->zb_blkid = zb->zb_blkid;
255 ),
b9541d6b 256 TP_printk("hdr { dva 0x%llx:0x%llx birth %llu "
d3c2ae1c 257 "flags 0x%x bufcnt %u psize %u lsize %u spa %llu state_type %u "
49ee64e5
NB
258 "access %lu mru_hits %u mru_ghost_hits %u mfu_hits %u "
259 "mfu_ghost_hits %u l2_hits %u refcount %lli } "
260 "bp { dva0 0x%llx:0x%llx dva1 0x%llx:0x%llx dva2 "
261 "0x%llx:0x%llx cksum 0x%llx:0x%llx:0x%llx:0x%llx "
262 "lsize %llu } zb { objset %llu object %llu level %lli "
263 "blkid %llu }",
264 __entry->hdr_dva_word[0], __entry->hdr_dva_word[1],
b9541d6b 265 __entry->hdr_birth, __entry->hdr_flags,
d3c2ae1c 266 __entry->hdr_bufcnt, __entry->hdr_psize, __entry->hdr_lsize,
49ee64e5
NB
267 __entry->hdr_spa, __entry->hdr_state_type, __entry->hdr_access,
268 __entry->hdr_mru_hits, __entry->hdr_mru_ghost_hits,
269 __entry->hdr_mfu_hits, __entry->hdr_mfu_ghost_hits,
270 __entry->hdr_l2_hits, __entry->hdr_refcount,
271 __entry->bp_dva0[0], __entry->bp_dva0[1],
272 __entry->bp_dva1[0], __entry->bp_dva1[1],
273 __entry->bp_dva2[0], __entry->bp_dva2[1],
274 __entry->bp_cksum[0], __entry->bp_cksum[1],
275 __entry->bp_cksum[2], __entry->bp_cksum[3],
276 __entry->bp_lsize, __entry->zb_objset, __entry->zb_object,
277 __entry->zb_level, __entry->zb_blkid)
278);
02730c33 279/* END CSTYLED */
49ee64e5 280
e82dbae1 281#define DEFINE_ARC_MISS_EVENT(name) \
49ee64e5 282DEFINE_EVENT(zfs_arc_miss_class, name, \
7ada752a
AZ
283 TP_PROTO(arc_buf_hdr_t *hdr, \
284 const blkptr_t *bp, uint64_t size, const zbookmark_phys_t *zb), \
285 TP_ARGS(hdr, bp, size, zb))
49ee64e5
NB
286DEFINE_ARC_MISS_EVENT(zfs_arc__miss);
287
288/*
289 * Generic support for four argument tracepoints of the form:
290 *
291 * DTRACE_PROBE4(...,
292 * l2arc_dev_t *, ...,
293 * list_t *, ...,
294 * uint64_t, ...,
295 * boolean_t, ...);
296 */
02730c33 297/* BEGIN CSTYLED */
49ee64e5
NB
298DECLARE_EVENT_CLASS(zfs_l2arc_evict_class,
299 TP_PROTO(l2arc_dev_t *dev,
300 list_t *buflist, uint64_t taddr, boolean_t all),
301 TP_ARGS(dev, buflist, taddr, all),
302 TP_STRUCT__entry(
303 __field(uint64_t, vdev_id)
304 __field(uint64_t, vdev_guid)
305 __field(uint64_t, vdev_state)
306
307 __field(uint64_t, l2ad_hand)
308 __field(uint64_t, l2ad_start)
309 __field(uint64_t, l2ad_end)
49ee64e5
NB
310 __field(boolean_t, l2ad_first)
311 __field(boolean_t, l2ad_writing)
312
313 __field(uint64_t, taddr)
314 __field(boolean_t, all)
315 ),
316 TP_fast_assign(
317 __entry->vdev_id = dev->l2ad_vdev->vdev_id;
318 __entry->vdev_guid = dev->l2ad_vdev->vdev_guid;
319 __entry->vdev_state = dev->l2ad_vdev->vdev_state;
320
321 __entry->l2ad_hand = dev->l2ad_hand;
322 __entry->l2ad_start = dev->l2ad_start;
323 __entry->l2ad_end = dev->l2ad_end;
49ee64e5
NB
324 __entry->l2ad_first = dev->l2ad_first;
325 __entry->l2ad_writing = dev->l2ad_writing;
326
327 __entry->taddr = taddr;
328 __entry->all = all;
329 ),
330 TP_printk("l2ad { vdev { id %llu guid %llu state %llu } "
84045c2d 331 "hand %llu start %llu end %llu "
49ee64e5
NB
332 "first %d writing %d } taddr %llu all %d",
333 __entry->vdev_id, __entry->vdev_guid, __entry->vdev_state,
334 __entry->l2ad_hand, __entry->l2ad_start,
84045c2d 335 __entry->l2ad_end, __entry->l2ad_first, __entry->l2ad_writing,
49ee64e5
NB
336 __entry->taddr, __entry->all)
337);
02730c33 338/* END CSTYLED */
49ee64e5 339
e82dbae1 340#define DEFINE_L2ARC_EVICT_EVENT(name) \
49ee64e5 341DEFINE_EVENT(zfs_l2arc_evict_class, name, \
7ada752a
AZ
342 TP_PROTO(l2arc_dev_t *dev, list_t *buflist, uint64_t taddr, boolean_t all),\
343 TP_ARGS(dev, buflist, taddr, all))
49ee64e5
NB
344DEFINE_L2ARC_EVICT_EVENT(zfs_l2arc__evict);
345
3442c2a0
MA
346/*
347 * Generic support for three argument tracepoints of the form:
348 *
349 * DTRACE_PROBE3(...,
350 * uint64_t, ...,
351 * uint64_t, ...,
352 * uint64_t, ...);
353 */
354/* BEGIN CSTYLED */
355DECLARE_EVENT_CLASS(zfs_arc_wait_for_eviction_class,
356 TP_PROTO(uint64_t amount, uint64_t arc_evict_count, uint64_t aew_count),
357 TP_ARGS(amount, arc_evict_count, aew_count),
358 TP_STRUCT__entry(
359 __field(uint64_t, amount)
360 __field(uint64_t, arc_evict_count)
361 __field(uint64_t, aew_count)
362 ),
363 TP_fast_assign(
364 __entry->amount = amount;
365 __entry->arc_evict_count = arc_evict_count;
366 __entry->aew_count = aew_count;
367 ),
368 TP_printk("amount %llu arc_evict_count %llu aew_count %llu",
369 __entry->amount, __entry->arc_evict_count, __entry->aew_count)
370);
371/* END CSTYLED */
372
3442c2a0
MA
373#define DEFINE_ARC_WAIT_FOR_EVICTION_EVENT(name) \
374DEFINE_EVENT(zfs_arc_wait_for_eviction_class, name, \
7ada752a
AZ
375 TP_PROTO(uint64_t amount, uint64_t arc_evict_count, uint64_t aew_count), \
376 TP_ARGS(amount, arc_evict_count, aew_count))
3442c2a0
MA
377DEFINE_ARC_WAIT_FOR_EVICTION_EVENT(zfs_arc__wait__for__eviction);
378
49ee64e5
NB
379#endif /* _TRACE_ARC_H */
380
381#undef TRACE_INCLUDE_PATH
382#undef TRACE_INCLUDE_FILE
383#define TRACE_INCLUDE_PATH sys
384#define TRACE_INCLUDE_FILE trace_arc
385#include <trace/define_trace.h>
386
cb709642
BL
387#else
388
389DEFINE_DTRACE_PROBE1(arc__hit);
390DEFINE_DTRACE_PROBE1(arc__evict);
391DEFINE_DTRACE_PROBE1(arc__delete);
392DEFINE_DTRACE_PROBE1(new_state__mru);
393DEFINE_DTRACE_PROBE1(new_state__mfu);
394DEFINE_DTRACE_PROBE1(arc__async__upgrade__sync);
395DEFINE_DTRACE_PROBE1(arc__demand__hit__predictive__prefetch);
396DEFINE_DTRACE_PROBE1(l2arc__hit);
397DEFINE_DTRACE_PROBE1(l2arc__miss);
398DEFINE_DTRACE_PROBE2(l2arc__read);
399DEFINE_DTRACE_PROBE2(l2arc__write);
400DEFINE_DTRACE_PROBE2(l2arc__iodone);
3442c2a0 401DEFINE_DTRACE_PROBE3(arc__wait__for__eviction);
cb709642
BL
402DEFINE_DTRACE_PROBE4(arc__miss);
403DEFINE_DTRACE_PROBE4(l2arc__evict);
404
405#endif /* HAVE_DECLARE_EVENT_CLASS */
406#endif /* _KERNEL */