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