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