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