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