xref: /openbmc/linux/fs/xfs/xfs_trace.h (revision 17e5530a)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2009, Christoph Hellwig
4  * All Rights Reserved.
5  *
6  * NOTE: none of these tracepoints shall be considered a stable kernel ABI
7  * as they can change at any time.
8  *
9  * Current conventions for printing numbers measuring specific units:
10  *
11  * agno: allocation group number
12  *
13  * agino: per-AG inode number
14  * ino: filesystem inode number
15  *
16  * agbno: per-AG block number in fs blocks
17  * startblock: physical block number for file mappings.  This is either a
18  *             segmented fsblock for data device mappings, or a rfsblock
19  *             for realtime device mappings
20  * fsbcount: number of blocks in an extent, in fs blocks
21  *
22  * daddr: physical block number in 512b blocks
23  * bbcount: number of blocks in a physical extent, in 512b blocks
24  *
25  * rtx: physical rt extent number for extent mappings
26  * rtxcount: number of rt extents in an extent mapping
27  *
28  * owner: reverse-mapping owner, usually inodes
29  *
30  * fileoff: file offset, in fs blocks
31  * pos: file offset, in bytes
32  * bytecount: number of bytes
33  *
34  * disize: ondisk file size, in bytes
35  * isize: incore file size, in bytes
36  *
37  * forkoff: inode fork offset, in bytes
38  *
39  * ireccount: number of inode records
40  *
41  * Numbers describing space allocations (blocks, extents, inodes) should be
42  * formatted in hexadecimal.
43  */
44 #undef TRACE_SYSTEM
45 #define TRACE_SYSTEM xfs
46 
47 #if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
48 #define _TRACE_XFS_H
49 
50 #include <linux/tracepoint.h>
51 
52 struct xfs_agf;
53 struct xfs_alloc_arg;
54 struct xfs_attr_list_context;
55 struct xfs_buf_log_item;
56 struct xfs_da_args;
57 struct xfs_da_node_entry;
58 struct xfs_dquot;
59 struct xfs_log_item;
60 struct xlog;
61 struct xlog_ticket;
62 struct xlog_recover;
63 struct xlog_recover_item;
64 struct xlog_rec_header;
65 struct xlog_in_core;
66 struct xfs_buf_log_format;
67 struct xfs_inode_log_format;
68 struct xfs_bmbt_irec;
69 struct xfs_btree_cur;
70 struct xfs_refcount_irec;
71 struct xfs_fsmap;
72 struct xfs_rmap_irec;
73 struct xfs_icreate_log;
74 struct xfs_owner_info;
75 struct xfs_trans_res;
76 struct xfs_inobt_rec_incore;
77 union xfs_btree_ptr;
78 struct xfs_dqtrx;
79 struct xfs_icwalk;
80 struct xfs_perag;
81 
82 #define XFS_ATTR_FILTER_FLAGS \
83 	{ XFS_ATTR_ROOT,	"ROOT" }, \
84 	{ XFS_ATTR_SECURE,	"SECURE" }, \
85 	{ XFS_ATTR_INCOMPLETE,	"INCOMPLETE" }
86 
87 DECLARE_EVENT_CLASS(xfs_attr_list_class,
88 	TP_PROTO(struct xfs_attr_list_context *ctx),
89 	TP_ARGS(ctx),
90 	TP_STRUCT__entry(
91 		__field(dev_t, dev)
92 		__field(xfs_ino_t, ino)
93 		__field(u32, hashval)
94 		__field(u32, blkno)
95 		__field(u32, offset)
96 		__field(void *, buffer)
97 		__field(int, bufsize)
98 		__field(int, count)
99 		__field(int, firstu)
100 		__field(int, dupcnt)
101 		__field(unsigned int, attr_filter)
102 	),
103 	TP_fast_assign(
104 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
105 		__entry->ino = ctx->dp->i_ino;
106 		__entry->hashval = ctx->cursor.hashval;
107 		__entry->blkno = ctx->cursor.blkno;
108 		__entry->offset = ctx->cursor.offset;
109 		__entry->buffer = ctx->buffer;
110 		__entry->bufsize = ctx->bufsize;
111 		__entry->count = ctx->count;
112 		__entry->firstu = ctx->firstu;
113 		__entry->attr_filter = ctx->attr_filter;
114 	),
115 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
116 		  "buffer %p size %u count %u firstu %u filter %s",
117 		  MAJOR(__entry->dev), MINOR(__entry->dev),
118 		   __entry->ino,
119 		   __entry->hashval,
120 		   __entry->blkno,
121 		   __entry->offset,
122 		   __entry->dupcnt,
123 		   __entry->buffer,
124 		   __entry->bufsize,
125 		   __entry->count,
126 		   __entry->firstu,
127 		   __print_flags(__entry->attr_filter, "|",
128 				 XFS_ATTR_FILTER_FLAGS)
129 	)
130 )
131 
132 #define DEFINE_ATTR_LIST_EVENT(name) \
133 DEFINE_EVENT(xfs_attr_list_class, name, \
134 	TP_PROTO(struct xfs_attr_list_context *ctx), \
135 	TP_ARGS(ctx))
136 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
137 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
138 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
139 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
140 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
141 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
142 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
143 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
144 DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
145 DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
146 
147 TRACE_EVENT(xlog_intent_recovery_failed,
148 	TP_PROTO(struct xfs_mount *mp, int error, void *function),
149 	TP_ARGS(mp, error, function),
150 	TP_STRUCT__entry(
151 		__field(dev_t, dev)
152 		__field(int, error)
153 		__field(void *, function)
154 	),
155 	TP_fast_assign(
156 		__entry->dev = mp->m_super->s_dev;
157 		__entry->error = error;
158 		__entry->function = function;
159 	),
160 	TP_printk("dev %d:%d error %d function %pS",
161 		  MAJOR(__entry->dev), MINOR(__entry->dev),
162 		  __entry->error, __entry->function)
163 );
164 
165 DECLARE_EVENT_CLASS(xfs_perag_class,
166 	TP_PROTO(struct xfs_perag *pag, unsigned long caller_ip),
167 	TP_ARGS(pag, caller_ip),
168 	TP_STRUCT__entry(
169 		__field(dev_t, dev)
170 		__field(xfs_agnumber_t, agno)
171 		__field(int, refcount)
172 		__field(int, active_refcount)
173 		__field(unsigned long, caller_ip)
174 	),
175 	TP_fast_assign(
176 		__entry->dev = pag->pag_mount->m_super->s_dev;
177 		__entry->agno = pag->pag_agno;
178 		__entry->refcount = atomic_read(&pag->pag_ref);
179 		__entry->active_refcount = atomic_read(&pag->pag_active_ref);
180 		__entry->caller_ip = caller_ip;
181 	),
182 	TP_printk("dev %d:%d agno 0x%x passive refs %d active refs %d caller %pS",
183 		  MAJOR(__entry->dev), MINOR(__entry->dev),
184 		  __entry->agno,
185 		  __entry->refcount,
186 		  __entry->active_refcount,
187 		  (char *)__entry->caller_ip)
188 );
189 
190 #define DEFINE_PERAG_REF_EVENT(name)	\
191 DEFINE_EVENT(xfs_perag_class, name,	\
192 	TP_PROTO(struct xfs_perag *pag, unsigned long caller_ip), \
193 	TP_ARGS(pag, caller_ip))
194 DEFINE_PERAG_REF_EVENT(xfs_perag_get);
195 DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
196 DEFINE_PERAG_REF_EVENT(xfs_perag_hold);
197 DEFINE_PERAG_REF_EVENT(xfs_perag_put);
198 DEFINE_PERAG_REF_EVENT(xfs_perag_grab);
199 DEFINE_PERAG_REF_EVENT(xfs_perag_grab_tag);
200 DEFINE_PERAG_REF_EVENT(xfs_perag_rele);
201 DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
202 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
203 
204 TRACE_EVENT(xfs_inodegc_worker,
205 	TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
206 	TP_ARGS(mp, shrinker_hits),
207 	TP_STRUCT__entry(
208 		__field(dev_t, dev)
209 		__field(unsigned int, shrinker_hits)
210 	),
211 	TP_fast_assign(
212 		__entry->dev = mp->m_super->s_dev;
213 		__entry->shrinker_hits = shrinker_hits;
214 	),
215 	TP_printk("dev %d:%d shrinker_hits %u",
216 		  MAJOR(__entry->dev), MINOR(__entry->dev),
217 		  __entry->shrinker_hits)
218 );
219 
220 DECLARE_EVENT_CLASS(xfs_fs_class,
221 	TP_PROTO(struct xfs_mount *mp, void *caller_ip),
222 	TP_ARGS(mp, caller_ip),
223 	TP_STRUCT__entry(
224 		__field(dev_t, dev)
225 		__field(unsigned long long, mflags)
226 		__field(unsigned long, opstate)
227 		__field(unsigned long, sbflags)
228 		__field(void *, caller_ip)
229 	),
230 	TP_fast_assign(
231 		if (mp) {
232 			__entry->dev = mp->m_super->s_dev;
233 			__entry->mflags = mp->m_features;
234 			__entry->opstate = mp->m_opstate;
235 			__entry->sbflags = mp->m_super->s_flags;
236 		}
237 		__entry->caller_ip = caller_ip;
238 	),
239 	TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
240 		  MAJOR(__entry->dev), MINOR(__entry->dev),
241 		  __entry->mflags,
242 		  __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
243 		  __entry->sbflags,
244 		  __entry->caller_ip)
245 );
246 
247 #define DEFINE_FS_EVENT(name)	\
248 DEFINE_EVENT(xfs_fs_class, name,					\
249 	TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
250 	TP_ARGS(mp, caller_ip))
251 DEFINE_FS_EVENT(xfs_inodegc_flush);
252 DEFINE_FS_EVENT(xfs_inodegc_push);
253 DEFINE_FS_EVENT(xfs_inodegc_start);
254 DEFINE_FS_EVENT(xfs_inodegc_stop);
255 DEFINE_FS_EVENT(xfs_inodegc_queue);
256 DEFINE_FS_EVENT(xfs_inodegc_throttle);
257 DEFINE_FS_EVENT(xfs_fs_sync_fs);
258 DEFINE_FS_EVENT(xfs_blockgc_start);
259 DEFINE_FS_EVENT(xfs_blockgc_stop);
260 DEFINE_FS_EVENT(xfs_blockgc_worker);
261 DEFINE_FS_EVENT(xfs_blockgc_flush_all);
262 
263 TRACE_EVENT(xfs_inodegc_shrinker_scan,
264 	TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
265 		 void *caller_ip),
266 	TP_ARGS(mp, sc, caller_ip),
267 	TP_STRUCT__entry(
268 		__field(dev_t, dev)
269 		__field(unsigned long, nr_to_scan)
270 		__field(void *, caller_ip)
271 	),
272 	TP_fast_assign(
273 		__entry->dev = mp->m_super->s_dev;
274 		__entry->nr_to_scan = sc->nr_to_scan;
275 		__entry->caller_ip = caller_ip;
276 	),
277 	TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
278 		  MAJOR(__entry->dev), MINOR(__entry->dev),
279 		  __entry->nr_to_scan,
280 		  __entry->caller_ip)
281 );
282 
283 DECLARE_EVENT_CLASS(xfs_ag_class,
284 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
285 	TP_ARGS(mp, agno),
286 	TP_STRUCT__entry(
287 		__field(dev_t, dev)
288 		__field(xfs_agnumber_t, agno)
289 	),
290 	TP_fast_assign(
291 		__entry->dev = mp->m_super->s_dev;
292 		__entry->agno = agno;
293 	),
294 	TP_printk("dev %d:%d agno 0x%x",
295 		  MAJOR(__entry->dev), MINOR(__entry->dev),
296 		  __entry->agno)
297 );
298 #define DEFINE_AG_EVENT(name)	\
299 DEFINE_EVENT(xfs_ag_class, name,	\
300 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),	\
301 	TP_ARGS(mp, agno))
302 
303 DEFINE_AG_EVENT(xfs_read_agf);
304 DEFINE_AG_EVENT(xfs_alloc_read_agf);
305 DEFINE_AG_EVENT(xfs_read_agi);
306 DEFINE_AG_EVENT(xfs_ialloc_read_agi);
307 
308 TRACE_EVENT(xfs_attr_list_node_descend,
309 	TP_PROTO(struct xfs_attr_list_context *ctx,
310 		 struct xfs_da_node_entry *btree),
311 	TP_ARGS(ctx, btree),
312 	TP_STRUCT__entry(
313 		__field(dev_t, dev)
314 		__field(xfs_ino_t, ino)
315 		__field(u32, hashval)
316 		__field(u32, blkno)
317 		__field(u32, offset)
318 		__field(void *, buffer)
319 		__field(int, bufsize)
320 		__field(int, count)
321 		__field(int, firstu)
322 		__field(int, dupcnt)
323 		__field(unsigned int, attr_filter)
324 		__field(u32, bt_hashval)
325 		__field(u32, bt_before)
326 	),
327 	TP_fast_assign(
328 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
329 		__entry->ino = ctx->dp->i_ino;
330 		__entry->hashval = ctx->cursor.hashval;
331 		__entry->blkno = ctx->cursor.blkno;
332 		__entry->offset = ctx->cursor.offset;
333 		__entry->buffer = ctx->buffer;
334 		__entry->bufsize = ctx->bufsize;
335 		__entry->count = ctx->count;
336 		__entry->firstu = ctx->firstu;
337 		__entry->attr_filter = ctx->attr_filter;
338 		__entry->bt_hashval = be32_to_cpu(btree->hashval);
339 		__entry->bt_before = be32_to_cpu(btree->before);
340 	),
341 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
342 		  "buffer %p size %u count %u firstu %u filter %s "
343 		  "node hashval %u, node before %u",
344 		  MAJOR(__entry->dev), MINOR(__entry->dev),
345 		   __entry->ino,
346 		   __entry->hashval,
347 		   __entry->blkno,
348 		   __entry->offset,
349 		   __entry->dupcnt,
350 		   __entry->buffer,
351 		   __entry->bufsize,
352 		   __entry->count,
353 		   __entry->firstu,
354 		   __print_flags(__entry->attr_filter, "|",
355 				 XFS_ATTR_FILTER_FLAGS),
356 		   __entry->bt_hashval,
357 		   __entry->bt_before)
358 );
359 
360 DECLARE_EVENT_CLASS(xfs_bmap_class,
361 	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
362 		 unsigned long caller_ip),
363 	TP_ARGS(ip, cur, state, caller_ip),
364 	TP_STRUCT__entry(
365 		__field(dev_t, dev)
366 		__field(xfs_ino_t, ino)
367 		__field(void *, leaf)
368 		__field(int, pos)
369 		__field(xfs_fileoff_t, startoff)
370 		__field(xfs_fsblock_t, startblock)
371 		__field(xfs_filblks_t, blockcount)
372 		__field(xfs_exntst_t, state)
373 		__field(int, bmap_state)
374 		__field(unsigned long, caller_ip)
375 	),
376 	TP_fast_assign(
377 		struct xfs_ifork	*ifp;
378 		struct xfs_bmbt_irec	r;
379 
380 		ifp = xfs_iext_state_to_fork(ip, state);
381 		xfs_iext_get_extent(ifp, cur, &r);
382 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
383 		__entry->ino = ip->i_ino;
384 		__entry->leaf = cur->leaf;
385 		__entry->pos = cur->pos;
386 		__entry->startoff = r.br_startoff;
387 		__entry->startblock = r.br_startblock;
388 		__entry->blockcount = r.br_blockcount;
389 		__entry->state = r.br_state;
390 		__entry->bmap_state = state;
391 		__entry->caller_ip = caller_ip;
392 	),
393 	TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
394 		  "fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx flag %d caller %pS",
395 		  MAJOR(__entry->dev), MINOR(__entry->dev),
396 		  __entry->ino,
397 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
398 		  __entry->leaf,
399 		  __entry->pos,
400 		  __entry->startoff,
401 		  (int64_t)__entry->startblock,
402 		  __entry->blockcount,
403 		  __entry->state,
404 		  (char *)__entry->caller_ip)
405 )
406 
407 #define DEFINE_BMAP_EVENT(name) \
408 DEFINE_EVENT(xfs_bmap_class, name, \
409 	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
410 		 unsigned long caller_ip), \
411 	TP_ARGS(ip, cur, state, caller_ip))
412 DEFINE_BMAP_EVENT(xfs_iext_insert);
413 DEFINE_BMAP_EVENT(xfs_iext_remove);
414 DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
415 DEFINE_BMAP_EVENT(xfs_bmap_post_update);
416 DEFINE_BMAP_EVENT(xfs_read_extent);
417 DEFINE_BMAP_EVENT(xfs_write_extent);
418 
419 DECLARE_EVENT_CLASS(xfs_buf_class,
420 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
421 	TP_ARGS(bp, caller_ip),
422 	TP_STRUCT__entry(
423 		__field(dev_t, dev)
424 		__field(xfs_daddr_t, bno)
425 		__field(int, nblks)
426 		__field(int, hold)
427 		__field(int, pincount)
428 		__field(unsigned, lockval)
429 		__field(unsigned, flags)
430 		__field(unsigned long, caller_ip)
431 		__field(const void *, buf_ops)
432 	),
433 	TP_fast_assign(
434 		__entry->dev = bp->b_target->bt_dev;
435 		__entry->bno = xfs_buf_daddr(bp);
436 		__entry->nblks = bp->b_length;
437 		__entry->hold = atomic_read(&bp->b_hold);
438 		__entry->pincount = atomic_read(&bp->b_pin_count);
439 		__entry->lockval = bp->b_sema.count;
440 		__entry->flags = bp->b_flags;
441 		__entry->caller_ip = caller_ip;
442 		__entry->buf_ops = bp->b_ops;
443 	),
444 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
445 		  "lock %d flags %s bufops %pS caller %pS",
446 		  MAJOR(__entry->dev), MINOR(__entry->dev),
447 		  (unsigned long long)__entry->bno,
448 		  __entry->nblks,
449 		  __entry->hold,
450 		  __entry->pincount,
451 		  __entry->lockval,
452 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
453 		  __entry->buf_ops,
454 		  (void *)__entry->caller_ip)
455 )
456 
457 #define DEFINE_BUF_EVENT(name) \
458 DEFINE_EVENT(xfs_buf_class, name, \
459 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
460 	TP_ARGS(bp, caller_ip))
461 DEFINE_BUF_EVENT(xfs_buf_init);
462 DEFINE_BUF_EVENT(xfs_buf_free);
463 DEFINE_BUF_EVENT(xfs_buf_hold);
464 DEFINE_BUF_EVENT(xfs_buf_rele);
465 DEFINE_BUF_EVENT(xfs_buf_iodone);
466 DEFINE_BUF_EVENT(xfs_buf_submit);
467 DEFINE_BUF_EVENT(xfs_buf_lock);
468 DEFINE_BUF_EVENT(xfs_buf_lock_done);
469 DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
470 DEFINE_BUF_EVENT(xfs_buf_trylock);
471 DEFINE_BUF_EVENT(xfs_buf_unlock);
472 DEFINE_BUF_EVENT(xfs_buf_iowait);
473 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
474 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
475 DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
476 DEFINE_BUF_EVENT(xfs_buf_delwri_split);
477 DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
478 DEFINE_BUF_EVENT(xfs_buf_get_uncached);
479 DEFINE_BUF_EVENT(xfs_buf_item_relse);
480 DEFINE_BUF_EVENT(xfs_buf_iodone_async);
481 DEFINE_BUF_EVENT(xfs_buf_error_relse);
482 DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
483 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
484 
485 /* not really buffer traces, but the buf provides useful information */
486 DEFINE_BUF_EVENT(xfs_btree_corrupt);
487 DEFINE_BUF_EVENT(xfs_reset_dqcounts);
488 
489 /* pass flags explicitly */
490 DECLARE_EVENT_CLASS(xfs_buf_flags_class,
491 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
492 	TP_ARGS(bp, flags, caller_ip),
493 	TP_STRUCT__entry(
494 		__field(dev_t, dev)
495 		__field(xfs_daddr_t, bno)
496 		__field(unsigned int, length)
497 		__field(int, hold)
498 		__field(int, pincount)
499 		__field(unsigned, lockval)
500 		__field(unsigned, flags)
501 		__field(unsigned long, caller_ip)
502 	),
503 	TP_fast_assign(
504 		__entry->dev = bp->b_target->bt_dev;
505 		__entry->bno = xfs_buf_daddr(bp);
506 		__entry->length = bp->b_length;
507 		__entry->flags = flags;
508 		__entry->hold = atomic_read(&bp->b_hold);
509 		__entry->pincount = atomic_read(&bp->b_pin_count);
510 		__entry->lockval = bp->b_sema.count;
511 		__entry->caller_ip = caller_ip;
512 	),
513 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
514 		  "lock %d flags %s caller %pS",
515 		  MAJOR(__entry->dev), MINOR(__entry->dev),
516 		  (unsigned long long)__entry->bno,
517 		  __entry->length,
518 		  __entry->hold,
519 		  __entry->pincount,
520 		  __entry->lockval,
521 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
522 		  (void *)__entry->caller_ip)
523 )
524 
525 #define DEFINE_BUF_FLAGS_EVENT(name) \
526 DEFINE_EVENT(xfs_buf_flags_class, name, \
527 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
528 	TP_ARGS(bp, flags, caller_ip))
529 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
530 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
531 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
532 
533 TRACE_EVENT(xfs_buf_ioerror,
534 	TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
535 	TP_ARGS(bp, error, caller_ip),
536 	TP_STRUCT__entry(
537 		__field(dev_t, dev)
538 		__field(xfs_daddr_t, bno)
539 		__field(unsigned int, length)
540 		__field(unsigned, flags)
541 		__field(int, hold)
542 		__field(int, pincount)
543 		__field(unsigned, lockval)
544 		__field(int, error)
545 		__field(xfs_failaddr_t, caller_ip)
546 	),
547 	TP_fast_assign(
548 		__entry->dev = bp->b_target->bt_dev;
549 		__entry->bno = xfs_buf_daddr(bp);
550 		__entry->length = bp->b_length;
551 		__entry->hold = atomic_read(&bp->b_hold);
552 		__entry->pincount = atomic_read(&bp->b_pin_count);
553 		__entry->lockval = bp->b_sema.count;
554 		__entry->error = error;
555 		__entry->flags = bp->b_flags;
556 		__entry->caller_ip = caller_ip;
557 	),
558 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
559 		  "lock %d error %d flags %s caller %pS",
560 		  MAJOR(__entry->dev), MINOR(__entry->dev),
561 		  (unsigned long long)__entry->bno,
562 		  __entry->length,
563 		  __entry->hold,
564 		  __entry->pincount,
565 		  __entry->lockval,
566 		  __entry->error,
567 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
568 		  (void *)__entry->caller_ip)
569 );
570 
571 DECLARE_EVENT_CLASS(xfs_buf_item_class,
572 	TP_PROTO(struct xfs_buf_log_item *bip),
573 	TP_ARGS(bip),
574 	TP_STRUCT__entry(
575 		__field(dev_t, dev)
576 		__field(xfs_daddr_t, buf_bno)
577 		__field(unsigned int, buf_len)
578 		__field(int, buf_hold)
579 		__field(int, buf_pincount)
580 		__field(int, buf_lockval)
581 		__field(unsigned, buf_flags)
582 		__field(unsigned, bli_recur)
583 		__field(int, bli_refcount)
584 		__field(unsigned, bli_flags)
585 		__field(unsigned long, li_flags)
586 	),
587 	TP_fast_assign(
588 		__entry->dev = bip->bli_buf->b_target->bt_dev;
589 		__entry->bli_flags = bip->bli_flags;
590 		__entry->bli_recur = bip->bli_recur;
591 		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
592 		__entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
593 		__entry->buf_len = bip->bli_buf->b_length;
594 		__entry->buf_flags = bip->bli_buf->b_flags;
595 		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
596 		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
597 		__entry->buf_lockval = bip->bli_buf->b_sema.count;
598 		__entry->li_flags = bip->bli_item.li_flags;
599 	),
600 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
601 		  "lock %d flags %s recur %d refcount %d bliflags %s "
602 		  "liflags %s",
603 		  MAJOR(__entry->dev), MINOR(__entry->dev),
604 		  (unsigned long long)__entry->buf_bno,
605 		  __entry->buf_len,
606 		  __entry->buf_hold,
607 		  __entry->buf_pincount,
608 		  __entry->buf_lockval,
609 		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
610 		  __entry->bli_recur,
611 		  __entry->bli_refcount,
612 		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
613 		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
614 )
615 
616 #define DEFINE_BUF_ITEM_EVENT(name) \
617 DEFINE_EVENT(xfs_buf_item_class, name, \
618 	TP_PROTO(struct xfs_buf_log_item *bip), \
619 	TP_ARGS(bip))
620 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
621 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
622 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
623 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
624 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
625 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
626 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
627 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
628 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
629 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
630 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
631 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
632 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
633 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
634 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
635 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
636 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
637 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
638 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
639 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
640 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
641 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
642 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
643 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
644 
645 DECLARE_EVENT_CLASS(xfs_filestream_class,
646 	TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino),
647 	TP_ARGS(pag, ino),
648 	TP_STRUCT__entry(
649 		__field(dev_t, dev)
650 		__field(xfs_ino_t, ino)
651 		__field(xfs_agnumber_t, agno)
652 		__field(int, streams)
653 	),
654 	TP_fast_assign(
655 		__entry->dev = pag->pag_mount->m_super->s_dev;
656 		__entry->ino = ino;
657 		__entry->agno = pag->pag_agno;
658 		__entry->streams = atomic_read(&pag->pagf_fstrms);
659 	),
660 	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
661 		  MAJOR(__entry->dev), MINOR(__entry->dev),
662 		  __entry->ino,
663 		  __entry->agno,
664 		  __entry->streams)
665 )
666 #define DEFINE_FILESTREAM_EVENT(name) \
667 DEFINE_EVENT(xfs_filestream_class, name, \
668 	TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino), \
669 	TP_ARGS(pag, ino))
670 DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
671 DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
672 DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
673 
674 TRACE_EVENT(xfs_filestream_pick,
675 	TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino, xfs_extlen_t free),
676 	TP_ARGS(pag, ino, free),
677 	TP_STRUCT__entry(
678 		__field(dev_t, dev)
679 		__field(xfs_ino_t, ino)
680 		__field(xfs_agnumber_t, agno)
681 		__field(int, streams)
682 		__field(xfs_extlen_t, free)
683 	),
684 	TP_fast_assign(
685 		__entry->dev = pag->pag_mount->m_super->s_dev;
686 		__entry->ino = ino;
687 		if (pag) {
688 			__entry->agno = pag->pag_agno;
689 			__entry->streams = atomic_read(&pag->pagf_fstrms);
690 		} else {
691 			__entry->agno = NULLAGNUMBER;
692 			__entry->streams = 0;
693 		}
694 		__entry->free = free;
695 	),
696 	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d",
697 		  MAJOR(__entry->dev), MINOR(__entry->dev),
698 		  __entry->ino,
699 		  __entry->agno,
700 		  __entry->streams,
701 		  __entry->free)
702 );
703 
704 DECLARE_EVENT_CLASS(xfs_lock_class,
705 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
706 		 unsigned long caller_ip),
707 	TP_ARGS(ip,  lock_flags, caller_ip),
708 	TP_STRUCT__entry(
709 		__field(dev_t, dev)
710 		__field(xfs_ino_t, ino)
711 		__field(int, lock_flags)
712 		__field(unsigned long, caller_ip)
713 	),
714 	TP_fast_assign(
715 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
716 		__entry->ino = ip->i_ino;
717 		__entry->lock_flags = lock_flags;
718 		__entry->caller_ip = caller_ip;
719 	),
720 	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
721 		  MAJOR(__entry->dev), MINOR(__entry->dev),
722 		  __entry->ino,
723 		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
724 		  (void *)__entry->caller_ip)
725 )
726 
727 #define DEFINE_LOCK_EVENT(name) \
728 DEFINE_EVENT(xfs_lock_class, name, \
729 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
730 		 unsigned long caller_ip), \
731 	TP_ARGS(ip,  lock_flags, caller_ip))
732 DEFINE_LOCK_EVENT(xfs_ilock);
733 DEFINE_LOCK_EVENT(xfs_ilock_nowait);
734 DEFINE_LOCK_EVENT(xfs_ilock_demote);
735 DEFINE_LOCK_EVENT(xfs_iunlock);
736 
737 DECLARE_EVENT_CLASS(xfs_inode_class,
738 	TP_PROTO(struct xfs_inode *ip),
739 	TP_ARGS(ip),
740 	TP_STRUCT__entry(
741 		__field(dev_t, dev)
742 		__field(xfs_ino_t, ino)
743 		__field(unsigned long, iflags)
744 	),
745 	TP_fast_assign(
746 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
747 		__entry->ino = ip->i_ino;
748 		__entry->iflags = ip->i_flags;
749 	),
750 	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
751 		  MAJOR(__entry->dev), MINOR(__entry->dev),
752 		  __entry->ino,
753 		  __entry->iflags)
754 )
755 
756 #define DEFINE_INODE_EVENT(name) \
757 DEFINE_EVENT(xfs_inode_class, name, \
758 	TP_PROTO(struct xfs_inode *ip), \
759 	TP_ARGS(ip))
760 DEFINE_INODE_EVENT(xfs_iget_skip);
761 DEFINE_INODE_EVENT(xfs_iget_recycle);
762 DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
763 DEFINE_INODE_EVENT(xfs_iget_hit);
764 DEFINE_INODE_EVENT(xfs_iget_miss);
765 
766 DEFINE_INODE_EVENT(xfs_getattr);
767 DEFINE_INODE_EVENT(xfs_setattr);
768 DEFINE_INODE_EVENT(xfs_readlink);
769 DEFINE_INODE_EVENT(xfs_inactive_symlink);
770 DEFINE_INODE_EVENT(xfs_alloc_file_space);
771 DEFINE_INODE_EVENT(xfs_free_file_space);
772 DEFINE_INODE_EVENT(xfs_zero_file_space);
773 DEFINE_INODE_EVENT(xfs_collapse_file_space);
774 DEFINE_INODE_EVENT(xfs_insert_file_space);
775 DEFINE_INODE_EVENT(xfs_readdir);
776 #ifdef CONFIG_XFS_POSIX_ACL
777 DEFINE_INODE_EVENT(xfs_get_acl);
778 #endif
779 DEFINE_INODE_EVENT(xfs_vm_bmap);
780 DEFINE_INODE_EVENT(xfs_file_ioctl);
781 DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
782 DEFINE_INODE_EVENT(xfs_ioctl_setattr);
783 DEFINE_INODE_EVENT(xfs_dir_fsync);
784 DEFINE_INODE_EVENT(xfs_file_fsync);
785 DEFINE_INODE_EVENT(xfs_destroy_inode);
786 DEFINE_INODE_EVENT(xfs_update_time);
787 
788 DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
789 DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
790 
791 DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
792 DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
793 DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
794 DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
795 DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
796 DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
797 DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
798 DEFINE_INODE_EVENT(xfs_inode_reclaiming);
799 DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
800 DEFINE_INODE_EVENT(xfs_inode_inactivating);
801 
802 /*
803  * ftrace's __print_symbolic requires that all enum values be wrapped in the
804  * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
805  * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
806  * code.
807  */
808 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
809 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
810 
811 TRACE_EVENT(xfs_filemap_fault,
812 	TP_PROTO(struct xfs_inode *ip, unsigned int order, bool write_fault),
813 	TP_ARGS(ip, order, write_fault),
814 	TP_STRUCT__entry(
815 		__field(dev_t, dev)
816 		__field(xfs_ino_t, ino)
817 		__field(unsigned int, order)
818 		__field(bool, write_fault)
819 	),
820 	TP_fast_assign(
821 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
822 		__entry->ino = ip->i_ino;
823 		__entry->order = order;
824 		__entry->write_fault = write_fault;
825 	),
826 	TP_printk("dev %d:%d ino 0x%llx order %u write_fault %d",
827 		  MAJOR(__entry->dev), MINOR(__entry->dev),
828 		  __entry->ino,
829 		  __entry->order,
830 		  __entry->write_fault)
831 )
832 
833 DECLARE_EVENT_CLASS(xfs_iref_class,
834 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
835 	TP_ARGS(ip, caller_ip),
836 	TP_STRUCT__entry(
837 		__field(dev_t, dev)
838 		__field(xfs_ino_t, ino)
839 		__field(int, count)
840 		__field(int, pincount)
841 		__field(unsigned long, caller_ip)
842 	),
843 	TP_fast_assign(
844 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
845 		__entry->ino = ip->i_ino;
846 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
847 		__entry->pincount = atomic_read(&ip->i_pincount);
848 		__entry->caller_ip = caller_ip;
849 	),
850 	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
851 		  MAJOR(__entry->dev), MINOR(__entry->dev),
852 		  __entry->ino,
853 		  __entry->count,
854 		  __entry->pincount,
855 		  (char *)__entry->caller_ip)
856 )
857 
858 TRACE_EVENT(xfs_iomap_prealloc_size,
859 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
860 		 unsigned int writeio_blocks),
861 	TP_ARGS(ip, blocks, shift, writeio_blocks),
862 	TP_STRUCT__entry(
863 		__field(dev_t, dev)
864 		__field(xfs_ino_t, ino)
865 		__field(xfs_fsblock_t, blocks)
866 		__field(int, shift)
867 		__field(unsigned int, writeio_blocks)
868 	),
869 	TP_fast_assign(
870 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
871 		__entry->ino = ip->i_ino;
872 		__entry->blocks = blocks;
873 		__entry->shift = shift;
874 		__entry->writeio_blocks = writeio_blocks;
875 	),
876 	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
877 		  "m_allocsize_blocks %u",
878 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
879 		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
880 )
881 
882 TRACE_EVENT(xfs_irec_merge_pre,
883 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
884 		 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
885 	TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
886 	TP_STRUCT__entry(
887 		__field(dev_t, dev)
888 		__field(xfs_agnumber_t, agno)
889 		__field(xfs_agino_t, agino)
890 		__field(uint16_t, holemask)
891 		__field(xfs_agino_t, nagino)
892 		__field(uint16_t, nholemask)
893 	),
894 	TP_fast_assign(
895 		__entry->dev = mp->m_super->s_dev;
896 		__entry->agno = agno;
897 		__entry->agino = agino;
898 		__entry->holemask = holemask;
899 		__entry->nagino = nagino;
900 		__entry->nholemask = holemask;
901 	),
902 	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x new_agino 0x%x new_holemask 0x%x",
903 		  MAJOR(__entry->dev), MINOR(__entry->dev),
904 		  __entry->agno,
905 		  __entry->agino,
906 		  __entry->holemask,
907 		  __entry->nagino,
908 		  __entry->nholemask)
909 )
910 
911 TRACE_EVENT(xfs_irec_merge_post,
912 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
913 		 uint16_t holemask),
914 	TP_ARGS(mp, agno, agino, holemask),
915 	TP_STRUCT__entry(
916 		__field(dev_t, dev)
917 		__field(xfs_agnumber_t, agno)
918 		__field(xfs_agino_t, agino)
919 		__field(uint16_t, holemask)
920 	),
921 	TP_fast_assign(
922 		__entry->dev = mp->m_super->s_dev;
923 		__entry->agno = agno;
924 		__entry->agino = agino;
925 		__entry->holemask = holemask;
926 	),
927 	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x",
928 		  MAJOR(__entry->dev),
929 		  MINOR(__entry->dev),
930 		  __entry->agno,
931 		  __entry->agino,
932 		  __entry->holemask)
933 )
934 
935 #define DEFINE_IREF_EVENT(name) \
936 DEFINE_EVENT(xfs_iref_class, name, \
937 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
938 	TP_ARGS(ip, caller_ip))
939 DEFINE_IREF_EVENT(xfs_irele);
940 DEFINE_IREF_EVENT(xfs_inode_pin);
941 DEFINE_IREF_EVENT(xfs_inode_unpin);
942 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
943 
944 DECLARE_EVENT_CLASS(xfs_namespace_class,
945 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
946 	TP_ARGS(dp, name),
947 	TP_STRUCT__entry(
948 		__field(dev_t, dev)
949 		__field(xfs_ino_t, dp_ino)
950 		__field(int, namelen)
951 		__dynamic_array(char, name, name->len)
952 	),
953 	TP_fast_assign(
954 		__entry->dev = VFS_I(dp)->i_sb->s_dev;
955 		__entry->dp_ino = dp->i_ino;
956 		__entry->namelen = name->len;
957 		memcpy(__get_str(name), name->name, name->len);
958 	),
959 	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
960 		  MAJOR(__entry->dev), MINOR(__entry->dev),
961 		  __entry->dp_ino,
962 		  __entry->namelen,
963 		  __get_str(name))
964 )
965 
966 #define DEFINE_NAMESPACE_EVENT(name) \
967 DEFINE_EVENT(xfs_namespace_class, name, \
968 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name), \
969 	TP_ARGS(dp, name))
970 DEFINE_NAMESPACE_EVENT(xfs_remove);
971 DEFINE_NAMESPACE_EVENT(xfs_link);
972 DEFINE_NAMESPACE_EVENT(xfs_lookup);
973 DEFINE_NAMESPACE_EVENT(xfs_create);
974 DEFINE_NAMESPACE_EVENT(xfs_symlink);
975 
976 TRACE_EVENT(xfs_rename,
977 	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
978 		 struct xfs_name *src_name, struct xfs_name *target_name),
979 	TP_ARGS(src_dp, target_dp, src_name, target_name),
980 	TP_STRUCT__entry(
981 		__field(dev_t, dev)
982 		__field(xfs_ino_t, src_dp_ino)
983 		__field(xfs_ino_t, target_dp_ino)
984 		__field(int, src_namelen)
985 		__field(int, target_namelen)
986 		__dynamic_array(char, src_name, src_name->len)
987 		__dynamic_array(char, target_name, target_name->len)
988 	),
989 	TP_fast_assign(
990 		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
991 		__entry->src_dp_ino = src_dp->i_ino;
992 		__entry->target_dp_ino = target_dp->i_ino;
993 		__entry->src_namelen = src_name->len;
994 		__entry->target_namelen = target_name->len;
995 		memcpy(__get_str(src_name), src_name->name, src_name->len);
996 		memcpy(__get_str(target_name), target_name->name,
997 			target_name->len);
998 	),
999 	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
1000 		  " src name %.*s target name %.*s",
1001 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1002 		  __entry->src_dp_ino,
1003 		  __entry->target_dp_ino,
1004 		  __entry->src_namelen,
1005 		  __get_str(src_name),
1006 		  __entry->target_namelen,
1007 		  __get_str(target_name))
1008 )
1009 
1010 DECLARE_EVENT_CLASS(xfs_dquot_class,
1011 	TP_PROTO(struct xfs_dquot *dqp),
1012 	TP_ARGS(dqp),
1013 	TP_STRUCT__entry(
1014 		__field(dev_t, dev)
1015 		__field(u32, id)
1016 		__field(xfs_dqtype_t, type)
1017 		__field(unsigned, flags)
1018 		__field(unsigned, nrefs)
1019 		__field(unsigned long long, res_bcount)
1020 		__field(unsigned long long, res_rtbcount)
1021 		__field(unsigned long long, res_icount)
1022 
1023 		__field(unsigned long long, bcount)
1024 		__field(unsigned long long, rtbcount)
1025 		__field(unsigned long long, icount)
1026 
1027 		__field(unsigned long long, blk_hardlimit)
1028 		__field(unsigned long long, blk_softlimit)
1029 		__field(unsigned long long, rtb_hardlimit)
1030 		__field(unsigned long long, rtb_softlimit)
1031 		__field(unsigned long long, ino_hardlimit)
1032 		__field(unsigned long long, ino_softlimit)
1033 	),
1034 	TP_fast_assign(
1035 		__entry->dev = dqp->q_mount->m_super->s_dev;
1036 		__entry->id = dqp->q_id;
1037 		__entry->type = dqp->q_type;
1038 		__entry->flags = dqp->q_flags;
1039 		__entry->nrefs = dqp->q_nrefs;
1040 
1041 		__entry->res_bcount = dqp->q_blk.reserved;
1042 		__entry->res_rtbcount = dqp->q_rtb.reserved;
1043 		__entry->res_icount = dqp->q_ino.reserved;
1044 
1045 		__entry->bcount = dqp->q_blk.count;
1046 		__entry->rtbcount = dqp->q_rtb.count;
1047 		__entry->icount = dqp->q_ino.count;
1048 
1049 		__entry->blk_hardlimit = dqp->q_blk.hardlimit;
1050 		__entry->blk_softlimit = dqp->q_blk.softlimit;
1051 		__entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
1052 		__entry->rtb_softlimit = dqp->q_rtb.softlimit;
1053 		__entry->ino_hardlimit = dqp->q_ino.hardlimit;
1054 		__entry->ino_softlimit = dqp->q_ino.softlimit;
1055 	),
1056 	TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
1057 		  "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
1058 		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
1059 		  "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
1060 		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
1061 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1062 		  __entry->id,
1063 		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1064 		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1065 		  __entry->nrefs,
1066 		  __entry->res_bcount,
1067 		  __entry->res_rtbcount,
1068 		  __entry->res_icount,
1069 		  __entry->bcount,
1070 		  __entry->blk_hardlimit,
1071 		  __entry->blk_softlimit,
1072 		  __entry->rtbcount,
1073 		  __entry->rtb_hardlimit,
1074 		  __entry->rtb_softlimit,
1075 		  __entry->icount,
1076 		  __entry->ino_hardlimit,
1077 		  __entry->ino_softlimit)
1078 )
1079 
1080 #define DEFINE_DQUOT_EVENT(name) \
1081 DEFINE_EVENT(xfs_dquot_class, name, \
1082 	TP_PROTO(struct xfs_dquot *dqp), \
1083 	TP_ARGS(dqp))
1084 DEFINE_DQUOT_EVENT(xfs_dqadjust);
1085 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
1086 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
1087 DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
1088 DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
1089 DEFINE_DQUOT_EVENT(xfs_dqattach_found);
1090 DEFINE_DQUOT_EVENT(xfs_dqattach_get);
1091 DEFINE_DQUOT_EVENT(xfs_dqalloc);
1092 DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
1093 DEFINE_DQUOT_EVENT(xfs_dqread);
1094 DEFINE_DQUOT_EVENT(xfs_dqread_fail);
1095 DEFINE_DQUOT_EVENT(xfs_dqget_hit);
1096 DEFINE_DQUOT_EVENT(xfs_dqget_miss);
1097 DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
1098 DEFINE_DQUOT_EVENT(xfs_dqget_dup);
1099 DEFINE_DQUOT_EVENT(xfs_dqput);
1100 DEFINE_DQUOT_EVENT(xfs_dqput_free);
1101 DEFINE_DQUOT_EVENT(xfs_dqrele);
1102 DEFINE_DQUOT_EVENT(xfs_dqflush);
1103 DEFINE_DQUOT_EVENT(xfs_dqflush_force);
1104 DEFINE_DQUOT_EVENT(xfs_dqflush_done);
1105 DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
1106 DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
1107 
1108 TRACE_EVENT(xfs_trans_mod_dquot,
1109 	TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
1110 		 unsigned int field, int64_t delta),
1111 	TP_ARGS(tp, dqp, field, delta),
1112 	TP_STRUCT__entry(
1113 		__field(dev_t, dev)
1114 		__field(xfs_dqtype_t, type)
1115 		__field(unsigned int, flags)
1116 		__field(unsigned int, dqid)
1117 		__field(unsigned int, field)
1118 		__field(int64_t, delta)
1119 	),
1120 	TP_fast_assign(
1121 		__entry->dev = tp->t_mountp->m_super->s_dev;
1122 		__entry->type = dqp->q_type;
1123 		__entry->flags = dqp->q_flags;
1124 		__entry->dqid = dqp->q_id;
1125 		__entry->field = field;
1126 		__entry->delta = delta;
1127 	),
1128 	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
1129 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1130 		  __entry->dqid,
1131 		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1132 		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1133 		  __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
1134 		  __entry->delta)
1135 );
1136 
1137 DECLARE_EVENT_CLASS(xfs_dqtrx_class,
1138 	TP_PROTO(struct xfs_dqtrx *qtrx),
1139 	TP_ARGS(qtrx),
1140 	TP_STRUCT__entry(
1141 		__field(dev_t, dev)
1142 		__field(xfs_dqtype_t, type)
1143 		__field(unsigned int, flags)
1144 		__field(u32, dqid)
1145 
1146 		__field(uint64_t, blk_res)
1147 		__field(int64_t,  bcount_delta)
1148 		__field(int64_t,  delbcnt_delta)
1149 
1150 		__field(uint64_t, rtblk_res)
1151 		__field(uint64_t, rtblk_res_used)
1152 		__field(int64_t,  rtbcount_delta)
1153 		__field(int64_t,  delrtb_delta)
1154 
1155 		__field(uint64_t, ino_res)
1156 		__field(uint64_t, ino_res_used)
1157 		__field(int64_t,  icount_delta)
1158 	),
1159 	TP_fast_assign(
1160 		__entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
1161 		__entry->type = qtrx->qt_dquot->q_type;
1162 		__entry->flags = qtrx->qt_dquot->q_flags;
1163 		__entry->dqid = qtrx->qt_dquot->q_id;
1164 
1165 		__entry->blk_res = qtrx->qt_blk_res;
1166 		__entry->bcount_delta = qtrx->qt_bcount_delta;
1167 		__entry->delbcnt_delta = qtrx->qt_delbcnt_delta;
1168 
1169 		__entry->rtblk_res = qtrx->qt_rtblk_res;
1170 		__entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
1171 		__entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
1172 		__entry->delrtb_delta = qtrx->qt_delrtb_delta;
1173 
1174 		__entry->ino_res = qtrx->qt_ino_res;
1175 		__entry->ino_res_used = qtrx->qt_ino_res_used;
1176 		__entry->icount_delta = qtrx->qt_icount_delta;
1177 	),
1178 	TP_printk("dev %d:%d dquot id 0x%x type %s flags %s "
1179 		  "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
1180 		  "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
1181 		  "ino_res %llu ino_res_used %llu icount_delta %lld",
1182 		MAJOR(__entry->dev), MINOR(__entry->dev),
1183 		__entry->dqid,
1184 		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1185 		  __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1186 
1187 		__entry->blk_res,
1188 		__entry->bcount_delta,
1189 		__entry->delbcnt_delta,
1190 
1191 		__entry->rtblk_res,
1192 		__entry->rtblk_res_used,
1193 		__entry->rtbcount_delta,
1194 		__entry->delrtb_delta,
1195 
1196 		__entry->ino_res,
1197 		__entry->ino_res_used,
1198 		__entry->icount_delta)
1199 )
1200 
1201 #define DEFINE_DQTRX_EVENT(name) \
1202 DEFINE_EVENT(xfs_dqtrx_class, name, \
1203 	TP_PROTO(struct xfs_dqtrx *qtrx), \
1204 	TP_ARGS(qtrx))
1205 DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
1206 DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
1207 DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
1208 
1209 DECLARE_EVENT_CLASS(xfs_loggrant_class,
1210 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
1211 	TP_ARGS(log, tic),
1212 	TP_STRUCT__entry(
1213 		__field(dev_t, dev)
1214 		__field(char, ocnt)
1215 		__field(char, cnt)
1216 		__field(int, curr_res)
1217 		__field(int, unit_res)
1218 		__field(unsigned int, flags)
1219 		__field(int, reserveq)
1220 		__field(int, writeq)
1221 		__field(int, grant_reserve_cycle)
1222 		__field(int, grant_reserve_bytes)
1223 		__field(int, grant_write_cycle)
1224 		__field(int, grant_write_bytes)
1225 		__field(int, curr_cycle)
1226 		__field(int, curr_block)
1227 		__field(xfs_lsn_t, tail_lsn)
1228 	),
1229 	TP_fast_assign(
1230 		__entry->dev = log->l_mp->m_super->s_dev;
1231 		__entry->ocnt = tic->t_ocnt;
1232 		__entry->cnt = tic->t_cnt;
1233 		__entry->curr_res = tic->t_curr_res;
1234 		__entry->unit_res = tic->t_unit_res;
1235 		__entry->flags = tic->t_flags;
1236 		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
1237 		__entry->writeq = list_empty(&log->l_write_head.waiters);
1238 		xlog_crack_grant_head(&log->l_reserve_head.grant,
1239 				&__entry->grant_reserve_cycle,
1240 				&__entry->grant_reserve_bytes);
1241 		xlog_crack_grant_head(&log->l_write_head.grant,
1242 				&__entry->grant_write_cycle,
1243 				&__entry->grant_write_bytes);
1244 		__entry->curr_cycle = log->l_curr_cycle;
1245 		__entry->curr_block = log->l_curr_block;
1246 		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
1247 	),
1248 	TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
1249 		  "t_unit_res %u t_flags %s reserveq %s "
1250 		  "writeq %s grant_reserve_cycle %d "
1251 		  "grant_reserve_bytes %d grant_write_cycle %d "
1252 		  "grant_write_bytes %d curr_cycle %d curr_block %d "
1253 		  "tail_cycle %d tail_block %d",
1254 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1255 		  __entry->ocnt,
1256 		  __entry->cnt,
1257 		  __entry->curr_res,
1258 		  __entry->unit_res,
1259 		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
1260 		  __entry->reserveq ? "empty" : "active",
1261 		  __entry->writeq ? "empty" : "active",
1262 		  __entry->grant_reserve_cycle,
1263 		  __entry->grant_reserve_bytes,
1264 		  __entry->grant_write_cycle,
1265 		  __entry->grant_write_bytes,
1266 		  __entry->curr_cycle,
1267 		  __entry->curr_block,
1268 		  CYCLE_LSN(__entry->tail_lsn),
1269 		  BLOCK_LSN(__entry->tail_lsn)
1270 	)
1271 )
1272 
1273 #define DEFINE_LOGGRANT_EVENT(name) \
1274 DEFINE_EVENT(xfs_loggrant_class, name, \
1275 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1276 	TP_ARGS(log, tic))
1277 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1278 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1279 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1280 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1281 DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1282 DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1283 DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1284 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1285 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant);
1286 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_exit);
1287 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_sub);
1288 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
1289 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
1290 DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
1291 DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
1292 
1293 DECLARE_EVENT_CLASS(xfs_log_item_class,
1294 	TP_PROTO(struct xfs_log_item *lip),
1295 	TP_ARGS(lip),
1296 	TP_STRUCT__entry(
1297 		__field(dev_t, dev)
1298 		__field(void *, lip)
1299 		__field(uint, type)
1300 		__field(unsigned long, flags)
1301 		__field(xfs_lsn_t, lsn)
1302 	),
1303 	TP_fast_assign(
1304 		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
1305 		__entry->lip = lip;
1306 		__entry->type = lip->li_type;
1307 		__entry->flags = lip->li_flags;
1308 		__entry->lsn = lip->li_lsn;
1309 	),
1310 	TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
1311 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1312 		  __entry->lip,
1313 		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1314 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1315 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1316 )
1317 
1318 TRACE_EVENT(xfs_log_force,
1319 	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1320 	TP_ARGS(mp, lsn, caller_ip),
1321 	TP_STRUCT__entry(
1322 		__field(dev_t, dev)
1323 		__field(xfs_lsn_t, lsn)
1324 		__field(unsigned long, caller_ip)
1325 	),
1326 	TP_fast_assign(
1327 		__entry->dev = mp->m_super->s_dev;
1328 		__entry->lsn = lsn;
1329 		__entry->caller_ip = caller_ip;
1330 	),
1331 	TP_printk("dev %d:%d lsn 0x%llx caller %pS",
1332 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1333 		  __entry->lsn, (void *)__entry->caller_ip)
1334 )
1335 
1336 #define DEFINE_LOG_ITEM_EVENT(name) \
1337 DEFINE_EVENT(xfs_log_item_class, name, \
1338 	TP_PROTO(struct xfs_log_item *lip), \
1339 	TP_ARGS(lip))
1340 DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1341 DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1342 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1343 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1344 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
1345 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
1346 DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
1347 
1348 DECLARE_EVENT_CLASS(xfs_ail_class,
1349 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1350 	TP_ARGS(lip, old_lsn, new_lsn),
1351 	TP_STRUCT__entry(
1352 		__field(dev_t, dev)
1353 		__field(void *, lip)
1354 		__field(uint, type)
1355 		__field(unsigned long, flags)
1356 		__field(xfs_lsn_t, old_lsn)
1357 		__field(xfs_lsn_t, new_lsn)
1358 	),
1359 	TP_fast_assign(
1360 		__entry->dev = lip->li_log->l_mp->m_super->s_dev;
1361 		__entry->lip = lip;
1362 		__entry->type = lip->li_type;
1363 		__entry->flags = lip->li_flags;
1364 		__entry->old_lsn = old_lsn;
1365 		__entry->new_lsn = new_lsn;
1366 	),
1367 	TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s",
1368 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1369 		  __entry->lip,
1370 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1371 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1372 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1373 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1374 )
1375 
1376 #define DEFINE_AIL_EVENT(name) \
1377 DEFINE_EVENT(xfs_ail_class, name, \
1378 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1379 	TP_ARGS(lip, old_lsn, new_lsn))
1380 DEFINE_AIL_EVENT(xfs_ail_insert);
1381 DEFINE_AIL_EVENT(xfs_ail_move);
1382 DEFINE_AIL_EVENT(xfs_ail_delete);
1383 
1384 TRACE_EVENT(xfs_log_assign_tail_lsn,
1385 	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1386 	TP_ARGS(log, new_lsn),
1387 	TP_STRUCT__entry(
1388 		__field(dev_t, dev)
1389 		__field(xfs_lsn_t, new_lsn)
1390 		__field(xfs_lsn_t, old_lsn)
1391 		__field(xfs_lsn_t, last_sync_lsn)
1392 	),
1393 	TP_fast_assign(
1394 		__entry->dev = log->l_mp->m_super->s_dev;
1395 		__entry->new_lsn = new_lsn;
1396 		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1397 		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1398 	),
1399 	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1400 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1401 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1402 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1403 		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1404 )
1405 
1406 DECLARE_EVENT_CLASS(xfs_file_class,
1407 	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
1408 	TP_ARGS(iocb, iter),
1409 	TP_STRUCT__entry(
1410 		__field(dev_t, dev)
1411 		__field(xfs_ino_t, ino)
1412 		__field(xfs_fsize_t, size)
1413 		__field(loff_t, offset)
1414 		__field(size_t, count)
1415 	),
1416 	TP_fast_assign(
1417 		__entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
1418 		__entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
1419 		__entry->size = XFS_I(file_inode(iocb->ki_filp))->i_disk_size;
1420 		__entry->offset = iocb->ki_pos;
1421 		__entry->count = iov_iter_count(iter);
1422 	),
1423 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx",
1424 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1425 		  __entry->ino,
1426 		  __entry->size,
1427 		  __entry->offset,
1428 		  __entry->count)
1429 )
1430 
1431 #define DEFINE_RW_EVENT(name)		\
1432 DEFINE_EVENT(xfs_file_class, name,	\
1433 	TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),		\
1434 	TP_ARGS(iocb, iter))
1435 DEFINE_RW_EVENT(xfs_file_buffered_read);
1436 DEFINE_RW_EVENT(xfs_file_direct_read);
1437 DEFINE_RW_EVENT(xfs_file_dax_read);
1438 DEFINE_RW_EVENT(xfs_file_buffered_write);
1439 DEFINE_RW_EVENT(xfs_file_direct_write);
1440 DEFINE_RW_EVENT(xfs_file_dax_write);
1441 DEFINE_RW_EVENT(xfs_reflink_bounce_dio_write);
1442 
1443 DECLARE_EVENT_CLASS(xfs_imap_class,
1444 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1445 		 int whichfork, struct xfs_bmbt_irec *irec),
1446 	TP_ARGS(ip, offset, count, whichfork, irec),
1447 	TP_STRUCT__entry(
1448 		__field(dev_t, dev)
1449 		__field(xfs_ino_t, ino)
1450 		__field(loff_t, size)
1451 		__field(loff_t, offset)
1452 		__field(size_t, count)
1453 		__field(int, whichfork)
1454 		__field(xfs_fileoff_t, startoff)
1455 		__field(xfs_fsblock_t, startblock)
1456 		__field(xfs_filblks_t, blockcount)
1457 	),
1458 	TP_fast_assign(
1459 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1460 		__entry->ino = ip->i_ino;
1461 		__entry->size = ip->i_disk_size;
1462 		__entry->offset = offset;
1463 		__entry->count = count;
1464 		__entry->whichfork = whichfork;
1465 		__entry->startoff = irec ? irec->br_startoff : 0;
1466 		__entry->startblock = irec ? irec->br_startblock : 0;
1467 		__entry->blockcount = irec ? irec->br_blockcount : 0;
1468 	),
1469 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx "
1470 		  "fork %s startoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
1471 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1472 		  __entry->ino,
1473 		  __entry->size,
1474 		  __entry->offset,
1475 		  __entry->count,
1476 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
1477 		  __entry->startoff,
1478 		  (int64_t)__entry->startblock,
1479 		  __entry->blockcount)
1480 )
1481 
1482 #define DEFINE_IMAP_EVENT(name)	\
1483 DEFINE_EVENT(xfs_imap_class, name,	\
1484 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1485 		 int whichfork, struct xfs_bmbt_irec *irec),		\
1486 	TP_ARGS(ip, offset, count, whichfork, irec))
1487 DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1488 DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1489 DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1490 DEFINE_IMAP_EVENT(xfs_iomap_found);
1491 
1492 DECLARE_EVENT_CLASS(xfs_simple_io_class,
1493 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1494 	TP_ARGS(ip, offset, count),
1495 	TP_STRUCT__entry(
1496 		__field(dev_t, dev)
1497 		__field(xfs_ino_t, ino)
1498 		__field(loff_t, isize)
1499 		__field(loff_t, disize)
1500 		__field(loff_t, offset)
1501 		__field(size_t, count)
1502 	),
1503 	TP_fast_assign(
1504 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1505 		__entry->ino = ip->i_ino;
1506 		__entry->isize = VFS_I(ip)->i_size;
1507 		__entry->disize = ip->i_disk_size;
1508 		__entry->offset = offset;
1509 		__entry->count = count;
1510 	),
1511 	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1512 		  "pos 0x%llx bytecount 0x%zx",
1513 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1514 		  __entry->ino,
1515 		  __entry->isize,
1516 		  __entry->disize,
1517 		  __entry->offset,
1518 		  __entry->count)
1519 );
1520 
1521 #define DEFINE_SIMPLE_IO_EVENT(name)	\
1522 DEFINE_EVENT(xfs_simple_io_class, name,	\
1523 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1524 	TP_ARGS(ip, offset, count))
1525 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1526 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1527 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1528 DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1529 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1530 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1531 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
1532 DEFINE_SIMPLE_IO_EVENT(xfs_file_splice_read);
1533 
1534 DECLARE_EVENT_CLASS(xfs_itrunc_class,
1535 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1536 	TP_ARGS(ip, new_size),
1537 	TP_STRUCT__entry(
1538 		__field(dev_t, dev)
1539 		__field(xfs_ino_t, ino)
1540 		__field(xfs_fsize_t, size)
1541 		__field(xfs_fsize_t, new_size)
1542 	),
1543 	TP_fast_assign(
1544 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1545 		__entry->ino = ip->i_ino;
1546 		__entry->size = ip->i_disk_size;
1547 		__entry->new_size = new_size;
1548 	),
1549 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx new_size 0x%llx",
1550 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1551 		  __entry->ino,
1552 		  __entry->size,
1553 		  __entry->new_size)
1554 )
1555 
1556 #define DEFINE_ITRUNC_EVENT(name) \
1557 DEFINE_EVENT(xfs_itrunc_class, name, \
1558 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1559 	TP_ARGS(ip, new_size))
1560 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1561 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1562 
1563 TRACE_EVENT(xfs_pagecache_inval,
1564 	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1565 	TP_ARGS(ip, start, finish),
1566 	TP_STRUCT__entry(
1567 		__field(dev_t, dev)
1568 		__field(xfs_ino_t, ino)
1569 		__field(xfs_fsize_t, size)
1570 		__field(xfs_off_t, start)
1571 		__field(xfs_off_t, finish)
1572 	),
1573 	TP_fast_assign(
1574 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1575 		__entry->ino = ip->i_ino;
1576 		__entry->size = ip->i_disk_size;
1577 		__entry->start = start;
1578 		__entry->finish = finish;
1579 	),
1580 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx start 0x%llx finish 0x%llx",
1581 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1582 		  __entry->ino,
1583 		  __entry->size,
1584 		  __entry->start,
1585 		  __entry->finish)
1586 );
1587 
1588 TRACE_EVENT(xfs_bunmap,
1589 	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t fileoff, xfs_filblks_t len,
1590 		 int flags, unsigned long caller_ip),
1591 	TP_ARGS(ip, fileoff, len, flags, caller_ip),
1592 	TP_STRUCT__entry(
1593 		__field(dev_t, dev)
1594 		__field(xfs_ino_t, ino)
1595 		__field(xfs_fsize_t, size)
1596 		__field(xfs_fileoff_t, fileoff)
1597 		__field(xfs_filblks_t, len)
1598 		__field(unsigned long, caller_ip)
1599 		__field(int, flags)
1600 	),
1601 	TP_fast_assign(
1602 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1603 		__entry->ino = ip->i_ino;
1604 		__entry->size = ip->i_disk_size;
1605 		__entry->fileoff = fileoff;
1606 		__entry->len = len;
1607 		__entry->caller_ip = caller_ip;
1608 		__entry->flags = flags;
1609 	),
1610 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx "
1611 		  "flags %s caller %pS",
1612 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1613 		  __entry->ino,
1614 		  __entry->size,
1615 		  __entry->fileoff,
1616 		  __entry->len,
1617 		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1618 		  (void *)__entry->caller_ip)
1619 
1620 );
1621 
1622 DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1623 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1624 		 xfs_agblock_t agbno, xfs_extlen_t len),
1625 	TP_ARGS(mp, agno, agbno, len),
1626 	TP_STRUCT__entry(
1627 		__field(dev_t, dev)
1628 		__field(xfs_agnumber_t, agno)
1629 		__field(xfs_agblock_t, agbno)
1630 		__field(xfs_extlen_t, len)
1631 	),
1632 	TP_fast_assign(
1633 		__entry->dev = mp->m_super->s_dev;
1634 		__entry->agno = agno;
1635 		__entry->agbno = agbno;
1636 		__entry->len = len;
1637 	),
1638 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
1639 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1640 		  __entry->agno,
1641 		  __entry->agbno,
1642 		  __entry->len)
1643 );
1644 #define DEFINE_BUSY_EVENT(name) \
1645 DEFINE_EVENT(xfs_extent_busy_class, name, \
1646 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1647 		 xfs_agblock_t agbno, xfs_extlen_t len), \
1648 	TP_ARGS(mp, agno, agbno, len))
1649 DEFINE_BUSY_EVENT(xfs_extent_busy);
1650 DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1651 DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1652 DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1653 DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1654 
1655 TRACE_EVENT(xfs_extent_busy_trim,
1656 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1657 		 xfs_agblock_t agbno, xfs_extlen_t len,
1658 		 xfs_agblock_t tbno, xfs_extlen_t tlen),
1659 	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1660 	TP_STRUCT__entry(
1661 		__field(dev_t, dev)
1662 		__field(xfs_agnumber_t, agno)
1663 		__field(xfs_agblock_t, agbno)
1664 		__field(xfs_extlen_t, len)
1665 		__field(xfs_agblock_t, tbno)
1666 		__field(xfs_extlen_t, tlen)
1667 	),
1668 	TP_fast_assign(
1669 		__entry->dev = mp->m_super->s_dev;
1670 		__entry->agno = agno;
1671 		__entry->agbno = agbno;
1672 		__entry->len = len;
1673 		__entry->tbno = tbno;
1674 		__entry->tlen = tlen;
1675 	),
1676 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x found_agbno 0x%x found_fsbcount 0x%x",
1677 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1678 		  __entry->agno,
1679 		  __entry->agbno,
1680 		  __entry->len,
1681 		  __entry->tbno,
1682 		  __entry->tlen)
1683 );
1684 
1685 DECLARE_EVENT_CLASS(xfs_agf_class,
1686 	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1687 		 unsigned long caller_ip),
1688 	TP_ARGS(mp, agf, flags, caller_ip),
1689 	TP_STRUCT__entry(
1690 		__field(dev_t, dev)
1691 		__field(xfs_agnumber_t, agno)
1692 		__field(int, flags)
1693 		__field(__u32, length)
1694 		__field(__u32, bno_root)
1695 		__field(__u32, cnt_root)
1696 		__field(__u32, bno_level)
1697 		__field(__u32, cnt_level)
1698 		__field(__u32, flfirst)
1699 		__field(__u32, fllast)
1700 		__field(__u32, flcount)
1701 		__field(__u32, freeblks)
1702 		__field(__u32, longest)
1703 		__field(unsigned long, caller_ip)
1704 	),
1705 	TP_fast_assign(
1706 		__entry->dev = mp->m_super->s_dev;
1707 		__entry->agno = be32_to_cpu(agf->agf_seqno),
1708 		__entry->flags = flags;
1709 		__entry->length = be32_to_cpu(agf->agf_length),
1710 		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1711 		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1712 		__entry->bno_level =
1713 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1714 		__entry->cnt_level =
1715 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1716 		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1717 		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1718 		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1719 		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1720 		__entry->longest = be32_to_cpu(agf->agf_longest);
1721 		__entry->caller_ip = caller_ip;
1722 	),
1723 	TP_printk("dev %d:%d agno 0x%x flags %s length %u roots b %u c %u "
1724 		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1725 		  "freeblks %u longest %u caller %pS",
1726 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1727 		  __entry->agno,
1728 		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1729 		  __entry->length,
1730 		  __entry->bno_root,
1731 		  __entry->cnt_root,
1732 		  __entry->bno_level,
1733 		  __entry->cnt_level,
1734 		  __entry->flfirst,
1735 		  __entry->fllast,
1736 		  __entry->flcount,
1737 		  __entry->freeblks,
1738 		  __entry->longest,
1739 		  (void *)__entry->caller_ip)
1740 );
1741 #define DEFINE_AGF_EVENT(name) \
1742 DEFINE_EVENT(xfs_agf_class, name, \
1743 	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1744 		 unsigned long caller_ip), \
1745 	TP_ARGS(mp, agf, flags, caller_ip))
1746 DEFINE_AGF_EVENT(xfs_agf);
1747 DEFINE_AGF_EVENT(xfs_agfl_reset);
1748 
1749 TRACE_EVENT(xfs_free_extent,
1750 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1751 		 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1752 		 int haveright),
1753 	TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
1754 	TP_STRUCT__entry(
1755 		__field(dev_t, dev)
1756 		__field(xfs_agnumber_t, agno)
1757 		__field(xfs_agblock_t, agbno)
1758 		__field(xfs_extlen_t, len)
1759 		__field(int, resv)
1760 		__field(int, haveleft)
1761 		__field(int, haveright)
1762 	),
1763 	TP_fast_assign(
1764 		__entry->dev = mp->m_super->s_dev;
1765 		__entry->agno = agno;
1766 		__entry->agbno = agbno;
1767 		__entry->len = len;
1768 		__entry->resv = resv;
1769 		__entry->haveleft = haveleft;
1770 		__entry->haveright = haveright;
1771 	),
1772 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x resv %d %s",
1773 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1774 		  __entry->agno,
1775 		  __entry->agbno,
1776 		  __entry->len,
1777 		  __entry->resv,
1778 		  __entry->haveleft ?
1779 			(__entry->haveright ? "both" : "left") :
1780 			(__entry->haveright ? "right" : "none"))
1781 
1782 );
1783 
1784 DECLARE_EVENT_CLASS(xfs_alloc_class,
1785 	TP_PROTO(struct xfs_alloc_arg *args),
1786 	TP_ARGS(args),
1787 	TP_STRUCT__entry(
1788 		__field(dev_t, dev)
1789 		__field(xfs_agnumber_t, agno)
1790 		__field(xfs_agblock_t, agbno)
1791 		__field(xfs_extlen_t, minlen)
1792 		__field(xfs_extlen_t, maxlen)
1793 		__field(xfs_extlen_t, mod)
1794 		__field(xfs_extlen_t, prod)
1795 		__field(xfs_extlen_t, minleft)
1796 		__field(xfs_extlen_t, total)
1797 		__field(xfs_extlen_t, alignment)
1798 		__field(xfs_extlen_t, minalignslop)
1799 		__field(xfs_extlen_t, len)
1800 		__field(char, wasdel)
1801 		__field(char, wasfromfl)
1802 		__field(int, resv)
1803 		__field(int, datatype)
1804 		__field(xfs_agnumber_t, highest_agno)
1805 	),
1806 	TP_fast_assign(
1807 		__entry->dev = args->mp->m_super->s_dev;
1808 		__entry->agno = args->agno;
1809 		__entry->agbno = args->agbno;
1810 		__entry->minlen = args->minlen;
1811 		__entry->maxlen = args->maxlen;
1812 		__entry->mod = args->mod;
1813 		__entry->prod = args->prod;
1814 		__entry->minleft = args->minleft;
1815 		__entry->total = args->total;
1816 		__entry->alignment = args->alignment;
1817 		__entry->minalignslop = args->minalignslop;
1818 		__entry->len = args->len;
1819 		__entry->wasdel = args->wasdel;
1820 		__entry->wasfromfl = args->wasfromfl;
1821 		__entry->resv = args->resv;
1822 		__entry->datatype = args->datatype;
1823 		__entry->highest_agno = args->tp->t_highest_agno;
1824 	),
1825 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u "
1826 		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1827 		  "len %u wasdel %d wasfromfl %d resv %d "
1828 		  "datatype 0x%x highest_agno 0x%x",
1829 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1830 		  __entry->agno,
1831 		  __entry->agbno,
1832 		  __entry->minlen,
1833 		  __entry->maxlen,
1834 		  __entry->mod,
1835 		  __entry->prod,
1836 		  __entry->minleft,
1837 		  __entry->total,
1838 		  __entry->alignment,
1839 		  __entry->minalignslop,
1840 		  __entry->len,
1841 		  __entry->wasdel,
1842 		  __entry->wasfromfl,
1843 		  __entry->resv,
1844 		  __entry->datatype,
1845 		  __entry->highest_agno)
1846 )
1847 
1848 #define DEFINE_ALLOC_EVENT(name) \
1849 DEFINE_EVENT(xfs_alloc_class, name, \
1850 	TP_PROTO(struct xfs_alloc_arg *args), \
1851 	TP_ARGS(args))
1852 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1853 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1854 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1855 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1856 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1857 DEFINE_ALLOC_EVENT(xfs_alloc_cur);
1858 DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1859 DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
1860 DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
1861 DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
1862 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1863 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1864 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1865 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1866 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1867 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1868 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1869 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1870 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1871 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1872 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1873 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1874 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1875 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1876 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_skip_deadlock);
1877 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1878 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1879 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1880 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1881 
1882 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_this_ag);
1883 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_start_ag);
1884 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_first_ag);
1885 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_exact_bno);
1886 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_near_bno);
1887 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_finish);
1888 
1889 TRACE_EVENT(xfs_alloc_cur_check,
1890 	TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1891 		 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1892 	TP_ARGS(mp, btnum, bno, len, diff, new),
1893 	TP_STRUCT__entry(
1894 		__field(dev_t, dev)
1895 		__field(xfs_btnum_t, btnum)
1896 		__field(xfs_agblock_t, bno)
1897 		__field(xfs_extlen_t, len)
1898 		__field(xfs_extlen_t, diff)
1899 		__field(bool, new)
1900 	),
1901 	TP_fast_assign(
1902 		__entry->dev = mp->m_super->s_dev;
1903 		__entry->btnum = btnum;
1904 		__entry->bno = bno;
1905 		__entry->len = len;
1906 		__entry->diff = diff;
1907 		__entry->new = new;
1908 	),
1909 	TP_printk("dev %d:%d btree %s agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
1910 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1911 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1912 		  __entry->bno, __entry->len, __entry->diff, __entry->new)
1913 )
1914 
1915 DECLARE_EVENT_CLASS(xfs_da_class,
1916 	TP_PROTO(struct xfs_da_args *args),
1917 	TP_ARGS(args),
1918 	TP_STRUCT__entry(
1919 		__field(dev_t, dev)
1920 		__field(xfs_ino_t, ino)
1921 		__dynamic_array(char, name, args->namelen)
1922 		__field(int, namelen)
1923 		__field(xfs_dahash_t, hashval)
1924 		__field(xfs_ino_t, inumber)
1925 		__field(uint32_t, op_flags)
1926 	),
1927 	TP_fast_assign(
1928 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1929 		__entry->ino = args->dp->i_ino;
1930 		if (args->namelen)
1931 			memcpy(__get_str(name), args->name, args->namelen);
1932 		__entry->namelen = args->namelen;
1933 		__entry->hashval = args->hashval;
1934 		__entry->inumber = args->inumber;
1935 		__entry->op_flags = args->op_flags;
1936 	),
1937 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1938 		  "inumber 0x%llx op_flags %s",
1939 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1940 		  __entry->ino,
1941 		  __entry->namelen,
1942 		  __entry->namelen ? __get_str(name) : NULL,
1943 		  __entry->namelen,
1944 		  __entry->hashval,
1945 		  __entry->inumber,
1946 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1947 )
1948 
1949 #define DEFINE_DIR2_EVENT(name) \
1950 DEFINE_EVENT(xfs_da_class, name, \
1951 	TP_PROTO(struct xfs_da_args *args), \
1952 	TP_ARGS(args))
1953 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1954 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1955 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1956 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1957 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1958 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1959 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1960 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1961 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1962 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1963 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1964 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1965 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1966 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1967 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1968 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1969 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1970 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1971 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1972 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1973 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1974 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1975 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1976 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1977 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1978 
1979 DECLARE_EVENT_CLASS(xfs_attr_class,
1980 	TP_PROTO(struct xfs_da_args *args),
1981 	TP_ARGS(args),
1982 	TP_STRUCT__entry(
1983 		__field(dev_t, dev)
1984 		__field(xfs_ino_t, ino)
1985 		__dynamic_array(char, name, args->namelen)
1986 		__field(int, namelen)
1987 		__field(int, valuelen)
1988 		__field(xfs_dahash_t, hashval)
1989 		__field(unsigned int, attr_filter)
1990 		__field(unsigned int, attr_flags)
1991 		__field(uint32_t, op_flags)
1992 	),
1993 	TP_fast_assign(
1994 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1995 		__entry->ino = args->dp->i_ino;
1996 		if (args->namelen)
1997 			memcpy(__get_str(name), args->name, args->namelen);
1998 		__entry->namelen = args->namelen;
1999 		__entry->valuelen = args->valuelen;
2000 		__entry->hashval = args->hashval;
2001 		__entry->attr_filter = args->attr_filter;
2002 		__entry->attr_flags = args->attr_flags;
2003 		__entry->op_flags = args->op_flags;
2004 	),
2005 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
2006 		  "hashval 0x%x filter %s flags %s op_flags %s",
2007 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2008 		  __entry->ino,
2009 		  __entry->namelen,
2010 		  __entry->namelen ? __get_str(name) : NULL,
2011 		  __entry->namelen,
2012 		  __entry->valuelen,
2013 		  __entry->hashval,
2014 		  __print_flags(__entry->attr_filter, "|",
2015 				XFS_ATTR_FILTER_FLAGS),
2016 		   __print_flags(__entry->attr_flags, "|",
2017 				{ XATTR_CREATE,		"CREATE" },
2018 				{ XATTR_REPLACE,	"REPLACE" }),
2019 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
2020 )
2021 
2022 #define DEFINE_ATTR_EVENT(name) \
2023 DEFINE_EVENT(xfs_attr_class, name, \
2024 	TP_PROTO(struct xfs_da_args *args), \
2025 	TP_ARGS(args))
2026 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
2027 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
2028 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
2029 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2030 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
2031 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2032 
2033 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2034 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2035 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2036 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
2037 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2038 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2039 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2040 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2041 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2042 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2043 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2044 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2045 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2046 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2047 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2048 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2049 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2050 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2051 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2052 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2053 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2054 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2055 
2056 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2057 DEFINE_ATTR_EVENT(xfs_attr_node_get);
2058 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2059 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2060 
2061 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2062 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2063 
2064 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2065 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
2066 
2067 #define DEFINE_DA_EVENT(name) \
2068 DEFINE_EVENT(xfs_da_class, name, \
2069 	TP_PROTO(struct xfs_da_args *args), \
2070 	TP_ARGS(args))
2071 DEFINE_DA_EVENT(xfs_da_split);
2072 DEFINE_DA_EVENT(xfs_da_join);
2073 DEFINE_DA_EVENT(xfs_da_link_before);
2074 DEFINE_DA_EVENT(xfs_da_link_after);
2075 DEFINE_DA_EVENT(xfs_da_unlink_back);
2076 DEFINE_DA_EVENT(xfs_da_unlink_forward);
2077 DEFINE_DA_EVENT(xfs_da_root_split);
2078 DEFINE_DA_EVENT(xfs_da_root_join);
2079 DEFINE_DA_EVENT(xfs_da_node_add);
2080 DEFINE_DA_EVENT(xfs_da_node_create);
2081 DEFINE_DA_EVENT(xfs_da_node_split);
2082 DEFINE_DA_EVENT(xfs_da_node_remove);
2083 DEFINE_DA_EVENT(xfs_da_node_rebalance);
2084 DEFINE_DA_EVENT(xfs_da_node_unbalance);
2085 DEFINE_DA_EVENT(xfs_da_node_toosmall);
2086 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2087 DEFINE_DA_EVENT(xfs_da_grow_inode);
2088 DEFINE_DA_EVENT(xfs_da_shrink_inode);
2089 DEFINE_DA_EVENT(xfs_da_fixhashpath);
2090 DEFINE_DA_EVENT(xfs_da_path_shift);
2091 
2092 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2093 	TP_PROTO(struct xfs_da_args *args, int idx),
2094 	TP_ARGS(args, idx),
2095 	TP_STRUCT__entry(
2096 		__field(dev_t, dev)
2097 		__field(xfs_ino_t, ino)
2098 		__field(uint32_t, op_flags)
2099 		__field(int, idx)
2100 	),
2101 	TP_fast_assign(
2102 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2103 		__entry->ino = args->dp->i_ino;
2104 		__entry->op_flags = args->op_flags;
2105 		__entry->idx = idx;
2106 	),
2107 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2108 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2109 		  __entry->ino,
2110 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2111 		  __entry->idx)
2112 )
2113 
2114 #define DEFINE_DIR2_SPACE_EVENT(name) \
2115 DEFINE_EVENT(xfs_dir2_space_class, name, \
2116 	TP_PROTO(struct xfs_da_args *args, int idx), \
2117 	TP_ARGS(args, idx))
2118 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2119 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2120 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2121 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
2122 
2123 TRACE_EVENT(xfs_dir2_leafn_moveents,
2124 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2125 	TP_ARGS(args, src_idx, dst_idx, count),
2126 	TP_STRUCT__entry(
2127 		__field(dev_t, dev)
2128 		__field(xfs_ino_t, ino)
2129 		__field(uint32_t, op_flags)
2130 		__field(int, src_idx)
2131 		__field(int, dst_idx)
2132 		__field(int, count)
2133 	),
2134 	TP_fast_assign(
2135 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2136 		__entry->ino = args->dp->i_ino;
2137 		__entry->op_flags = args->op_flags;
2138 		__entry->src_idx = src_idx;
2139 		__entry->dst_idx = dst_idx;
2140 		__entry->count = count;
2141 	),
2142 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2143 		  "src_idx %d dst_idx %d count %d",
2144 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2145 		  __entry->ino,
2146 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2147 		  __entry->src_idx,
2148 		  __entry->dst_idx,
2149 		  __entry->count)
2150 );
2151 
2152 #define XFS_SWAPEXT_INODES \
2153 	{ 0,	"target" }, \
2154 	{ 1,	"temp" }
2155 
2156 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2157 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2158 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2159 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2160 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2161 
2162 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2163 	TP_PROTO(struct xfs_inode *ip, int which),
2164 	TP_ARGS(ip, which),
2165 	TP_STRUCT__entry(
2166 		__field(dev_t, dev)
2167 		__field(int, which)
2168 		__field(xfs_ino_t, ino)
2169 		__field(int, format)
2170 		__field(xfs_extnum_t, nex)
2171 		__field(int, broot_size)
2172 		__field(int, fork_off)
2173 	),
2174 	TP_fast_assign(
2175 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2176 		__entry->which = which;
2177 		__entry->ino = ip->i_ino;
2178 		__entry->format = ip->i_df.if_format;
2179 		__entry->nex = ip->i_df.if_nextents;
2180 		__entry->broot_size = ip->i_df.if_broot_bytes;
2181 		__entry->fork_off = xfs_inode_fork_boff(ip);
2182 	),
2183 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2184 		  "broot size %d, forkoff 0x%x",
2185 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2186 		  __entry->ino,
2187 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2188 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2189 		  __entry->nex,
2190 		  __entry->broot_size,
2191 		  __entry->fork_off)
2192 )
2193 
2194 #define DEFINE_SWAPEXT_EVENT(name) \
2195 DEFINE_EVENT(xfs_swap_extent_class, name, \
2196 	TP_PROTO(struct xfs_inode *ip, int which), \
2197 	TP_ARGS(ip, which))
2198 
2199 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2200 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2201 
2202 TRACE_EVENT(xfs_log_recover,
2203 	TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2204 	TP_ARGS(log, headblk, tailblk),
2205 	TP_STRUCT__entry(
2206 		__field(dev_t, dev)
2207 		__field(xfs_daddr_t, headblk)
2208 		__field(xfs_daddr_t, tailblk)
2209 	),
2210 	TP_fast_assign(
2211 		__entry->dev = log->l_mp->m_super->s_dev;
2212 		__entry->headblk = headblk;
2213 		__entry->tailblk = tailblk;
2214 	),
2215 	TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2216 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2217 		  __entry->tailblk)
2218 )
2219 
2220 TRACE_EVENT(xfs_log_recover_record,
2221 	TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2222 	TP_ARGS(log, rhead, pass),
2223 	TP_STRUCT__entry(
2224 		__field(dev_t, dev)
2225 		__field(xfs_lsn_t, lsn)
2226 		__field(int, len)
2227 		__field(int, num_logops)
2228 		__field(int, pass)
2229 	),
2230 	TP_fast_assign(
2231 		__entry->dev = log->l_mp->m_super->s_dev;
2232 		__entry->lsn = be64_to_cpu(rhead->h_lsn);
2233 		__entry->len = be32_to_cpu(rhead->h_len);
2234 		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2235 		__entry->pass = pass;
2236 	),
2237 	TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2238 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2239 		  __entry->lsn, __entry->len, __entry->num_logops,
2240 		   __entry->pass)
2241 )
2242 
2243 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2244 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2245 		struct xlog_recover_item *item, int pass),
2246 	TP_ARGS(log, trans, item, pass),
2247 	TP_STRUCT__entry(
2248 		__field(dev_t, dev)
2249 		__field(unsigned long, item)
2250 		__field(xlog_tid_t, tid)
2251 		__field(xfs_lsn_t, lsn)
2252 		__field(int, type)
2253 		__field(int, pass)
2254 		__field(int, count)
2255 		__field(int, total)
2256 	),
2257 	TP_fast_assign(
2258 		__entry->dev = log->l_mp->m_super->s_dev;
2259 		__entry->item = (unsigned long)item;
2260 		__entry->tid = trans->r_log_tid;
2261 		__entry->lsn = trans->r_lsn;
2262 		__entry->type = ITEM_TYPE(item);
2263 		__entry->pass = pass;
2264 		__entry->count = item->ri_cnt;
2265 		__entry->total = item->ri_total;
2266 	),
2267 	TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2268 		  "item type %s item region count/total %d/%d",
2269 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2270 		  __entry->tid,
2271 		  __entry->lsn,
2272 		  __entry->pass,
2273 		  (void *)__entry->item,
2274 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2275 		  __entry->count,
2276 		  __entry->total)
2277 )
2278 
2279 #define DEFINE_LOG_RECOVER_ITEM(name) \
2280 DEFINE_EVENT(xfs_log_recover_item_class, name, \
2281 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2282 		struct xlog_recover_item *item, int pass), \
2283 	TP_ARGS(log, trans, item, pass))
2284 
2285 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2286 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2287 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2288 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2289 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2290 
2291 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2292 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2293 	TP_ARGS(log, buf_f),
2294 	TP_STRUCT__entry(
2295 		__field(dev_t, dev)
2296 		__field(int64_t, blkno)
2297 		__field(unsigned short, len)
2298 		__field(unsigned short, flags)
2299 		__field(unsigned short, size)
2300 		__field(unsigned int, map_size)
2301 	),
2302 	TP_fast_assign(
2303 		__entry->dev = log->l_mp->m_super->s_dev;
2304 		__entry->blkno = buf_f->blf_blkno;
2305 		__entry->len = buf_f->blf_len;
2306 		__entry->flags = buf_f->blf_flags;
2307 		__entry->size = buf_f->blf_size;
2308 		__entry->map_size = buf_f->blf_map_size;
2309 	),
2310 	TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2311 			"map_size %d",
2312 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2313 		  __entry->blkno,
2314 		  __entry->len,
2315 		  __entry->flags,
2316 		  __entry->size,
2317 		  __entry->map_size)
2318 )
2319 
2320 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2321 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2322 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2323 	TP_ARGS(log, buf_f))
2324 
2325 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2326 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2327 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2328 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2329 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2330 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2331 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2332 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2333 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2334 
2335 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2336 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2337 	TP_ARGS(log, in_f),
2338 	TP_STRUCT__entry(
2339 		__field(dev_t, dev)
2340 		__field(xfs_ino_t, ino)
2341 		__field(unsigned short, size)
2342 		__field(int, fields)
2343 		__field(unsigned short, asize)
2344 		__field(unsigned short, dsize)
2345 		__field(int64_t, blkno)
2346 		__field(int, len)
2347 		__field(int, boffset)
2348 	),
2349 	TP_fast_assign(
2350 		__entry->dev = log->l_mp->m_super->s_dev;
2351 		__entry->ino = in_f->ilf_ino;
2352 		__entry->size = in_f->ilf_size;
2353 		__entry->fields = in_f->ilf_fields;
2354 		__entry->asize = in_f->ilf_asize;
2355 		__entry->dsize = in_f->ilf_dsize;
2356 		__entry->blkno = in_f->ilf_blkno;
2357 		__entry->len = in_f->ilf_len;
2358 		__entry->boffset = in_f->ilf_boffset;
2359 	),
2360 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2361 			"dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2362 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2363 		  __entry->ino,
2364 		  __entry->size,
2365 		  __entry->fields,
2366 		  __entry->asize,
2367 		  __entry->dsize,
2368 		  __entry->blkno,
2369 		  __entry->len,
2370 		  __entry->boffset)
2371 )
2372 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2373 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2374 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2375 	TP_ARGS(log, in_f))
2376 
2377 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2378 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2379 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2380 
2381 DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2382 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2383 	TP_ARGS(log, in_f),
2384 	TP_STRUCT__entry(
2385 		__field(dev_t, dev)
2386 		__field(xfs_agnumber_t, agno)
2387 		__field(xfs_agblock_t, agbno)
2388 		__field(unsigned int, count)
2389 		__field(unsigned int, isize)
2390 		__field(xfs_agblock_t, length)
2391 		__field(unsigned int, gen)
2392 	),
2393 	TP_fast_assign(
2394 		__entry->dev = log->l_mp->m_super->s_dev;
2395 		__entry->agno = be32_to_cpu(in_f->icl_ag);
2396 		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2397 		__entry->count = be32_to_cpu(in_f->icl_count);
2398 		__entry->isize = be32_to_cpu(in_f->icl_isize);
2399 		__entry->length = be32_to_cpu(in_f->icl_length);
2400 		__entry->gen = be32_to_cpu(in_f->icl_gen);
2401 	),
2402 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2403 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2404 		  __entry->agno,
2405 		  __entry->agbno,
2406 		  __entry->length,
2407 		  __entry->count,
2408 		  __entry->isize,
2409 		  __entry->gen)
2410 )
2411 #define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2412 DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2413 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2414 	TP_ARGS(log, in_f))
2415 
2416 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2417 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2418 
2419 DECLARE_EVENT_CLASS(xfs_discard_class,
2420 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2421 		 xfs_agblock_t agbno, xfs_extlen_t len),
2422 	TP_ARGS(mp, agno, agbno, len),
2423 	TP_STRUCT__entry(
2424 		__field(dev_t, dev)
2425 		__field(xfs_agnumber_t, agno)
2426 		__field(xfs_agblock_t, agbno)
2427 		__field(xfs_extlen_t, len)
2428 	),
2429 	TP_fast_assign(
2430 		__entry->dev = mp->m_super->s_dev;
2431 		__entry->agno = agno;
2432 		__entry->agbno = agbno;
2433 		__entry->len = len;
2434 	),
2435 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2436 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2437 		  __entry->agno,
2438 		  __entry->agbno,
2439 		  __entry->len)
2440 )
2441 
2442 #define DEFINE_DISCARD_EVENT(name) \
2443 DEFINE_EVENT(xfs_discard_class, name, \
2444 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2445 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2446 	TP_ARGS(mp, agno, agbno, len))
2447 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2448 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2449 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2450 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2451 
2452 /* btree cursor events */
2453 TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2454 TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2455 TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2456 TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2457 TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2458 TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2459 TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2460 
2461 DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2462 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2463 	TP_ARGS(cur, level, bp),
2464 	TP_STRUCT__entry(
2465 		__field(dev_t, dev)
2466 		__field(xfs_btnum_t, btnum)
2467 		__field(int, level)
2468 		__field(int, nlevels)
2469 		__field(int, ptr)
2470 		__field(xfs_daddr_t, daddr)
2471 	),
2472 	TP_fast_assign(
2473 		__entry->dev = cur->bc_mp->m_super->s_dev;
2474 		__entry->btnum = cur->bc_btnum;
2475 		__entry->level = level;
2476 		__entry->nlevels = cur->bc_nlevels;
2477 		__entry->ptr = cur->bc_levels[level].ptr;
2478 		__entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2479 	),
2480 	TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
2481 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2482 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
2483 		  __entry->level,
2484 		  __entry->nlevels,
2485 		  __entry->ptr,
2486 		  (unsigned long long)__entry->daddr)
2487 )
2488 
2489 #define DEFINE_BTREE_CUR_EVENT(name) \
2490 DEFINE_EVENT(xfs_btree_cur_class, name, \
2491 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2492 	TP_ARGS(cur, level, bp))
2493 DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2494 DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2495 
2496 /* deferred ops */
2497 struct xfs_defer_pending;
2498 
2499 DECLARE_EVENT_CLASS(xfs_defer_class,
2500 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2501 	TP_ARGS(tp, caller_ip),
2502 	TP_STRUCT__entry(
2503 		__field(dev_t, dev)
2504 		__field(struct xfs_trans *, tp)
2505 		__field(char, committed)
2506 		__field(unsigned long, caller_ip)
2507 	),
2508 	TP_fast_assign(
2509 		__entry->dev = tp->t_mountp->m_super->s_dev;
2510 		__entry->tp = tp;
2511 		__entry->caller_ip = caller_ip;
2512 	),
2513 	TP_printk("dev %d:%d tp %p caller %pS",
2514 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2515 		  __entry->tp,
2516 		  (char *)__entry->caller_ip)
2517 )
2518 #define DEFINE_DEFER_EVENT(name) \
2519 DEFINE_EVENT(xfs_defer_class, name, \
2520 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2521 	TP_ARGS(tp, caller_ip))
2522 
2523 DECLARE_EVENT_CLASS(xfs_defer_error_class,
2524 	TP_PROTO(struct xfs_trans *tp, int error),
2525 	TP_ARGS(tp, error),
2526 	TP_STRUCT__entry(
2527 		__field(dev_t, dev)
2528 		__field(struct xfs_trans *, tp)
2529 		__field(char, committed)
2530 		__field(int, error)
2531 	),
2532 	TP_fast_assign(
2533 		__entry->dev = tp->t_mountp->m_super->s_dev;
2534 		__entry->tp = tp;
2535 		__entry->error = error;
2536 	),
2537 	TP_printk("dev %d:%d tp %p err %d",
2538 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2539 		  __entry->tp,
2540 		  __entry->error)
2541 )
2542 #define DEFINE_DEFER_ERROR_EVENT(name) \
2543 DEFINE_EVENT(xfs_defer_error_class, name, \
2544 	TP_PROTO(struct xfs_trans *tp, int error), \
2545 	TP_ARGS(tp, error))
2546 
2547 DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2548 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2549 	TP_ARGS(mp, dfp),
2550 	TP_STRUCT__entry(
2551 		__field(dev_t, dev)
2552 		__field(int, type)
2553 		__field(void *, intent)
2554 		__field(char, committed)
2555 		__field(int, nr)
2556 	),
2557 	TP_fast_assign(
2558 		__entry->dev = mp ? mp->m_super->s_dev : 0;
2559 		__entry->type = dfp->dfp_type;
2560 		__entry->intent = dfp->dfp_intent;
2561 		__entry->committed = dfp->dfp_done != NULL;
2562 		__entry->nr = dfp->dfp_count;
2563 	),
2564 	TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
2565 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2566 		  __entry->type,
2567 		  __entry->intent,
2568 		  __entry->committed,
2569 		  __entry->nr)
2570 )
2571 #define DEFINE_DEFER_PENDING_EVENT(name) \
2572 DEFINE_EVENT(xfs_defer_pending_class, name, \
2573 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2574 	TP_ARGS(mp, dfp))
2575 
2576 DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2577 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2578 		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2579 	TP_ARGS(mp, agno, type, agbno, len),
2580 	TP_STRUCT__entry(
2581 		__field(dev_t, dev)
2582 		__field(xfs_agnumber_t, agno)
2583 		__field(int, type)
2584 		__field(xfs_agblock_t, agbno)
2585 		__field(xfs_extlen_t, len)
2586 	),
2587 	TP_fast_assign(
2588 		__entry->dev = mp->m_super->s_dev;
2589 		__entry->agno = agno;
2590 		__entry->type = type;
2591 		__entry->agbno = agbno;
2592 		__entry->len = len;
2593 	),
2594 	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x",
2595 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2596 		  __entry->type,
2597 		  __entry->agno,
2598 		  __entry->agbno,
2599 		  __entry->len)
2600 );
2601 #define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2602 DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2603 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2604 		 int type, \
2605 		 xfs_agblock_t bno, \
2606 		 xfs_extlen_t len), \
2607 	TP_ARGS(mp, agno, type, bno, len))
2608 
2609 DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2610 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2611 		 int op,
2612 		 xfs_agblock_t agbno,
2613 		 xfs_ino_t ino,
2614 		 int whichfork,
2615 		 xfs_fileoff_t offset,
2616 		 xfs_filblks_t len,
2617 		 xfs_exntst_t state),
2618 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2619 	TP_STRUCT__entry(
2620 		__field(dev_t, dev)
2621 		__field(xfs_agnumber_t, agno)
2622 		__field(xfs_ino_t, ino)
2623 		__field(xfs_agblock_t, agbno)
2624 		__field(int, whichfork)
2625 		__field(xfs_fileoff_t, l_loff)
2626 		__field(xfs_filblks_t, l_len)
2627 		__field(xfs_exntst_t, l_state)
2628 		__field(int, op)
2629 	),
2630 	TP_fast_assign(
2631 		__entry->dev = mp->m_super->s_dev;
2632 		__entry->agno = agno;
2633 		__entry->ino = ino;
2634 		__entry->agbno = agbno;
2635 		__entry->whichfork = whichfork;
2636 		__entry->l_loff = offset;
2637 		__entry->l_len = len;
2638 		__entry->l_state = state;
2639 		__entry->op = op;
2640 	),
2641 	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
2642 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2643 		  __entry->op,
2644 		  __entry->agno,
2645 		  __entry->agbno,
2646 		  __entry->ino,
2647 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2648 		  __entry->l_loff,
2649 		  __entry->l_len,
2650 		  __entry->l_state)
2651 );
2652 #define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2653 DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2654 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2655 		 int op, \
2656 		 xfs_agblock_t agbno, \
2657 		 xfs_ino_t ino, \
2658 		 int whichfork, \
2659 		 xfs_fileoff_t offset, \
2660 		 xfs_filblks_t len, \
2661 		 xfs_exntst_t state), \
2662 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2663 
2664 DEFINE_DEFER_EVENT(xfs_defer_cancel);
2665 DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2666 DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2667 DEFINE_DEFER_EVENT(xfs_defer_finish);
2668 DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2669 
2670 DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2671 DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2672 
2673 DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2674 DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2675 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2676 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2677 DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2678 
2679 #define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2680 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2681 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2682 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2683 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
2684 
2685 DECLARE_EVENT_CLASS(xfs_defer_pending_item_class,
2686 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp,
2687 		 void *item),
2688 	TP_ARGS(mp, dfp, item),
2689 	TP_STRUCT__entry(
2690 		__field(dev_t, dev)
2691 		__field(int, type)
2692 		__field(void *, intent)
2693 		__field(void *, item)
2694 		__field(char, committed)
2695 		__field(int, nr)
2696 	),
2697 	TP_fast_assign(
2698 		__entry->dev = mp ? mp->m_super->s_dev : 0;
2699 		__entry->type = dfp->dfp_type;
2700 		__entry->intent = dfp->dfp_intent;
2701 		__entry->item = item;
2702 		__entry->committed = dfp->dfp_done != NULL;
2703 		__entry->nr = dfp->dfp_count;
2704 	),
2705 	TP_printk("dev %d:%d optype %d intent %p item %p committed %d nr %d",
2706 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2707 		  __entry->type,
2708 		  __entry->intent,
2709 		  __entry->item,
2710 		  __entry->committed,
2711 		  __entry->nr)
2712 )
2713 #define DEFINE_DEFER_PENDING_ITEM_EVENT(name) \
2714 DEFINE_EVENT(xfs_defer_pending_item_class, name, \
2715 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp, \
2716 		 void *item), \
2717 	TP_ARGS(mp, dfp, item))
2718 
2719 DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_add_item);
2720 DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_cancel_item);
2721 DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_finish_item);
2722 
2723 /* rmap tracepoints */
2724 DECLARE_EVENT_CLASS(xfs_rmap_class,
2725 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2726 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2727 		 const struct xfs_owner_info *oinfo),
2728 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2729 	TP_STRUCT__entry(
2730 		__field(dev_t, dev)
2731 		__field(xfs_agnumber_t, agno)
2732 		__field(xfs_agblock_t, agbno)
2733 		__field(xfs_extlen_t, len)
2734 		__field(uint64_t, owner)
2735 		__field(uint64_t, offset)
2736 		__field(unsigned long, flags)
2737 	),
2738 	TP_fast_assign(
2739 		__entry->dev = mp->m_super->s_dev;
2740 		__entry->agno = agno;
2741 		__entry->agbno = agbno;
2742 		__entry->len = len;
2743 		__entry->owner = oinfo->oi_owner;
2744 		__entry->offset = oinfo->oi_offset;
2745 		__entry->flags = oinfo->oi_flags;
2746 		if (unwritten)
2747 			__entry->flags |= XFS_RMAP_UNWRITTEN;
2748 	),
2749 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2750 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2751 		  __entry->agno,
2752 		  __entry->agbno,
2753 		  __entry->len,
2754 		  __entry->owner,
2755 		  __entry->offset,
2756 		  __entry->flags)
2757 );
2758 #define DEFINE_RMAP_EVENT(name) \
2759 DEFINE_EVENT(xfs_rmap_class, name, \
2760 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2761 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2762 		 const struct xfs_owner_info *oinfo), \
2763 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2764 
2765 /* simple AG-based error/%ip tracepoint class */
2766 DECLARE_EVENT_CLASS(xfs_ag_error_class,
2767 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2768 		 unsigned long caller_ip),
2769 	TP_ARGS(mp, agno, error, caller_ip),
2770 	TP_STRUCT__entry(
2771 		__field(dev_t, dev)
2772 		__field(xfs_agnumber_t, agno)
2773 		__field(int, error)
2774 		__field(unsigned long, caller_ip)
2775 	),
2776 	TP_fast_assign(
2777 		__entry->dev = mp->m_super->s_dev;
2778 		__entry->agno = agno;
2779 		__entry->error = error;
2780 		__entry->caller_ip = caller_ip;
2781 	),
2782 	TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
2783 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2784 		  __entry->agno,
2785 		  __entry->error,
2786 		  (char *)__entry->caller_ip)
2787 );
2788 
2789 #define DEFINE_AG_ERROR_EVENT(name) \
2790 DEFINE_EVENT(xfs_ag_error_class, name, \
2791 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2792 		 unsigned long caller_ip), \
2793 	TP_ARGS(mp, agno, error, caller_ip))
2794 
2795 DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2796 DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2797 DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2798 DEFINE_RMAP_EVENT(xfs_rmap_map);
2799 DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2800 DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2801 DEFINE_RMAP_EVENT(xfs_rmap_convert);
2802 DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2803 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2804 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2805 
2806 DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2807 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2808 		 xfs_agblock_t agbno, xfs_extlen_t len,
2809 		 uint64_t owner, uint64_t offset, unsigned int flags),
2810 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2811 	TP_STRUCT__entry(
2812 		__field(dev_t, dev)
2813 		__field(xfs_agnumber_t, agno)
2814 		__field(xfs_agblock_t, agbno)
2815 		__field(xfs_extlen_t, len)
2816 		__field(uint64_t, owner)
2817 		__field(uint64_t, offset)
2818 		__field(unsigned int, flags)
2819 	),
2820 	TP_fast_assign(
2821 		__entry->dev = mp->m_super->s_dev;
2822 		__entry->agno = agno;
2823 		__entry->agbno = agbno;
2824 		__entry->len = len;
2825 		__entry->owner = owner;
2826 		__entry->offset = offset;
2827 		__entry->flags = flags;
2828 	),
2829 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2830 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2831 		  __entry->agno,
2832 		  __entry->agbno,
2833 		  __entry->len,
2834 		  __entry->owner,
2835 		  __entry->offset,
2836 		  __entry->flags)
2837 );
2838 #define DEFINE_RMAPBT_EVENT(name) \
2839 DEFINE_EVENT(xfs_rmapbt_class, name, \
2840 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2841 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2842 		 uint64_t owner, uint64_t offset, unsigned int flags), \
2843 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2844 
2845 #define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2846 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2847 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2848 
2849 DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2850 DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2851 DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2852 DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2853 DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2854 DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2855 DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2856 DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2857 
2858 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2859 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2860 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2861 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2862 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2863 DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2864 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
2865 
2866 /* deferred bmbt updates */
2867 #define DEFINE_BMAP_DEFERRED_EVENT	DEFINE_RMAP_DEFERRED_EVENT
2868 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2869 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2870 
2871 /* per-AG reservation */
2872 DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2873 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2874 		 xfs_extlen_t len),
2875 	TP_ARGS(pag, resv, len),
2876 	TP_STRUCT__entry(
2877 		__field(dev_t, dev)
2878 		__field(xfs_agnumber_t, agno)
2879 		__field(int, resv)
2880 		__field(xfs_extlen_t, freeblks)
2881 		__field(xfs_extlen_t, flcount)
2882 		__field(xfs_extlen_t, reserved)
2883 		__field(xfs_extlen_t, asked)
2884 		__field(xfs_extlen_t, len)
2885 	),
2886 	TP_fast_assign(
2887 		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);
2888 
2889 		__entry->dev = pag->pag_mount->m_super->s_dev;
2890 		__entry->agno = pag->pag_agno;
2891 		__entry->resv = resv;
2892 		__entry->freeblks = pag->pagf_freeblks;
2893 		__entry->flcount = pag->pagf_flcount;
2894 		__entry->reserved = r ? r->ar_reserved : 0;
2895 		__entry->asked = r ? r->ar_asked : 0;
2896 		__entry->len = len;
2897 	),
2898 	TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
2899 		  "resv %u ask %u len %u",
2900 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2901 		  __entry->agno,
2902 		  __entry->resv,
2903 		  __entry->freeblks,
2904 		  __entry->flcount,
2905 		  __entry->reserved,
2906 		  __entry->asked,
2907 		  __entry->len)
2908 )
2909 #define DEFINE_AG_RESV_EVENT(name) \
2910 DEFINE_EVENT(xfs_ag_resv_class, name, \
2911 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2912 		 xfs_extlen_t len), \
2913 	TP_ARGS(pag, type, len))
2914 
2915 /* per-AG reservation tracepoints */
2916 DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2917 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2918 DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2919 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2920 DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2921 DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2922 
2923 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2924 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2925 
2926 /* refcount tracepoint classes */
2927 
2928 /* reuse the discard trace class for agbno/aglen-based traces */
2929 #define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2930 
2931 /* ag btree lookup tracepoint class */
2932 TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2933 TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2934 TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
2935 DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2936 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2937 		 xfs_agblock_t agbno, xfs_lookup_t dir),
2938 	TP_ARGS(mp, agno, agbno, dir),
2939 	TP_STRUCT__entry(
2940 		__field(dev_t, dev)
2941 		__field(xfs_agnumber_t, agno)
2942 		__field(xfs_agblock_t, agbno)
2943 		__field(xfs_lookup_t, dir)
2944 	),
2945 	TP_fast_assign(
2946 		__entry->dev = mp->m_super->s_dev;
2947 		__entry->agno = agno;
2948 		__entry->agbno = agbno;
2949 		__entry->dir = dir;
2950 	),
2951 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
2952 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2953 		  __entry->agno,
2954 		  __entry->agbno,
2955 		  __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2956 		  __entry->dir)
2957 )
2958 
2959 #define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2960 DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2961 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2962 		 xfs_agblock_t agbno, xfs_lookup_t dir), \
2963 	TP_ARGS(mp, agno, agbno, dir))
2964 
2965 /* single-rcext tracepoint class */
2966 DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2967 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2968 		 struct xfs_refcount_irec *irec),
2969 	TP_ARGS(mp, agno, irec),
2970 	TP_STRUCT__entry(
2971 		__field(dev_t, dev)
2972 		__field(xfs_agnumber_t, agno)
2973 		__field(enum xfs_refc_domain, domain)
2974 		__field(xfs_agblock_t, startblock)
2975 		__field(xfs_extlen_t, blockcount)
2976 		__field(xfs_nlink_t, refcount)
2977 	),
2978 	TP_fast_assign(
2979 		__entry->dev = mp->m_super->s_dev;
2980 		__entry->agno = agno;
2981 		__entry->domain = irec->rc_domain;
2982 		__entry->startblock = irec->rc_startblock;
2983 		__entry->blockcount = irec->rc_blockcount;
2984 		__entry->refcount = irec->rc_refcount;
2985 	),
2986 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
2987 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2988 		  __entry->agno,
2989 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
2990 		  __entry->startblock,
2991 		  __entry->blockcount,
2992 		  __entry->refcount)
2993 )
2994 
2995 #define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2996 DEFINE_EVENT(xfs_refcount_extent_class, name, \
2997 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2998 		 struct xfs_refcount_irec *irec), \
2999 	TP_ARGS(mp, agno, irec))
3000 
3001 /* single-rcext and an agbno tracepoint class */
3002 DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
3003 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3004 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
3005 	TP_ARGS(mp, agno, irec, agbno),
3006 	TP_STRUCT__entry(
3007 		__field(dev_t, dev)
3008 		__field(xfs_agnumber_t, agno)
3009 		__field(enum xfs_refc_domain, domain)
3010 		__field(xfs_agblock_t, startblock)
3011 		__field(xfs_extlen_t, blockcount)
3012 		__field(xfs_nlink_t, refcount)
3013 		__field(xfs_agblock_t, agbno)
3014 	),
3015 	TP_fast_assign(
3016 		__entry->dev = mp->m_super->s_dev;
3017 		__entry->agno = agno;
3018 		__entry->domain = irec->rc_domain;
3019 		__entry->startblock = irec->rc_startblock;
3020 		__entry->blockcount = irec->rc_blockcount;
3021 		__entry->refcount = irec->rc_refcount;
3022 		__entry->agbno = agbno;
3023 	),
3024 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3025 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3026 		  __entry->agno,
3027 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
3028 		  __entry->startblock,
3029 		  __entry->blockcount,
3030 		  __entry->refcount,
3031 		  __entry->agbno)
3032 )
3033 
3034 #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
3035 DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
3036 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3037 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
3038 	TP_ARGS(mp, agno, irec, agbno))
3039 
3040 /* double-rcext tracepoint class */
3041 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
3042 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3043 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
3044 	TP_ARGS(mp, agno, i1, i2),
3045 	TP_STRUCT__entry(
3046 		__field(dev_t, dev)
3047 		__field(xfs_agnumber_t, agno)
3048 		__field(enum xfs_refc_domain, i1_domain)
3049 		__field(xfs_agblock_t, i1_startblock)
3050 		__field(xfs_extlen_t, i1_blockcount)
3051 		__field(xfs_nlink_t, i1_refcount)
3052 		__field(enum xfs_refc_domain, i2_domain)
3053 		__field(xfs_agblock_t, i2_startblock)
3054 		__field(xfs_extlen_t, i2_blockcount)
3055 		__field(xfs_nlink_t, i2_refcount)
3056 	),
3057 	TP_fast_assign(
3058 		__entry->dev = mp->m_super->s_dev;
3059 		__entry->agno = agno;
3060 		__entry->i1_domain = i1->rc_domain;
3061 		__entry->i1_startblock = i1->rc_startblock;
3062 		__entry->i1_blockcount = i1->rc_blockcount;
3063 		__entry->i1_refcount = i1->rc_refcount;
3064 		__entry->i2_domain = i2->rc_domain;
3065 		__entry->i2_startblock = i2->rc_startblock;
3066 		__entry->i2_blockcount = i2->rc_blockcount;
3067 		__entry->i2_refcount = i2->rc_refcount;
3068 	),
3069 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3070 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3071 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3072 		  __entry->agno,
3073 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3074 		  __entry->i1_startblock,
3075 		  __entry->i1_blockcount,
3076 		  __entry->i1_refcount,
3077 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3078 		  __entry->i2_startblock,
3079 		  __entry->i2_blockcount,
3080 		  __entry->i2_refcount)
3081 )
3082 
3083 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3084 DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3085 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3086 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
3087 	TP_ARGS(mp, agno, i1, i2))
3088 
3089 /* double-rcext and an agbno tracepoint class */
3090 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3091 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3092 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3093 		 xfs_agblock_t agbno),
3094 	TP_ARGS(mp, agno, i1, i2, agbno),
3095 	TP_STRUCT__entry(
3096 		__field(dev_t, dev)
3097 		__field(xfs_agnumber_t, agno)
3098 		__field(enum xfs_refc_domain, i1_domain)
3099 		__field(xfs_agblock_t, i1_startblock)
3100 		__field(xfs_extlen_t, i1_blockcount)
3101 		__field(xfs_nlink_t, i1_refcount)
3102 		__field(enum xfs_refc_domain, i2_domain)
3103 		__field(xfs_agblock_t, i2_startblock)
3104 		__field(xfs_extlen_t, i2_blockcount)
3105 		__field(xfs_nlink_t, i2_refcount)
3106 		__field(xfs_agblock_t, agbno)
3107 	),
3108 	TP_fast_assign(
3109 		__entry->dev = mp->m_super->s_dev;
3110 		__entry->agno = agno;
3111 		__entry->i1_domain = i1->rc_domain;
3112 		__entry->i1_startblock = i1->rc_startblock;
3113 		__entry->i1_blockcount = i1->rc_blockcount;
3114 		__entry->i1_refcount = i1->rc_refcount;
3115 		__entry->i2_domain = i2->rc_domain;
3116 		__entry->i2_startblock = i2->rc_startblock;
3117 		__entry->i2_blockcount = i2->rc_blockcount;
3118 		__entry->i2_refcount = i2->rc_refcount;
3119 		__entry->agbno = agbno;
3120 	),
3121 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3122 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3123 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3124 		  __entry->agno,
3125 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3126 		  __entry->i1_startblock,
3127 		  __entry->i1_blockcount,
3128 		  __entry->i1_refcount,
3129 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3130 		  __entry->i2_startblock,
3131 		  __entry->i2_blockcount,
3132 		  __entry->i2_refcount,
3133 		  __entry->agbno)
3134 )
3135 
3136 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3137 DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3138 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3139 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3140 		 xfs_agblock_t agbno), \
3141 	TP_ARGS(mp, agno, i1, i2, agbno))
3142 
3143 /* triple-rcext tracepoint class */
3144 DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3145 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3146 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3147 		 struct xfs_refcount_irec *i3),
3148 	TP_ARGS(mp, agno, i1, i2, i3),
3149 	TP_STRUCT__entry(
3150 		__field(dev_t, dev)
3151 		__field(xfs_agnumber_t, agno)
3152 		__field(enum xfs_refc_domain, i1_domain)
3153 		__field(xfs_agblock_t, i1_startblock)
3154 		__field(xfs_extlen_t, i1_blockcount)
3155 		__field(xfs_nlink_t, i1_refcount)
3156 		__field(enum xfs_refc_domain, i2_domain)
3157 		__field(xfs_agblock_t, i2_startblock)
3158 		__field(xfs_extlen_t, i2_blockcount)
3159 		__field(xfs_nlink_t, i2_refcount)
3160 		__field(enum xfs_refc_domain, i3_domain)
3161 		__field(xfs_agblock_t, i3_startblock)
3162 		__field(xfs_extlen_t, i3_blockcount)
3163 		__field(xfs_nlink_t, i3_refcount)
3164 	),
3165 	TP_fast_assign(
3166 		__entry->dev = mp->m_super->s_dev;
3167 		__entry->agno = agno;
3168 		__entry->i1_domain = i1->rc_domain;
3169 		__entry->i1_startblock = i1->rc_startblock;
3170 		__entry->i1_blockcount = i1->rc_blockcount;
3171 		__entry->i1_refcount = i1->rc_refcount;
3172 		__entry->i2_domain = i2->rc_domain;
3173 		__entry->i2_startblock = i2->rc_startblock;
3174 		__entry->i2_blockcount = i2->rc_blockcount;
3175 		__entry->i2_refcount = i2->rc_refcount;
3176 		__entry->i3_domain = i3->rc_domain;
3177 		__entry->i3_startblock = i3->rc_startblock;
3178 		__entry->i3_blockcount = i3->rc_blockcount;
3179 		__entry->i3_refcount = i3->rc_refcount;
3180 	),
3181 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3182 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3183 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3184 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3185 		  __entry->agno,
3186 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3187 		  __entry->i1_startblock,
3188 		  __entry->i1_blockcount,
3189 		  __entry->i1_refcount,
3190 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3191 		  __entry->i2_startblock,
3192 		  __entry->i2_blockcount,
3193 		  __entry->i2_refcount,
3194 		  __print_symbolic(__entry->i3_domain, XFS_REFC_DOMAIN_STRINGS),
3195 		  __entry->i3_startblock,
3196 		  __entry->i3_blockcount,
3197 		  __entry->i3_refcount)
3198 );
3199 
3200 #define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3201 DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3202 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3203 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3204 		 struct xfs_refcount_irec *i3), \
3205 	TP_ARGS(mp, agno, i1, i2, i3))
3206 
3207 /* refcount btree tracepoints */
3208 DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
3209 DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
3210 DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
3211 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3212 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3213 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3214 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3215 DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
3216 DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
3217 DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
3218 
3219 /* refcount adjustment tracepoints */
3220 DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
3221 DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
3222 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
3223 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
3224 DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3225 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3226 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
3227 DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3228 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3229 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3230 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3231 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3232 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
3233 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3234 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3235 DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
3236 DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
3237 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3238 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3239 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3240 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3241 
3242 /* reflink helpers */
3243 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
3244 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
3245 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
3246 #define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
3247 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3248 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3249 
3250 TRACE_EVENT(xfs_refcount_finish_one_leftover,
3251 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3252 		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
3253 	TP_ARGS(mp, agno, type, agbno, len),
3254 	TP_STRUCT__entry(
3255 		__field(dev_t, dev)
3256 		__field(xfs_agnumber_t, agno)
3257 		__field(int, type)
3258 		__field(xfs_agblock_t, agbno)
3259 		__field(xfs_extlen_t, len)
3260 	),
3261 	TP_fast_assign(
3262 		__entry->dev = mp->m_super->s_dev;
3263 		__entry->agno = agno;
3264 		__entry->type = type;
3265 		__entry->agbno = agbno;
3266 		__entry->len = len;
3267 	),
3268 	TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x",
3269 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3270 		  __entry->type,
3271 		  __entry->agno,
3272 		  __entry->agbno,
3273 		  __entry->len)
3274 );
3275 
3276 /* simple inode-based error/%ip tracepoint class */
3277 DECLARE_EVENT_CLASS(xfs_inode_error_class,
3278 	TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3279 	TP_ARGS(ip, error, caller_ip),
3280 	TP_STRUCT__entry(
3281 		__field(dev_t, dev)
3282 		__field(xfs_ino_t, ino)
3283 		__field(int, error)
3284 		__field(unsigned long, caller_ip)
3285 	),
3286 	TP_fast_assign(
3287 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3288 		__entry->ino = ip->i_ino;
3289 		__entry->error = error;
3290 		__entry->caller_ip = caller_ip;
3291 	),
3292 	TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3293 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3294 		  __entry->ino,
3295 		  __entry->error,
3296 		  (char *)__entry->caller_ip)
3297 );
3298 
3299 #define DEFINE_INODE_ERROR_EVENT(name) \
3300 DEFINE_EVENT(xfs_inode_error_class, name, \
3301 	TP_PROTO(struct xfs_inode *ip, int error, \
3302 		 unsigned long caller_ip), \
3303 	TP_ARGS(ip, error, caller_ip))
3304 
3305 /* reflink tracepoint classes */
3306 
3307 /* two-file io tracepoint class */
3308 DECLARE_EVENT_CLASS(xfs_double_io_class,
3309 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3310 		 struct xfs_inode *dest, xfs_off_t doffset),
3311 	TP_ARGS(src, soffset, len, dest, doffset),
3312 	TP_STRUCT__entry(
3313 		__field(dev_t, dev)
3314 		__field(xfs_ino_t, src_ino)
3315 		__field(loff_t, src_isize)
3316 		__field(loff_t, src_disize)
3317 		__field(loff_t, src_offset)
3318 		__field(long long, len)
3319 		__field(xfs_ino_t, dest_ino)
3320 		__field(loff_t, dest_isize)
3321 		__field(loff_t, dest_disize)
3322 		__field(loff_t, dest_offset)
3323 	),
3324 	TP_fast_assign(
3325 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3326 		__entry->src_ino = src->i_ino;
3327 		__entry->src_isize = VFS_I(src)->i_size;
3328 		__entry->src_disize = src->i_disk_size;
3329 		__entry->src_offset = soffset;
3330 		__entry->len = len;
3331 		__entry->dest_ino = dest->i_ino;
3332 		__entry->dest_isize = VFS_I(dest)->i_size;
3333 		__entry->dest_disize = dest->i_disk_size;
3334 		__entry->dest_offset = doffset;
3335 	),
3336 	TP_printk("dev %d:%d bytecount 0x%llx "
3337 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
3338 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3339 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3340 		  __entry->len,
3341 		  __entry->src_ino,
3342 		  __entry->src_isize,
3343 		  __entry->src_disize,
3344 		  __entry->src_offset,
3345 		  __entry->dest_ino,
3346 		  __entry->dest_isize,
3347 		  __entry->dest_disize,
3348 		  __entry->dest_offset)
3349 )
3350 
3351 #define DEFINE_DOUBLE_IO_EVENT(name)	\
3352 DEFINE_EVENT(xfs_double_io_class, name,	\
3353 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3354 		 struct xfs_inode *dest, xfs_off_t doffset), \
3355 	TP_ARGS(src, soffset, len, dest, doffset))
3356 
3357 /* inode/irec events */
3358 DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3359 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3360 	TP_ARGS(ip, irec),
3361 	TP_STRUCT__entry(
3362 		__field(dev_t, dev)
3363 		__field(xfs_ino_t, ino)
3364 		__field(xfs_fileoff_t, lblk)
3365 		__field(xfs_extlen_t, len)
3366 		__field(xfs_fsblock_t, pblk)
3367 		__field(int, state)
3368 	),
3369 	TP_fast_assign(
3370 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3371 		__entry->ino = ip->i_ino;
3372 		__entry->lblk = irec->br_startoff;
3373 		__entry->len = irec->br_blockcount;
3374 		__entry->pblk = irec->br_startblock;
3375 		__entry->state = irec->br_state;
3376 	),
3377 	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3378 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3379 		  __entry->ino,
3380 		  __entry->lblk,
3381 		  __entry->len,
3382 		  __entry->pblk,
3383 		  __entry->state)
3384 );
3385 #define DEFINE_INODE_IREC_EVENT(name) \
3386 DEFINE_EVENT(xfs_inode_irec_class, name, \
3387 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3388 	TP_ARGS(ip, irec))
3389 
3390 /* inode iomap invalidation events */
3391 DECLARE_EVENT_CLASS(xfs_wb_invalid_class,
3392 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork),
3393 	TP_ARGS(ip, iomap, wpcseq, whichfork),
3394 	TP_STRUCT__entry(
3395 		__field(dev_t, dev)
3396 		__field(xfs_ino_t, ino)
3397 		__field(u64, addr)
3398 		__field(loff_t, pos)
3399 		__field(u64, len)
3400 		__field(u16, type)
3401 		__field(u16, flags)
3402 		__field(u32, wpcseq)
3403 		__field(u32, forkseq)
3404 	),
3405 	TP_fast_assign(
3406 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3407 		__entry->ino = ip->i_ino;
3408 		__entry->addr = iomap->addr;
3409 		__entry->pos = iomap->offset;
3410 		__entry->len = iomap->length;
3411 		__entry->type = iomap->type;
3412 		__entry->flags = iomap->flags;
3413 		__entry->wpcseq = wpcseq;
3414 		__entry->forkseq = READ_ONCE(xfs_ifork_ptr(ip, whichfork)->if_seq);
3415 	),
3416 	TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x wpcseq 0x%x forkseq 0x%x",
3417 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3418 		  __entry->ino,
3419 		  __entry->pos,
3420 		  __entry->addr,
3421 		  __entry->len,
3422 		  __entry->type,
3423 		  __entry->flags,
3424 		  __entry->wpcseq,
3425 		  __entry->forkseq)
3426 );
3427 #define DEFINE_WB_INVALID_EVENT(name) \
3428 DEFINE_EVENT(xfs_wb_invalid_class, name, \
3429 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork), \
3430 	TP_ARGS(ip, iomap, wpcseq, whichfork))
3431 DEFINE_WB_INVALID_EVENT(xfs_wb_cow_iomap_invalid);
3432 DEFINE_WB_INVALID_EVENT(xfs_wb_data_iomap_invalid);
3433 
3434 DECLARE_EVENT_CLASS(xfs_iomap_invalid_class,
3435 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap),
3436 	TP_ARGS(ip, iomap),
3437 	TP_STRUCT__entry(
3438 		__field(dev_t, dev)
3439 		__field(xfs_ino_t, ino)
3440 		__field(u64, addr)
3441 		__field(loff_t, pos)
3442 		__field(u64, len)
3443 		__field(u64, validity_cookie)
3444 		__field(u64, inodeseq)
3445 		__field(u16, type)
3446 		__field(u16, flags)
3447 	),
3448 	TP_fast_assign(
3449 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3450 		__entry->ino = ip->i_ino;
3451 		__entry->addr = iomap->addr;
3452 		__entry->pos = iomap->offset;
3453 		__entry->len = iomap->length;
3454 		__entry->validity_cookie = iomap->validity_cookie;
3455 		__entry->type = iomap->type;
3456 		__entry->flags = iomap->flags;
3457 		__entry->inodeseq = xfs_iomap_inode_sequence(ip, iomap->flags);
3458 	),
3459 	TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x validity_cookie 0x%llx inodeseq 0x%llx",
3460 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3461 		  __entry->ino,
3462 		  __entry->pos,
3463 		  __entry->addr,
3464 		  __entry->len,
3465 		  __entry->type,
3466 		  __entry->flags,
3467 		  __entry->validity_cookie,
3468 		  __entry->inodeseq)
3469 );
3470 #define DEFINE_IOMAP_INVALID_EVENT(name) \
3471 DEFINE_EVENT(xfs_iomap_invalid_class, name, \
3472 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap), \
3473 	TP_ARGS(ip, iomap))
3474 DEFINE_IOMAP_INVALID_EVENT(xfs_iomap_invalid);
3475 
3476 /* refcount/reflink tracepoint definitions */
3477 
3478 /* reflink tracepoints */
3479 DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3480 DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3481 DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3482 TRACE_EVENT(xfs_reflink_remap_blocks,
3483 	TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3484 		 xfs_filblks_t len, struct xfs_inode *dest,
3485 		 xfs_fileoff_t doffset),
3486 	TP_ARGS(src, soffset, len, dest, doffset),
3487 	TP_STRUCT__entry(
3488 		__field(dev_t, dev)
3489 		__field(xfs_ino_t, src_ino)
3490 		__field(xfs_fileoff_t, src_lblk)
3491 		__field(xfs_filblks_t, len)
3492 		__field(xfs_ino_t, dest_ino)
3493 		__field(xfs_fileoff_t, dest_lblk)
3494 	),
3495 	TP_fast_assign(
3496 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3497 		__entry->src_ino = src->i_ino;
3498 		__entry->src_lblk = soffset;
3499 		__entry->len = len;
3500 		__entry->dest_ino = dest->i_ino;
3501 		__entry->dest_lblk = doffset;
3502 	),
3503 	TP_printk("dev %d:%d fsbcount 0x%llx "
3504 		  "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3505 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3506 		  __entry->len,
3507 		  __entry->src_ino,
3508 		  __entry->src_lblk,
3509 		  __entry->dest_ino,
3510 		  __entry->dest_lblk)
3511 );
3512 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3513 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3514 DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3515 DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3516 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3517 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3518 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3519 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3520 
3521 /* dedupe tracepoints */
3522 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3523 DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3524 
3525 /* ioctl tracepoints */
3526 TRACE_EVENT(xfs_ioctl_clone,
3527 	TP_PROTO(struct inode *src, struct inode *dest),
3528 	TP_ARGS(src, dest),
3529 	TP_STRUCT__entry(
3530 		__field(dev_t, dev)
3531 		__field(unsigned long, src_ino)
3532 		__field(loff_t, src_isize)
3533 		__field(unsigned long, dest_ino)
3534 		__field(loff_t, dest_isize)
3535 	),
3536 	TP_fast_assign(
3537 		__entry->dev = src->i_sb->s_dev;
3538 		__entry->src_ino = src->i_ino;
3539 		__entry->src_isize = i_size_read(src);
3540 		__entry->dest_ino = dest->i_ino;
3541 		__entry->dest_isize = i_size_read(dest);
3542 	),
3543 	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3544 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3545 		  __entry->src_ino,
3546 		  __entry->src_isize,
3547 		  __entry->dest_ino,
3548 		  __entry->dest_isize)
3549 );
3550 
3551 /* unshare tracepoints */
3552 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3553 DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3554 
3555 /* copy on write */
3556 DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3557 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3558 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3559 DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3560 
3561 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3562 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3563 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
3564 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3565 
3566 DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3567 DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3568 
3569 
3570 DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3571 
3572 /* rmap swapext tracepoints */
3573 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3574 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3575 DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3576 
3577 /* fsmap traces */
3578 DECLARE_EVENT_CLASS(xfs_fsmap_class,
3579 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3580 		 const struct xfs_rmap_irec *rmap),
3581 	TP_ARGS(mp, keydev, agno, rmap),
3582 	TP_STRUCT__entry(
3583 		__field(dev_t, dev)
3584 		__field(dev_t, keydev)
3585 		__field(xfs_agnumber_t, agno)
3586 		__field(xfs_fsblock_t, bno)
3587 		__field(xfs_filblks_t, len)
3588 		__field(uint64_t, owner)
3589 		__field(uint64_t, offset)
3590 		__field(unsigned int, flags)
3591 	),
3592 	TP_fast_assign(
3593 		__entry->dev = mp->m_super->s_dev;
3594 		__entry->keydev = new_decode_dev(keydev);
3595 		__entry->agno = agno;
3596 		__entry->bno = rmap->rm_startblock;
3597 		__entry->len = rmap->rm_blockcount;
3598 		__entry->owner = rmap->rm_owner;
3599 		__entry->offset = rmap->rm_offset;
3600 		__entry->flags = rmap->rm_flags;
3601 	),
3602 	TP_printk("dev %d:%d keydev %d:%d agno 0x%x startblock 0x%llx fsbcount 0x%llx owner 0x%llx fileoff 0x%llx flags 0x%x",
3603 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3604 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3605 		  __entry->agno,
3606 		  __entry->bno,
3607 		  __entry->len,
3608 		  __entry->owner,
3609 		  __entry->offset,
3610 		  __entry->flags)
3611 )
3612 #define DEFINE_FSMAP_EVENT(name) \
3613 DEFINE_EVENT(xfs_fsmap_class, name, \
3614 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3615 		 const struct xfs_rmap_irec *rmap), \
3616 	TP_ARGS(mp, keydev, agno, rmap))
3617 DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3618 DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3619 DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3620 
3621 DECLARE_EVENT_CLASS(xfs_fsmap_linear_class,
3622 	TP_PROTO(struct xfs_mount *mp, u32 keydev, uint64_t bno),
3623 	TP_ARGS(mp, keydev, bno),
3624 	TP_STRUCT__entry(
3625 		__field(dev_t, dev)
3626 		__field(dev_t, keydev)
3627 		__field(xfs_fsblock_t, bno)
3628 	),
3629 	TP_fast_assign(
3630 		__entry->dev = mp->m_super->s_dev;
3631 		__entry->keydev = new_decode_dev(keydev);
3632 		__entry->bno = bno;
3633 	),
3634 	TP_printk("dev %d:%d keydev %d:%d bno 0x%llx",
3635 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3636 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3637 		  __entry->bno)
3638 )
3639 #define DEFINE_FSMAP_LINEAR_EVENT(name) \
3640 DEFINE_EVENT(xfs_fsmap_linear_class, name, \
3641 	TP_PROTO(struct xfs_mount *mp, u32 keydev, uint64_t bno), \
3642 	TP_ARGS(mp, keydev, bno))
3643 DEFINE_FSMAP_LINEAR_EVENT(xfs_fsmap_low_key_linear);
3644 DEFINE_FSMAP_LINEAR_EVENT(xfs_fsmap_high_key_linear);
3645 
3646 DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3647 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3648 	TP_ARGS(mp, fsmap),
3649 	TP_STRUCT__entry(
3650 		__field(dev_t, dev)
3651 		__field(dev_t, keydev)
3652 		__field(xfs_daddr_t, block)
3653 		__field(xfs_daddr_t, len)
3654 		__field(uint64_t, owner)
3655 		__field(uint64_t, offset)
3656 		__field(uint64_t, flags)
3657 	),
3658 	TP_fast_assign(
3659 		__entry->dev = mp->m_super->s_dev;
3660 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
3661 		__entry->block = fsmap->fmr_physical;
3662 		__entry->len = fsmap->fmr_length;
3663 		__entry->owner = fsmap->fmr_owner;
3664 		__entry->offset = fsmap->fmr_offset;
3665 		__entry->flags = fsmap->fmr_flags;
3666 	),
3667 	TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
3668 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3669 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3670 		  __entry->block,
3671 		  __entry->len,
3672 		  __entry->owner,
3673 		  __entry->offset,
3674 		  __entry->flags)
3675 )
3676 #define DEFINE_GETFSMAP_EVENT(name) \
3677 DEFINE_EVENT(xfs_getfsmap_class, name, \
3678 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3679 	TP_ARGS(mp, fsmap))
3680 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3681 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3682 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3683 
3684 DECLARE_EVENT_CLASS(xfs_trans_resv_class,
3685 	TP_PROTO(struct xfs_mount *mp, unsigned int type,
3686 		 struct xfs_trans_res *res),
3687 	TP_ARGS(mp, type, res),
3688 	TP_STRUCT__entry(
3689 		__field(dev_t, dev)
3690 		__field(int, type)
3691 		__field(uint, logres)
3692 		__field(int, logcount)
3693 		__field(int, logflags)
3694 	),
3695 	TP_fast_assign(
3696 		__entry->dev = mp->m_super->s_dev;
3697 		__entry->type = type;
3698 		__entry->logres = res->tr_logres;
3699 		__entry->logcount = res->tr_logcount;
3700 		__entry->logflags = res->tr_logflags;
3701 	),
3702 	TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3703 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3704 		  __entry->type,
3705 		  __entry->logres,
3706 		  __entry->logcount,
3707 		  __entry->logflags)
3708 )
3709 
3710 #define DEFINE_TRANS_RESV_EVENT(name) \
3711 DEFINE_EVENT(xfs_trans_resv_class, name, \
3712 	TP_PROTO(struct xfs_mount *mp, unsigned int type, \
3713 		 struct xfs_trans_res *res), \
3714 	TP_ARGS(mp, type, res))
3715 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
3716 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
3717 
3718 TRACE_EVENT(xfs_log_get_max_trans_res,
3719 	TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
3720 	TP_ARGS(mp, res),
3721 	TP_STRUCT__entry(
3722 		__field(dev_t, dev)
3723 		__field(uint, logres)
3724 		__field(int, logcount)
3725 	),
3726 	TP_fast_assign(
3727 		__entry->dev = mp->m_super->s_dev;
3728 		__entry->logres = res->tr_logres;
3729 		__entry->logcount = res->tr_logcount;
3730 	),
3731 	TP_printk("dev %d:%d logres %u logcount %d",
3732 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3733 		  __entry->logres,
3734 		  __entry->logcount)
3735 );
3736 
3737 DECLARE_EVENT_CLASS(xfs_trans_class,
3738 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3739 	TP_ARGS(tp, caller_ip),
3740 	TP_STRUCT__entry(
3741 		__field(dev_t, dev)
3742 		__field(uint32_t, tid)
3743 		__field(uint32_t, flags)
3744 		__field(unsigned long, caller_ip)
3745 	),
3746 	TP_fast_assign(
3747 		__entry->dev = tp->t_mountp->m_super->s_dev;
3748 		__entry->tid = 0;
3749 		if (tp->t_ticket)
3750 			__entry->tid = tp->t_ticket->t_tid;
3751 		__entry->flags = tp->t_flags;
3752 		__entry->caller_ip = caller_ip;
3753 	),
3754 	TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3755 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3756 		  __entry->tid,
3757 		  __entry->flags,
3758 		  (char *)__entry->caller_ip)
3759 )
3760 
3761 #define DEFINE_TRANS_EVENT(name) \
3762 DEFINE_EVENT(xfs_trans_class, name, \
3763 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3764 	TP_ARGS(tp, caller_ip))
3765 DEFINE_TRANS_EVENT(xfs_trans_alloc);
3766 DEFINE_TRANS_EVENT(xfs_trans_cancel);
3767 DEFINE_TRANS_EVENT(xfs_trans_commit);
3768 DEFINE_TRANS_EVENT(xfs_trans_dup);
3769 DEFINE_TRANS_EVENT(xfs_trans_free);
3770 DEFINE_TRANS_EVENT(xfs_trans_roll);
3771 DEFINE_TRANS_EVENT(xfs_trans_add_item);
3772 DEFINE_TRANS_EVENT(xfs_trans_commit_items);
3773 DEFINE_TRANS_EVENT(xfs_trans_free_items);
3774 
3775 TRACE_EVENT(xfs_iunlink_update_bucket,
3776 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3777 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3778 	TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3779 	TP_STRUCT__entry(
3780 		__field(dev_t, dev)
3781 		__field(xfs_agnumber_t, agno)
3782 		__field(unsigned int, bucket)
3783 		__field(xfs_agino_t, old_ptr)
3784 		__field(xfs_agino_t, new_ptr)
3785 	),
3786 	TP_fast_assign(
3787 		__entry->dev = mp->m_super->s_dev;
3788 		__entry->agno = agno;
3789 		__entry->bucket = bucket;
3790 		__entry->old_ptr = old_ptr;
3791 		__entry->new_ptr = new_ptr;
3792 	),
3793 	TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
3794 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3795 		  __entry->agno,
3796 		  __entry->bucket,
3797 		  __entry->old_ptr,
3798 		  __entry->new_ptr)
3799 );
3800 
3801 TRACE_EVENT(xfs_iunlink_update_dinode,
3802 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3803 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3804 	TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3805 	TP_STRUCT__entry(
3806 		__field(dev_t, dev)
3807 		__field(xfs_agnumber_t, agno)
3808 		__field(xfs_agino_t, agino)
3809 		__field(xfs_agino_t, old_ptr)
3810 		__field(xfs_agino_t, new_ptr)
3811 	),
3812 	TP_fast_assign(
3813 		__entry->dev = mp->m_super->s_dev;
3814 		__entry->agno = agno;
3815 		__entry->agino = agino;
3816 		__entry->old_ptr = old_ptr;
3817 		__entry->new_ptr = new_ptr;
3818 	),
3819 	TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
3820 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3821 		  __entry->agno,
3822 		  __entry->agino,
3823 		  __entry->old_ptr,
3824 		  __entry->new_ptr)
3825 );
3826 
3827 TRACE_EVENT(xfs_iunlink_reload_next,
3828 	TP_PROTO(struct xfs_inode *ip),
3829 	TP_ARGS(ip),
3830 	TP_STRUCT__entry(
3831 		__field(dev_t, dev)
3832 		__field(xfs_agnumber_t, agno)
3833 		__field(xfs_agino_t, agino)
3834 		__field(xfs_agino_t, prev_agino)
3835 		__field(xfs_agino_t, next_agino)
3836 	),
3837 	TP_fast_assign(
3838 		__entry->dev = ip->i_mount->m_super->s_dev;
3839 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3840 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3841 		__entry->prev_agino = ip->i_prev_unlinked;
3842 		__entry->next_agino = ip->i_next_unlinked;
3843 	),
3844 	TP_printk("dev %d:%d agno 0x%x agino 0x%x prev_unlinked 0x%x next_unlinked 0x%x",
3845 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3846 		  __entry->agno,
3847 		  __entry->agino,
3848 		  __entry->prev_agino,
3849 		  __entry->next_agino)
3850 );
3851 
3852 TRACE_EVENT(xfs_inode_reload_unlinked_bucket,
3853 	TP_PROTO(struct xfs_inode *ip),
3854 	TP_ARGS(ip),
3855 	TP_STRUCT__entry(
3856 		__field(dev_t, dev)
3857 		__field(xfs_agnumber_t, agno)
3858 		__field(xfs_agino_t, agino)
3859 	),
3860 	TP_fast_assign(
3861 		__entry->dev = ip->i_mount->m_super->s_dev;
3862 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3863 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3864 	),
3865 	TP_printk("dev %d:%d agno 0x%x agino 0x%x bucket %u",
3866 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3867 		  __entry->agno,
3868 		  __entry->agino,
3869 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS)
3870 );
3871 
3872 DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3873 	TP_PROTO(struct xfs_inode *ip),
3874 	TP_ARGS(ip),
3875 	TP_STRUCT__entry(
3876 		__field(dev_t, dev)
3877 		__field(xfs_agnumber_t, agno)
3878 		__field(xfs_agino_t, agino)
3879 	),
3880 	TP_fast_assign(
3881 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3882 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3883 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3884 	),
3885 	TP_printk("dev %d:%d agno 0x%x agino 0x%x",
3886 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3887 		  __entry->agno, __entry->agino)
3888 )
3889 
3890 #define DEFINE_AGINODE_EVENT(name) \
3891 DEFINE_EVENT(xfs_ag_inode_class, name, \
3892 	TP_PROTO(struct xfs_inode *ip), \
3893 	TP_ARGS(ip))
3894 DEFINE_AGINODE_EVENT(xfs_iunlink);
3895 DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
3896 
3897 DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3898 	TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3899 	TP_ARGS(mp, flags),
3900 	TP_STRUCT__entry(
3901 		__field(dev_t, dev)
3902 		__field(unsigned int, flags)
3903 	),
3904 	TP_fast_assign(
3905 		__entry->dev = mp->m_super->s_dev;
3906 		__entry->flags = flags;
3907 	),
3908 	TP_printk("dev %d:%d flags 0x%x",
3909 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3910 		  __entry->flags)
3911 );
3912 #define DEFINE_FS_CORRUPT_EVENT(name)	\
3913 DEFINE_EVENT(xfs_fs_corrupt_class, name,	\
3914 	TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3915 	TP_ARGS(mp, flags))
3916 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3917 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
3918 DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
3919 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3920 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
3921 DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
3922 
3923 DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3924 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3925 	TP_ARGS(mp, agno, flags),
3926 	TP_STRUCT__entry(
3927 		__field(dev_t, dev)
3928 		__field(xfs_agnumber_t, agno)
3929 		__field(unsigned int, flags)
3930 	),
3931 	TP_fast_assign(
3932 		__entry->dev = mp->m_super->s_dev;
3933 		__entry->agno = agno;
3934 		__entry->flags = flags;
3935 	),
3936 	TP_printk("dev %d:%d agno 0x%x flags 0x%x",
3937 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3938 		  __entry->agno, __entry->flags)
3939 );
3940 #define DEFINE_AG_CORRUPT_EVENT(name)	\
3941 DEFINE_EVENT(xfs_ag_corrupt_class, name,	\
3942 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3943 		 unsigned int flags), \
3944 	TP_ARGS(mp, agno, flags))
3945 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3946 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
3947 DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
3948 
3949 DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3950 	TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3951 	TP_ARGS(ip, flags),
3952 	TP_STRUCT__entry(
3953 		__field(dev_t, dev)
3954 		__field(xfs_ino_t, ino)
3955 		__field(unsigned int, flags)
3956 	),
3957 	TP_fast_assign(
3958 		__entry->dev = ip->i_mount->m_super->s_dev;
3959 		__entry->ino = ip->i_ino;
3960 		__entry->flags = flags;
3961 	),
3962 	TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3963 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3964 		  __entry->ino, __entry->flags)
3965 );
3966 #define DEFINE_INODE_CORRUPT_EVENT(name)	\
3967 DEFINE_EVENT(xfs_inode_corrupt_class, name,	\
3968 	TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3969 	TP_ARGS(ip, flags))
3970 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3971 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3972 
3973 TRACE_EVENT(xfs_iwalk_ag,
3974 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3975 		 xfs_agino_t startino),
3976 	TP_ARGS(mp, agno, startino),
3977 	TP_STRUCT__entry(
3978 		__field(dev_t, dev)
3979 		__field(xfs_agnumber_t, agno)
3980 		__field(xfs_agino_t, startino)
3981 	),
3982 	TP_fast_assign(
3983 		__entry->dev = mp->m_super->s_dev;
3984 		__entry->agno = agno;
3985 		__entry->startino = startino;
3986 	),
3987 	TP_printk("dev %d:%d agno 0x%x startino 0x%x",
3988 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3989 		  __entry->startino)
3990 )
3991 
3992 TRACE_EVENT(xfs_iwalk_ag_rec,
3993 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3994 		 struct xfs_inobt_rec_incore *irec),
3995 	TP_ARGS(mp, agno, irec),
3996 	TP_STRUCT__entry(
3997 		__field(dev_t, dev)
3998 		__field(xfs_agnumber_t, agno)
3999 		__field(xfs_agino_t, startino)
4000 		__field(uint64_t, freemask)
4001 	),
4002 	TP_fast_assign(
4003 		__entry->dev = mp->m_super->s_dev;
4004 		__entry->agno = agno;
4005 		__entry->startino = irec->ir_startino;
4006 		__entry->freemask = irec->ir_free;
4007 	),
4008 	TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
4009 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
4010 		  __entry->startino, __entry->freemask)
4011 )
4012 
4013 TRACE_EVENT(xfs_pwork_init,
4014 	TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
4015 	TP_ARGS(mp, nr_threads, pid),
4016 	TP_STRUCT__entry(
4017 		__field(dev_t, dev)
4018 		__field(unsigned int, nr_threads)
4019 		__field(pid_t, pid)
4020 	),
4021 	TP_fast_assign(
4022 		__entry->dev = mp->m_super->s_dev;
4023 		__entry->nr_threads = nr_threads;
4024 		__entry->pid = pid;
4025 	),
4026 	TP_printk("dev %d:%d nr_threads %u pid %u",
4027 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4028 		  __entry->nr_threads, __entry->pid)
4029 )
4030 
4031 DECLARE_EVENT_CLASS(xfs_kmem_class,
4032 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
4033 	TP_ARGS(size, flags, caller_ip),
4034 	TP_STRUCT__entry(
4035 		__field(ssize_t, size)
4036 		__field(int, flags)
4037 		__field(unsigned long, caller_ip)
4038 	),
4039 	TP_fast_assign(
4040 		__entry->size = size;
4041 		__entry->flags = flags;
4042 		__entry->caller_ip = caller_ip;
4043 	),
4044 	TP_printk("size %zd flags 0x%x caller %pS",
4045 		  __entry->size,
4046 		  __entry->flags,
4047 		  (char *)__entry->caller_ip)
4048 )
4049 
4050 #define DEFINE_KMEM_EVENT(name) \
4051 DEFINE_EVENT(xfs_kmem_class, name, \
4052 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
4053 	TP_ARGS(size, flags, caller_ip))
4054 DEFINE_KMEM_EVENT(kmem_alloc);
4055 
4056 TRACE_EVENT(xfs_check_new_dalign,
4057 	TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
4058 	TP_ARGS(mp, new_dalign, calc_rootino),
4059 	TP_STRUCT__entry(
4060 		__field(dev_t, dev)
4061 		__field(int, new_dalign)
4062 		__field(xfs_ino_t, sb_rootino)
4063 		__field(xfs_ino_t, calc_rootino)
4064 	),
4065 	TP_fast_assign(
4066 		__entry->dev = mp->m_super->s_dev;
4067 		__entry->new_dalign = new_dalign;
4068 		__entry->sb_rootino = mp->m_sb.sb_rootino;
4069 		__entry->calc_rootino = calc_rootino;
4070 	),
4071 	TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
4072 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4073 		  __entry->new_dalign, __entry->sb_rootino,
4074 		  __entry->calc_rootino)
4075 )
4076 
4077 TRACE_EVENT(xfs_btree_commit_afakeroot,
4078 	TP_PROTO(struct xfs_btree_cur *cur),
4079 	TP_ARGS(cur),
4080 	TP_STRUCT__entry(
4081 		__field(dev_t, dev)
4082 		__field(xfs_btnum_t, btnum)
4083 		__field(xfs_agnumber_t, agno)
4084 		__field(xfs_agblock_t, agbno)
4085 		__field(unsigned int, levels)
4086 		__field(unsigned int, blocks)
4087 	),
4088 	TP_fast_assign(
4089 		__entry->dev = cur->bc_mp->m_super->s_dev;
4090 		__entry->btnum = cur->bc_btnum;
4091 		__entry->agno = cur->bc_ag.pag->pag_agno;
4092 		__entry->agbno = cur->bc_ag.afake->af_root;
4093 		__entry->levels = cur->bc_ag.afake->af_levels;
4094 		__entry->blocks = cur->bc_ag.afake->af_blocks;
4095 	),
4096 	TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
4097 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4098 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4099 		  __entry->agno,
4100 		  __entry->levels,
4101 		  __entry->blocks,
4102 		  __entry->agbno)
4103 )
4104 
4105 TRACE_EVENT(xfs_btree_commit_ifakeroot,
4106 	TP_PROTO(struct xfs_btree_cur *cur),
4107 	TP_ARGS(cur),
4108 	TP_STRUCT__entry(
4109 		__field(dev_t, dev)
4110 		__field(xfs_btnum_t, btnum)
4111 		__field(xfs_agnumber_t, agno)
4112 		__field(xfs_agino_t, agino)
4113 		__field(unsigned int, levels)
4114 		__field(unsigned int, blocks)
4115 		__field(int, whichfork)
4116 	),
4117 	TP_fast_assign(
4118 		__entry->dev = cur->bc_mp->m_super->s_dev;
4119 		__entry->btnum = cur->bc_btnum;
4120 		__entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
4121 					cur->bc_ino.ip->i_ino);
4122 		__entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
4123 					cur->bc_ino.ip->i_ino);
4124 		__entry->levels = cur->bc_ino.ifake->if_levels;
4125 		__entry->blocks = cur->bc_ino.ifake->if_blocks;
4126 		__entry->whichfork = cur->bc_ino.whichfork;
4127 	),
4128 	TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
4129 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4130 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4131 		  __entry->agno,
4132 		  __entry->agino,
4133 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
4134 		  __entry->levels,
4135 		  __entry->blocks)
4136 )
4137 
4138 TRACE_EVENT(xfs_btree_bload_level_geometry,
4139 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4140 		 uint64_t nr_this_level, unsigned int nr_per_block,
4141 		 unsigned int desired_npb, uint64_t blocks,
4142 		 uint64_t blocks_with_extra),
4143 	TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
4144 		blocks_with_extra),
4145 	TP_STRUCT__entry(
4146 		__field(dev_t, dev)
4147 		__field(xfs_btnum_t, btnum)
4148 		__field(unsigned int, level)
4149 		__field(unsigned int, nlevels)
4150 		__field(uint64_t, nr_this_level)
4151 		__field(unsigned int, nr_per_block)
4152 		__field(unsigned int, desired_npb)
4153 		__field(unsigned long long, blocks)
4154 		__field(unsigned long long, blocks_with_extra)
4155 	),
4156 	TP_fast_assign(
4157 		__entry->dev = cur->bc_mp->m_super->s_dev;
4158 		__entry->btnum = cur->bc_btnum;
4159 		__entry->level = level;
4160 		__entry->nlevels = cur->bc_nlevels;
4161 		__entry->nr_this_level = nr_this_level;
4162 		__entry->nr_per_block = nr_per_block;
4163 		__entry->desired_npb = desired_npb;
4164 		__entry->blocks = blocks;
4165 		__entry->blocks_with_extra = blocks_with_extra;
4166 	),
4167 	TP_printk("dev %d:%d btree %s level %u/%u nr_this_level %llu nr_per_block %u desired_npb %u blocks %llu blocks_with_extra %llu",
4168 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4169 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4170 		  __entry->level,
4171 		  __entry->nlevels,
4172 		  __entry->nr_this_level,
4173 		  __entry->nr_per_block,
4174 		  __entry->desired_npb,
4175 		  __entry->blocks,
4176 		  __entry->blocks_with_extra)
4177 )
4178 
4179 TRACE_EVENT(xfs_btree_bload_block,
4180 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4181 		 uint64_t block_idx, uint64_t nr_blocks,
4182 		 union xfs_btree_ptr *ptr, unsigned int nr_records),
4183 	TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
4184 	TP_STRUCT__entry(
4185 		__field(dev_t, dev)
4186 		__field(xfs_btnum_t, btnum)
4187 		__field(unsigned int, level)
4188 		__field(unsigned long long, block_idx)
4189 		__field(unsigned long long, nr_blocks)
4190 		__field(xfs_agnumber_t, agno)
4191 		__field(xfs_agblock_t, agbno)
4192 		__field(unsigned int, nr_records)
4193 	),
4194 	TP_fast_assign(
4195 		__entry->dev = cur->bc_mp->m_super->s_dev;
4196 		__entry->btnum = cur->bc_btnum;
4197 		__entry->level = level;
4198 		__entry->block_idx = block_idx;
4199 		__entry->nr_blocks = nr_blocks;
4200 		if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
4201 			xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);
4202 
4203 			__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
4204 			__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
4205 		} else {
4206 			__entry->agno = cur->bc_ag.pag->pag_agno;
4207 			__entry->agbno = be32_to_cpu(ptr->s);
4208 		}
4209 		__entry->nr_records = nr_records;
4210 	),
4211 	TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
4212 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4213 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4214 		  __entry->level,
4215 		  __entry->block_idx,
4216 		  __entry->nr_blocks,
4217 		  __entry->agno,
4218 		  __entry->agbno,
4219 		  __entry->nr_records)
4220 )
4221 
4222 DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
4223 	TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
4224 	TP_ARGS(mp, min, max),
4225 	TP_STRUCT__entry(
4226 		__field(dev_t, dev)
4227 		__field(long long, min)
4228 		__field(long long, max)
4229 	),
4230 	TP_fast_assign(
4231 		__entry->dev = mp->m_super->s_dev;
4232 		__entry->min = min;
4233 		__entry->max = max;
4234 	),
4235 	TP_printk("dev %d:%d min %lld max %lld",
4236 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4237 		  __entry->min,
4238 		  __entry->max)
4239 )
4240 
4241 #define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
4242 DEFINE_EVENT(xfs_timestamp_range_class, name, \
4243 	TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
4244 	TP_ARGS(mp, min, max))
4245 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
4246 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
4247 
4248 DECLARE_EVENT_CLASS(xfs_icwalk_class,
4249 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4250 		 unsigned long caller_ip),
4251 	TP_ARGS(mp, icw, caller_ip),
4252 	TP_STRUCT__entry(
4253 		__field(dev_t, dev)
4254 		__field(__u32, flags)
4255 		__field(uint32_t, uid)
4256 		__field(uint32_t, gid)
4257 		__field(prid_t, prid)
4258 		__field(__u64, min_file_size)
4259 		__field(long, scan_limit)
4260 		__field(unsigned long, caller_ip)
4261 	),
4262 	TP_fast_assign(
4263 		__entry->dev = mp->m_super->s_dev;
4264 		__entry->flags = icw ? icw->icw_flags : 0;
4265 		__entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
4266 						icw->icw_uid) : 0;
4267 		__entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
4268 						icw->icw_gid) : 0;
4269 		__entry->prid = icw ? icw->icw_prid : 0;
4270 		__entry->min_file_size = icw ? icw->icw_min_file_size : 0;
4271 		__entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4272 		__entry->caller_ip = caller_ip;
4273 	),
4274 	TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4275 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4276 		  __entry->flags,
4277 		  __entry->uid,
4278 		  __entry->gid,
4279 		  __entry->prid,
4280 		  __entry->min_file_size,
4281 		  __entry->scan_limit,
4282 		  (char *)__entry->caller_ip)
4283 );
4284 #define DEFINE_ICWALK_EVENT(name)	\
4285 DEFINE_EVENT(xfs_icwalk_class, name,	\
4286 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4287 		 unsigned long caller_ip), \
4288 	TP_ARGS(mp, icw, caller_ip))
4289 DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4290 DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4291 
4292 TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4293 TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4294 TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4295 TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4296 TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4297 TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
4298 
4299 DECLARE_EVENT_CLASS(xlog_iclog_class,
4300 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4301 	TP_ARGS(iclog, caller_ip),
4302 	TP_STRUCT__entry(
4303 		__field(dev_t, dev)
4304 		__field(uint32_t, state)
4305 		__field(int32_t, refcount)
4306 		__field(uint32_t, offset)
4307 		__field(uint32_t, flags)
4308 		__field(unsigned long long, lsn)
4309 		__field(unsigned long, caller_ip)
4310 	),
4311 	TP_fast_assign(
4312 		__entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4313 		__entry->state = iclog->ic_state;
4314 		__entry->refcount = atomic_read(&iclog->ic_refcnt);
4315 		__entry->offset = iclog->ic_offset;
4316 		__entry->flags = iclog->ic_flags;
4317 		__entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4318 		__entry->caller_ip = caller_ip;
4319 	),
4320 	TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
4321 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4322 		  __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4323 		  __entry->refcount,
4324 		  __entry->offset,
4325 		  __entry->lsn,
4326 		  __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
4327 		  (char *)__entry->caller_ip)
4328 
4329 );
4330 
4331 #define DEFINE_ICLOG_EVENT(name)	\
4332 DEFINE_EVENT(xlog_iclog_class, name,	\
4333 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4334 	TP_ARGS(iclog, caller_ip))
4335 
4336 DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4337 DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4338 DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4339 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4340 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4341 DEFINE_ICLOG_EVENT(xlog_iclog_force);
4342 DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4343 DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4344 DEFINE_ICLOG_EVENT(xlog_iclog_release);
4345 DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4346 DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4347 DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4348 DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4349 DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4350 DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4351 DEFINE_ICLOG_EVENT(xlog_iclog_write);
4352 
4353 TRACE_DEFINE_ENUM(XFS_DAS_UNINIT);
4354 TRACE_DEFINE_ENUM(XFS_DAS_SF_ADD);
4355 TRACE_DEFINE_ENUM(XFS_DAS_SF_REMOVE);
4356 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ADD);
4357 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE);
4358 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ADD);
4359 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE);
4360 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_SET_RMT);
4361 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ALLOC_RMT);
4362 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REPLACE);
4363 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_OLD);
4364 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_RMT);
4365 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_ATTR);
4366 TRACE_DEFINE_ENUM(XFS_DAS_NODE_SET_RMT);
4367 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ALLOC_RMT);
4368 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REPLACE);
4369 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_OLD);
4370 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_RMT);
4371 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_ATTR);
4372 TRACE_DEFINE_ENUM(XFS_DAS_DONE);
4373 
4374 DECLARE_EVENT_CLASS(xfs_das_state_class,
4375 	TP_PROTO(int das, struct xfs_inode *ip),
4376 	TP_ARGS(das, ip),
4377 	TP_STRUCT__entry(
4378 		__field(int, das)
4379 		__field(xfs_ino_t, ino)
4380 	),
4381 	TP_fast_assign(
4382 		__entry->das = das;
4383 		__entry->ino = ip->i_ino;
4384 	),
4385 	TP_printk("state change %s ino 0x%llx",
4386 		  __print_symbolic(__entry->das, XFS_DAS_STRINGS),
4387 		  __entry->ino)
4388 )
4389 
4390 #define DEFINE_DAS_STATE_EVENT(name) \
4391 DEFINE_EVENT(xfs_das_state_class, name, \
4392 	TP_PROTO(int das, struct xfs_inode *ip), \
4393 	TP_ARGS(das, ip))
4394 DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4395 DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4396 DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4397 DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4398 DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4399 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
4400 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4401 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
4402 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_replace);
4403 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_remove);
4404 
4405 
4406 TRACE_EVENT(xfs_force_shutdown,
4407 	TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4408 		 int line_num),
4409 	TP_ARGS(mp, ptag, flags, fname, line_num),
4410 	TP_STRUCT__entry(
4411 		__field(dev_t, dev)
4412 		__field(int, ptag)
4413 		__field(int, flags)
4414 		__string(fname, fname)
4415 		__field(int, line_num)
4416 	),
4417 	TP_fast_assign(
4418 		__entry->dev = mp->m_super->s_dev;
4419 		__entry->ptag = ptag;
4420 		__entry->flags = flags;
4421 		__assign_str(fname, fname);
4422 		__entry->line_num = line_num;
4423 	),
4424 	TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4425 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4426 		__print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4427 		__print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4428 		__get_str(fname),
4429 		__entry->line_num)
4430 );
4431 
4432 #ifdef CONFIG_XFS_DRAIN_INTENTS
4433 DECLARE_EVENT_CLASS(xfs_perag_intents_class,
4434 	TP_PROTO(struct xfs_perag *pag, void *caller_ip),
4435 	TP_ARGS(pag, caller_ip),
4436 	TP_STRUCT__entry(
4437 		__field(dev_t, dev)
4438 		__field(xfs_agnumber_t, agno)
4439 		__field(long, nr_intents)
4440 		__field(void *, caller_ip)
4441 	),
4442 	TP_fast_assign(
4443 		__entry->dev = pag->pag_mount->m_super->s_dev;
4444 		__entry->agno = pag->pag_agno;
4445 		__entry->nr_intents = atomic_read(&pag->pag_intents_drain.dr_count);
4446 		__entry->caller_ip = caller_ip;
4447 	),
4448 	TP_printk("dev %d:%d agno 0x%x intents %ld caller %pS",
4449 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4450 		  __entry->agno,
4451 		  __entry->nr_intents,
4452 		  __entry->caller_ip)
4453 );
4454 
4455 #define DEFINE_PERAG_INTENTS_EVENT(name)	\
4456 DEFINE_EVENT(xfs_perag_intents_class, name,					\
4457 	TP_PROTO(struct xfs_perag *pag, void *caller_ip), \
4458 	TP_ARGS(pag, caller_ip))
4459 DEFINE_PERAG_INTENTS_EVENT(xfs_perag_intent_hold);
4460 DEFINE_PERAG_INTENTS_EVENT(xfs_perag_intent_rele);
4461 DEFINE_PERAG_INTENTS_EVENT(xfs_perag_wait_intents);
4462 
4463 #endif /* CONFIG_XFS_DRAIN_INTENTS */
4464 
4465 #endif /* _TRACE_XFS_H */
4466 
4467 #undef TRACE_INCLUDE_PATH
4468 #define TRACE_INCLUDE_PATH .
4469 #define TRACE_INCLUDE_FILE xfs_trace
4470 #include <trace/define_trace.h>
4471