xref: /linux/fs/xfs/xfs_trace.h (revision 24bce201d79807b668bf9d9e0aca801c5c0d5f78)
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  * owner: reverse-mapping owner, usually inodes
26  *
27  * fileoff: file offset, in fs blocks
28  * pos: file offset, in bytes
29  * bytecount: number of bytes
30  *
31  * disize: ondisk file size, in bytes
32  * isize: incore file size, in bytes
33  *
34  * forkoff: inode fork offset, in bytes
35  *
36  * ireccount: number of inode records
37  *
38  * Numbers describing space allocations (blocks, extents, inodes) should be
39  * formatted in hexadecimal.
40  */
41 #undef TRACE_SYSTEM
42 #define TRACE_SYSTEM xfs
43 
44 #if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
45 #define _TRACE_XFS_H
46 
47 #include <linux/tracepoint.h>
48 
49 struct xfs_agf;
50 struct xfs_alloc_arg;
51 struct xfs_attr_list_context;
52 struct xfs_buf_log_item;
53 struct xfs_da_args;
54 struct xfs_da_node_entry;
55 struct xfs_dquot;
56 struct xfs_log_item;
57 struct xlog;
58 struct xlog_ticket;
59 struct xlog_recover;
60 struct xlog_recover_item;
61 struct xlog_rec_header;
62 struct xlog_in_core;
63 struct xfs_buf_log_format;
64 struct xfs_inode_log_format;
65 struct xfs_bmbt_irec;
66 struct xfs_btree_cur;
67 struct xfs_refcount_irec;
68 struct xfs_fsmap;
69 struct xfs_rmap_irec;
70 struct xfs_icreate_log;
71 struct xfs_owner_info;
72 struct xfs_trans_res;
73 struct xfs_inobt_rec_incore;
74 union xfs_btree_ptr;
75 struct xfs_dqtrx;
76 struct xfs_icwalk;
77 
78 #define XFS_ATTR_FILTER_FLAGS \
79 	{ XFS_ATTR_ROOT,	"ROOT" }, \
80 	{ XFS_ATTR_SECURE,	"SECURE" }, \
81 	{ XFS_ATTR_INCOMPLETE,	"INCOMPLETE" }
82 
83 DECLARE_EVENT_CLASS(xfs_attr_list_class,
84 	TP_PROTO(struct xfs_attr_list_context *ctx),
85 	TP_ARGS(ctx),
86 	TP_STRUCT__entry(
87 		__field(dev_t, dev)
88 		__field(xfs_ino_t, ino)
89 		__field(u32, hashval)
90 		__field(u32, blkno)
91 		__field(u32, offset)
92 		__field(void *, buffer)
93 		__field(int, bufsize)
94 		__field(int, count)
95 		__field(int, firstu)
96 		__field(int, dupcnt)
97 		__field(unsigned int, attr_filter)
98 	),
99 	TP_fast_assign(
100 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
101 		__entry->ino = ctx->dp->i_ino;
102 		__entry->hashval = ctx->cursor.hashval;
103 		__entry->blkno = ctx->cursor.blkno;
104 		__entry->offset = ctx->cursor.offset;
105 		__entry->buffer = ctx->buffer;
106 		__entry->bufsize = ctx->bufsize;
107 		__entry->count = ctx->count;
108 		__entry->firstu = ctx->firstu;
109 		__entry->attr_filter = ctx->attr_filter;
110 	),
111 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
112 		  "buffer %p size %u count %u firstu %u filter %s",
113 		  MAJOR(__entry->dev), MINOR(__entry->dev),
114 		   __entry->ino,
115 		   __entry->hashval,
116 		   __entry->blkno,
117 		   __entry->offset,
118 		   __entry->dupcnt,
119 		   __entry->buffer,
120 		   __entry->bufsize,
121 		   __entry->count,
122 		   __entry->firstu,
123 		   __print_flags(__entry->attr_filter, "|",
124 				 XFS_ATTR_FILTER_FLAGS)
125 	)
126 )
127 
128 #define DEFINE_ATTR_LIST_EVENT(name) \
129 DEFINE_EVENT(xfs_attr_list_class, name, \
130 	TP_PROTO(struct xfs_attr_list_context *ctx), \
131 	TP_ARGS(ctx))
132 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
133 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
134 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
135 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
136 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
137 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
138 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
139 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
140 DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
141 DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
142 
143 TRACE_EVENT(xlog_intent_recovery_failed,
144 	TP_PROTO(struct xfs_mount *mp, int error, void *function),
145 	TP_ARGS(mp, error, function),
146 	TP_STRUCT__entry(
147 		__field(dev_t, dev)
148 		__field(int, error)
149 		__field(void *, function)
150 	),
151 	TP_fast_assign(
152 		__entry->dev = mp->m_super->s_dev;
153 		__entry->error = error;
154 		__entry->function = function;
155 	),
156 	TP_printk("dev %d:%d error %d function %pS",
157 		  MAJOR(__entry->dev), MINOR(__entry->dev),
158 		  __entry->error, __entry->function)
159 );
160 
161 DECLARE_EVENT_CLASS(xfs_perag_class,
162 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
163 		 unsigned long caller_ip),
164 	TP_ARGS(mp, agno, refcount, caller_ip),
165 	TP_STRUCT__entry(
166 		__field(dev_t, dev)
167 		__field(xfs_agnumber_t, agno)
168 		__field(int, refcount)
169 		__field(unsigned long, caller_ip)
170 	),
171 	TP_fast_assign(
172 		__entry->dev = mp->m_super->s_dev;
173 		__entry->agno = agno;
174 		__entry->refcount = refcount;
175 		__entry->caller_ip = caller_ip;
176 	),
177 	TP_printk("dev %d:%d agno 0x%x refcount %d caller %pS",
178 		  MAJOR(__entry->dev), MINOR(__entry->dev),
179 		  __entry->agno,
180 		  __entry->refcount,
181 		  (char *)__entry->caller_ip)
182 );
183 
184 #define DEFINE_PERAG_REF_EVENT(name)	\
185 DEFINE_EVENT(xfs_perag_class, name,	\
186 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,	\
187 		 unsigned long caller_ip),					\
188 	TP_ARGS(mp, agno, refcount, caller_ip))
189 DEFINE_PERAG_REF_EVENT(xfs_perag_get);
190 DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
191 DEFINE_PERAG_REF_EVENT(xfs_perag_put);
192 DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
193 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
194 
195 TRACE_EVENT(xfs_inodegc_worker,
196 	TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
197 	TP_ARGS(mp, shrinker_hits),
198 	TP_STRUCT__entry(
199 		__field(dev_t, dev)
200 		__field(unsigned int, shrinker_hits)
201 	),
202 	TP_fast_assign(
203 		__entry->dev = mp->m_super->s_dev;
204 		__entry->shrinker_hits = shrinker_hits;
205 	),
206 	TP_printk("dev %d:%d shrinker_hits %u",
207 		  MAJOR(__entry->dev), MINOR(__entry->dev),
208 		  __entry->shrinker_hits)
209 );
210 
211 DECLARE_EVENT_CLASS(xfs_fs_class,
212 	TP_PROTO(struct xfs_mount *mp, void *caller_ip),
213 	TP_ARGS(mp, caller_ip),
214 	TP_STRUCT__entry(
215 		__field(dev_t, dev)
216 		__field(unsigned long long, mflags)
217 		__field(unsigned long, opstate)
218 		__field(unsigned long, sbflags)
219 		__field(void *, caller_ip)
220 	),
221 	TP_fast_assign(
222 		if (mp) {
223 			__entry->dev = mp->m_super->s_dev;
224 			__entry->mflags = mp->m_features;
225 			__entry->opstate = mp->m_opstate;
226 			__entry->sbflags = mp->m_super->s_flags;
227 		}
228 		__entry->caller_ip = caller_ip;
229 	),
230 	TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
231 		  MAJOR(__entry->dev), MINOR(__entry->dev),
232 		  __entry->mflags,
233 		  __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
234 		  __entry->sbflags,
235 		  __entry->caller_ip)
236 );
237 
238 #define DEFINE_FS_EVENT(name)	\
239 DEFINE_EVENT(xfs_fs_class, name,					\
240 	TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
241 	TP_ARGS(mp, caller_ip))
242 DEFINE_FS_EVENT(xfs_inodegc_flush);
243 DEFINE_FS_EVENT(xfs_inodegc_push);
244 DEFINE_FS_EVENT(xfs_inodegc_start);
245 DEFINE_FS_EVENT(xfs_inodegc_stop);
246 DEFINE_FS_EVENT(xfs_inodegc_queue);
247 DEFINE_FS_EVENT(xfs_inodegc_throttle);
248 DEFINE_FS_EVENT(xfs_fs_sync_fs);
249 DEFINE_FS_EVENT(xfs_blockgc_start);
250 DEFINE_FS_EVENT(xfs_blockgc_stop);
251 DEFINE_FS_EVENT(xfs_blockgc_worker);
252 DEFINE_FS_EVENT(xfs_blockgc_flush_all);
253 
254 TRACE_EVENT(xfs_inodegc_shrinker_scan,
255 	TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
256 		 void *caller_ip),
257 	TP_ARGS(mp, sc, caller_ip),
258 	TP_STRUCT__entry(
259 		__field(dev_t, dev)
260 		__field(unsigned long, nr_to_scan)
261 		__field(void *, caller_ip)
262 	),
263 	TP_fast_assign(
264 		__entry->dev = mp->m_super->s_dev;
265 		__entry->nr_to_scan = sc->nr_to_scan;
266 		__entry->caller_ip = caller_ip;
267 	),
268 	TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
269 		  MAJOR(__entry->dev), MINOR(__entry->dev),
270 		  __entry->nr_to_scan,
271 		  __entry->caller_ip)
272 );
273 
274 DECLARE_EVENT_CLASS(xfs_ag_class,
275 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
276 	TP_ARGS(mp, agno),
277 	TP_STRUCT__entry(
278 		__field(dev_t, dev)
279 		__field(xfs_agnumber_t, agno)
280 	),
281 	TP_fast_assign(
282 		__entry->dev = mp->m_super->s_dev;
283 		__entry->agno = agno;
284 	),
285 	TP_printk("dev %d:%d agno 0x%x",
286 		  MAJOR(__entry->dev), MINOR(__entry->dev),
287 		  __entry->agno)
288 );
289 #define DEFINE_AG_EVENT(name)	\
290 DEFINE_EVENT(xfs_ag_class, name,	\
291 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),	\
292 	TP_ARGS(mp, agno))
293 
294 DEFINE_AG_EVENT(xfs_read_agf);
295 DEFINE_AG_EVENT(xfs_alloc_read_agf);
296 DEFINE_AG_EVENT(xfs_read_agi);
297 DEFINE_AG_EVENT(xfs_ialloc_read_agi);
298 
299 TRACE_EVENT(xfs_attr_list_node_descend,
300 	TP_PROTO(struct xfs_attr_list_context *ctx,
301 		 struct xfs_da_node_entry *btree),
302 	TP_ARGS(ctx, btree),
303 	TP_STRUCT__entry(
304 		__field(dev_t, dev)
305 		__field(xfs_ino_t, ino)
306 		__field(u32, hashval)
307 		__field(u32, blkno)
308 		__field(u32, offset)
309 		__field(void *, buffer)
310 		__field(int, bufsize)
311 		__field(int, count)
312 		__field(int, firstu)
313 		__field(int, dupcnt)
314 		__field(unsigned int, attr_filter)
315 		__field(u32, bt_hashval)
316 		__field(u32, bt_before)
317 	),
318 	TP_fast_assign(
319 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
320 		__entry->ino = ctx->dp->i_ino;
321 		__entry->hashval = ctx->cursor.hashval;
322 		__entry->blkno = ctx->cursor.blkno;
323 		__entry->offset = ctx->cursor.offset;
324 		__entry->buffer = ctx->buffer;
325 		__entry->bufsize = ctx->bufsize;
326 		__entry->count = ctx->count;
327 		__entry->firstu = ctx->firstu;
328 		__entry->attr_filter = ctx->attr_filter;
329 		__entry->bt_hashval = be32_to_cpu(btree->hashval);
330 		__entry->bt_before = be32_to_cpu(btree->before);
331 	),
332 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
333 		  "buffer %p size %u count %u firstu %u filter %s "
334 		  "node hashval %u, node before %u",
335 		  MAJOR(__entry->dev), MINOR(__entry->dev),
336 		   __entry->ino,
337 		   __entry->hashval,
338 		   __entry->blkno,
339 		   __entry->offset,
340 		   __entry->dupcnt,
341 		   __entry->buffer,
342 		   __entry->bufsize,
343 		   __entry->count,
344 		   __entry->firstu,
345 		   __print_flags(__entry->attr_filter, "|",
346 				 XFS_ATTR_FILTER_FLAGS),
347 		   __entry->bt_hashval,
348 		   __entry->bt_before)
349 );
350 
351 DECLARE_EVENT_CLASS(xfs_bmap_class,
352 	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
353 		 unsigned long caller_ip),
354 	TP_ARGS(ip, cur, state, caller_ip),
355 	TP_STRUCT__entry(
356 		__field(dev_t, dev)
357 		__field(xfs_ino_t, ino)
358 		__field(void *, leaf)
359 		__field(int, pos)
360 		__field(xfs_fileoff_t, startoff)
361 		__field(xfs_fsblock_t, startblock)
362 		__field(xfs_filblks_t, blockcount)
363 		__field(xfs_exntst_t, state)
364 		__field(int, bmap_state)
365 		__field(unsigned long, caller_ip)
366 	),
367 	TP_fast_assign(
368 		struct xfs_ifork	*ifp;
369 		struct xfs_bmbt_irec	r;
370 
371 		ifp = xfs_iext_state_to_fork(ip, state);
372 		xfs_iext_get_extent(ifp, cur, &r);
373 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
374 		__entry->ino = ip->i_ino;
375 		__entry->leaf = cur->leaf;
376 		__entry->pos = cur->pos;
377 		__entry->startoff = r.br_startoff;
378 		__entry->startblock = r.br_startblock;
379 		__entry->blockcount = r.br_blockcount;
380 		__entry->state = r.br_state;
381 		__entry->bmap_state = state;
382 		__entry->caller_ip = caller_ip;
383 	),
384 	TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
385 		  "fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx flag %d caller %pS",
386 		  MAJOR(__entry->dev), MINOR(__entry->dev),
387 		  __entry->ino,
388 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
389 		  __entry->leaf,
390 		  __entry->pos,
391 		  __entry->startoff,
392 		  (int64_t)__entry->startblock,
393 		  __entry->blockcount,
394 		  __entry->state,
395 		  (char *)__entry->caller_ip)
396 )
397 
398 #define DEFINE_BMAP_EVENT(name) \
399 DEFINE_EVENT(xfs_bmap_class, name, \
400 	TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
401 		 unsigned long caller_ip), \
402 	TP_ARGS(ip, cur, state, caller_ip))
403 DEFINE_BMAP_EVENT(xfs_iext_insert);
404 DEFINE_BMAP_EVENT(xfs_iext_remove);
405 DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
406 DEFINE_BMAP_EVENT(xfs_bmap_post_update);
407 DEFINE_BMAP_EVENT(xfs_read_extent);
408 DEFINE_BMAP_EVENT(xfs_write_extent);
409 
410 DECLARE_EVENT_CLASS(xfs_buf_class,
411 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
412 	TP_ARGS(bp, caller_ip),
413 	TP_STRUCT__entry(
414 		__field(dev_t, dev)
415 		__field(xfs_daddr_t, bno)
416 		__field(int, nblks)
417 		__field(int, hold)
418 		__field(int, pincount)
419 		__field(unsigned, lockval)
420 		__field(unsigned, flags)
421 		__field(unsigned long, caller_ip)
422 		__field(const void *, buf_ops)
423 	),
424 	TP_fast_assign(
425 		__entry->dev = bp->b_target->bt_dev;
426 		__entry->bno = xfs_buf_daddr(bp);
427 		__entry->nblks = bp->b_length;
428 		__entry->hold = atomic_read(&bp->b_hold);
429 		__entry->pincount = atomic_read(&bp->b_pin_count);
430 		__entry->lockval = bp->b_sema.count;
431 		__entry->flags = bp->b_flags;
432 		__entry->caller_ip = caller_ip;
433 		__entry->buf_ops = bp->b_ops;
434 	),
435 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
436 		  "lock %d flags %s bufops %pS caller %pS",
437 		  MAJOR(__entry->dev), MINOR(__entry->dev),
438 		  (unsigned long long)__entry->bno,
439 		  __entry->nblks,
440 		  __entry->hold,
441 		  __entry->pincount,
442 		  __entry->lockval,
443 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
444 		  __entry->buf_ops,
445 		  (void *)__entry->caller_ip)
446 )
447 
448 #define DEFINE_BUF_EVENT(name) \
449 DEFINE_EVENT(xfs_buf_class, name, \
450 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
451 	TP_ARGS(bp, caller_ip))
452 DEFINE_BUF_EVENT(xfs_buf_init);
453 DEFINE_BUF_EVENT(xfs_buf_free);
454 DEFINE_BUF_EVENT(xfs_buf_hold);
455 DEFINE_BUF_EVENT(xfs_buf_rele);
456 DEFINE_BUF_EVENT(xfs_buf_iodone);
457 DEFINE_BUF_EVENT(xfs_buf_submit);
458 DEFINE_BUF_EVENT(xfs_buf_lock);
459 DEFINE_BUF_EVENT(xfs_buf_lock_done);
460 DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
461 DEFINE_BUF_EVENT(xfs_buf_trylock);
462 DEFINE_BUF_EVENT(xfs_buf_unlock);
463 DEFINE_BUF_EVENT(xfs_buf_iowait);
464 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
465 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
466 DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
467 DEFINE_BUF_EVENT(xfs_buf_delwri_split);
468 DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
469 DEFINE_BUF_EVENT(xfs_buf_get_uncached);
470 DEFINE_BUF_EVENT(xfs_buf_item_relse);
471 DEFINE_BUF_EVENT(xfs_buf_iodone_async);
472 DEFINE_BUF_EVENT(xfs_buf_error_relse);
473 DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
474 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
475 
476 /* not really buffer traces, but the buf provides useful information */
477 DEFINE_BUF_EVENT(xfs_btree_corrupt);
478 DEFINE_BUF_EVENT(xfs_reset_dqcounts);
479 
480 /* pass flags explicitly */
481 DECLARE_EVENT_CLASS(xfs_buf_flags_class,
482 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
483 	TP_ARGS(bp, flags, caller_ip),
484 	TP_STRUCT__entry(
485 		__field(dev_t, dev)
486 		__field(xfs_daddr_t, bno)
487 		__field(unsigned int, length)
488 		__field(int, hold)
489 		__field(int, pincount)
490 		__field(unsigned, lockval)
491 		__field(unsigned, flags)
492 		__field(unsigned long, caller_ip)
493 	),
494 	TP_fast_assign(
495 		__entry->dev = bp->b_target->bt_dev;
496 		__entry->bno = xfs_buf_daddr(bp);
497 		__entry->length = bp->b_length;
498 		__entry->flags = flags;
499 		__entry->hold = atomic_read(&bp->b_hold);
500 		__entry->pincount = atomic_read(&bp->b_pin_count);
501 		__entry->lockval = bp->b_sema.count;
502 		__entry->caller_ip = caller_ip;
503 	),
504 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
505 		  "lock %d flags %s caller %pS",
506 		  MAJOR(__entry->dev), MINOR(__entry->dev),
507 		  (unsigned long long)__entry->bno,
508 		  __entry->length,
509 		  __entry->hold,
510 		  __entry->pincount,
511 		  __entry->lockval,
512 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
513 		  (void *)__entry->caller_ip)
514 )
515 
516 #define DEFINE_BUF_FLAGS_EVENT(name) \
517 DEFINE_EVENT(xfs_buf_flags_class, name, \
518 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
519 	TP_ARGS(bp, flags, caller_ip))
520 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
521 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
522 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
523 
524 TRACE_EVENT(xfs_buf_ioerror,
525 	TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
526 	TP_ARGS(bp, error, caller_ip),
527 	TP_STRUCT__entry(
528 		__field(dev_t, dev)
529 		__field(xfs_daddr_t, bno)
530 		__field(unsigned int, length)
531 		__field(unsigned, flags)
532 		__field(int, hold)
533 		__field(int, pincount)
534 		__field(unsigned, lockval)
535 		__field(int, error)
536 		__field(xfs_failaddr_t, caller_ip)
537 	),
538 	TP_fast_assign(
539 		__entry->dev = bp->b_target->bt_dev;
540 		__entry->bno = xfs_buf_daddr(bp);
541 		__entry->length = bp->b_length;
542 		__entry->hold = atomic_read(&bp->b_hold);
543 		__entry->pincount = atomic_read(&bp->b_pin_count);
544 		__entry->lockval = bp->b_sema.count;
545 		__entry->error = error;
546 		__entry->flags = bp->b_flags;
547 		__entry->caller_ip = caller_ip;
548 	),
549 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
550 		  "lock %d error %d flags %s caller %pS",
551 		  MAJOR(__entry->dev), MINOR(__entry->dev),
552 		  (unsigned long long)__entry->bno,
553 		  __entry->length,
554 		  __entry->hold,
555 		  __entry->pincount,
556 		  __entry->lockval,
557 		  __entry->error,
558 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
559 		  (void *)__entry->caller_ip)
560 );
561 
562 DECLARE_EVENT_CLASS(xfs_buf_item_class,
563 	TP_PROTO(struct xfs_buf_log_item *bip),
564 	TP_ARGS(bip),
565 	TP_STRUCT__entry(
566 		__field(dev_t, dev)
567 		__field(xfs_daddr_t, buf_bno)
568 		__field(unsigned int, buf_len)
569 		__field(int, buf_hold)
570 		__field(int, buf_pincount)
571 		__field(int, buf_lockval)
572 		__field(unsigned, buf_flags)
573 		__field(unsigned, bli_recur)
574 		__field(int, bli_refcount)
575 		__field(unsigned, bli_flags)
576 		__field(unsigned long, li_flags)
577 	),
578 	TP_fast_assign(
579 		__entry->dev = bip->bli_buf->b_target->bt_dev;
580 		__entry->bli_flags = bip->bli_flags;
581 		__entry->bli_recur = bip->bli_recur;
582 		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
583 		__entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
584 		__entry->buf_len = bip->bli_buf->b_length;
585 		__entry->buf_flags = bip->bli_buf->b_flags;
586 		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
587 		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
588 		__entry->buf_lockval = bip->bli_buf->b_sema.count;
589 		__entry->li_flags = bip->bli_item.li_flags;
590 	),
591 	TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
592 		  "lock %d flags %s recur %d refcount %d bliflags %s "
593 		  "liflags %s",
594 		  MAJOR(__entry->dev), MINOR(__entry->dev),
595 		  (unsigned long long)__entry->buf_bno,
596 		  __entry->buf_len,
597 		  __entry->buf_hold,
598 		  __entry->buf_pincount,
599 		  __entry->buf_lockval,
600 		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
601 		  __entry->bli_recur,
602 		  __entry->bli_refcount,
603 		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
604 		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
605 )
606 
607 #define DEFINE_BUF_ITEM_EVENT(name) \
608 DEFINE_EVENT(xfs_buf_item_class, name, \
609 	TP_PROTO(struct xfs_buf_log_item *bip), \
610 	TP_ARGS(bip))
611 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
612 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
613 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
614 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
615 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
616 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
617 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
618 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
619 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
620 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
621 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
622 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
623 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
624 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
625 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
626 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
627 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
628 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
629 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
630 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
631 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
632 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
633 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
634 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
635 
636 DECLARE_EVENT_CLASS(xfs_filestream_class,
637 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
638 	TP_ARGS(mp, ino, agno),
639 	TP_STRUCT__entry(
640 		__field(dev_t, dev)
641 		__field(xfs_ino_t, ino)
642 		__field(xfs_agnumber_t, agno)
643 		__field(int, streams)
644 	),
645 	TP_fast_assign(
646 		__entry->dev = mp->m_super->s_dev;
647 		__entry->ino = ino;
648 		__entry->agno = agno;
649 		__entry->streams = xfs_filestream_peek_ag(mp, agno);
650 	),
651 	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
652 		  MAJOR(__entry->dev), MINOR(__entry->dev),
653 		  __entry->ino,
654 		  __entry->agno,
655 		  __entry->streams)
656 )
657 #define DEFINE_FILESTREAM_EVENT(name) \
658 DEFINE_EVENT(xfs_filestream_class, name, \
659 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
660 	TP_ARGS(mp, ino, agno))
661 DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
662 DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
663 DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
664 
665 TRACE_EVENT(xfs_filestream_pick,
666 	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
667 		 xfs_extlen_t free, int nscan),
668 	TP_ARGS(ip, agno, free, nscan),
669 	TP_STRUCT__entry(
670 		__field(dev_t, dev)
671 		__field(xfs_ino_t, ino)
672 		__field(xfs_agnumber_t, agno)
673 		__field(int, streams)
674 		__field(xfs_extlen_t, free)
675 		__field(int, nscan)
676 	),
677 	TP_fast_assign(
678 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
679 		__entry->ino = ip->i_ino;
680 		__entry->agno = agno;
681 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
682 		__entry->free = free;
683 		__entry->nscan = nscan;
684 	),
685 	TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d nscan %d",
686 		  MAJOR(__entry->dev), MINOR(__entry->dev),
687 		  __entry->ino,
688 		  __entry->agno,
689 		  __entry->streams,
690 		  __entry->free,
691 		  __entry->nscan)
692 );
693 
694 DECLARE_EVENT_CLASS(xfs_lock_class,
695 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
696 		 unsigned long caller_ip),
697 	TP_ARGS(ip,  lock_flags, caller_ip),
698 	TP_STRUCT__entry(
699 		__field(dev_t, dev)
700 		__field(xfs_ino_t, ino)
701 		__field(int, lock_flags)
702 		__field(unsigned long, caller_ip)
703 	),
704 	TP_fast_assign(
705 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
706 		__entry->ino = ip->i_ino;
707 		__entry->lock_flags = lock_flags;
708 		__entry->caller_ip = caller_ip;
709 	),
710 	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
711 		  MAJOR(__entry->dev), MINOR(__entry->dev),
712 		  __entry->ino,
713 		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
714 		  (void *)__entry->caller_ip)
715 )
716 
717 #define DEFINE_LOCK_EVENT(name) \
718 DEFINE_EVENT(xfs_lock_class, name, \
719 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
720 		 unsigned long caller_ip), \
721 	TP_ARGS(ip,  lock_flags, caller_ip))
722 DEFINE_LOCK_EVENT(xfs_ilock);
723 DEFINE_LOCK_EVENT(xfs_ilock_nowait);
724 DEFINE_LOCK_EVENT(xfs_ilock_demote);
725 DEFINE_LOCK_EVENT(xfs_iunlock);
726 
727 DECLARE_EVENT_CLASS(xfs_inode_class,
728 	TP_PROTO(struct xfs_inode *ip),
729 	TP_ARGS(ip),
730 	TP_STRUCT__entry(
731 		__field(dev_t, dev)
732 		__field(xfs_ino_t, ino)
733 		__field(unsigned long, iflags)
734 	),
735 	TP_fast_assign(
736 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
737 		__entry->ino = ip->i_ino;
738 		__entry->iflags = ip->i_flags;
739 	),
740 	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
741 		  MAJOR(__entry->dev), MINOR(__entry->dev),
742 		  __entry->ino,
743 		  __entry->iflags)
744 )
745 
746 #define DEFINE_INODE_EVENT(name) \
747 DEFINE_EVENT(xfs_inode_class, name, \
748 	TP_PROTO(struct xfs_inode *ip), \
749 	TP_ARGS(ip))
750 DEFINE_INODE_EVENT(xfs_iget_skip);
751 DEFINE_INODE_EVENT(xfs_iget_recycle);
752 DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
753 DEFINE_INODE_EVENT(xfs_iget_hit);
754 DEFINE_INODE_EVENT(xfs_iget_miss);
755 
756 DEFINE_INODE_EVENT(xfs_getattr);
757 DEFINE_INODE_EVENT(xfs_setattr);
758 DEFINE_INODE_EVENT(xfs_readlink);
759 DEFINE_INODE_EVENT(xfs_inactive_symlink);
760 DEFINE_INODE_EVENT(xfs_alloc_file_space);
761 DEFINE_INODE_EVENT(xfs_free_file_space);
762 DEFINE_INODE_EVENT(xfs_zero_file_space);
763 DEFINE_INODE_EVENT(xfs_collapse_file_space);
764 DEFINE_INODE_EVENT(xfs_insert_file_space);
765 DEFINE_INODE_EVENT(xfs_readdir);
766 #ifdef CONFIG_XFS_POSIX_ACL
767 DEFINE_INODE_EVENT(xfs_get_acl);
768 #endif
769 DEFINE_INODE_EVENT(xfs_vm_bmap);
770 DEFINE_INODE_EVENT(xfs_file_ioctl);
771 DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
772 DEFINE_INODE_EVENT(xfs_ioctl_setattr);
773 DEFINE_INODE_EVENT(xfs_dir_fsync);
774 DEFINE_INODE_EVENT(xfs_file_fsync);
775 DEFINE_INODE_EVENT(xfs_destroy_inode);
776 DEFINE_INODE_EVENT(xfs_update_time);
777 
778 DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
779 DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
780 
781 DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
782 DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
783 DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
784 DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
785 DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
786 DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
787 DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
788 DEFINE_INODE_EVENT(xfs_inode_reclaiming);
789 DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
790 DEFINE_INODE_EVENT(xfs_inode_inactivating);
791 
792 /*
793  * ftrace's __print_symbolic requires that all enum values be wrapped in the
794  * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
795  * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
796  * code.
797  */
798 TRACE_DEFINE_ENUM(PE_SIZE_PTE);
799 TRACE_DEFINE_ENUM(PE_SIZE_PMD);
800 TRACE_DEFINE_ENUM(PE_SIZE_PUD);
801 
802 TRACE_EVENT(xfs_filemap_fault,
803 	TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
804 		 bool write_fault),
805 	TP_ARGS(ip, pe_size, write_fault),
806 	TP_STRUCT__entry(
807 		__field(dev_t, dev)
808 		__field(xfs_ino_t, ino)
809 		__field(enum page_entry_size, pe_size)
810 		__field(bool, write_fault)
811 	),
812 	TP_fast_assign(
813 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
814 		__entry->ino = ip->i_ino;
815 		__entry->pe_size = pe_size;
816 		__entry->write_fault = write_fault;
817 	),
818 	TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
819 		  MAJOR(__entry->dev), MINOR(__entry->dev),
820 		  __entry->ino,
821 		  __print_symbolic(__entry->pe_size,
822 			{ PE_SIZE_PTE,	"PTE" },
823 			{ PE_SIZE_PMD,	"PMD" },
824 			{ PE_SIZE_PUD,	"PUD" }),
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 
1439 DECLARE_EVENT_CLASS(xfs_imap_class,
1440 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1441 		 int whichfork, struct xfs_bmbt_irec *irec),
1442 	TP_ARGS(ip, offset, count, whichfork, irec),
1443 	TP_STRUCT__entry(
1444 		__field(dev_t, dev)
1445 		__field(xfs_ino_t, ino)
1446 		__field(loff_t, size)
1447 		__field(loff_t, offset)
1448 		__field(size_t, count)
1449 		__field(int, whichfork)
1450 		__field(xfs_fileoff_t, startoff)
1451 		__field(xfs_fsblock_t, startblock)
1452 		__field(xfs_filblks_t, blockcount)
1453 	),
1454 	TP_fast_assign(
1455 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1456 		__entry->ino = ip->i_ino;
1457 		__entry->size = ip->i_disk_size;
1458 		__entry->offset = offset;
1459 		__entry->count = count;
1460 		__entry->whichfork = whichfork;
1461 		__entry->startoff = irec ? irec->br_startoff : 0;
1462 		__entry->startblock = irec ? irec->br_startblock : 0;
1463 		__entry->blockcount = irec ? irec->br_blockcount : 0;
1464 	),
1465 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx "
1466 		  "fork %s startoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
1467 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1468 		  __entry->ino,
1469 		  __entry->size,
1470 		  __entry->offset,
1471 		  __entry->count,
1472 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
1473 		  __entry->startoff,
1474 		  (int64_t)__entry->startblock,
1475 		  __entry->blockcount)
1476 )
1477 
1478 #define DEFINE_IMAP_EVENT(name)	\
1479 DEFINE_EVENT(xfs_imap_class, name,	\
1480 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1481 		 int whichfork, struct xfs_bmbt_irec *irec),		\
1482 	TP_ARGS(ip, offset, count, whichfork, irec))
1483 DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1484 DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1485 DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1486 DEFINE_IMAP_EVENT(xfs_iomap_found);
1487 
1488 DECLARE_EVENT_CLASS(xfs_simple_io_class,
1489 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1490 	TP_ARGS(ip, offset, count),
1491 	TP_STRUCT__entry(
1492 		__field(dev_t, dev)
1493 		__field(xfs_ino_t, ino)
1494 		__field(loff_t, isize)
1495 		__field(loff_t, disize)
1496 		__field(loff_t, offset)
1497 		__field(size_t, count)
1498 	),
1499 	TP_fast_assign(
1500 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1501 		__entry->ino = ip->i_ino;
1502 		__entry->isize = VFS_I(ip)->i_size;
1503 		__entry->disize = ip->i_disk_size;
1504 		__entry->offset = offset;
1505 		__entry->count = count;
1506 	),
1507 	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1508 		  "pos 0x%llx bytecount 0x%zx",
1509 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1510 		  __entry->ino,
1511 		  __entry->isize,
1512 		  __entry->disize,
1513 		  __entry->offset,
1514 		  __entry->count)
1515 );
1516 
1517 #define DEFINE_SIMPLE_IO_EVENT(name)	\
1518 DEFINE_EVENT(xfs_simple_io_class, name,	\
1519 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1520 	TP_ARGS(ip, offset, count))
1521 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1522 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1523 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1524 DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1525 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1526 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1527 DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
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(short, type)
1796 		__field(short, otype)
1797 		__field(char, wasdel)
1798 		__field(char, wasfromfl)
1799 		__field(int, resv)
1800 		__field(int, datatype)
1801 		__field(xfs_fsblock_t, firstblock)
1802 	),
1803 	TP_fast_assign(
1804 		__entry->dev = args->mp->m_super->s_dev;
1805 		__entry->agno = args->agno;
1806 		__entry->agbno = args->agbno;
1807 		__entry->minlen = args->minlen;
1808 		__entry->maxlen = args->maxlen;
1809 		__entry->mod = args->mod;
1810 		__entry->prod = args->prod;
1811 		__entry->minleft = args->minleft;
1812 		__entry->total = args->total;
1813 		__entry->alignment = args->alignment;
1814 		__entry->minalignslop = args->minalignslop;
1815 		__entry->len = args->len;
1816 		__entry->type = args->type;
1817 		__entry->otype = args->otype;
1818 		__entry->wasdel = args->wasdel;
1819 		__entry->wasfromfl = args->wasfromfl;
1820 		__entry->resv = args->resv;
1821 		__entry->datatype = args->datatype;
1822 		__entry->firstblock = args->tp->t_firstblock;
1823 	),
1824 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u "
1825 		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1826 		  "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
1827 		  "datatype 0x%x firstblock 0x%llx",
1828 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1829 		  __entry->agno,
1830 		  __entry->agbno,
1831 		  __entry->minlen,
1832 		  __entry->maxlen,
1833 		  __entry->mod,
1834 		  __entry->prod,
1835 		  __entry->minleft,
1836 		  __entry->total,
1837 		  __entry->alignment,
1838 		  __entry->minalignslop,
1839 		  __entry->len,
1840 		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1841 		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1842 		  __entry->wasdel,
1843 		  __entry->wasfromfl,
1844 		  __entry->resv,
1845 		  __entry->datatype,
1846 		  (unsigned long long)__entry->firstblock)
1847 )
1848 
1849 #define DEFINE_ALLOC_EVENT(name) \
1850 DEFINE_EVENT(xfs_alloc_class, name, \
1851 	TP_PROTO(struct xfs_alloc_arg *args), \
1852 	TP_ARGS(args))
1853 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1854 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1855 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1856 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1857 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1858 DEFINE_ALLOC_EVENT(xfs_alloc_cur);
1859 DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1860 DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
1861 DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
1862 DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
1863 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1864 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1865 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1866 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1867 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1868 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1869 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1870 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1871 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1872 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1873 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1874 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1875 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1876 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1877 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1878 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1879 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1880 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1881 
1882 TRACE_EVENT(xfs_alloc_cur_check,
1883 	TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1884 		 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1885 	TP_ARGS(mp, btnum, bno, len, diff, new),
1886 	TP_STRUCT__entry(
1887 		__field(dev_t, dev)
1888 		__field(xfs_btnum_t, btnum)
1889 		__field(xfs_agblock_t, bno)
1890 		__field(xfs_extlen_t, len)
1891 		__field(xfs_extlen_t, diff)
1892 		__field(bool, new)
1893 	),
1894 	TP_fast_assign(
1895 		__entry->dev = mp->m_super->s_dev;
1896 		__entry->btnum = btnum;
1897 		__entry->bno = bno;
1898 		__entry->len = len;
1899 		__entry->diff = diff;
1900 		__entry->new = new;
1901 	),
1902 	TP_printk("dev %d:%d btree %s agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
1903 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1904 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1905 		  __entry->bno, __entry->len, __entry->diff, __entry->new)
1906 )
1907 
1908 DECLARE_EVENT_CLASS(xfs_da_class,
1909 	TP_PROTO(struct xfs_da_args *args),
1910 	TP_ARGS(args),
1911 	TP_STRUCT__entry(
1912 		__field(dev_t, dev)
1913 		__field(xfs_ino_t, ino)
1914 		__dynamic_array(char, name, args->namelen)
1915 		__field(int, namelen)
1916 		__field(xfs_dahash_t, hashval)
1917 		__field(xfs_ino_t, inumber)
1918 		__field(uint32_t, op_flags)
1919 	),
1920 	TP_fast_assign(
1921 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1922 		__entry->ino = args->dp->i_ino;
1923 		if (args->namelen)
1924 			memcpy(__get_str(name), args->name, args->namelen);
1925 		__entry->namelen = args->namelen;
1926 		__entry->hashval = args->hashval;
1927 		__entry->inumber = args->inumber;
1928 		__entry->op_flags = args->op_flags;
1929 	),
1930 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1931 		  "inumber 0x%llx op_flags %s",
1932 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1933 		  __entry->ino,
1934 		  __entry->namelen,
1935 		  __entry->namelen ? __get_str(name) : NULL,
1936 		  __entry->namelen,
1937 		  __entry->hashval,
1938 		  __entry->inumber,
1939 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1940 )
1941 
1942 #define DEFINE_DIR2_EVENT(name) \
1943 DEFINE_EVENT(xfs_da_class, name, \
1944 	TP_PROTO(struct xfs_da_args *args), \
1945 	TP_ARGS(args))
1946 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1947 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1948 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1949 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1950 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1951 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1952 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1953 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1954 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1955 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1956 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1957 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1958 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1959 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1960 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1961 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1962 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1963 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1964 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1965 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1966 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1967 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1968 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1969 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1970 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1971 
1972 DECLARE_EVENT_CLASS(xfs_attr_class,
1973 	TP_PROTO(struct xfs_da_args *args),
1974 	TP_ARGS(args),
1975 	TP_STRUCT__entry(
1976 		__field(dev_t, dev)
1977 		__field(xfs_ino_t, ino)
1978 		__dynamic_array(char, name, args->namelen)
1979 		__field(int, namelen)
1980 		__field(int, valuelen)
1981 		__field(xfs_dahash_t, hashval)
1982 		__field(unsigned int, attr_filter)
1983 		__field(unsigned int, attr_flags)
1984 		__field(uint32_t, op_flags)
1985 	),
1986 	TP_fast_assign(
1987 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1988 		__entry->ino = args->dp->i_ino;
1989 		if (args->namelen)
1990 			memcpy(__get_str(name), args->name, args->namelen);
1991 		__entry->namelen = args->namelen;
1992 		__entry->valuelen = args->valuelen;
1993 		__entry->hashval = args->hashval;
1994 		__entry->attr_filter = args->attr_filter;
1995 		__entry->attr_flags = args->attr_flags;
1996 		__entry->op_flags = args->op_flags;
1997 	),
1998 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1999 		  "hashval 0x%x filter %s flags %s op_flags %s",
2000 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2001 		  __entry->ino,
2002 		  __entry->namelen,
2003 		  __entry->namelen ? __get_str(name) : NULL,
2004 		  __entry->namelen,
2005 		  __entry->valuelen,
2006 		  __entry->hashval,
2007 		  __print_flags(__entry->attr_filter, "|",
2008 				XFS_ATTR_FILTER_FLAGS),
2009 		   __print_flags(__entry->attr_flags, "|",
2010 				{ XATTR_CREATE,		"CREATE" },
2011 				{ XATTR_REPLACE,	"REPLACE" }),
2012 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
2013 )
2014 
2015 #define DEFINE_ATTR_EVENT(name) \
2016 DEFINE_EVENT(xfs_attr_class, name, \
2017 	TP_PROTO(struct xfs_da_args *args), \
2018 	TP_ARGS(args))
2019 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
2020 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
2021 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
2022 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2023 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
2024 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2025 
2026 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2027 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2028 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2029 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
2030 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2031 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2032 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2033 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2034 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2035 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2036 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2037 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2038 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2039 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2040 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2041 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2042 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2043 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2044 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2045 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2046 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2047 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2048 
2049 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2050 DEFINE_ATTR_EVENT(xfs_attr_node_get);
2051 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2052 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2053 
2054 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2055 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2056 
2057 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2058 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
2059 
2060 #define DEFINE_DA_EVENT(name) \
2061 DEFINE_EVENT(xfs_da_class, name, \
2062 	TP_PROTO(struct xfs_da_args *args), \
2063 	TP_ARGS(args))
2064 DEFINE_DA_EVENT(xfs_da_split);
2065 DEFINE_DA_EVENT(xfs_da_join);
2066 DEFINE_DA_EVENT(xfs_da_link_before);
2067 DEFINE_DA_EVENT(xfs_da_link_after);
2068 DEFINE_DA_EVENT(xfs_da_unlink_back);
2069 DEFINE_DA_EVENT(xfs_da_unlink_forward);
2070 DEFINE_DA_EVENT(xfs_da_root_split);
2071 DEFINE_DA_EVENT(xfs_da_root_join);
2072 DEFINE_DA_EVENT(xfs_da_node_add);
2073 DEFINE_DA_EVENT(xfs_da_node_create);
2074 DEFINE_DA_EVENT(xfs_da_node_split);
2075 DEFINE_DA_EVENT(xfs_da_node_remove);
2076 DEFINE_DA_EVENT(xfs_da_node_rebalance);
2077 DEFINE_DA_EVENT(xfs_da_node_unbalance);
2078 DEFINE_DA_EVENT(xfs_da_node_toosmall);
2079 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2080 DEFINE_DA_EVENT(xfs_da_grow_inode);
2081 DEFINE_DA_EVENT(xfs_da_shrink_inode);
2082 DEFINE_DA_EVENT(xfs_da_fixhashpath);
2083 DEFINE_DA_EVENT(xfs_da_path_shift);
2084 
2085 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2086 	TP_PROTO(struct xfs_da_args *args, int idx),
2087 	TP_ARGS(args, idx),
2088 	TP_STRUCT__entry(
2089 		__field(dev_t, dev)
2090 		__field(xfs_ino_t, ino)
2091 		__field(uint32_t, op_flags)
2092 		__field(int, idx)
2093 	),
2094 	TP_fast_assign(
2095 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2096 		__entry->ino = args->dp->i_ino;
2097 		__entry->op_flags = args->op_flags;
2098 		__entry->idx = idx;
2099 	),
2100 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2101 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2102 		  __entry->ino,
2103 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2104 		  __entry->idx)
2105 )
2106 
2107 #define DEFINE_DIR2_SPACE_EVENT(name) \
2108 DEFINE_EVENT(xfs_dir2_space_class, name, \
2109 	TP_PROTO(struct xfs_da_args *args, int idx), \
2110 	TP_ARGS(args, idx))
2111 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2112 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2113 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2114 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
2115 
2116 TRACE_EVENT(xfs_dir2_leafn_moveents,
2117 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2118 	TP_ARGS(args, src_idx, dst_idx, count),
2119 	TP_STRUCT__entry(
2120 		__field(dev_t, dev)
2121 		__field(xfs_ino_t, ino)
2122 		__field(uint32_t, op_flags)
2123 		__field(int, src_idx)
2124 		__field(int, dst_idx)
2125 		__field(int, count)
2126 	),
2127 	TP_fast_assign(
2128 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2129 		__entry->ino = args->dp->i_ino;
2130 		__entry->op_flags = args->op_flags;
2131 		__entry->src_idx = src_idx;
2132 		__entry->dst_idx = dst_idx;
2133 		__entry->count = count;
2134 	),
2135 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2136 		  "src_idx %d dst_idx %d count %d",
2137 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2138 		  __entry->ino,
2139 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2140 		  __entry->src_idx,
2141 		  __entry->dst_idx,
2142 		  __entry->count)
2143 );
2144 
2145 #define XFS_SWAPEXT_INODES \
2146 	{ 0,	"target" }, \
2147 	{ 1,	"temp" }
2148 
2149 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2150 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2151 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2152 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2153 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2154 
2155 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2156 	TP_PROTO(struct xfs_inode *ip, int which),
2157 	TP_ARGS(ip, which),
2158 	TP_STRUCT__entry(
2159 		__field(dev_t, dev)
2160 		__field(int, which)
2161 		__field(xfs_ino_t, ino)
2162 		__field(int, format)
2163 		__field(xfs_extnum_t, nex)
2164 		__field(int, broot_size)
2165 		__field(int, fork_off)
2166 	),
2167 	TP_fast_assign(
2168 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2169 		__entry->which = which;
2170 		__entry->ino = ip->i_ino;
2171 		__entry->format = ip->i_df.if_format;
2172 		__entry->nex = ip->i_df.if_nextents;
2173 		__entry->broot_size = ip->i_df.if_broot_bytes;
2174 		__entry->fork_off = XFS_IFORK_BOFF(ip);
2175 	),
2176 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2177 		  "broot size %d, forkoff 0x%x",
2178 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2179 		  __entry->ino,
2180 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2181 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2182 		  __entry->nex,
2183 		  __entry->broot_size,
2184 		  __entry->fork_off)
2185 )
2186 
2187 #define DEFINE_SWAPEXT_EVENT(name) \
2188 DEFINE_EVENT(xfs_swap_extent_class, name, \
2189 	TP_PROTO(struct xfs_inode *ip, int which), \
2190 	TP_ARGS(ip, which))
2191 
2192 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2193 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2194 
2195 TRACE_EVENT(xfs_log_recover,
2196 	TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2197 	TP_ARGS(log, headblk, tailblk),
2198 	TP_STRUCT__entry(
2199 		__field(dev_t, dev)
2200 		__field(xfs_daddr_t, headblk)
2201 		__field(xfs_daddr_t, tailblk)
2202 	),
2203 	TP_fast_assign(
2204 		__entry->dev = log->l_mp->m_super->s_dev;
2205 		__entry->headblk = headblk;
2206 		__entry->tailblk = tailblk;
2207 	),
2208 	TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2209 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2210 		  __entry->tailblk)
2211 )
2212 
2213 TRACE_EVENT(xfs_log_recover_record,
2214 	TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2215 	TP_ARGS(log, rhead, pass),
2216 	TP_STRUCT__entry(
2217 		__field(dev_t, dev)
2218 		__field(xfs_lsn_t, lsn)
2219 		__field(int, len)
2220 		__field(int, num_logops)
2221 		__field(int, pass)
2222 	),
2223 	TP_fast_assign(
2224 		__entry->dev = log->l_mp->m_super->s_dev;
2225 		__entry->lsn = be64_to_cpu(rhead->h_lsn);
2226 		__entry->len = be32_to_cpu(rhead->h_len);
2227 		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2228 		__entry->pass = pass;
2229 	),
2230 	TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2231 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2232 		  __entry->lsn, __entry->len, __entry->num_logops,
2233 		   __entry->pass)
2234 )
2235 
2236 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2237 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2238 		struct xlog_recover_item *item, int pass),
2239 	TP_ARGS(log, trans, item, pass),
2240 	TP_STRUCT__entry(
2241 		__field(dev_t, dev)
2242 		__field(unsigned long, item)
2243 		__field(xlog_tid_t, tid)
2244 		__field(xfs_lsn_t, lsn)
2245 		__field(int, type)
2246 		__field(int, pass)
2247 		__field(int, count)
2248 		__field(int, total)
2249 	),
2250 	TP_fast_assign(
2251 		__entry->dev = log->l_mp->m_super->s_dev;
2252 		__entry->item = (unsigned long)item;
2253 		__entry->tid = trans->r_log_tid;
2254 		__entry->lsn = trans->r_lsn;
2255 		__entry->type = ITEM_TYPE(item);
2256 		__entry->pass = pass;
2257 		__entry->count = item->ri_cnt;
2258 		__entry->total = item->ri_total;
2259 	),
2260 	TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2261 		  "item type %s item region count/total %d/%d",
2262 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2263 		  __entry->tid,
2264 		  __entry->lsn,
2265 		  __entry->pass,
2266 		  (void *)__entry->item,
2267 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2268 		  __entry->count,
2269 		  __entry->total)
2270 )
2271 
2272 #define DEFINE_LOG_RECOVER_ITEM(name) \
2273 DEFINE_EVENT(xfs_log_recover_item_class, name, \
2274 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2275 		struct xlog_recover_item *item, int pass), \
2276 	TP_ARGS(log, trans, item, pass))
2277 
2278 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2279 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2280 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2281 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2282 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2283 
2284 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2285 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2286 	TP_ARGS(log, buf_f),
2287 	TP_STRUCT__entry(
2288 		__field(dev_t, dev)
2289 		__field(int64_t, blkno)
2290 		__field(unsigned short, len)
2291 		__field(unsigned short, flags)
2292 		__field(unsigned short, size)
2293 		__field(unsigned int, map_size)
2294 	),
2295 	TP_fast_assign(
2296 		__entry->dev = log->l_mp->m_super->s_dev;
2297 		__entry->blkno = buf_f->blf_blkno;
2298 		__entry->len = buf_f->blf_len;
2299 		__entry->flags = buf_f->blf_flags;
2300 		__entry->size = buf_f->blf_size;
2301 		__entry->map_size = buf_f->blf_map_size;
2302 	),
2303 	TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2304 			"map_size %d",
2305 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2306 		  __entry->blkno,
2307 		  __entry->len,
2308 		  __entry->flags,
2309 		  __entry->size,
2310 		  __entry->map_size)
2311 )
2312 
2313 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2314 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2315 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2316 	TP_ARGS(log, buf_f))
2317 
2318 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2319 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2320 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2321 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2322 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2323 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2324 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2325 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2326 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2327 
2328 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2329 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2330 	TP_ARGS(log, in_f),
2331 	TP_STRUCT__entry(
2332 		__field(dev_t, dev)
2333 		__field(xfs_ino_t, ino)
2334 		__field(unsigned short, size)
2335 		__field(int, fields)
2336 		__field(unsigned short, asize)
2337 		__field(unsigned short, dsize)
2338 		__field(int64_t, blkno)
2339 		__field(int, len)
2340 		__field(int, boffset)
2341 	),
2342 	TP_fast_assign(
2343 		__entry->dev = log->l_mp->m_super->s_dev;
2344 		__entry->ino = in_f->ilf_ino;
2345 		__entry->size = in_f->ilf_size;
2346 		__entry->fields = in_f->ilf_fields;
2347 		__entry->asize = in_f->ilf_asize;
2348 		__entry->dsize = in_f->ilf_dsize;
2349 		__entry->blkno = in_f->ilf_blkno;
2350 		__entry->len = in_f->ilf_len;
2351 		__entry->boffset = in_f->ilf_boffset;
2352 	),
2353 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2354 			"dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2355 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2356 		  __entry->ino,
2357 		  __entry->size,
2358 		  __entry->fields,
2359 		  __entry->asize,
2360 		  __entry->dsize,
2361 		  __entry->blkno,
2362 		  __entry->len,
2363 		  __entry->boffset)
2364 )
2365 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2366 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2367 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2368 	TP_ARGS(log, in_f))
2369 
2370 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2371 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2372 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2373 
2374 DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2375 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2376 	TP_ARGS(log, in_f),
2377 	TP_STRUCT__entry(
2378 		__field(dev_t, dev)
2379 		__field(xfs_agnumber_t, agno)
2380 		__field(xfs_agblock_t, agbno)
2381 		__field(unsigned int, count)
2382 		__field(unsigned int, isize)
2383 		__field(xfs_agblock_t, length)
2384 		__field(unsigned int, gen)
2385 	),
2386 	TP_fast_assign(
2387 		__entry->dev = log->l_mp->m_super->s_dev;
2388 		__entry->agno = be32_to_cpu(in_f->icl_ag);
2389 		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2390 		__entry->count = be32_to_cpu(in_f->icl_count);
2391 		__entry->isize = be32_to_cpu(in_f->icl_isize);
2392 		__entry->length = be32_to_cpu(in_f->icl_length);
2393 		__entry->gen = be32_to_cpu(in_f->icl_gen);
2394 	),
2395 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2396 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2397 		  __entry->agno,
2398 		  __entry->agbno,
2399 		  __entry->length,
2400 		  __entry->count,
2401 		  __entry->isize,
2402 		  __entry->gen)
2403 )
2404 #define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2405 DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2406 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2407 	TP_ARGS(log, in_f))
2408 
2409 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2410 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2411 
2412 DECLARE_EVENT_CLASS(xfs_discard_class,
2413 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2414 		 xfs_agblock_t agbno, xfs_extlen_t len),
2415 	TP_ARGS(mp, agno, agbno, len),
2416 	TP_STRUCT__entry(
2417 		__field(dev_t, dev)
2418 		__field(xfs_agnumber_t, agno)
2419 		__field(xfs_agblock_t, agbno)
2420 		__field(xfs_extlen_t, len)
2421 	),
2422 	TP_fast_assign(
2423 		__entry->dev = mp->m_super->s_dev;
2424 		__entry->agno = agno;
2425 		__entry->agbno = agbno;
2426 		__entry->len = len;
2427 	),
2428 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2429 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2430 		  __entry->agno,
2431 		  __entry->agbno,
2432 		  __entry->len)
2433 )
2434 
2435 #define DEFINE_DISCARD_EVENT(name) \
2436 DEFINE_EVENT(xfs_discard_class, name, \
2437 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2438 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2439 	TP_ARGS(mp, agno, agbno, len))
2440 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2441 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2442 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2443 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2444 
2445 /* btree cursor events */
2446 TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2447 TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2448 TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2449 TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2450 TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2451 TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2452 TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2453 
2454 DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2455 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2456 	TP_ARGS(cur, level, bp),
2457 	TP_STRUCT__entry(
2458 		__field(dev_t, dev)
2459 		__field(xfs_btnum_t, btnum)
2460 		__field(int, level)
2461 		__field(int, nlevels)
2462 		__field(int, ptr)
2463 		__field(xfs_daddr_t, daddr)
2464 	),
2465 	TP_fast_assign(
2466 		__entry->dev = cur->bc_mp->m_super->s_dev;
2467 		__entry->btnum = cur->bc_btnum;
2468 		__entry->level = level;
2469 		__entry->nlevels = cur->bc_nlevels;
2470 		__entry->ptr = cur->bc_levels[level].ptr;
2471 		__entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2472 	),
2473 	TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
2474 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2475 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
2476 		  __entry->level,
2477 		  __entry->nlevels,
2478 		  __entry->ptr,
2479 		  (unsigned long long)__entry->daddr)
2480 )
2481 
2482 #define DEFINE_BTREE_CUR_EVENT(name) \
2483 DEFINE_EVENT(xfs_btree_cur_class, name, \
2484 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2485 	TP_ARGS(cur, level, bp))
2486 DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2487 DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2488 
2489 /* deferred ops */
2490 struct xfs_defer_pending;
2491 
2492 DECLARE_EVENT_CLASS(xfs_defer_class,
2493 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2494 	TP_ARGS(tp, caller_ip),
2495 	TP_STRUCT__entry(
2496 		__field(dev_t, dev)
2497 		__field(struct xfs_trans *, tp)
2498 		__field(char, committed)
2499 		__field(unsigned long, caller_ip)
2500 	),
2501 	TP_fast_assign(
2502 		__entry->dev = tp->t_mountp->m_super->s_dev;
2503 		__entry->tp = tp;
2504 		__entry->caller_ip = caller_ip;
2505 	),
2506 	TP_printk("dev %d:%d tp %p caller %pS",
2507 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2508 		  __entry->tp,
2509 		  (char *)__entry->caller_ip)
2510 )
2511 #define DEFINE_DEFER_EVENT(name) \
2512 DEFINE_EVENT(xfs_defer_class, name, \
2513 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2514 	TP_ARGS(tp, caller_ip))
2515 
2516 DECLARE_EVENT_CLASS(xfs_defer_error_class,
2517 	TP_PROTO(struct xfs_trans *tp, int error),
2518 	TP_ARGS(tp, error),
2519 	TP_STRUCT__entry(
2520 		__field(dev_t, dev)
2521 		__field(struct xfs_trans *, tp)
2522 		__field(char, committed)
2523 		__field(int, error)
2524 	),
2525 	TP_fast_assign(
2526 		__entry->dev = tp->t_mountp->m_super->s_dev;
2527 		__entry->tp = tp;
2528 		__entry->error = error;
2529 	),
2530 	TP_printk("dev %d:%d tp %p err %d",
2531 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2532 		  __entry->tp,
2533 		  __entry->error)
2534 )
2535 #define DEFINE_DEFER_ERROR_EVENT(name) \
2536 DEFINE_EVENT(xfs_defer_error_class, name, \
2537 	TP_PROTO(struct xfs_trans *tp, int error), \
2538 	TP_ARGS(tp, error))
2539 
2540 DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2541 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2542 	TP_ARGS(mp, dfp),
2543 	TP_STRUCT__entry(
2544 		__field(dev_t, dev)
2545 		__field(int, type)
2546 		__field(void *, intent)
2547 		__field(char, committed)
2548 		__field(int, nr)
2549 	),
2550 	TP_fast_assign(
2551 		__entry->dev = mp ? mp->m_super->s_dev : 0;
2552 		__entry->type = dfp->dfp_type;
2553 		__entry->intent = dfp->dfp_intent;
2554 		__entry->committed = dfp->dfp_done != NULL;
2555 		__entry->nr = dfp->dfp_count;
2556 	),
2557 	TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
2558 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2559 		  __entry->type,
2560 		  __entry->intent,
2561 		  __entry->committed,
2562 		  __entry->nr)
2563 )
2564 #define DEFINE_DEFER_PENDING_EVENT(name) \
2565 DEFINE_EVENT(xfs_defer_pending_class, name, \
2566 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2567 	TP_ARGS(mp, dfp))
2568 
2569 DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2570 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2571 		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2572 	TP_ARGS(mp, agno, type, agbno, len),
2573 	TP_STRUCT__entry(
2574 		__field(dev_t, dev)
2575 		__field(xfs_agnumber_t, agno)
2576 		__field(int, type)
2577 		__field(xfs_agblock_t, agbno)
2578 		__field(xfs_extlen_t, len)
2579 	),
2580 	TP_fast_assign(
2581 		__entry->dev = mp->m_super->s_dev;
2582 		__entry->agno = agno;
2583 		__entry->type = type;
2584 		__entry->agbno = agbno;
2585 		__entry->len = len;
2586 	),
2587 	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x",
2588 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2589 		  __entry->type,
2590 		  __entry->agno,
2591 		  __entry->agbno,
2592 		  __entry->len)
2593 );
2594 #define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2595 DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2596 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2597 		 int type, \
2598 		 xfs_agblock_t bno, \
2599 		 xfs_extlen_t len), \
2600 	TP_ARGS(mp, agno, type, bno, len))
2601 
2602 DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2603 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2604 		 int op,
2605 		 xfs_agblock_t agbno,
2606 		 xfs_ino_t ino,
2607 		 int whichfork,
2608 		 xfs_fileoff_t offset,
2609 		 xfs_filblks_t len,
2610 		 xfs_exntst_t state),
2611 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2612 	TP_STRUCT__entry(
2613 		__field(dev_t, dev)
2614 		__field(xfs_agnumber_t, agno)
2615 		__field(xfs_ino_t, ino)
2616 		__field(xfs_agblock_t, agbno)
2617 		__field(int, whichfork)
2618 		__field(xfs_fileoff_t, l_loff)
2619 		__field(xfs_filblks_t, l_len)
2620 		__field(xfs_exntst_t, l_state)
2621 		__field(int, op)
2622 	),
2623 	TP_fast_assign(
2624 		__entry->dev = mp->m_super->s_dev;
2625 		__entry->agno = agno;
2626 		__entry->ino = ino;
2627 		__entry->agbno = agbno;
2628 		__entry->whichfork = whichfork;
2629 		__entry->l_loff = offset;
2630 		__entry->l_len = len;
2631 		__entry->l_state = state;
2632 		__entry->op = op;
2633 	),
2634 	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",
2635 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2636 		  __entry->op,
2637 		  __entry->agno,
2638 		  __entry->agbno,
2639 		  __entry->ino,
2640 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2641 		  __entry->l_loff,
2642 		  __entry->l_len,
2643 		  __entry->l_state)
2644 );
2645 #define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2646 DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2647 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2648 		 int op, \
2649 		 xfs_agblock_t agbno, \
2650 		 xfs_ino_t ino, \
2651 		 int whichfork, \
2652 		 xfs_fileoff_t offset, \
2653 		 xfs_filblks_t len, \
2654 		 xfs_exntst_t state), \
2655 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2656 
2657 DEFINE_DEFER_EVENT(xfs_defer_cancel);
2658 DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2659 DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2660 DEFINE_DEFER_EVENT(xfs_defer_finish);
2661 DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2662 
2663 DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2664 DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2665 
2666 DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2667 DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2668 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2669 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2670 DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2671 
2672 #define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2673 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2674 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2675 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2676 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
2677 
2678 /* rmap tracepoints */
2679 DECLARE_EVENT_CLASS(xfs_rmap_class,
2680 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2681 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2682 		 const struct xfs_owner_info *oinfo),
2683 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2684 	TP_STRUCT__entry(
2685 		__field(dev_t, dev)
2686 		__field(xfs_agnumber_t, agno)
2687 		__field(xfs_agblock_t, agbno)
2688 		__field(xfs_extlen_t, len)
2689 		__field(uint64_t, owner)
2690 		__field(uint64_t, offset)
2691 		__field(unsigned long, flags)
2692 	),
2693 	TP_fast_assign(
2694 		__entry->dev = mp->m_super->s_dev;
2695 		__entry->agno = agno;
2696 		__entry->agbno = agbno;
2697 		__entry->len = len;
2698 		__entry->owner = oinfo->oi_owner;
2699 		__entry->offset = oinfo->oi_offset;
2700 		__entry->flags = oinfo->oi_flags;
2701 		if (unwritten)
2702 			__entry->flags |= XFS_RMAP_UNWRITTEN;
2703 	),
2704 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2705 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2706 		  __entry->agno,
2707 		  __entry->agbno,
2708 		  __entry->len,
2709 		  __entry->owner,
2710 		  __entry->offset,
2711 		  __entry->flags)
2712 );
2713 #define DEFINE_RMAP_EVENT(name) \
2714 DEFINE_EVENT(xfs_rmap_class, name, \
2715 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2716 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2717 		 const struct xfs_owner_info *oinfo), \
2718 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2719 
2720 /* simple AG-based error/%ip tracepoint class */
2721 DECLARE_EVENT_CLASS(xfs_ag_error_class,
2722 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2723 		 unsigned long caller_ip),
2724 	TP_ARGS(mp, agno, error, caller_ip),
2725 	TP_STRUCT__entry(
2726 		__field(dev_t, dev)
2727 		__field(xfs_agnumber_t, agno)
2728 		__field(int, error)
2729 		__field(unsigned long, caller_ip)
2730 	),
2731 	TP_fast_assign(
2732 		__entry->dev = mp->m_super->s_dev;
2733 		__entry->agno = agno;
2734 		__entry->error = error;
2735 		__entry->caller_ip = caller_ip;
2736 	),
2737 	TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
2738 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2739 		  __entry->agno,
2740 		  __entry->error,
2741 		  (char *)__entry->caller_ip)
2742 );
2743 
2744 #define DEFINE_AG_ERROR_EVENT(name) \
2745 DEFINE_EVENT(xfs_ag_error_class, name, \
2746 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2747 		 unsigned long caller_ip), \
2748 	TP_ARGS(mp, agno, error, caller_ip))
2749 
2750 DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2751 DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2752 DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2753 DEFINE_RMAP_EVENT(xfs_rmap_map);
2754 DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2755 DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2756 DEFINE_RMAP_EVENT(xfs_rmap_convert);
2757 DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2758 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2759 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2760 
2761 DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2762 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2763 		 xfs_agblock_t agbno, xfs_extlen_t len,
2764 		 uint64_t owner, uint64_t offset, unsigned int flags),
2765 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2766 	TP_STRUCT__entry(
2767 		__field(dev_t, dev)
2768 		__field(xfs_agnumber_t, agno)
2769 		__field(xfs_agblock_t, agbno)
2770 		__field(xfs_extlen_t, len)
2771 		__field(uint64_t, owner)
2772 		__field(uint64_t, offset)
2773 		__field(unsigned int, flags)
2774 	),
2775 	TP_fast_assign(
2776 		__entry->dev = mp->m_super->s_dev;
2777 		__entry->agno = agno;
2778 		__entry->agbno = agbno;
2779 		__entry->len = len;
2780 		__entry->owner = owner;
2781 		__entry->offset = offset;
2782 		__entry->flags = flags;
2783 	),
2784 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2785 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2786 		  __entry->agno,
2787 		  __entry->agbno,
2788 		  __entry->len,
2789 		  __entry->owner,
2790 		  __entry->offset,
2791 		  __entry->flags)
2792 );
2793 #define DEFINE_RMAPBT_EVENT(name) \
2794 DEFINE_EVENT(xfs_rmapbt_class, name, \
2795 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2796 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2797 		 uint64_t owner, uint64_t offset, unsigned int flags), \
2798 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2799 
2800 #define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2801 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2802 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2803 
2804 DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2805 DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2806 DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2807 DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2808 DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2809 DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2810 DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2811 DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2812 
2813 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2814 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2815 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2816 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2817 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2818 DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2819 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
2820 
2821 /* deferred bmbt updates */
2822 #define DEFINE_BMAP_DEFERRED_EVENT	DEFINE_RMAP_DEFERRED_EVENT
2823 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2824 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2825 
2826 /* per-AG reservation */
2827 DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2828 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2829 		 xfs_extlen_t len),
2830 	TP_ARGS(pag, resv, len),
2831 	TP_STRUCT__entry(
2832 		__field(dev_t, dev)
2833 		__field(xfs_agnumber_t, agno)
2834 		__field(int, resv)
2835 		__field(xfs_extlen_t, freeblks)
2836 		__field(xfs_extlen_t, flcount)
2837 		__field(xfs_extlen_t, reserved)
2838 		__field(xfs_extlen_t, asked)
2839 		__field(xfs_extlen_t, len)
2840 	),
2841 	TP_fast_assign(
2842 		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);
2843 
2844 		__entry->dev = pag->pag_mount->m_super->s_dev;
2845 		__entry->agno = pag->pag_agno;
2846 		__entry->resv = resv;
2847 		__entry->freeblks = pag->pagf_freeblks;
2848 		__entry->flcount = pag->pagf_flcount;
2849 		__entry->reserved = r ? r->ar_reserved : 0;
2850 		__entry->asked = r ? r->ar_asked : 0;
2851 		__entry->len = len;
2852 	),
2853 	TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
2854 		  "resv %u ask %u len %u",
2855 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2856 		  __entry->agno,
2857 		  __entry->resv,
2858 		  __entry->freeblks,
2859 		  __entry->flcount,
2860 		  __entry->reserved,
2861 		  __entry->asked,
2862 		  __entry->len)
2863 )
2864 #define DEFINE_AG_RESV_EVENT(name) \
2865 DEFINE_EVENT(xfs_ag_resv_class, name, \
2866 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2867 		 xfs_extlen_t len), \
2868 	TP_ARGS(pag, type, len))
2869 
2870 /* per-AG reservation tracepoints */
2871 DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2872 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2873 DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2874 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2875 DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2876 DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2877 
2878 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2879 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2880 
2881 /* refcount tracepoint classes */
2882 
2883 /* reuse the discard trace class for agbno/aglen-based traces */
2884 #define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2885 
2886 /* ag btree lookup tracepoint class */
2887 TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2888 TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2889 TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
2890 DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2891 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2892 		 xfs_agblock_t agbno, xfs_lookup_t dir),
2893 	TP_ARGS(mp, agno, agbno, dir),
2894 	TP_STRUCT__entry(
2895 		__field(dev_t, dev)
2896 		__field(xfs_agnumber_t, agno)
2897 		__field(xfs_agblock_t, agbno)
2898 		__field(xfs_lookup_t, dir)
2899 	),
2900 	TP_fast_assign(
2901 		__entry->dev = mp->m_super->s_dev;
2902 		__entry->agno = agno;
2903 		__entry->agbno = agbno;
2904 		__entry->dir = dir;
2905 	),
2906 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
2907 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2908 		  __entry->agno,
2909 		  __entry->agbno,
2910 		  __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2911 		  __entry->dir)
2912 )
2913 
2914 #define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2915 DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2916 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2917 		 xfs_agblock_t agbno, xfs_lookup_t dir), \
2918 	TP_ARGS(mp, agno, agbno, dir))
2919 
2920 /* single-rcext tracepoint class */
2921 DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2922 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2923 		 struct xfs_refcount_irec *irec),
2924 	TP_ARGS(mp, agno, irec),
2925 	TP_STRUCT__entry(
2926 		__field(dev_t, dev)
2927 		__field(xfs_agnumber_t, agno)
2928 		__field(xfs_agblock_t, startblock)
2929 		__field(xfs_extlen_t, blockcount)
2930 		__field(xfs_nlink_t, refcount)
2931 	),
2932 	TP_fast_assign(
2933 		__entry->dev = mp->m_super->s_dev;
2934 		__entry->agno = agno;
2935 		__entry->startblock = irec->rc_startblock;
2936 		__entry->blockcount = irec->rc_blockcount;
2937 		__entry->refcount = irec->rc_refcount;
2938 	),
2939 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u",
2940 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2941 		  __entry->agno,
2942 		  __entry->startblock,
2943 		  __entry->blockcount,
2944 		  __entry->refcount)
2945 )
2946 
2947 #define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2948 DEFINE_EVENT(xfs_refcount_extent_class, name, \
2949 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2950 		 struct xfs_refcount_irec *irec), \
2951 	TP_ARGS(mp, agno, irec))
2952 
2953 /* single-rcext and an agbno tracepoint class */
2954 DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2955 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2956 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2957 	TP_ARGS(mp, agno, irec, agbno),
2958 	TP_STRUCT__entry(
2959 		__field(dev_t, dev)
2960 		__field(xfs_agnumber_t, agno)
2961 		__field(xfs_agblock_t, startblock)
2962 		__field(xfs_extlen_t, blockcount)
2963 		__field(xfs_nlink_t, refcount)
2964 		__field(xfs_agblock_t, agbno)
2965 	),
2966 	TP_fast_assign(
2967 		__entry->dev = mp->m_super->s_dev;
2968 		__entry->agno = agno;
2969 		__entry->startblock = irec->rc_startblock;
2970 		__entry->blockcount = irec->rc_blockcount;
2971 		__entry->refcount = irec->rc_refcount;
2972 		__entry->agbno = agbno;
2973 	),
2974 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
2975 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2976 		  __entry->agno,
2977 		  __entry->startblock,
2978 		  __entry->blockcount,
2979 		  __entry->refcount,
2980 		  __entry->agbno)
2981 )
2982 
2983 #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2984 DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2985 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2986 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2987 	TP_ARGS(mp, agno, irec, agbno))
2988 
2989 /* double-rcext tracepoint class */
2990 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2991 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2992 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2993 	TP_ARGS(mp, agno, i1, i2),
2994 	TP_STRUCT__entry(
2995 		__field(dev_t, dev)
2996 		__field(xfs_agnumber_t, agno)
2997 		__field(xfs_agblock_t, i1_startblock)
2998 		__field(xfs_extlen_t, i1_blockcount)
2999 		__field(xfs_nlink_t, i1_refcount)
3000 		__field(xfs_agblock_t, i2_startblock)
3001 		__field(xfs_extlen_t, i2_blockcount)
3002 		__field(xfs_nlink_t, i2_refcount)
3003 	),
3004 	TP_fast_assign(
3005 		__entry->dev = mp->m_super->s_dev;
3006 		__entry->agno = agno;
3007 		__entry->i1_startblock = i1->rc_startblock;
3008 		__entry->i1_blockcount = i1->rc_blockcount;
3009 		__entry->i1_refcount = i1->rc_refcount;
3010 		__entry->i2_startblock = i2->rc_startblock;
3011 		__entry->i2_blockcount = i2->rc_blockcount;
3012 		__entry->i2_refcount = i2->rc_refcount;
3013 	),
3014 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
3015 		  "agbno 0x%x fsbcount 0x%x refcount %u",
3016 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3017 		  __entry->agno,
3018 		  __entry->i1_startblock,
3019 		  __entry->i1_blockcount,
3020 		  __entry->i1_refcount,
3021 		  __entry->i2_startblock,
3022 		  __entry->i2_blockcount,
3023 		  __entry->i2_refcount)
3024 )
3025 
3026 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3027 DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3028 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3029 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
3030 	TP_ARGS(mp, agno, i1, i2))
3031 
3032 /* double-rcext and an agbno tracepoint class */
3033 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3034 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3035 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3036 		 xfs_agblock_t agbno),
3037 	TP_ARGS(mp, agno, i1, i2, agbno),
3038 	TP_STRUCT__entry(
3039 		__field(dev_t, dev)
3040 		__field(xfs_agnumber_t, agno)
3041 		__field(xfs_agblock_t, i1_startblock)
3042 		__field(xfs_extlen_t, i1_blockcount)
3043 		__field(xfs_nlink_t, i1_refcount)
3044 		__field(xfs_agblock_t, i2_startblock)
3045 		__field(xfs_extlen_t, i2_blockcount)
3046 		__field(xfs_nlink_t, i2_refcount)
3047 		__field(xfs_agblock_t, agbno)
3048 	),
3049 	TP_fast_assign(
3050 		__entry->dev = mp->m_super->s_dev;
3051 		__entry->agno = agno;
3052 		__entry->i1_startblock = i1->rc_startblock;
3053 		__entry->i1_blockcount = i1->rc_blockcount;
3054 		__entry->i1_refcount = i1->rc_refcount;
3055 		__entry->i2_startblock = i2->rc_startblock;
3056 		__entry->i2_blockcount = i2->rc_blockcount;
3057 		__entry->i2_refcount = i2->rc_refcount;
3058 		__entry->agbno = agbno;
3059 	),
3060 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
3061 		  "agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3062 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3063 		  __entry->agno,
3064 		  __entry->i1_startblock,
3065 		  __entry->i1_blockcount,
3066 		  __entry->i1_refcount,
3067 		  __entry->i2_startblock,
3068 		  __entry->i2_blockcount,
3069 		  __entry->i2_refcount,
3070 		  __entry->agbno)
3071 )
3072 
3073 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3074 DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3075 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3076 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3077 		 xfs_agblock_t agbno), \
3078 	TP_ARGS(mp, agno, i1, i2, agbno))
3079 
3080 /* triple-rcext tracepoint class */
3081 DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3082 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3083 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3084 		 struct xfs_refcount_irec *i3),
3085 	TP_ARGS(mp, agno, i1, i2, i3),
3086 	TP_STRUCT__entry(
3087 		__field(dev_t, dev)
3088 		__field(xfs_agnumber_t, agno)
3089 		__field(xfs_agblock_t, i1_startblock)
3090 		__field(xfs_extlen_t, i1_blockcount)
3091 		__field(xfs_nlink_t, i1_refcount)
3092 		__field(xfs_agblock_t, i2_startblock)
3093 		__field(xfs_extlen_t, i2_blockcount)
3094 		__field(xfs_nlink_t, i2_refcount)
3095 		__field(xfs_agblock_t, i3_startblock)
3096 		__field(xfs_extlen_t, i3_blockcount)
3097 		__field(xfs_nlink_t, i3_refcount)
3098 	),
3099 	TP_fast_assign(
3100 		__entry->dev = mp->m_super->s_dev;
3101 		__entry->agno = agno;
3102 		__entry->i1_startblock = i1->rc_startblock;
3103 		__entry->i1_blockcount = i1->rc_blockcount;
3104 		__entry->i1_refcount = i1->rc_refcount;
3105 		__entry->i2_startblock = i2->rc_startblock;
3106 		__entry->i2_blockcount = i2->rc_blockcount;
3107 		__entry->i2_refcount = i2->rc_refcount;
3108 		__entry->i3_startblock = i3->rc_startblock;
3109 		__entry->i3_blockcount = i3->rc_blockcount;
3110 		__entry->i3_refcount = i3->rc_refcount;
3111 	),
3112 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u -- "
3113 		  "agbno 0x%x fsbcount 0x%x refcount %u -- "
3114 		  "agbno 0x%x fsbcount 0x%x refcount %u",
3115 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3116 		  __entry->agno,
3117 		  __entry->i1_startblock,
3118 		  __entry->i1_blockcount,
3119 		  __entry->i1_refcount,
3120 		  __entry->i2_startblock,
3121 		  __entry->i2_blockcount,
3122 		  __entry->i2_refcount,
3123 		  __entry->i3_startblock,
3124 		  __entry->i3_blockcount,
3125 		  __entry->i3_refcount)
3126 );
3127 
3128 #define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3129 DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3130 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3131 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3132 		 struct xfs_refcount_irec *i3), \
3133 	TP_ARGS(mp, agno, i1, i2, i3))
3134 
3135 /* refcount btree tracepoints */
3136 DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
3137 DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
3138 DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
3139 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3140 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3141 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3142 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3143 DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
3144 DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
3145 DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
3146 
3147 /* refcount adjustment tracepoints */
3148 DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
3149 DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
3150 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
3151 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
3152 DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3153 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3154 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
3155 DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3156 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3157 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3158 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3159 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3160 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
3161 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3162 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3163 DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
3164 DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
3165 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3166 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3167 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3168 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3169 
3170 /* reflink helpers */
3171 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
3172 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
3173 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
3174 #define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
3175 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3176 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3177 
3178 TRACE_EVENT(xfs_refcount_finish_one_leftover,
3179 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3180 		 int type, xfs_agblock_t agbno, xfs_extlen_t len,
3181 		 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
3182 	TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
3183 	TP_STRUCT__entry(
3184 		__field(dev_t, dev)
3185 		__field(xfs_agnumber_t, agno)
3186 		__field(int, type)
3187 		__field(xfs_agblock_t, agbno)
3188 		__field(xfs_extlen_t, len)
3189 		__field(xfs_agblock_t, new_agbno)
3190 		__field(xfs_extlen_t, new_len)
3191 	),
3192 	TP_fast_assign(
3193 		__entry->dev = mp->m_super->s_dev;
3194 		__entry->agno = agno;
3195 		__entry->type = type;
3196 		__entry->agbno = agbno;
3197 		__entry->len = len;
3198 		__entry->new_agbno = new_agbno;
3199 		__entry->new_len = new_len;
3200 	),
3201 	TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x new_agbno 0x%x new_fsbcount 0x%x",
3202 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3203 		  __entry->type,
3204 		  __entry->agno,
3205 		  __entry->agbno,
3206 		  __entry->len,
3207 		  __entry->new_agbno,
3208 		  __entry->new_len)
3209 );
3210 
3211 /* simple inode-based error/%ip tracepoint class */
3212 DECLARE_EVENT_CLASS(xfs_inode_error_class,
3213 	TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3214 	TP_ARGS(ip, error, caller_ip),
3215 	TP_STRUCT__entry(
3216 		__field(dev_t, dev)
3217 		__field(xfs_ino_t, ino)
3218 		__field(int, error)
3219 		__field(unsigned long, caller_ip)
3220 	),
3221 	TP_fast_assign(
3222 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3223 		__entry->ino = ip->i_ino;
3224 		__entry->error = error;
3225 		__entry->caller_ip = caller_ip;
3226 	),
3227 	TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3228 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3229 		  __entry->ino,
3230 		  __entry->error,
3231 		  (char *)__entry->caller_ip)
3232 );
3233 
3234 #define DEFINE_INODE_ERROR_EVENT(name) \
3235 DEFINE_EVENT(xfs_inode_error_class, name, \
3236 	TP_PROTO(struct xfs_inode *ip, int error, \
3237 		 unsigned long caller_ip), \
3238 	TP_ARGS(ip, error, caller_ip))
3239 
3240 /* reflink tracepoint classes */
3241 
3242 /* two-file io tracepoint class */
3243 DECLARE_EVENT_CLASS(xfs_double_io_class,
3244 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3245 		 struct xfs_inode *dest, xfs_off_t doffset),
3246 	TP_ARGS(src, soffset, len, dest, doffset),
3247 	TP_STRUCT__entry(
3248 		__field(dev_t, dev)
3249 		__field(xfs_ino_t, src_ino)
3250 		__field(loff_t, src_isize)
3251 		__field(loff_t, src_disize)
3252 		__field(loff_t, src_offset)
3253 		__field(long long, len)
3254 		__field(xfs_ino_t, dest_ino)
3255 		__field(loff_t, dest_isize)
3256 		__field(loff_t, dest_disize)
3257 		__field(loff_t, dest_offset)
3258 	),
3259 	TP_fast_assign(
3260 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3261 		__entry->src_ino = src->i_ino;
3262 		__entry->src_isize = VFS_I(src)->i_size;
3263 		__entry->src_disize = src->i_disk_size;
3264 		__entry->src_offset = soffset;
3265 		__entry->len = len;
3266 		__entry->dest_ino = dest->i_ino;
3267 		__entry->dest_isize = VFS_I(dest)->i_size;
3268 		__entry->dest_disize = dest->i_disk_size;
3269 		__entry->dest_offset = doffset;
3270 	),
3271 	TP_printk("dev %d:%d bytecount 0x%llx "
3272 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
3273 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3274 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3275 		  __entry->len,
3276 		  __entry->src_ino,
3277 		  __entry->src_isize,
3278 		  __entry->src_disize,
3279 		  __entry->src_offset,
3280 		  __entry->dest_ino,
3281 		  __entry->dest_isize,
3282 		  __entry->dest_disize,
3283 		  __entry->dest_offset)
3284 )
3285 
3286 #define DEFINE_DOUBLE_IO_EVENT(name)	\
3287 DEFINE_EVENT(xfs_double_io_class, name,	\
3288 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3289 		 struct xfs_inode *dest, xfs_off_t doffset), \
3290 	TP_ARGS(src, soffset, len, dest, doffset))
3291 
3292 /* inode/irec events */
3293 DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3294 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3295 	TP_ARGS(ip, irec),
3296 	TP_STRUCT__entry(
3297 		__field(dev_t, dev)
3298 		__field(xfs_ino_t, ino)
3299 		__field(xfs_fileoff_t, lblk)
3300 		__field(xfs_extlen_t, len)
3301 		__field(xfs_fsblock_t, pblk)
3302 		__field(int, state)
3303 	),
3304 	TP_fast_assign(
3305 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3306 		__entry->ino = ip->i_ino;
3307 		__entry->lblk = irec->br_startoff;
3308 		__entry->len = irec->br_blockcount;
3309 		__entry->pblk = irec->br_startblock;
3310 		__entry->state = irec->br_state;
3311 	),
3312 	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3313 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3314 		  __entry->ino,
3315 		  __entry->lblk,
3316 		  __entry->len,
3317 		  __entry->pblk,
3318 		  __entry->state)
3319 );
3320 #define DEFINE_INODE_IREC_EVENT(name) \
3321 DEFINE_EVENT(xfs_inode_irec_class, name, \
3322 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3323 	TP_ARGS(ip, irec))
3324 
3325 /* refcount/reflink tracepoint definitions */
3326 
3327 /* reflink tracepoints */
3328 DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3329 DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3330 DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3331 TRACE_EVENT(xfs_reflink_remap_blocks,
3332 	TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3333 		 xfs_filblks_t len, struct xfs_inode *dest,
3334 		 xfs_fileoff_t doffset),
3335 	TP_ARGS(src, soffset, len, dest, doffset),
3336 	TP_STRUCT__entry(
3337 		__field(dev_t, dev)
3338 		__field(xfs_ino_t, src_ino)
3339 		__field(xfs_fileoff_t, src_lblk)
3340 		__field(xfs_filblks_t, len)
3341 		__field(xfs_ino_t, dest_ino)
3342 		__field(xfs_fileoff_t, dest_lblk)
3343 	),
3344 	TP_fast_assign(
3345 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3346 		__entry->src_ino = src->i_ino;
3347 		__entry->src_lblk = soffset;
3348 		__entry->len = len;
3349 		__entry->dest_ino = dest->i_ino;
3350 		__entry->dest_lblk = doffset;
3351 	),
3352 	TP_printk("dev %d:%d fsbcount 0x%llx "
3353 		  "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3354 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3355 		  __entry->len,
3356 		  __entry->src_ino,
3357 		  __entry->src_lblk,
3358 		  __entry->dest_ino,
3359 		  __entry->dest_lblk)
3360 );
3361 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3362 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3363 DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3364 DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3365 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3366 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3367 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3368 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3369 
3370 /* dedupe tracepoints */
3371 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3372 DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3373 
3374 /* ioctl tracepoints */
3375 TRACE_EVENT(xfs_ioctl_clone,
3376 	TP_PROTO(struct inode *src, struct inode *dest),
3377 	TP_ARGS(src, dest),
3378 	TP_STRUCT__entry(
3379 		__field(dev_t, dev)
3380 		__field(unsigned long, src_ino)
3381 		__field(loff_t, src_isize)
3382 		__field(unsigned long, dest_ino)
3383 		__field(loff_t, dest_isize)
3384 	),
3385 	TP_fast_assign(
3386 		__entry->dev = src->i_sb->s_dev;
3387 		__entry->src_ino = src->i_ino;
3388 		__entry->src_isize = i_size_read(src);
3389 		__entry->dest_ino = dest->i_ino;
3390 		__entry->dest_isize = i_size_read(dest);
3391 	),
3392 	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3393 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3394 		  __entry->src_ino,
3395 		  __entry->src_isize,
3396 		  __entry->dest_ino,
3397 		  __entry->dest_isize)
3398 );
3399 
3400 /* unshare tracepoints */
3401 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3402 DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3403 
3404 /* copy on write */
3405 DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3406 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3407 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3408 DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3409 
3410 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3411 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3412 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
3413 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3414 
3415 DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3416 DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3417 
3418 
3419 DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3420 
3421 /* rmap swapext tracepoints */
3422 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3423 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3424 DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3425 
3426 /* fsmap traces */
3427 DECLARE_EVENT_CLASS(xfs_fsmap_class,
3428 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3429 		 const struct xfs_rmap_irec *rmap),
3430 	TP_ARGS(mp, keydev, agno, rmap),
3431 	TP_STRUCT__entry(
3432 		__field(dev_t, dev)
3433 		__field(dev_t, keydev)
3434 		__field(xfs_agnumber_t, agno)
3435 		__field(xfs_fsblock_t, bno)
3436 		__field(xfs_filblks_t, len)
3437 		__field(uint64_t, owner)
3438 		__field(uint64_t, offset)
3439 		__field(unsigned int, flags)
3440 	),
3441 	TP_fast_assign(
3442 		__entry->dev = mp->m_super->s_dev;
3443 		__entry->keydev = new_decode_dev(keydev);
3444 		__entry->agno = agno;
3445 		__entry->bno = rmap->rm_startblock;
3446 		__entry->len = rmap->rm_blockcount;
3447 		__entry->owner = rmap->rm_owner;
3448 		__entry->offset = rmap->rm_offset;
3449 		__entry->flags = rmap->rm_flags;
3450 	),
3451 	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",
3452 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3453 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3454 		  __entry->agno,
3455 		  __entry->bno,
3456 		  __entry->len,
3457 		  __entry->owner,
3458 		  __entry->offset,
3459 		  __entry->flags)
3460 )
3461 #define DEFINE_FSMAP_EVENT(name) \
3462 DEFINE_EVENT(xfs_fsmap_class, name, \
3463 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3464 		 const struct xfs_rmap_irec *rmap), \
3465 	TP_ARGS(mp, keydev, agno, rmap))
3466 DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3467 DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3468 DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3469 
3470 DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3471 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3472 	TP_ARGS(mp, fsmap),
3473 	TP_STRUCT__entry(
3474 		__field(dev_t, dev)
3475 		__field(dev_t, keydev)
3476 		__field(xfs_daddr_t, block)
3477 		__field(xfs_daddr_t, len)
3478 		__field(uint64_t, owner)
3479 		__field(uint64_t, offset)
3480 		__field(uint64_t, flags)
3481 	),
3482 	TP_fast_assign(
3483 		__entry->dev = mp->m_super->s_dev;
3484 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
3485 		__entry->block = fsmap->fmr_physical;
3486 		__entry->len = fsmap->fmr_length;
3487 		__entry->owner = fsmap->fmr_owner;
3488 		__entry->offset = fsmap->fmr_offset;
3489 		__entry->flags = fsmap->fmr_flags;
3490 	),
3491 	TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
3492 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3493 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3494 		  __entry->block,
3495 		  __entry->len,
3496 		  __entry->owner,
3497 		  __entry->offset,
3498 		  __entry->flags)
3499 )
3500 #define DEFINE_GETFSMAP_EVENT(name) \
3501 DEFINE_EVENT(xfs_getfsmap_class, name, \
3502 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3503 	TP_ARGS(mp, fsmap))
3504 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3505 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3506 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3507 
3508 DECLARE_EVENT_CLASS(xfs_trans_resv_class,
3509 	TP_PROTO(struct xfs_mount *mp, unsigned int type,
3510 		 struct xfs_trans_res *res),
3511 	TP_ARGS(mp, type, res),
3512 	TP_STRUCT__entry(
3513 		__field(dev_t, dev)
3514 		__field(int, type)
3515 		__field(uint, logres)
3516 		__field(int, logcount)
3517 		__field(int, logflags)
3518 	),
3519 	TP_fast_assign(
3520 		__entry->dev = mp->m_super->s_dev;
3521 		__entry->type = type;
3522 		__entry->logres = res->tr_logres;
3523 		__entry->logcount = res->tr_logcount;
3524 		__entry->logflags = res->tr_logflags;
3525 	),
3526 	TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3527 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3528 		  __entry->type,
3529 		  __entry->logres,
3530 		  __entry->logcount,
3531 		  __entry->logflags)
3532 )
3533 
3534 #define DEFINE_TRANS_RESV_EVENT(name) \
3535 DEFINE_EVENT(xfs_trans_resv_class, name, \
3536 	TP_PROTO(struct xfs_mount *mp, unsigned int type, \
3537 		 struct xfs_trans_res *res), \
3538 	TP_ARGS(mp, type, res))
3539 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
3540 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
3541 
3542 TRACE_EVENT(xfs_log_get_max_trans_res,
3543 	TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
3544 	TP_ARGS(mp, res),
3545 	TP_STRUCT__entry(
3546 		__field(dev_t, dev)
3547 		__field(uint, logres)
3548 		__field(int, logcount)
3549 	),
3550 	TP_fast_assign(
3551 		__entry->dev = mp->m_super->s_dev;
3552 		__entry->logres = res->tr_logres;
3553 		__entry->logcount = res->tr_logcount;
3554 	),
3555 	TP_printk("dev %d:%d logres %u logcount %d",
3556 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3557 		  __entry->logres,
3558 		  __entry->logcount)
3559 );
3560 
3561 DECLARE_EVENT_CLASS(xfs_trans_class,
3562 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3563 	TP_ARGS(tp, caller_ip),
3564 	TP_STRUCT__entry(
3565 		__field(dev_t, dev)
3566 		__field(uint32_t, tid)
3567 		__field(uint32_t, flags)
3568 		__field(unsigned long, caller_ip)
3569 	),
3570 	TP_fast_assign(
3571 		__entry->dev = tp->t_mountp->m_super->s_dev;
3572 		__entry->tid = 0;
3573 		if (tp->t_ticket)
3574 			__entry->tid = tp->t_ticket->t_tid;
3575 		__entry->flags = tp->t_flags;
3576 		__entry->caller_ip = caller_ip;
3577 	),
3578 	TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3579 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3580 		  __entry->tid,
3581 		  __entry->flags,
3582 		  (char *)__entry->caller_ip)
3583 )
3584 
3585 #define DEFINE_TRANS_EVENT(name) \
3586 DEFINE_EVENT(xfs_trans_class, name, \
3587 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3588 	TP_ARGS(tp, caller_ip))
3589 DEFINE_TRANS_EVENT(xfs_trans_alloc);
3590 DEFINE_TRANS_EVENT(xfs_trans_cancel);
3591 DEFINE_TRANS_EVENT(xfs_trans_commit);
3592 DEFINE_TRANS_EVENT(xfs_trans_dup);
3593 DEFINE_TRANS_EVENT(xfs_trans_free);
3594 DEFINE_TRANS_EVENT(xfs_trans_roll);
3595 DEFINE_TRANS_EVENT(xfs_trans_add_item);
3596 DEFINE_TRANS_EVENT(xfs_trans_commit_items);
3597 DEFINE_TRANS_EVENT(xfs_trans_free_items);
3598 
3599 TRACE_EVENT(xfs_iunlink_update_bucket,
3600 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3601 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3602 	TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3603 	TP_STRUCT__entry(
3604 		__field(dev_t, dev)
3605 		__field(xfs_agnumber_t, agno)
3606 		__field(unsigned int, bucket)
3607 		__field(xfs_agino_t, old_ptr)
3608 		__field(xfs_agino_t, new_ptr)
3609 	),
3610 	TP_fast_assign(
3611 		__entry->dev = mp->m_super->s_dev;
3612 		__entry->agno = agno;
3613 		__entry->bucket = bucket;
3614 		__entry->old_ptr = old_ptr;
3615 		__entry->new_ptr = new_ptr;
3616 	),
3617 	TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
3618 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3619 		  __entry->agno,
3620 		  __entry->bucket,
3621 		  __entry->old_ptr,
3622 		  __entry->new_ptr)
3623 );
3624 
3625 TRACE_EVENT(xfs_iunlink_update_dinode,
3626 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3627 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3628 	TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3629 	TP_STRUCT__entry(
3630 		__field(dev_t, dev)
3631 		__field(xfs_agnumber_t, agno)
3632 		__field(xfs_agino_t, agino)
3633 		__field(xfs_agino_t, old_ptr)
3634 		__field(xfs_agino_t, new_ptr)
3635 	),
3636 	TP_fast_assign(
3637 		__entry->dev = mp->m_super->s_dev;
3638 		__entry->agno = agno;
3639 		__entry->agino = agino;
3640 		__entry->old_ptr = old_ptr;
3641 		__entry->new_ptr = new_ptr;
3642 	),
3643 	TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
3644 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3645 		  __entry->agno,
3646 		  __entry->agino,
3647 		  __entry->old_ptr,
3648 		  __entry->new_ptr)
3649 );
3650 
3651 DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3652 	TP_PROTO(struct xfs_inode *ip),
3653 	TP_ARGS(ip),
3654 	TP_STRUCT__entry(
3655 		__field(dev_t, dev)
3656 		__field(xfs_agnumber_t, agno)
3657 		__field(xfs_agino_t, agino)
3658 	),
3659 	TP_fast_assign(
3660 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3661 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3662 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3663 	),
3664 	TP_printk("dev %d:%d agno 0x%x agino 0x%x",
3665 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3666 		  __entry->agno, __entry->agino)
3667 )
3668 
3669 #define DEFINE_AGINODE_EVENT(name) \
3670 DEFINE_EVENT(xfs_ag_inode_class, name, \
3671 	TP_PROTO(struct xfs_inode *ip), \
3672 	TP_ARGS(ip))
3673 DEFINE_AGINODE_EVENT(xfs_iunlink);
3674 DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
3675 DEFINE_AG_EVENT(xfs_iunlink_map_prev_fallback);
3676 
3677 DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3678 	TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3679 	TP_ARGS(mp, flags),
3680 	TP_STRUCT__entry(
3681 		__field(dev_t, dev)
3682 		__field(unsigned int, flags)
3683 	),
3684 	TP_fast_assign(
3685 		__entry->dev = mp->m_super->s_dev;
3686 		__entry->flags = flags;
3687 	),
3688 	TP_printk("dev %d:%d flags 0x%x",
3689 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3690 		  __entry->flags)
3691 );
3692 #define DEFINE_FS_CORRUPT_EVENT(name)	\
3693 DEFINE_EVENT(xfs_fs_corrupt_class, name,	\
3694 	TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3695 	TP_ARGS(mp, flags))
3696 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3697 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
3698 DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
3699 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3700 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
3701 DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
3702 
3703 DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3704 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3705 	TP_ARGS(mp, agno, flags),
3706 	TP_STRUCT__entry(
3707 		__field(dev_t, dev)
3708 		__field(xfs_agnumber_t, agno)
3709 		__field(unsigned int, flags)
3710 	),
3711 	TP_fast_assign(
3712 		__entry->dev = mp->m_super->s_dev;
3713 		__entry->agno = agno;
3714 		__entry->flags = flags;
3715 	),
3716 	TP_printk("dev %d:%d agno 0x%x flags 0x%x",
3717 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3718 		  __entry->agno, __entry->flags)
3719 );
3720 #define DEFINE_AG_CORRUPT_EVENT(name)	\
3721 DEFINE_EVENT(xfs_ag_corrupt_class, name,	\
3722 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3723 		 unsigned int flags), \
3724 	TP_ARGS(mp, agno, flags))
3725 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3726 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
3727 DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
3728 
3729 DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3730 	TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3731 	TP_ARGS(ip, flags),
3732 	TP_STRUCT__entry(
3733 		__field(dev_t, dev)
3734 		__field(xfs_ino_t, ino)
3735 		__field(unsigned int, flags)
3736 	),
3737 	TP_fast_assign(
3738 		__entry->dev = ip->i_mount->m_super->s_dev;
3739 		__entry->ino = ip->i_ino;
3740 		__entry->flags = flags;
3741 	),
3742 	TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3743 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3744 		  __entry->ino, __entry->flags)
3745 );
3746 #define DEFINE_INODE_CORRUPT_EVENT(name)	\
3747 DEFINE_EVENT(xfs_inode_corrupt_class, name,	\
3748 	TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3749 	TP_ARGS(ip, flags))
3750 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3751 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3752 
3753 TRACE_EVENT(xfs_iwalk_ag,
3754 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3755 		 xfs_agino_t startino),
3756 	TP_ARGS(mp, agno, startino),
3757 	TP_STRUCT__entry(
3758 		__field(dev_t, dev)
3759 		__field(xfs_agnumber_t, agno)
3760 		__field(xfs_agino_t, startino)
3761 	),
3762 	TP_fast_assign(
3763 		__entry->dev = mp->m_super->s_dev;
3764 		__entry->agno = agno;
3765 		__entry->startino = startino;
3766 	),
3767 	TP_printk("dev %d:%d agno 0x%x startino 0x%x",
3768 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3769 		  __entry->startino)
3770 )
3771 
3772 TRACE_EVENT(xfs_iwalk_ag_rec,
3773 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3774 		 struct xfs_inobt_rec_incore *irec),
3775 	TP_ARGS(mp, agno, irec),
3776 	TP_STRUCT__entry(
3777 		__field(dev_t, dev)
3778 		__field(xfs_agnumber_t, agno)
3779 		__field(xfs_agino_t, startino)
3780 		__field(uint64_t, freemask)
3781 	),
3782 	TP_fast_assign(
3783 		__entry->dev = mp->m_super->s_dev;
3784 		__entry->agno = agno;
3785 		__entry->startino = irec->ir_startino;
3786 		__entry->freemask = irec->ir_free;
3787 	),
3788 	TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
3789 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3790 		  __entry->startino, __entry->freemask)
3791 )
3792 
3793 TRACE_EVENT(xfs_pwork_init,
3794 	TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
3795 	TP_ARGS(mp, nr_threads, pid),
3796 	TP_STRUCT__entry(
3797 		__field(dev_t, dev)
3798 		__field(unsigned int, nr_threads)
3799 		__field(pid_t, pid)
3800 	),
3801 	TP_fast_assign(
3802 		__entry->dev = mp->m_super->s_dev;
3803 		__entry->nr_threads = nr_threads;
3804 		__entry->pid = pid;
3805 	),
3806 	TP_printk("dev %d:%d nr_threads %u pid %u",
3807 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3808 		  __entry->nr_threads, __entry->pid)
3809 )
3810 
3811 DECLARE_EVENT_CLASS(xfs_kmem_class,
3812 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
3813 	TP_ARGS(size, flags, caller_ip),
3814 	TP_STRUCT__entry(
3815 		__field(ssize_t, size)
3816 		__field(int, flags)
3817 		__field(unsigned long, caller_ip)
3818 	),
3819 	TP_fast_assign(
3820 		__entry->size = size;
3821 		__entry->flags = flags;
3822 		__entry->caller_ip = caller_ip;
3823 	),
3824 	TP_printk("size %zd flags 0x%x caller %pS",
3825 		  __entry->size,
3826 		  __entry->flags,
3827 		  (char *)__entry->caller_ip)
3828 )
3829 
3830 #define DEFINE_KMEM_EVENT(name) \
3831 DEFINE_EVENT(xfs_kmem_class, name, \
3832 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
3833 	TP_ARGS(size, flags, caller_ip))
3834 DEFINE_KMEM_EVENT(kmem_alloc);
3835 
3836 TRACE_EVENT(xfs_check_new_dalign,
3837 	TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
3838 	TP_ARGS(mp, new_dalign, calc_rootino),
3839 	TP_STRUCT__entry(
3840 		__field(dev_t, dev)
3841 		__field(int, new_dalign)
3842 		__field(xfs_ino_t, sb_rootino)
3843 		__field(xfs_ino_t, calc_rootino)
3844 	),
3845 	TP_fast_assign(
3846 		__entry->dev = mp->m_super->s_dev;
3847 		__entry->new_dalign = new_dalign;
3848 		__entry->sb_rootino = mp->m_sb.sb_rootino;
3849 		__entry->calc_rootino = calc_rootino;
3850 	),
3851 	TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
3852 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3853 		  __entry->new_dalign, __entry->sb_rootino,
3854 		  __entry->calc_rootino)
3855 )
3856 
3857 TRACE_EVENT(xfs_btree_commit_afakeroot,
3858 	TP_PROTO(struct xfs_btree_cur *cur),
3859 	TP_ARGS(cur),
3860 	TP_STRUCT__entry(
3861 		__field(dev_t, dev)
3862 		__field(xfs_btnum_t, btnum)
3863 		__field(xfs_agnumber_t, agno)
3864 		__field(xfs_agblock_t, agbno)
3865 		__field(unsigned int, levels)
3866 		__field(unsigned int, blocks)
3867 	),
3868 	TP_fast_assign(
3869 		__entry->dev = cur->bc_mp->m_super->s_dev;
3870 		__entry->btnum = cur->bc_btnum;
3871 		__entry->agno = cur->bc_ag.pag->pag_agno;
3872 		__entry->agbno = cur->bc_ag.afake->af_root;
3873 		__entry->levels = cur->bc_ag.afake->af_levels;
3874 		__entry->blocks = cur->bc_ag.afake->af_blocks;
3875 	),
3876 	TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
3877 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3878 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3879 		  __entry->agno,
3880 		  __entry->levels,
3881 		  __entry->blocks,
3882 		  __entry->agbno)
3883 )
3884 
3885 TRACE_EVENT(xfs_btree_commit_ifakeroot,
3886 	TP_PROTO(struct xfs_btree_cur *cur),
3887 	TP_ARGS(cur),
3888 	TP_STRUCT__entry(
3889 		__field(dev_t, dev)
3890 		__field(xfs_btnum_t, btnum)
3891 		__field(xfs_agnumber_t, agno)
3892 		__field(xfs_agino_t, agino)
3893 		__field(unsigned int, levels)
3894 		__field(unsigned int, blocks)
3895 		__field(int, whichfork)
3896 	),
3897 	TP_fast_assign(
3898 		__entry->dev = cur->bc_mp->m_super->s_dev;
3899 		__entry->btnum = cur->bc_btnum;
3900 		__entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
3901 					cur->bc_ino.ip->i_ino);
3902 		__entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
3903 					cur->bc_ino.ip->i_ino);
3904 		__entry->levels = cur->bc_ino.ifake->if_levels;
3905 		__entry->blocks = cur->bc_ino.ifake->if_blocks;
3906 		__entry->whichfork = cur->bc_ino.whichfork;
3907 	),
3908 	TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
3909 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3910 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3911 		  __entry->agno,
3912 		  __entry->agino,
3913 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
3914 		  __entry->levels,
3915 		  __entry->blocks)
3916 )
3917 
3918 TRACE_EVENT(xfs_btree_bload_level_geometry,
3919 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3920 		 uint64_t nr_this_level, unsigned int nr_per_block,
3921 		 unsigned int desired_npb, uint64_t blocks,
3922 		 uint64_t blocks_with_extra),
3923 	TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
3924 		blocks_with_extra),
3925 	TP_STRUCT__entry(
3926 		__field(dev_t, dev)
3927 		__field(xfs_btnum_t, btnum)
3928 		__field(unsigned int, level)
3929 		__field(unsigned int, nlevels)
3930 		__field(uint64_t, nr_this_level)
3931 		__field(unsigned int, nr_per_block)
3932 		__field(unsigned int, desired_npb)
3933 		__field(unsigned long long, blocks)
3934 		__field(unsigned long long, blocks_with_extra)
3935 	),
3936 	TP_fast_assign(
3937 		__entry->dev = cur->bc_mp->m_super->s_dev;
3938 		__entry->btnum = cur->bc_btnum;
3939 		__entry->level = level;
3940 		__entry->nlevels = cur->bc_nlevels;
3941 		__entry->nr_this_level = nr_this_level;
3942 		__entry->nr_per_block = nr_per_block;
3943 		__entry->desired_npb = desired_npb;
3944 		__entry->blocks = blocks;
3945 		__entry->blocks_with_extra = blocks_with_extra;
3946 	),
3947 	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",
3948 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3949 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3950 		  __entry->level,
3951 		  __entry->nlevels,
3952 		  __entry->nr_this_level,
3953 		  __entry->nr_per_block,
3954 		  __entry->desired_npb,
3955 		  __entry->blocks,
3956 		  __entry->blocks_with_extra)
3957 )
3958 
3959 TRACE_EVENT(xfs_btree_bload_block,
3960 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3961 		 uint64_t block_idx, uint64_t nr_blocks,
3962 		 union xfs_btree_ptr *ptr, unsigned int nr_records),
3963 	TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
3964 	TP_STRUCT__entry(
3965 		__field(dev_t, dev)
3966 		__field(xfs_btnum_t, btnum)
3967 		__field(unsigned int, level)
3968 		__field(unsigned long long, block_idx)
3969 		__field(unsigned long long, nr_blocks)
3970 		__field(xfs_agnumber_t, agno)
3971 		__field(xfs_agblock_t, agbno)
3972 		__field(unsigned int, nr_records)
3973 	),
3974 	TP_fast_assign(
3975 		__entry->dev = cur->bc_mp->m_super->s_dev;
3976 		__entry->btnum = cur->bc_btnum;
3977 		__entry->level = level;
3978 		__entry->block_idx = block_idx;
3979 		__entry->nr_blocks = nr_blocks;
3980 		if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
3981 			xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);
3982 
3983 			__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
3984 			__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
3985 		} else {
3986 			__entry->agno = cur->bc_ag.pag->pag_agno;
3987 			__entry->agbno = be32_to_cpu(ptr->s);
3988 		}
3989 		__entry->nr_records = nr_records;
3990 	),
3991 	TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
3992 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3993 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3994 		  __entry->level,
3995 		  __entry->block_idx,
3996 		  __entry->nr_blocks,
3997 		  __entry->agno,
3998 		  __entry->agbno,
3999 		  __entry->nr_records)
4000 )
4001 
4002 DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
4003 	TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
4004 	TP_ARGS(mp, min, max),
4005 	TP_STRUCT__entry(
4006 		__field(dev_t, dev)
4007 		__field(long long, min)
4008 		__field(long long, max)
4009 	),
4010 	TP_fast_assign(
4011 		__entry->dev = mp->m_super->s_dev;
4012 		__entry->min = min;
4013 		__entry->max = max;
4014 	),
4015 	TP_printk("dev %d:%d min %lld max %lld",
4016 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4017 		  __entry->min,
4018 		  __entry->max)
4019 )
4020 
4021 #define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
4022 DEFINE_EVENT(xfs_timestamp_range_class, name, \
4023 	TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
4024 	TP_ARGS(mp, min, max))
4025 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
4026 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
4027 
4028 DECLARE_EVENT_CLASS(xfs_icwalk_class,
4029 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4030 		 unsigned long caller_ip),
4031 	TP_ARGS(mp, icw, caller_ip),
4032 	TP_STRUCT__entry(
4033 		__field(dev_t, dev)
4034 		__field(__u32, flags)
4035 		__field(uint32_t, uid)
4036 		__field(uint32_t, gid)
4037 		__field(prid_t, prid)
4038 		__field(__u64, min_file_size)
4039 		__field(long, scan_limit)
4040 		__field(unsigned long, caller_ip)
4041 	),
4042 	TP_fast_assign(
4043 		__entry->dev = mp->m_super->s_dev;
4044 		__entry->flags = icw ? icw->icw_flags : 0;
4045 		__entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
4046 						icw->icw_uid) : 0;
4047 		__entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
4048 						icw->icw_gid) : 0;
4049 		__entry->prid = icw ? icw->icw_prid : 0;
4050 		__entry->min_file_size = icw ? icw->icw_min_file_size : 0;
4051 		__entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4052 		__entry->caller_ip = caller_ip;
4053 	),
4054 	TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4055 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4056 		  __entry->flags,
4057 		  __entry->uid,
4058 		  __entry->gid,
4059 		  __entry->prid,
4060 		  __entry->min_file_size,
4061 		  __entry->scan_limit,
4062 		  (char *)__entry->caller_ip)
4063 );
4064 #define DEFINE_ICWALK_EVENT(name)	\
4065 DEFINE_EVENT(xfs_icwalk_class, name,	\
4066 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4067 		 unsigned long caller_ip), \
4068 	TP_ARGS(mp, icw, caller_ip))
4069 DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4070 DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4071 
4072 TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4073 TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4074 TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4075 TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4076 TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4077 TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
4078 
4079 DECLARE_EVENT_CLASS(xlog_iclog_class,
4080 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4081 	TP_ARGS(iclog, caller_ip),
4082 	TP_STRUCT__entry(
4083 		__field(dev_t, dev)
4084 		__field(uint32_t, state)
4085 		__field(int32_t, refcount)
4086 		__field(uint32_t, offset)
4087 		__field(uint32_t, flags)
4088 		__field(unsigned long long, lsn)
4089 		__field(unsigned long, caller_ip)
4090 	),
4091 	TP_fast_assign(
4092 		__entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4093 		__entry->state = iclog->ic_state;
4094 		__entry->refcount = atomic_read(&iclog->ic_refcnt);
4095 		__entry->offset = iclog->ic_offset;
4096 		__entry->flags = iclog->ic_flags;
4097 		__entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4098 		__entry->caller_ip = caller_ip;
4099 	),
4100 	TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
4101 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4102 		  __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4103 		  __entry->refcount,
4104 		  __entry->offset,
4105 		  __entry->lsn,
4106 		  __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
4107 		  (char *)__entry->caller_ip)
4108 
4109 );
4110 
4111 #define DEFINE_ICLOG_EVENT(name)	\
4112 DEFINE_EVENT(xlog_iclog_class, name,	\
4113 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4114 	TP_ARGS(iclog, caller_ip))
4115 
4116 DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4117 DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4118 DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4119 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4120 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4121 DEFINE_ICLOG_EVENT(xlog_iclog_force);
4122 DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4123 DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4124 DEFINE_ICLOG_EVENT(xlog_iclog_release);
4125 DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4126 DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4127 DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4128 DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4129 DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4130 DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4131 DEFINE_ICLOG_EVENT(xlog_iclog_write);
4132 
4133 TRACE_DEFINE_ENUM(XFS_DAS_UNINIT);
4134 TRACE_DEFINE_ENUM(XFS_DAS_SF_ADD);
4135 TRACE_DEFINE_ENUM(XFS_DAS_SF_REMOVE);
4136 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ADD);
4137 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE);
4138 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ADD);
4139 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE);
4140 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_SET_RMT);
4141 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ALLOC_RMT);
4142 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REPLACE);
4143 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_OLD);
4144 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_RMT);
4145 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_ATTR);
4146 TRACE_DEFINE_ENUM(XFS_DAS_NODE_SET_RMT);
4147 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ALLOC_RMT);
4148 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REPLACE);
4149 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_OLD);
4150 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_RMT);
4151 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_ATTR);
4152 TRACE_DEFINE_ENUM(XFS_DAS_DONE);
4153 
4154 DECLARE_EVENT_CLASS(xfs_das_state_class,
4155 	TP_PROTO(int das, struct xfs_inode *ip),
4156 	TP_ARGS(das, ip),
4157 	TP_STRUCT__entry(
4158 		__field(int, das)
4159 		__field(xfs_ino_t, ino)
4160 	),
4161 	TP_fast_assign(
4162 		__entry->das = das;
4163 		__entry->ino = ip->i_ino;
4164 	),
4165 	TP_printk("state change %s ino 0x%llx",
4166 		  __print_symbolic(__entry->das, XFS_DAS_STRINGS),
4167 		  __entry->ino)
4168 )
4169 
4170 #define DEFINE_DAS_STATE_EVENT(name) \
4171 DEFINE_EVENT(xfs_das_state_class, name, \
4172 	TP_PROTO(int das, struct xfs_inode *ip), \
4173 	TP_ARGS(das, ip))
4174 DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4175 DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4176 DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4177 DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4178 DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4179 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
4180 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4181 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
4182 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_replace);
4183 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_remove);
4184 
4185 
4186 TRACE_EVENT(xfs_force_shutdown,
4187 	TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4188 		 int line_num),
4189 	TP_ARGS(mp, ptag, flags, fname, line_num),
4190 	TP_STRUCT__entry(
4191 		__field(dev_t, dev)
4192 		__field(int, ptag)
4193 		__field(int, flags)
4194 		__string(fname, fname)
4195 		__field(int, line_num)
4196 	),
4197 	TP_fast_assign(
4198 		__entry->dev = mp->m_super->s_dev;
4199 		__entry->ptag = ptag;
4200 		__entry->flags = flags;
4201 		__assign_str(fname, fname);
4202 		__entry->line_num = line_num;
4203 	),
4204 	TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4205 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4206 		__print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4207 		__print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4208 		__get_str(fname),
4209 		__entry->line_num)
4210 );
4211 
4212 #endif /* _TRACE_XFS_H */
4213 
4214 #undef TRACE_INCLUDE_PATH
4215 #define TRACE_INCLUDE_PATH .
4216 #define TRACE_INCLUDE_FILE xfs_trace
4217 #include <trace/define_trace.h>
4218