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