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