xref: /openbmc/linux/fs/xfs/xfs_trace.h (revision ae6385af)
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 TRACE_EVENT(xfs_alloc_cur_check,
1887 	TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1888 		 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1889 	TP_ARGS(mp, btnum, bno, len, diff, new),
1890 	TP_STRUCT__entry(
1891 		__field(dev_t, dev)
1892 		__field(xfs_btnum_t, btnum)
1893 		__field(xfs_agblock_t, bno)
1894 		__field(xfs_extlen_t, len)
1895 		__field(xfs_extlen_t, diff)
1896 		__field(bool, new)
1897 	),
1898 	TP_fast_assign(
1899 		__entry->dev = mp->m_super->s_dev;
1900 		__entry->btnum = btnum;
1901 		__entry->bno = bno;
1902 		__entry->len = len;
1903 		__entry->diff = diff;
1904 		__entry->new = new;
1905 	),
1906 	TP_printk("dev %d:%d btree %s agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
1907 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1908 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1909 		  __entry->bno, __entry->len, __entry->diff, __entry->new)
1910 )
1911 
1912 DECLARE_EVENT_CLASS(xfs_da_class,
1913 	TP_PROTO(struct xfs_da_args *args),
1914 	TP_ARGS(args),
1915 	TP_STRUCT__entry(
1916 		__field(dev_t, dev)
1917 		__field(xfs_ino_t, ino)
1918 		__dynamic_array(char, name, args->namelen)
1919 		__field(int, namelen)
1920 		__field(xfs_dahash_t, hashval)
1921 		__field(xfs_ino_t, inumber)
1922 		__field(uint32_t, op_flags)
1923 	),
1924 	TP_fast_assign(
1925 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1926 		__entry->ino = args->dp->i_ino;
1927 		if (args->namelen)
1928 			memcpy(__get_str(name), args->name, args->namelen);
1929 		__entry->namelen = args->namelen;
1930 		__entry->hashval = args->hashval;
1931 		__entry->inumber = args->inumber;
1932 		__entry->op_flags = args->op_flags;
1933 	),
1934 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1935 		  "inumber 0x%llx op_flags %s",
1936 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1937 		  __entry->ino,
1938 		  __entry->namelen,
1939 		  __entry->namelen ? __get_str(name) : NULL,
1940 		  __entry->namelen,
1941 		  __entry->hashval,
1942 		  __entry->inumber,
1943 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1944 )
1945 
1946 #define DEFINE_DIR2_EVENT(name) \
1947 DEFINE_EVENT(xfs_da_class, name, \
1948 	TP_PROTO(struct xfs_da_args *args), \
1949 	TP_ARGS(args))
1950 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1951 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1952 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1953 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1954 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1955 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1956 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1957 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1958 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1959 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1960 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1961 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1962 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1963 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1964 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1965 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1966 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1967 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1968 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1969 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1970 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1971 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1972 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1973 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1974 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1975 
1976 DECLARE_EVENT_CLASS(xfs_attr_class,
1977 	TP_PROTO(struct xfs_da_args *args),
1978 	TP_ARGS(args),
1979 	TP_STRUCT__entry(
1980 		__field(dev_t, dev)
1981 		__field(xfs_ino_t, ino)
1982 		__dynamic_array(char, name, args->namelen)
1983 		__field(int, namelen)
1984 		__field(int, valuelen)
1985 		__field(xfs_dahash_t, hashval)
1986 		__field(unsigned int, attr_filter)
1987 		__field(unsigned int, attr_flags)
1988 		__field(uint32_t, op_flags)
1989 	),
1990 	TP_fast_assign(
1991 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1992 		__entry->ino = args->dp->i_ino;
1993 		if (args->namelen)
1994 			memcpy(__get_str(name), args->name, args->namelen);
1995 		__entry->namelen = args->namelen;
1996 		__entry->valuelen = args->valuelen;
1997 		__entry->hashval = args->hashval;
1998 		__entry->attr_filter = args->attr_filter;
1999 		__entry->attr_flags = args->attr_flags;
2000 		__entry->op_flags = args->op_flags;
2001 	),
2002 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
2003 		  "hashval 0x%x filter %s flags %s op_flags %s",
2004 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2005 		  __entry->ino,
2006 		  __entry->namelen,
2007 		  __entry->namelen ? __get_str(name) : NULL,
2008 		  __entry->namelen,
2009 		  __entry->valuelen,
2010 		  __entry->hashval,
2011 		  __print_flags(__entry->attr_filter, "|",
2012 				XFS_ATTR_FILTER_FLAGS),
2013 		   __print_flags(__entry->attr_flags, "|",
2014 				{ XATTR_CREATE,		"CREATE" },
2015 				{ XATTR_REPLACE,	"REPLACE" }),
2016 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
2017 )
2018 
2019 #define DEFINE_ATTR_EVENT(name) \
2020 DEFINE_EVENT(xfs_attr_class, name, \
2021 	TP_PROTO(struct xfs_da_args *args), \
2022 	TP_ARGS(args))
2023 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
2024 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
2025 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
2026 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2027 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
2028 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2029 
2030 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2031 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2032 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2033 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
2034 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2035 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2036 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2037 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2038 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2039 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2040 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2041 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2042 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2043 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2044 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2045 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2046 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2047 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2048 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2049 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2050 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2051 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2052 
2053 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2054 DEFINE_ATTR_EVENT(xfs_attr_node_get);
2055 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2056 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2057 
2058 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2059 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2060 
2061 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2062 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
2063 
2064 #define DEFINE_DA_EVENT(name) \
2065 DEFINE_EVENT(xfs_da_class, name, \
2066 	TP_PROTO(struct xfs_da_args *args), \
2067 	TP_ARGS(args))
2068 DEFINE_DA_EVENT(xfs_da_split);
2069 DEFINE_DA_EVENT(xfs_da_join);
2070 DEFINE_DA_EVENT(xfs_da_link_before);
2071 DEFINE_DA_EVENT(xfs_da_link_after);
2072 DEFINE_DA_EVENT(xfs_da_unlink_back);
2073 DEFINE_DA_EVENT(xfs_da_unlink_forward);
2074 DEFINE_DA_EVENT(xfs_da_root_split);
2075 DEFINE_DA_EVENT(xfs_da_root_join);
2076 DEFINE_DA_EVENT(xfs_da_node_add);
2077 DEFINE_DA_EVENT(xfs_da_node_create);
2078 DEFINE_DA_EVENT(xfs_da_node_split);
2079 DEFINE_DA_EVENT(xfs_da_node_remove);
2080 DEFINE_DA_EVENT(xfs_da_node_rebalance);
2081 DEFINE_DA_EVENT(xfs_da_node_unbalance);
2082 DEFINE_DA_EVENT(xfs_da_node_toosmall);
2083 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2084 DEFINE_DA_EVENT(xfs_da_grow_inode);
2085 DEFINE_DA_EVENT(xfs_da_shrink_inode);
2086 DEFINE_DA_EVENT(xfs_da_fixhashpath);
2087 DEFINE_DA_EVENT(xfs_da_path_shift);
2088 
2089 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2090 	TP_PROTO(struct xfs_da_args *args, int idx),
2091 	TP_ARGS(args, idx),
2092 	TP_STRUCT__entry(
2093 		__field(dev_t, dev)
2094 		__field(xfs_ino_t, ino)
2095 		__field(uint32_t, op_flags)
2096 		__field(int, idx)
2097 	),
2098 	TP_fast_assign(
2099 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2100 		__entry->ino = args->dp->i_ino;
2101 		__entry->op_flags = args->op_flags;
2102 		__entry->idx = idx;
2103 	),
2104 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2105 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2106 		  __entry->ino,
2107 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2108 		  __entry->idx)
2109 )
2110 
2111 #define DEFINE_DIR2_SPACE_EVENT(name) \
2112 DEFINE_EVENT(xfs_dir2_space_class, name, \
2113 	TP_PROTO(struct xfs_da_args *args, int idx), \
2114 	TP_ARGS(args, idx))
2115 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2116 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2117 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2118 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
2119 
2120 TRACE_EVENT(xfs_dir2_leafn_moveents,
2121 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2122 	TP_ARGS(args, src_idx, dst_idx, count),
2123 	TP_STRUCT__entry(
2124 		__field(dev_t, dev)
2125 		__field(xfs_ino_t, ino)
2126 		__field(uint32_t, op_flags)
2127 		__field(int, src_idx)
2128 		__field(int, dst_idx)
2129 		__field(int, count)
2130 	),
2131 	TP_fast_assign(
2132 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2133 		__entry->ino = args->dp->i_ino;
2134 		__entry->op_flags = args->op_flags;
2135 		__entry->src_idx = src_idx;
2136 		__entry->dst_idx = dst_idx;
2137 		__entry->count = count;
2138 	),
2139 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2140 		  "src_idx %d dst_idx %d count %d",
2141 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2142 		  __entry->ino,
2143 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2144 		  __entry->src_idx,
2145 		  __entry->dst_idx,
2146 		  __entry->count)
2147 );
2148 
2149 #define XFS_SWAPEXT_INODES \
2150 	{ 0,	"target" }, \
2151 	{ 1,	"temp" }
2152 
2153 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2154 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2155 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2156 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2157 TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2158 
2159 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2160 	TP_PROTO(struct xfs_inode *ip, int which),
2161 	TP_ARGS(ip, which),
2162 	TP_STRUCT__entry(
2163 		__field(dev_t, dev)
2164 		__field(int, which)
2165 		__field(xfs_ino_t, ino)
2166 		__field(int, format)
2167 		__field(xfs_extnum_t, nex)
2168 		__field(int, broot_size)
2169 		__field(int, fork_off)
2170 	),
2171 	TP_fast_assign(
2172 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2173 		__entry->which = which;
2174 		__entry->ino = ip->i_ino;
2175 		__entry->format = ip->i_df.if_format;
2176 		__entry->nex = ip->i_df.if_nextents;
2177 		__entry->broot_size = ip->i_df.if_broot_bytes;
2178 		__entry->fork_off = xfs_inode_fork_boff(ip);
2179 	),
2180 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2181 		  "broot size %d, forkoff 0x%x",
2182 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2183 		  __entry->ino,
2184 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2185 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2186 		  __entry->nex,
2187 		  __entry->broot_size,
2188 		  __entry->fork_off)
2189 )
2190 
2191 #define DEFINE_SWAPEXT_EVENT(name) \
2192 DEFINE_EVENT(xfs_swap_extent_class, name, \
2193 	TP_PROTO(struct xfs_inode *ip, int which), \
2194 	TP_ARGS(ip, which))
2195 
2196 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2197 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2198 
2199 TRACE_EVENT(xfs_log_recover,
2200 	TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2201 	TP_ARGS(log, headblk, tailblk),
2202 	TP_STRUCT__entry(
2203 		__field(dev_t, dev)
2204 		__field(xfs_daddr_t, headblk)
2205 		__field(xfs_daddr_t, tailblk)
2206 	),
2207 	TP_fast_assign(
2208 		__entry->dev = log->l_mp->m_super->s_dev;
2209 		__entry->headblk = headblk;
2210 		__entry->tailblk = tailblk;
2211 	),
2212 	TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2213 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2214 		  __entry->tailblk)
2215 )
2216 
2217 TRACE_EVENT(xfs_log_recover_record,
2218 	TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2219 	TP_ARGS(log, rhead, pass),
2220 	TP_STRUCT__entry(
2221 		__field(dev_t, dev)
2222 		__field(xfs_lsn_t, lsn)
2223 		__field(int, len)
2224 		__field(int, num_logops)
2225 		__field(int, pass)
2226 	),
2227 	TP_fast_assign(
2228 		__entry->dev = log->l_mp->m_super->s_dev;
2229 		__entry->lsn = be64_to_cpu(rhead->h_lsn);
2230 		__entry->len = be32_to_cpu(rhead->h_len);
2231 		__entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2232 		__entry->pass = pass;
2233 	),
2234 	TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2235 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2236 		  __entry->lsn, __entry->len, __entry->num_logops,
2237 		   __entry->pass)
2238 )
2239 
2240 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2241 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2242 		struct xlog_recover_item *item, int pass),
2243 	TP_ARGS(log, trans, item, pass),
2244 	TP_STRUCT__entry(
2245 		__field(dev_t, dev)
2246 		__field(unsigned long, item)
2247 		__field(xlog_tid_t, tid)
2248 		__field(xfs_lsn_t, lsn)
2249 		__field(int, type)
2250 		__field(int, pass)
2251 		__field(int, count)
2252 		__field(int, total)
2253 	),
2254 	TP_fast_assign(
2255 		__entry->dev = log->l_mp->m_super->s_dev;
2256 		__entry->item = (unsigned long)item;
2257 		__entry->tid = trans->r_log_tid;
2258 		__entry->lsn = trans->r_lsn;
2259 		__entry->type = ITEM_TYPE(item);
2260 		__entry->pass = pass;
2261 		__entry->count = item->ri_cnt;
2262 		__entry->total = item->ri_total;
2263 	),
2264 	TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2265 		  "item type %s item region count/total %d/%d",
2266 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2267 		  __entry->tid,
2268 		  __entry->lsn,
2269 		  __entry->pass,
2270 		  (void *)__entry->item,
2271 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2272 		  __entry->count,
2273 		  __entry->total)
2274 )
2275 
2276 #define DEFINE_LOG_RECOVER_ITEM(name) \
2277 DEFINE_EVENT(xfs_log_recover_item_class, name, \
2278 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2279 		struct xlog_recover_item *item, int pass), \
2280 	TP_ARGS(log, trans, item, pass))
2281 
2282 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2283 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2284 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2285 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2286 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2287 
2288 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2289 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2290 	TP_ARGS(log, buf_f),
2291 	TP_STRUCT__entry(
2292 		__field(dev_t, dev)
2293 		__field(int64_t, blkno)
2294 		__field(unsigned short, len)
2295 		__field(unsigned short, flags)
2296 		__field(unsigned short, size)
2297 		__field(unsigned int, map_size)
2298 	),
2299 	TP_fast_assign(
2300 		__entry->dev = log->l_mp->m_super->s_dev;
2301 		__entry->blkno = buf_f->blf_blkno;
2302 		__entry->len = buf_f->blf_len;
2303 		__entry->flags = buf_f->blf_flags;
2304 		__entry->size = buf_f->blf_size;
2305 		__entry->map_size = buf_f->blf_map_size;
2306 	),
2307 	TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2308 			"map_size %d",
2309 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2310 		  __entry->blkno,
2311 		  __entry->len,
2312 		  __entry->flags,
2313 		  __entry->size,
2314 		  __entry->map_size)
2315 )
2316 
2317 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2318 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2319 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2320 	TP_ARGS(log, buf_f))
2321 
2322 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2323 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2324 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2325 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2326 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2327 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2328 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2329 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2330 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2331 
2332 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2333 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2334 	TP_ARGS(log, in_f),
2335 	TP_STRUCT__entry(
2336 		__field(dev_t, dev)
2337 		__field(xfs_ino_t, ino)
2338 		__field(unsigned short, size)
2339 		__field(int, fields)
2340 		__field(unsigned short, asize)
2341 		__field(unsigned short, dsize)
2342 		__field(int64_t, blkno)
2343 		__field(int, len)
2344 		__field(int, boffset)
2345 	),
2346 	TP_fast_assign(
2347 		__entry->dev = log->l_mp->m_super->s_dev;
2348 		__entry->ino = in_f->ilf_ino;
2349 		__entry->size = in_f->ilf_size;
2350 		__entry->fields = in_f->ilf_fields;
2351 		__entry->asize = in_f->ilf_asize;
2352 		__entry->dsize = in_f->ilf_dsize;
2353 		__entry->blkno = in_f->ilf_blkno;
2354 		__entry->len = in_f->ilf_len;
2355 		__entry->boffset = in_f->ilf_boffset;
2356 	),
2357 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2358 			"dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2359 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2360 		  __entry->ino,
2361 		  __entry->size,
2362 		  __entry->fields,
2363 		  __entry->asize,
2364 		  __entry->dsize,
2365 		  __entry->blkno,
2366 		  __entry->len,
2367 		  __entry->boffset)
2368 )
2369 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2370 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2371 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2372 	TP_ARGS(log, in_f))
2373 
2374 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2375 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2376 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2377 
2378 DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2379 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2380 	TP_ARGS(log, in_f),
2381 	TP_STRUCT__entry(
2382 		__field(dev_t, dev)
2383 		__field(xfs_agnumber_t, agno)
2384 		__field(xfs_agblock_t, agbno)
2385 		__field(unsigned int, count)
2386 		__field(unsigned int, isize)
2387 		__field(xfs_agblock_t, length)
2388 		__field(unsigned int, gen)
2389 	),
2390 	TP_fast_assign(
2391 		__entry->dev = log->l_mp->m_super->s_dev;
2392 		__entry->agno = be32_to_cpu(in_f->icl_ag);
2393 		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2394 		__entry->count = be32_to_cpu(in_f->icl_count);
2395 		__entry->isize = be32_to_cpu(in_f->icl_isize);
2396 		__entry->length = be32_to_cpu(in_f->icl_length);
2397 		__entry->gen = be32_to_cpu(in_f->icl_gen);
2398 	),
2399 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2400 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2401 		  __entry->agno,
2402 		  __entry->agbno,
2403 		  __entry->length,
2404 		  __entry->count,
2405 		  __entry->isize,
2406 		  __entry->gen)
2407 )
2408 #define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2409 DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2410 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2411 	TP_ARGS(log, in_f))
2412 
2413 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2414 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2415 
2416 DECLARE_EVENT_CLASS(xfs_discard_class,
2417 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2418 		 xfs_agblock_t agbno, xfs_extlen_t len),
2419 	TP_ARGS(mp, agno, agbno, len),
2420 	TP_STRUCT__entry(
2421 		__field(dev_t, dev)
2422 		__field(xfs_agnumber_t, agno)
2423 		__field(xfs_agblock_t, agbno)
2424 		__field(xfs_extlen_t, len)
2425 	),
2426 	TP_fast_assign(
2427 		__entry->dev = mp->m_super->s_dev;
2428 		__entry->agno = agno;
2429 		__entry->agbno = agbno;
2430 		__entry->len = len;
2431 	),
2432 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2433 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2434 		  __entry->agno,
2435 		  __entry->agbno,
2436 		  __entry->len)
2437 )
2438 
2439 #define DEFINE_DISCARD_EVENT(name) \
2440 DEFINE_EVENT(xfs_discard_class, name, \
2441 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2442 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2443 	TP_ARGS(mp, agno, agbno, len))
2444 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2445 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2446 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2447 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2448 
2449 /* btree cursor events */
2450 TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2451 TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2452 TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2453 TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2454 TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2455 TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2456 TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2457 
2458 DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2459 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2460 	TP_ARGS(cur, level, bp),
2461 	TP_STRUCT__entry(
2462 		__field(dev_t, dev)
2463 		__field(xfs_btnum_t, btnum)
2464 		__field(int, level)
2465 		__field(int, nlevels)
2466 		__field(int, ptr)
2467 		__field(xfs_daddr_t, daddr)
2468 	),
2469 	TP_fast_assign(
2470 		__entry->dev = cur->bc_mp->m_super->s_dev;
2471 		__entry->btnum = cur->bc_btnum;
2472 		__entry->level = level;
2473 		__entry->nlevels = cur->bc_nlevels;
2474 		__entry->ptr = cur->bc_levels[level].ptr;
2475 		__entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2476 	),
2477 	TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
2478 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2479 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
2480 		  __entry->level,
2481 		  __entry->nlevels,
2482 		  __entry->ptr,
2483 		  (unsigned long long)__entry->daddr)
2484 )
2485 
2486 #define DEFINE_BTREE_CUR_EVENT(name) \
2487 DEFINE_EVENT(xfs_btree_cur_class, name, \
2488 	TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2489 	TP_ARGS(cur, level, bp))
2490 DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2491 DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2492 
2493 /* deferred ops */
2494 struct xfs_defer_pending;
2495 
2496 DECLARE_EVENT_CLASS(xfs_defer_class,
2497 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2498 	TP_ARGS(tp, caller_ip),
2499 	TP_STRUCT__entry(
2500 		__field(dev_t, dev)
2501 		__field(struct xfs_trans *, tp)
2502 		__field(char, committed)
2503 		__field(unsigned long, caller_ip)
2504 	),
2505 	TP_fast_assign(
2506 		__entry->dev = tp->t_mountp->m_super->s_dev;
2507 		__entry->tp = tp;
2508 		__entry->caller_ip = caller_ip;
2509 	),
2510 	TP_printk("dev %d:%d tp %p caller %pS",
2511 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2512 		  __entry->tp,
2513 		  (char *)__entry->caller_ip)
2514 )
2515 #define DEFINE_DEFER_EVENT(name) \
2516 DEFINE_EVENT(xfs_defer_class, name, \
2517 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2518 	TP_ARGS(tp, caller_ip))
2519 
2520 DECLARE_EVENT_CLASS(xfs_defer_error_class,
2521 	TP_PROTO(struct xfs_trans *tp, int error),
2522 	TP_ARGS(tp, error),
2523 	TP_STRUCT__entry(
2524 		__field(dev_t, dev)
2525 		__field(struct xfs_trans *, tp)
2526 		__field(char, committed)
2527 		__field(int, error)
2528 	),
2529 	TP_fast_assign(
2530 		__entry->dev = tp->t_mountp->m_super->s_dev;
2531 		__entry->tp = tp;
2532 		__entry->error = error;
2533 	),
2534 	TP_printk("dev %d:%d tp %p err %d",
2535 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2536 		  __entry->tp,
2537 		  __entry->error)
2538 )
2539 #define DEFINE_DEFER_ERROR_EVENT(name) \
2540 DEFINE_EVENT(xfs_defer_error_class, name, \
2541 	TP_PROTO(struct xfs_trans *tp, int error), \
2542 	TP_ARGS(tp, error))
2543 
2544 DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2545 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2546 	TP_ARGS(mp, dfp),
2547 	TP_STRUCT__entry(
2548 		__field(dev_t, dev)
2549 		__field(int, type)
2550 		__field(void *, intent)
2551 		__field(char, committed)
2552 		__field(int, nr)
2553 	),
2554 	TP_fast_assign(
2555 		__entry->dev = mp ? mp->m_super->s_dev : 0;
2556 		__entry->type = dfp->dfp_type;
2557 		__entry->intent = dfp->dfp_intent;
2558 		__entry->committed = dfp->dfp_done != NULL;
2559 		__entry->nr = dfp->dfp_count;
2560 	),
2561 	TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
2562 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2563 		  __entry->type,
2564 		  __entry->intent,
2565 		  __entry->committed,
2566 		  __entry->nr)
2567 )
2568 #define DEFINE_DEFER_PENDING_EVENT(name) \
2569 DEFINE_EVENT(xfs_defer_pending_class, name, \
2570 	TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2571 	TP_ARGS(mp, dfp))
2572 
2573 DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2574 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2575 		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2576 	TP_ARGS(mp, agno, type, agbno, len),
2577 	TP_STRUCT__entry(
2578 		__field(dev_t, dev)
2579 		__field(xfs_agnumber_t, agno)
2580 		__field(int, type)
2581 		__field(xfs_agblock_t, agbno)
2582 		__field(xfs_extlen_t, len)
2583 	),
2584 	TP_fast_assign(
2585 		__entry->dev = mp->m_super->s_dev;
2586 		__entry->agno = agno;
2587 		__entry->type = type;
2588 		__entry->agbno = agbno;
2589 		__entry->len = len;
2590 	),
2591 	TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x",
2592 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2593 		  __entry->type,
2594 		  __entry->agno,
2595 		  __entry->agbno,
2596 		  __entry->len)
2597 );
2598 #define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2599 DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2600 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2601 		 int type, \
2602 		 xfs_agblock_t bno, \
2603 		 xfs_extlen_t len), \
2604 	TP_ARGS(mp, agno, type, bno, len))
2605 
2606 DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2607 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2608 		 int op,
2609 		 xfs_agblock_t agbno,
2610 		 xfs_ino_t ino,
2611 		 int whichfork,
2612 		 xfs_fileoff_t offset,
2613 		 xfs_filblks_t len,
2614 		 xfs_exntst_t state),
2615 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2616 	TP_STRUCT__entry(
2617 		__field(dev_t, dev)
2618 		__field(xfs_agnumber_t, agno)
2619 		__field(xfs_ino_t, ino)
2620 		__field(xfs_agblock_t, agbno)
2621 		__field(int, whichfork)
2622 		__field(xfs_fileoff_t, l_loff)
2623 		__field(xfs_filblks_t, l_len)
2624 		__field(xfs_exntst_t, l_state)
2625 		__field(int, op)
2626 	),
2627 	TP_fast_assign(
2628 		__entry->dev = mp->m_super->s_dev;
2629 		__entry->agno = agno;
2630 		__entry->ino = ino;
2631 		__entry->agbno = agbno;
2632 		__entry->whichfork = whichfork;
2633 		__entry->l_loff = offset;
2634 		__entry->l_len = len;
2635 		__entry->l_state = state;
2636 		__entry->op = op;
2637 	),
2638 	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",
2639 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2640 		  __entry->op,
2641 		  __entry->agno,
2642 		  __entry->agbno,
2643 		  __entry->ino,
2644 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2645 		  __entry->l_loff,
2646 		  __entry->l_len,
2647 		  __entry->l_state)
2648 );
2649 #define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2650 DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2651 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2652 		 int op, \
2653 		 xfs_agblock_t agbno, \
2654 		 xfs_ino_t ino, \
2655 		 int whichfork, \
2656 		 xfs_fileoff_t offset, \
2657 		 xfs_filblks_t len, \
2658 		 xfs_exntst_t state), \
2659 	TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2660 
2661 DEFINE_DEFER_EVENT(xfs_defer_cancel);
2662 DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2663 DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2664 DEFINE_DEFER_EVENT(xfs_defer_finish);
2665 DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2666 
2667 DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2668 DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2669 
2670 DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2671 DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2672 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2673 DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2674 DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2675 
2676 #define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2677 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2678 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2679 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2680 DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
2681 
2682 /* rmap tracepoints */
2683 DECLARE_EVENT_CLASS(xfs_rmap_class,
2684 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2685 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2686 		 const struct xfs_owner_info *oinfo),
2687 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2688 	TP_STRUCT__entry(
2689 		__field(dev_t, dev)
2690 		__field(xfs_agnumber_t, agno)
2691 		__field(xfs_agblock_t, agbno)
2692 		__field(xfs_extlen_t, len)
2693 		__field(uint64_t, owner)
2694 		__field(uint64_t, offset)
2695 		__field(unsigned long, flags)
2696 	),
2697 	TP_fast_assign(
2698 		__entry->dev = mp->m_super->s_dev;
2699 		__entry->agno = agno;
2700 		__entry->agbno = agbno;
2701 		__entry->len = len;
2702 		__entry->owner = oinfo->oi_owner;
2703 		__entry->offset = oinfo->oi_offset;
2704 		__entry->flags = oinfo->oi_flags;
2705 		if (unwritten)
2706 			__entry->flags |= XFS_RMAP_UNWRITTEN;
2707 	),
2708 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2709 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2710 		  __entry->agno,
2711 		  __entry->agbno,
2712 		  __entry->len,
2713 		  __entry->owner,
2714 		  __entry->offset,
2715 		  __entry->flags)
2716 );
2717 #define DEFINE_RMAP_EVENT(name) \
2718 DEFINE_EVENT(xfs_rmap_class, name, \
2719 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2720 		 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2721 		 const struct xfs_owner_info *oinfo), \
2722 	TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2723 
2724 /* simple AG-based error/%ip tracepoint class */
2725 DECLARE_EVENT_CLASS(xfs_ag_error_class,
2726 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2727 		 unsigned long caller_ip),
2728 	TP_ARGS(mp, agno, error, caller_ip),
2729 	TP_STRUCT__entry(
2730 		__field(dev_t, dev)
2731 		__field(xfs_agnumber_t, agno)
2732 		__field(int, error)
2733 		__field(unsigned long, caller_ip)
2734 	),
2735 	TP_fast_assign(
2736 		__entry->dev = mp->m_super->s_dev;
2737 		__entry->agno = agno;
2738 		__entry->error = error;
2739 		__entry->caller_ip = caller_ip;
2740 	),
2741 	TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
2742 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2743 		  __entry->agno,
2744 		  __entry->error,
2745 		  (char *)__entry->caller_ip)
2746 );
2747 
2748 #define DEFINE_AG_ERROR_EVENT(name) \
2749 DEFINE_EVENT(xfs_ag_error_class, name, \
2750 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2751 		 unsigned long caller_ip), \
2752 	TP_ARGS(mp, agno, error, caller_ip))
2753 
2754 DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2755 DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2756 DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2757 DEFINE_RMAP_EVENT(xfs_rmap_map);
2758 DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2759 DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2760 DEFINE_RMAP_EVENT(xfs_rmap_convert);
2761 DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2762 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2763 DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2764 
2765 DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2766 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2767 		 xfs_agblock_t agbno, xfs_extlen_t len,
2768 		 uint64_t owner, uint64_t offset, unsigned int flags),
2769 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2770 	TP_STRUCT__entry(
2771 		__field(dev_t, dev)
2772 		__field(xfs_agnumber_t, agno)
2773 		__field(xfs_agblock_t, agbno)
2774 		__field(xfs_extlen_t, len)
2775 		__field(uint64_t, owner)
2776 		__field(uint64_t, offset)
2777 		__field(unsigned int, flags)
2778 	),
2779 	TP_fast_assign(
2780 		__entry->dev = mp->m_super->s_dev;
2781 		__entry->agno = agno;
2782 		__entry->agbno = agbno;
2783 		__entry->len = len;
2784 		__entry->owner = owner;
2785 		__entry->offset = offset;
2786 		__entry->flags = flags;
2787 	),
2788 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2789 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2790 		  __entry->agno,
2791 		  __entry->agbno,
2792 		  __entry->len,
2793 		  __entry->owner,
2794 		  __entry->offset,
2795 		  __entry->flags)
2796 );
2797 #define DEFINE_RMAPBT_EVENT(name) \
2798 DEFINE_EVENT(xfs_rmapbt_class, name, \
2799 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2800 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2801 		 uint64_t owner, uint64_t offset, unsigned int flags), \
2802 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2803 
2804 #define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2805 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2806 DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2807 
2808 DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2809 DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2810 DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2811 DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2812 DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2813 DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2814 DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2815 DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2816 
2817 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2818 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2819 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2820 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2821 DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2822 DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2823 DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
2824 
2825 /* deferred bmbt updates */
2826 #define DEFINE_BMAP_DEFERRED_EVENT	DEFINE_RMAP_DEFERRED_EVENT
2827 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2828 DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2829 
2830 /* per-AG reservation */
2831 DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2832 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2833 		 xfs_extlen_t len),
2834 	TP_ARGS(pag, resv, len),
2835 	TP_STRUCT__entry(
2836 		__field(dev_t, dev)
2837 		__field(xfs_agnumber_t, agno)
2838 		__field(int, resv)
2839 		__field(xfs_extlen_t, freeblks)
2840 		__field(xfs_extlen_t, flcount)
2841 		__field(xfs_extlen_t, reserved)
2842 		__field(xfs_extlen_t, asked)
2843 		__field(xfs_extlen_t, len)
2844 	),
2845 	TP_fast_assign(
2846 		struct xfs_ag_resv	*r = xfs_perag_resv(pag, resv);
2847 
2848 		__entry->dev = pag->pag_mount->m_super->s_dev;
2849 		__entry->agno = pag->pag_agno;
2850 		__entry->resv = resv;
2851 		__entry->freeblks = pag->pagf_freeblks;
2852 		__entry->flcount = pag->pagf_flcount;
2853 		__entry->reserved = r ? r->ar_reserved : 0;
2854 		__entry->asked = r ? r->ar_asked : 0;
2855 		__entry->len = len;
2856 	),
2857 	TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
2858 		  "resv %u ask %u len %u",
2859 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2860 		  __entry->agno,
2861 		  __entry->resv,
2862 		  __entry->freeblks,
2863 		  __entry->flcount,
2864 		  __entry->reserved,
2865 		  __entry->asked,
2866 		  __entry->len)
2867 )
2868 #define DEFINE_AG_RESV_EVENT(name) \
2869 DEFINE_EVENT(xfs_ag_resv_class, name, \
2870 	TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2871 		 xfs_extlen_t len), \
2872 	TP_ARGS(pag, type, len))
2873 
2874 /* per-AG reservation tracepoints */
2875 DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2876 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2877 DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2878 DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2879 DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2880 DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2881 
2882 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2883 DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2884 
2885 /* refcount tracepoint classes */
2886 
2887 /* reuse the discard trace class for agbno/aglen-based traces */
2888 #define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2889 
2890 /* ag btree lookup tracepoint class */
2891 TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2892 TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2893 TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
2894 DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2895 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2896 		 xfs_agblock_t agbno, xfs_lookup_t dir),
2897 	TP_ARGS(mp, agno, agbno, dir),
2898 	TP_STRUCT__entry(
2899 		__field(dev_t, dev)
2900 		__field(xfs_agnumber_t, agno)
2901 		__field(xfs_agblock_t, agbno)
2902 		__field(xfs_lookup_t, dir)
2903 	),
2904 	TP_fast_assign(
2905 		__entry->dev = mp->m_super->s_dev;
2906 		__entry->agno = agno;
2907 		__entry->agbno = agbno;
2908 		__entry->dir = dir;
2909 	),
2910 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
2911 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2912 		  __entry->agno,
2913 		  __entry->agbno,
2914 		  __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2915 		  __entry->dir)
2916 )
2917 
2918 #define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2919 DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2920 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2921 		 xfs_agblock_t agbno, xfs_lookup_t dir), \
2922 	TP_ARGS(mp, agno, agbno, dir))
2923 
2924 /* single-rcext tracepoint class */
2925 DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2926 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2927 		 struct xfs_refcount_irec *irec),
2928 	TP_ARGS(mp, agno, irec),
2929 	TP_STRUCT__entry(
2930 		__field(dev_t, dev)
2931 		__field(xfs_agnumber_t, agno)
2932 		__field(enum xfs_refc_domain, domain)
2933 		__field(xfs_agblock_t, startblock)
2934 		__field(xfs_extlen_t, blockcount)
2935 		__field(xfs_nlink_t, refcount)
2936 	),
2937 	TP_fast_assign(
2938 		__entry->dev = mp->m_super->s_dev;
2939 		__entry->agno = agno;
2940 		__entry->domain = irec->rc_domain;
2941 		__entry->startblock = irec->rc_startblock;
2942 		__entry->blockcount = irec->rc_blockcount;
2943 		__entry->refcount = irec->rc_refcount;
2944 	),
2945 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
2946 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2947 		  __entry->agno,
2948 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
2949 		  __entry->startblock,
2950 		  __entry->blockcount,
2951 		  __entry->refcount)
2952 )
2953 
2954 #define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2955 DEFINE_EVENT(xfs_refcount_extent_class, name, \
2956 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2957 		 struct xfs_refcount_irec *irec), \
2958 	TP_ARGS(mp, agno, irec))
2959 
2960 /* single-rcext and an agbno tracepoint class */
2961 DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2962 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2963 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2964 	TP_ARGS(mp, agno, irec, agbno),
2965 	TP_STRUCT__entry(
2966 		__field(dev_t, dev)
2967 		__field(xfs_agnumber_t, agno)
2968 		__field(enum xfs_refc_domain, domain)
2969 		__field(xfs_agblock_t, startblock)
2970 		__field(xfs_extlen_t, blockcount)
2971 		__field(xfs_nlink_t, refcount)
2972 		__field(xfs_agblock_t, agbno)
2973 	),
2974 	TP_fast_assign(
2975 		__entry->dev = mp->m_super->s_dev;
2976 		__entry->agno = agno;
2977 		__entry->domain = irec->rc_domain;
2978 		__entry->startblock = irec->rc_startblock;
2979 		__entry->blockcount = irec->rc_blockcount;
2980 		__entry->refcount = irec->rc_refcount;
2981 		__entry->agbno = agbno;
2982 	),
2983 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
2984 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2985 		  __entry->agno,
2986 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
2987 		  __entry->startblock,
2988 		  __entry->blockcount,
2989 		  __entry->refcount,
2990 		  __entry->agbno)
2991 )
2992 
2993 #define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2994 DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2995 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2996 		 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2997 	TP_ARGS(mp, agno, irec, agbno))
2998 
2999 /* double-rcext tracepoint class */
3000 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
3001 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3002 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
3003 	TP_ARGS(mp, agno, i1, i2),
3004 	TP_STRUCT__entry(
3005 		__field(dev_t, dev)
3006 		__field(xfs_agnumber_t, agno)
3007 		__field(enum xfs_refc_domain, i1_domain)
3008 		__field(xfs_agblock_t, i1_startblock)
3009 		__field(xfs_extlen_t, i1_blockcount)
3010 		__field(xfs_nlink_t, i1_refcount)
3011 		__field(enum xfs_refc_domain, i2_domain)
3012 		__field(xfs_agblock_t, i2_startblock)
3013 		__field(xfs_extlen_t, i2_blockcount)
3014 		__field(xfs_nlink_t, i2_refcount)
3015 	),
3016 	TP_fast_assign(
3017 		__entry->dev = mp->m_super->s_dev;
3018 		__entry->agno = agno;
3019 		__entry->i1_domain = i1->rc_domain;
3020 		__entry->i1_startblock = i1->rc_startblock;
3021 		__entry->i1_blockcount = i1->rc_blockcount;
3022 		__entry->i1_refcount = i1->rc_refcount;
3023 		__entry->i2_domain = i2->rc_domain;
3024 		__entry->i2_startblock = i2->rc_startblock;
3025 		__entry->i2_blockcount = i2->rc_blockcount;
3026 		__entry->i2_refcount = i2->rc_refcount;
3027 	),
3028 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3029 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3030 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3031 		  __entry->agno,
3032 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3033 		  __entry->i1_startblock,
3034 		  __entry->i1_blockcount,
3035 		  __entry->i1_refcount,
3036 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3037 		  __entry->i2_startblock,
3038 		  __entry->i2_blockcount,
3039 		  __entry->i2_refcount)
3040 )
3041 
3042 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3043 DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3044 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3045 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
3046 	TP_ARGS(mp, agno, i1, i2))
3047 
3048 /* double-rcext and an agbno tracepoint class */
3049 DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3050 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3051 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3052 		 xfs_agblock_t agbno),
3053 	TP_ARGS(mp, agno, i1, i2, agbno),
3054 	TP_STRUCT__entry(
3055 		__field(dev_t, dev)
3056 		__field(xfs_agnumber_t, agno)
3057 		__field(enum xfs_refc_domain, i1_domain)
3058 		__field(xfs_agblock_t, i1_startblock)
3059 		__field(xfs_extlen_t, i1_blockcount)
3060 		__field(xfs_nlink_t, i1_refcount)
3061 		__field(enum xfs_refc_domain, i2_domain)
3062 		__field(xfs_agblock_t, i2_startblock)
3063 		__field(xfs_extlen_t, i2_blockcount)
3064 		__field(xfs_nlink_t, i2_refcount)
3065 		__field(xfs_agblock_t, agbno)
3066 	),
3067 	TP_fast_assign(
3068 		__entry->dev = mp->m_super->s_dev;
3069 		__entry->agno = agno;
3070 		__entry->i1_domain = i1->rc_domain;
3071 		__entry->i1_startblock = i1->rc_startblock;
3072 		__entry->i1_blockcount = i1->rc_blockcount;
3073 		__entry->i1_refcount = i1->rc_refcount;
3074 		__entry->i2_domain = i2->rc_domain;
3075 		__entry->i2_startblock = i2->rc_startblock;
3076 		__entry->i2_blockcount = i2->rc_blockcount;
3077 		__entry->i2_refcount = i2->rc_refcount;
3078 		__entry->agbno = agbno;
3079 	),
3080 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3081 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3082 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3083 		  __entry->agno,
3084 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3085 		  __entry->i1_startblock,
3086 		  __entry->i1_blockcount,
3087 		  __entry->i1_refcount,
3088 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3089 		  __entry->i2_startblock,
3090 		  __entry->i2_blockcount,
3091 		  __entry->i2_refcount,
3092 		  __entry->agbno)
3093 )
3094 
3095 #define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3096 DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3097 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3098 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3099 		 xfs_agblock_t agbno), \
3100 	TP_ARGS(mp, agno, i1, i2, agbno))
3101 
3102 /* triple-rcext tracepoint class */
3103 DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3104 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3105 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3106 		 struct xfs_refcount_irec *i3),
3107 	TP_ARGS(mp, agno, i1, i2, i3),
3108 	TP_STRUCT__entry(
3109 		__field(dev_t, dev)
3110 		__field(xfs_agnumber_t, agno)
3111 		__field(enum xfs_refc_domain, i1_domain)
3112 		__field(xfs_agblock_t, i1_startblock)
3113 		__field(xfs_extlen_t, i1_blockcount)
3114 		__field(xfs_nlink_t, i1_refcount)
3115 		__field(enum xfs_refc_domain, i2_domain)
3116 		__field(xfs_agblock_t, i2_startblock)
3117 		__field(xfs_extlen_t, i2_blockcount)
3118 		__field(xfs_nlink_t, i2_refcount)
3119 		__field(enum xfs_refc_domain, i3_domain)
3120 		__field(xfs_agblock_t, i3_startblock)
3121 		__field(xfs_extlen_t, i3_blockcount)
3122 		__field(xfs_nlink_t, i3_refcount)
3123 	),
3124 	TP_fast_assign(
3125 		__entry->dev = mp->m_super->s_dev;
3126 		__entry->agno = agno;
3127 		__entry->i1_domain = i1->rc_domain;
3128 		__entry->i1_startblock = i1->rc_startblock;
3129 		__entry->i1_blockcount = i1->rc_blockcount;
3130 		__entry->i1_refcount = i1->rc_refcount;
3131 		__entry->i2_domain = i2->rc_domain;
3132 		__entry->i2_startblock = i2->rc_startblock;
3133 		__entry->i2_blockcount = i2->rc_blockcount;
3134 		__entry->i2_refcount = i2->rc_refcount;
3135 		__entry->i3_domain = i3->rc_domain;
3136 		__entry->i3_startblock = i3->rc_startblock;
3137 		__entry->i3_blockcount = i3->rc_blockcount;
3138 		__entry->i3_refcount = i3->rc_refcount;
3139 	),
3140 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3141 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3142 		  "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3143 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3144 		  __entry->agno,
3145 		  __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3146 		  __entry->i1_startblock,
3147 		  __entry->i1_blockcount,
3148 		  __entry->i1_refcount,
3149 		  __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3150 		  __entry->i2_startblock,
3151 		  __entry->i2_blockcount,
3152 		  __entry->i2_refcount,
3153 		  __print_symbolic(__entry->i3_domain, XFS_REFC_DOMAIN_STRINGS),
3154 		  __entry->i3_startblock,
3155 		  __entry->i3_blockcount,
3156 		  __entry->i3_refcount)
3157 );
3158 
3159 #define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3160 DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3161 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3162 		 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3163 		 struct xfs_refcount_irec *i3), \
3164 	TP_ARGS(mp, agno, i1, i2, i3))
3165 
3166 /* refcount btree tracepoints */
3167 DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
3168 DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
3169 DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
3170 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3171 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3172 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3173 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3174 DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
3175 DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
3176 DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
3177 
3178 /* refcount adjustment tracepoints */
3179 DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
3180 DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
3181 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
3182 DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
3183 DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3184 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3185 DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
3186 DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3187 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3188 DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3189 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3190 DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3191 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
3192 DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3193 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3194 DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
3195 DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
3196 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3197 DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3198 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3199 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3200 
3201 /* reflink helpers */
3202 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
3203 DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
3204 DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
3205 #define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
3206 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3207 DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3208 
3209 TRACE_EVENT(xfs_refcount_finish_one_leftover,
3210 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3211 		 int type, xfs_agblock_t agbno, xfs_extlen_t len),
3212 	TP_ARGS(mp, agno, type, agbno, len),
3213 	TP_STRUCT__entry(
3214 		__field(dev_t, dev)
3215 		__field(xfs_agnumber_t, agno)
3216 		__field(int, type)
3217 		__field(xfs_agblock_t, agbno)
3218 		__field(xfs_extlen_t, len)
3219 	),
3220 	TP_fast_assign(
3221 		__entry->dev = mp->m_super->s_dev;
3222 		__entry->agno = agno;
3223 		__entry->type = type;
3224 		__entry->agbno = agbno;
3225 		__entry->len = len;
3226 	),
3227 	TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x",
3228 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3229 		  __entry->type,
3230 		  __entry->agno,
3231 		  __entry->agbno,
3232 		  __entry->len)
3233 );
3234 
3235 /* simple inode-based error/%ip tracepoint class */
3236 DECLARE_EVENT_CLASS(xfs_inode_error_class,
3237 	TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3238 	TP_ARGS(ip, error, caller_ip),
3239 	TP_STRUCT__entry(
3240 		__field(dev_t, dev)
3241 		__field(xfs_ino_t, ino)
3242 		__field(int, error)
3243 		__field(unsigned long, caller_ip)
3244 	),
3245 	TP_fast_assign(
3246 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3247 		__entry->ino = ip->i_ino;
3248 		__entry->error = error;
3249 		__entry->caller_ip = caller_ip;
3250 	),
3251 	TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3252 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3253 		  __entry->ino,
3254 		  __entry->error,
3255 		  (char *)__entry->caller_ip)
3256 );
3257 
3258 #define DEFINE_INODE_ERROR_EVENT(name) \
3259 DEFINE_EVENT(xfs_inode_error_class, name, \
3260 	TP_PROTO(struct xfs_inode *ip, int error, \
3261 		 unsigned long caller_ip), \
3262 	TP_ARGS(ip, error, caller_ip))
3263 
3264 /* reflink tracepoint classes */
3265 
3266 /* two-file io tracepoint class */
3267 DECLARE_EVENT_CLASS(xfs_double_io_class,
3268 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3269 		 struct xfs_inode *dest, xfs_off_t doffset),
3270 	TP_ARGS(src, soffset, len, dest, doffset),
3271 	TP_STRUCT__entry(
3272 		__field(dev_t, dev)
3273 		__field(xfs_ino_t, src_ino)
3274 		__field(loff_t, src_isize)
3275 		__field(loff_t, src_disize)
3276 		__field(loff_t, src_offset)
3277 		__field(long long, len)
3278 		__field(xfs_ino_t, dest_ino)
3279 		__field(loff_t, dest_isize)
3280 		__field(loff_t, dest_disize)
3281 		__field(loff_t, dest_offset)
3282 	),
3283 	TP_fast_assign(
3284 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3285 		__entry->src_ino = src->i_ino;
3286 		__entry->src_isize = VFS_I(src)->i_size;
3287 		__entry->src_disize = src->i_disk_size;
3288 		__entry->src_offset = soffset;
3289 		__entry->len = len;
3290 		__entry->dest_ino = dest->i_ino;
3291 		__entry->dest_isize = VFS_I(dest)->i_size;
3292 		__entry->dest_disize = dest->i_disk_size;
3293 		__entry->dest_offset = doffset;
3294 	),
3295 	TP_printk("dev %d:%d bytecount 0x%llx "
3296 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
3297 		  "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3298 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3299 		  __entry->len,
3300 		  __entry->src_ino,
3301 		  __entry->src_isize,
3302 		  __entry->src_disize,
3303 		  __entry->src_offset,
3304 		  __entry->dest_ino,
3305 		  __entry->dest_isize,
3306 		  __entry->dest_disize,
3307 		  __entry->dest_offset)
3308 )
3309 
3310 #define DEFINE_DOUBLE_IO_EVENT(name)	\
3311 DEFINE_EVENT(xfs_double_io_class, name,	\
3312 	TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3313 		 struct xfs_inode *dest, xfs_off_t doffset), \
3314 	TP_ARGS(src, soffset, len, dest, doffset))
3315 
3316 /* inode/irec events */
3317 DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3318 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3319 	TP_ARGS(ip, irec),
3320 	TP_STRUCT__entry(
3321 		__field(dev_t, dev)
3322 		__field(xfs_ino_t, ino)
3323 		__field(xfs_fileoff_t, lblk)
3324 		__field(xfs_extlen_t, len)
3325 		__field(xfs_fsblock_t, pblk)
3326 		__field(int, state)
3327 	),
3328 	TP_fast_assign(
3329 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3330 		__entry->ino = ip->i_ino;
3331 		__entry->lblk = irec->br_startoff;
3332 		__entry->len = irec->br_blockcount;
3333 		__entry->pblk = irec->br_startblock;
3334 		__entry->state = irec->br_state;
3335 	),
3336 	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3337 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3338 		  __entry->ino,
3339 		  __entry->lblk,
3340 		  __entry->len,
3341 		  __entry->pblk,
3342 		  __entry->state)
3343 );
3344 #define DEFINE_INODE_IREC_EVENT(name) \
3345 DEFINE_EVENT(xfs_inode_irec_class, name, \
3346 	TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3347 	TP_ARGS(ip, irec))
3348 
3349 /* inode iomap invalidation events */
3350 DECLARE_EVENT_CLASS(xfs_wb_invalid_class,
3351 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork),
3352 	TP_ARGS(ip, iomap, wpcseq, whichfork),
3353 	TP_STRUCT__entry(
3354 		__field(dev_t, dev)
3355 		__field(xfs_ino_t, ino)
3356 		__field(u64, addr)
3357 		__field(loff_t, pos)
3358 		__field(u64, len)
3359 		__field(u16, type)
3360 		__field(u16, flags)
3361 		__field(u32, wpcseq)
3362 		__field(u32, forkseq)
3363 	),
3364 	TP_fast_assign(
3365 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3366 		__entry->ino = ip->i_ino;
3367 		__entry->addr = iomap->addr;
3368 		__entry->pos = iomap->offset;
3369 		__entry->len = iomap->length;
3370 		__entry->type = iomap->type;
3371 		__entry->flags = iomap->flags;
3372 		__entry->wpcseq = wpcseq;
3373 		__entry->forkseq = READ_ONCE(xfs_ifork_ptr(ip, whichfork)->if_seq);
3374 	),
3375 	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",
3376 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3377 		  __entry->ino,
3378 		  __entry->pos,
3379 		  __entry->addr,
3380 		  __entry->len,
3381 		  __entry->type,
3382 		  __entry->flags,
3383 		  __entry->wpcseq,
3384 		  __entry->forkseq)
3385 );
3386 #define DEFINE_WB_INVALID_EVENT(name) \
3387 DEFINE_EVENT(xfs_wb_invalid_class, name, \
3388 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork), \
3389 	TP_ARGS(ip, iomap, wpcseq, whichfork))
3390 DEFINE_WB_INVALID_EVENT(xfs_wb_cow_iomap_invalid);
3391 DEFINE_WB_INVALID_EVENT(xfs_wb_data_iomap_invalid);
3392 
3393 DECLARE_EVENT_CLASS(xfs_iomap_invalid_class,
3394 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap),
3395 	TP_ARGS(ip, iomap),
3396 	TP_STRUCT__entry(
3397 		__field(dev_t, dev)
3398 		__field(xfs_ino_t, ino)
3399 		__field(u64, addr)
3400 		__field(loff_t, pos)
3401 		__field(u64, len)
3402 		__field(u64, validity_cookie)
3403 		__field(u64, inodeseq)
3404 		__field(u16, type)
3405 		__field(u16, flags)
3406 	),
3407 	TP_fast_assign(
3408 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3409 		__entry->ino = ip->i_ino;
3410 		__entry->addr = iomap->addr;
3411 		__entry->pos = iomap->offset;
3412 		__entry->len = iomap->length;
3413 		__entry->validity_cookie = iomap->validity_cookie;
3414 		__entry->type = iomap->type;
3415 		__entry->flags = iomap->flags;
3416 		__entry->inodeseq = xfs_iomap_inode_sequence(ip, iomap->flags);
3417 	),
3418 	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",
3419 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3420 		  __entry->ino,
3421 		  __entry->pos,
3422 		  __entry->addr,
3423 		  __entry->len,
3424 		  __entry->type,
3425 		  __entry->flags,
3426 		  __entry->validity_cookie,
3427 		  __entry->inodeseq)
3428 );
3429 #define DEFINE_IOMAP_INVALID_EVENT(name) \
3430 DEFINE_EVENT(xfs_iomap_invalid_class, name, \
3431 	TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap), \
3432 	TP_ARGS(ip, iomap))
3433 DEFINE_IOMAP_INVALID_EVENT(xfs_iomap_invalid);
3434 
3435 /* refcount/reflink tracepoint definitions */
3436 
3437 /* reflink tracepoints */
3438 DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3439 DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3440 DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3441 TRACE_EVENT(xfs_reflink_remap_blocks,
3442 	TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3443 		 xfs_filblks_t len, struct xfs_inode *dest,
3444 		 xfs_fileoff_t doffset),
3445 	TP_ARGS(src, soffset, len, dest, doffset),
3446 	TP_STRUCT__entry(
3447 		__field(dev_t, dev)
3448 		__field(xfs_ino_t, src_ino)
3449 		__field(xfs_fileoff_t, src_lblk)
3450 		__field(xfs_filblks_t, len)
3451 		__field(xfs_ino_t, dest_ino)
3452 		__field(xfs_fileoff_t, dest_lblk)
3453 	),
3454 	TP_fast_assign(
3455 		__entry->dev = VFS_I(src)->i_sb->s_dev;
3456 		__entry->src_ino = src->i_ino;
3457 		__entry->src_lblk = soffset;
3458 		__entry->len = len;
3459 		__entry->dest_ino = dest->i_ino;
3460 		__entry->dest_lblk = doffset;
3461 	),
3462 	TP_printk("dev %d:%d fsbcount 0x%llx "
3463 		  "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3464 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3465 		  __entry->len,
3466 		  __entry->src_ino,
3467 		  __entry->src_lblk,
3468 		  __entry->dest_ino,
3469 		  __entry->dest_lblk)
3470 );
3471 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3472 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3473 DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3474 DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3475 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3476 DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3477 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3478 DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3479 
3480 /* dedupe tracepoints */
3481 DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3482 DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3483 
3484 /* ioctl tracepoints */
3485 TRACE_EVENT(xfs_ioctl_clone,
3486 	TP_PROTO(struct inode *src, struct inode *dest),
3487 	TP_ARGS(src, dest),
3488 	TP_STRUCT__entry(
3489 		__field(dev_t, dev)
3490 		__field(unsigned long, src_ino)
3491 		__field(loff_t, src_isize)
3492 		__field(unsigned long, dest_ino)
3493 		__field(loff_t, dest_isize)
3494 	),
3495 	TP_fast_assign(
3496 		__entry->dev = src->i_sb->s_dev;
3497 		__entry->src_ino = src->i_ino;
3498 		__entry->src_isize = i_size_read(src);
3499 		__entry->dest_ino = dest->i_ino;
3500 		__entry->dest_isize = i_size_read(dest);
3501 	),
3502 	TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3503 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3504 		  __entry->src_ino,
3505 		  __entry->src_isize,
3506 		  __entry->dest_ino,
3507 		  __entry->dest_isize)
3508 );
3509 
3510 /* unshare tracepoints */
3511 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3512 DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3513 
3514 /* copy on write */
3515 DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3516 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3517 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3518 DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3519 
3520 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3521 DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3522 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
3523 DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3524 
3525 DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3526 DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3527 
3528 
3529 DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3530 
3531 /* rmap swapext tracepoints */
3532 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3533 DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3534 DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3535 
3536 /* fsmap traces */
3537 DECLARE_EVENT_CLASS(xfs_fsmap_class,
3538 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3539 		 const struct xfs_rmap_irec *rmap),
3540 	TP_ARGS(mp, keydev, agno, rmap),
3541 	TP_STRUCT__entry(
3542 		__field(dev_t, dev)
3543 		__field(dev_t, keydev)
3544 		__field(xfs_agnumber_t, agno)
3545 		__field(xfs_fsblock_t, bno)
3546 		__field(xfs_filblks_t, len)
3547 		__field(uint64_t, owner)
3548 		__field(uint64_t, offset)
3549 		__field(unsigned int, flags)
3550 	),
3551 	TP_fast_assign(
3552 		__entry->dev = mp->m_super->s_dev;
3553 		__entry->keydev = new_decode_dev(keydev);
3554 		__entry->agno = agno;
3555 		__entry->bno = rmap->rm_startblock;
3556 		__entry->len = rmap->rm_blockcount;
3557 		__entry->owner = rmap->rm_owner;
3558 		__entry->offset = rmap->rm_offset;
3559 		__entry->flags = rmap->rm_flags;
3560 	),
3561 	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",
3562 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3563 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3564 		  __entry->agno,
3565 		  __entry->bno,
3566 		  __entry->len,
3567 		  __entry->owner,
3568 		  __entry->offset,
3569 		  __entry->flags)
3570 )
3571 #define DEFINE_FSMAP_EVENT(name) \
3572 DEFINE_EVENT(xfs_fsmap_class, name, \
3573 	TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3574 		 const struct xfs_rmap_irec *rmap), \
3575 	TP_ARGS(mp, keydev, agno, rmap))
3576 DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3577 DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3578 DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3579 
3580 DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3581 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3582 	TP_ARGS(mp, fsmap),
3583 	TP_STRUCT__entry(
3584 		__field(dev_t, dev)
3585 		__field(dev_t, keydev)
3586 		__field(xfs_daddr_t, block)
3587 		__field(xfs_daddr_t, len)
3588 		__field(uint64_t, owner)
3589 		__field(uint64_t, offset)
3590 		__field(uint64_t, flags)
3591 	),
3592 	TP_fast_assign(
3593 		__entry->dev = mp->m_super->s_dev;
3594 		__entry->keydev = new_decode_dev(fsmap->fmr_device);
3595 		__entry->block = fsmap->fmr_physical;
3596 		__entry->len = fsmap->fmr_length;
3597 		__entry->owner = fsmap->fmr_owner;
3598 		__entry->offset = fsmap->fmr_offset;
3599 		__entry->flags = fsmap->fmr_flags;
3600 	),
3601 	TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
3602 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3603 		  MAJOR(__entry->keydev), MINOR(__entry->keydev),
3604 		  __entry->block,
3605 		  __entry->len,
3606 		  __entry->owner,
3607 		  __entry->offset,
3608 		  __entry->flags)
3609 )
3610 #define DEFINE_GETFSMAP_EVENT(name) \
3611 DEFINE_EVENT(xfs_getfsmap_class, name, \
3612 	TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3613 	TP_ARGS(mp, fsmap))
3614 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3615 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3616 DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3617 
3618 DECLARE_EVENT_CLASS(xfs_trans_resv_class,
3619 	TP_PROTO(struct xfs_mount *mp, unsigned int type,
3620 		 struct xfs_trans_res *res),
3621 	TP_ARGS(mp, type, res),
3622 	TP_STRUCT__entry(
3623 		__field(dev_t, dev)
3624 		__field(int, type)
3625 		__field(uint, logres)
3626 		__field(int, logcount)
3627 		__field(int, logflags)
3628 	),
3629 	TP_fast_assign(
3630 		__entry->dev = mp->m_super->s_dev;
3631 		__entry->type = type;
3632 		__entry->logres = res->tr_logres;
3633 		__entry->logcount = res->tr_logcount;
3634 		__entry->logflags = res->tr_logflags;
3635 	),
3636 	TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3637 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3638 		  __entry->type,
3639 		  __entry->logres,
3640 		  __entry->logcount,
3641 		  __entry->logflags)
3642 )
3643 
3644 #define DEFINE_TRANS_RESV_EVENT(name) \
3645 DEFINE_EVENT(xfs_trans_resv_class, name, \
3646 	TP_PROTO(struct xfs_mount *mp, unsigned int type, \
3647 		 struct xfs_trans_res *res), \
3648 	TP_ARGS(mp, type, res))
3649 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
3650 DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
3651 
3652 TRACE_EVENT(xfs_log_get_max_trans_res,
3653 	TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
3654 	TP_ARGS(mp, res),
3655 	TP_STRUCT__entry(
3656 		__field(dev_t, dev)
3657 		__field(uint, logres)
3658 		__field(int, logcount)
3659 	),
3660 	TP_fast_assign(
3661 		__entry->dev = mp->m_super->s_dev;
3662 		__entry->logres = res->tr_logres;
3663 		__entry->logcount = res->tr_logcount;
3664 	),
3665 	TP_printk("dev %d:%d logres %u logcount %d",
3666 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3667 		  __entry->logres,
3668 		  __entry->logcount)
3669 );
3670 
3671 DECLARE_EVENT_CLASS(xfs_trans_class,
3672 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3673 	TP_ARGS(tp, caller_ip),
3674 	TP_STRUCT__entry(
3675 		__field(dev_t, dev)
3676 		__field(uint32_t, tid)
3677 		__field(uint32_t, flags)
3678 		__field(unsigned long, caller_ip)
3679 	),
3680 	TP_fast_assign(
3681 		__entry->dev = tp->t_mountp->m_super->s_dev;
3682 		__entry->tid = 0;
3683 		if (tp->t_ticket)
3684 			__entry->tid = tp->t_ticket->t_tid;
3685 		__entry->flags = tp->t_flags;
3686 		__entry->caller_ip = caller_ip;
3687 	),
3688 	TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3689 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3690 		  __entry->tid,
3691 		  __entry->flags,
3692 		  (char *)__entry->caller_ip)
3693 )
3694 
3695 #define DEFINE_TRANS_EVENT(name) \
3696 DEFINE_EVENT(xfs_trans_class, name, \
3697 	TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3698 	TP_ARGS(tp, caller_ip))
3699 DEFINE_TRANS_EVENT(xfs_trans_alloc);
3700 DEFINE_TRANS_EVENT(xfs_trans_cancel);
3701 DEFINE_TRANS_EVENT(xfs_trans_commit);
3702 DEFINE_TRANS_EVENT(xfs_trans_dup);
3703 DEFINE_TRANS_EVENT(xfs_trans_free);
3704 DEFINE_TRANS_EVENT(xfs_trans_roll);
3705 DEFINE_TRANS_EVENT(xfs_trans_add_item);
3706 DEFINE_TRANS_EVENT(xfs_trans_commit_items);
3707 DEFINE_TRANS_EVENT(xfs_trans_free_items);
3708 
3709 TRACE_EVENT(xfs_iunlink_update_bucket,
3710 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3711 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3712 	TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3713 	TP_STRUCT__entry(
3714 		__field(dev_t, dev)
3715 		__field(xfs_agnumber_t, agno)
3716 		__field(unsigned int, bucket)
3717 		__field(xfs_agino_t, old_ptr)
3718 		__field(xfs_agino_t, new_ptr)
3719 	),
3720 	TP_fast_assign(
3721 		__entry->dev = mp->m_super->s_dev;
3722 		__entry->agno = agno;
3723 		__entry->bucket = bucket;
3724 		__entry->old_ptr = old_ptr;
3725 		__entry->new_ptr = new_ptr;
3726 	),
3727 	TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
3728 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3729 		  __entry->agno,
3730 		  __entry->bucket,
3731 		  __entry->old_ptr,
3732 		  __entry->new_ptr)
3733 );
3734 
3735 TRACE_EVENT(xfs_iunlink_update_dinode,
3736 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3737 		 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3738 	TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3739 	TP_STRUCT__entry(
3740 		__field(dev_t, dev)
3741 		__field(xfs_agnumber_t, agno)
3742 		__field(xfs_agino_t, agino)
3743 		__field(xfs_agino_t, old_ptr)
3744 		__field(xfs_agino_t, new_ptr)
3745 	),
3746 	TP_fast_assign(
3747 		__entry->dev = mp->m_super->s_dev;
3748 		__entry->agno = agno;
3749 		__entry->agino = agino;
3750 		__entry->old_ptr = old_ptr;
3751 		__entry->new_ptr = new_ptr;
3752 	),
3753 	TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
3754 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3755 		  __entry->agno,
3756 		  __entry->agino,
3757 		  __entry->old_ptr,
3758 		  __entry->new_ptr)
3759 );
3760 
3761 DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3762 	TP_PROTO(struct xfs_inode *ip),
3763 	TP_ARGS(ip),
3764 	TP_STRUCT__entry(
3765 		__field(dev_t, dev)
3766 		__field(xfs_agnumber_t, agno)
3767 		__field(xfs_agino_t, agino)
3768 	),
3769 	TP_fast_assign(
3770 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
3771 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3772 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3773 	),
3774 	TP_printk("dev %d:%d agno 0x%x agino 0x%x",
3775 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3776 		  __entry->agno, __entry->agino)
3777 )
3778 
3779 #define DEFINE_AGINODE_EVENT(name) \
3780 DEFINE_EVENT(xfs_ag_inode_class, name, \
3781 	TP_PROTO(struct xfs_inode *ip), \
3782 	TP_ARGS(ip))
3783 DEFINE_AGINODE_EVENT(xfs_iunlink);
3784 DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
3785 
3786 DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3787 	TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3788 	TP_ARGS(mp, flags),
3789 	TP_STRUCT__entry(
3790 		__field(dev_t, dev)
3791 		__field(unsigned int, flags)
3792 	),
3793 	TP_fast_assign(
3794 		__entry->dev = mp->m_super->s_dev;
3795 		__entry->flags = flags;
3796 	),
3797 	TP_printk("dev %d:%d flags 0x%x",
3798 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3799 		  __entry->flags)
3800 );
3801 #define DEFINE_FS_CORRUPT_EVENT(name)	\
3802 DEFINE_EVENT(xfs_fs_corrupt_class, name,	\
3803 	TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3804 	TP_ARGS(mp, flags))
3805 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3806 DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
3807 DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
3808 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3809 DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
3810 DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
3811 
3812 DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3813 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3814 	TP_ARGS(mp, agno, flags),
3815 	TP_STRUCT__entry(
3816 		__field(dev_t, dev)
3817 		__field(xfs_agnumber_t, agno)
3818 		__field(unsigned int, flags)
3819 	),
3820 	TP_fast_assign(
3821 		__entry->dev = mp->m_super->s_dev;
3822 		__entry->agno = agno;
3823 		__entry->flags = flags;
3824 	),
3825 	TP_printk("dev %d:%d agno 0x%x flags 0x%x",
3826 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3827 		  __entry->agno, __entry->flags)
3828 );
3829 #define DEFINE_AG_CORRUPT_EVENT(name)	\
3830 DEFINE_EVENT(xfs_ag_corrupt_class, name,	\
3831 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3832 		 unsigned int flags), \
3833 	TP_ARGS(mp, agno, flags))
3834 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3835 DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
3836 DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
3837 
3838 DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3839 	TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3840 	TP_ARGS(ip, flags),
3841 	TP_STRUCT__entry(
3842 		__field(dev_t, dev)
3843 		__field(xfs_ino_t, ino)
3844 		__field(unsigned int, flags)
3845 	),
3846 	TP_fast_assign(
3847 		__entry->dev = ip->i_mount->m_super->s_dev;
3848 		__entry->ino = ip->i_ino;
3849 		__entry->flags = flags;
3850 	),
3851 	TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3852 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3853 		  __entry->ino, __entry->flags)
3854 );
3855 #define DEFINE_INODE_CORRUPT_EVENT(name)	\
3856 DEFINE_EVENT(xfs_inode_corrupt_class, name,	\
3857 	TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3858 	TP_ARGS(ip, flags))
3859 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3860 DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3861 
3862 TRACE_EVENT(xfs_iwalk_ag,
3863 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3864 		 xfs_agino_t startino),
3865 	TP_ARGS(mp, agno, startino),
3866 	TP_STRUCT__entry(
3867 		__field(dev_t, dev)
3868 		__field(xfs_agnumber_t, agno)
3869 		__field(xfs_agino_t, startino)
3870 	),
3871 	TP_fast_assign(
3872 		__entry->dev = mp->m_super->s_dev;
3873 		__entry->agno = agno;
3874 		__entry->startino = startino;
3875 	),
3876 	TP_printk("dev %d:%d agno 0x%x startino 0x%x",
3877 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3878 		  __entry->startino)
3879 )
3880 
3881 TRACE_EVENT(xfs_iwalk_ag_rec,
3882 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3883 		 struct xfs_inobt_rec_incore *irec),
3884 	TP_ARGS(mp, agno, irec),
3885 	TP_STRUCT__entry(
3886 		__field(dev_t, dev)
3887 		__field(xfs_agnumber_t, agno)
3888 		__field(xfs_agino_t, startino)
3889 		__field(uint64_t, freemask)
3890 	),
3891 	TP_fast_assign(
3892 		__entry->dev = mp->m_super->s_dev;
3893 		__entry->agno = agno;
3894 		__entry->startino = irec->ir_startino;
3895 		__entry->freemask = irec->ir_free;
3896 	),
3897 	TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
3898 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3899 		  __entry->startino, __entry->freemask)
3900 )
3901 
3902 TRACE_EVENT(xfs_pwork_init,
3903 	TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
3904 	TP_ARGS(mp, nr_threads, pid),
3905 	TP_STRUCT__entry(
3906 		__field(dev_t, dev)
3907 		__field(unsigned int, nr_threads)
3908 		__field(pid_t, pid)
3909 	),
3910 	TP_fast_assign(
3911 		__entry->dev = mp->m_super->s_dev;
3912 		__entry->nr_threads = nr_threads;
3913 		__entry->pid = pid;
3914 	),
3915 	TP_printk("dev %d:%d nr_threads %u pid %u",
3916 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3917 		  __entry->nr_threads, __entry->pid)
3918 )
3919 
3920 DECLARE_EVENT_CLASS(xfs_kmem_class,
3921 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
3922 	TP_ARGS(size, flags, caller_ip),
3923 	TP_STRUCT__entry(
3924 		__field(ssize_t, size)
3925 		__field(int, flags)
3926 		__field(unsigned long, caller_ip)
3927 	),
3928 	TP_fast_assign(
3929 		__entry->size = size;
3930 		__entry->flags = flags;
3931 		__entry->caller_ip = caller_ip;
3932 	),
3933 	TP_printk("size %zd flags 0x%x caller %pS",
3934 		  __entry->size,
3935 		  __entry->flags,
3936 		  (char *)__entry->caller_ip)
3937 )
3938 
3939 #define DEFINE_KMEM_EVENT(name) \
3940 DEFINE_EVENT(xfs_kmem_class, name, \
3941 	TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
3942 	TP_ARGS(size, flags, caller_ip))
3943 DEFINE_KMEM_EVENT(kmem_alloc);
3944 
3945 TRACE_EVENT(xfs_check_new_dalign,
3946 	TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
3947 	TP_ARGS(mp, new_dalign, calc_rootino),
3948 	TP_STRUCT__entry(
3949 		__field(dev_t, dev)
3950 		__field(int, new_dalign)
3951 		__field(xfs_ino_t, sb_rootino)
3952 		__field(xfs_ino_t, calc_rootino)
3953 	),
3954 	TP_fast_assign(
3955 		__entry->dev = mp->m_super->s_dev;
3956 		__entry->new_dalign = new_dalign;
3957 		__entry->sb_rootino = mp->m_sb.sb_rootino;
3958 		__entry->calc_rootino = calc_rootino;
3959 	),
3960 	TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
3961 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3962 		  __entry->new_dalign, __entry->sb_rootino,
3963 		  __entry->calc_rootino)
3964 )
3965 
3966 TRACE_EVENT(xfs_btree_commit_afakeroot,
3967 	TP_PROTO(struct xfs_btree_cur *cur),
3968 	TP_ARGS(cur),
3969 	TP_STRUCT__entry(
3970 		__field(dev_t, dev)
3971 		__field(xfs_btnum_t, btnum)
3972 		__field(xfs_agnumber_t, agno)
3973 		__field(xfs_agblock_t, agbno)
3974 		__field(unsigned int, levels)
3975 		__field(unsigned int, blocks)
3976 	),
3977 	TP_fast_assign(
3978 		__entry->dev = cur->bc_mp->m_super->s_dev;
3979 		__entry->btnum = cur->bc_btnum;
3980 		__entry->agno = cur->bc_ag.pag->pag_agno;
3981 		__entry->agbno = cur->bc_ag.afake->af_root;
3982 		__entry->levels = cur->bc_ag.afake->af_levels;
3983 		__entry->blocks = cur->bc_ag.afake->af_blocks;
3984 	),
3985 	TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
3986 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3987 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3988 		  __entry->agno,
3989 		  __entry->levels,
3990 		  __entry->blocks,
3991 		  __entry->agbno)
3992 )
3993 
3994 TRACE_EVENT(xfs_btree_commit_ifakeroot,
3995 	TP_PROTO(struct xfs_btree_cur *cur),
3996 	TP_ARGS(cur),
3997 	TP_STRUCT__entry(
3998 		__field(dev_t, dev)
3999 		__field(xfs_btnum_t, btnum)
4000 		__field(xfs_agnumber_t, agno)
4001 		__field(xfs_agino_t, agino)
4002 		__field(unsigned int, levels)
4003 		__field(unsigned int, blocks)
4004 		__field(int, whichfork)
4005 	),
4006 	TP_fast_assign(
4007 		__entry->dev = cur->bc_mp->m_super->s_dev;
4008 		__entry->btnum = cur->bc_btnum;
4009 		__entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
4010 					cur->bc_ino.ip->i_ino);
4011 		__entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
4012 					cur->bc_ino.ip->i_ino);
4013 		__entry->levels = cur->bc_ino.ifake->if_levels;
4014 		__entry->blocks = cur->bc_ino.ifake->if_blocks;
4015 		__entry->whichfork = cur->bc_ino.whichfork;
4016 	),
4017 	TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
4018 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4019 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4020 		  __entry->agno,
4021 		  __entry->agino,
4022 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
4023 		  __entry->levels,
4024 		  __entry->blocks)
4025 )
4026 
4027 TRACE_EVENT(xfs_btree_bload_level_geometry,
4028 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4029 		 uint64_t nr_this_level, unsigned int nr_per_block,
4030 		 unsigned int desired_npb, uint64_t blocks,
4031 		 uint64_t blocks_with_extra),
4032 	TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
4033 		blocks_with_extra),
4034 	TP_STRUCT__entry(
4035 		__field(dev_t, dev)
4036 		__field(xfs_btnum_t, btnum)
4037 		__field(unsigned int, level)
4038 		__field(unsigned int, nlevels)
4039 		__field(uint64_t, nr_this_level)
4040 		__field(unsigned int, nr_per_block)
4041 		__field(unsigned int, desired_npb)
4042 		__field(unsigned long long, blocks)
4043 		__field(unsigned long long, blocks_with_extra)
4044 	),
4045 	TP_fast_assign(
4046 		__entry->dev = cur->bc_mp->m_super->s_dev;
4047 		__entry->btnum = cur->bc_btnum;
4048 		__entry->level = level;
4049 		__entry->nlevels = cur->bc_nlevels;
4050 		__entry->nr_this_level = nr_this_level;
4051 		__entry->nr_per_block = nr_per_block;
4052 		__entry->desired_npb = desired_npb;
4053 		__entry->blocks = blocks;
4054 		__entry->blocks_with_extra = blocks_with_extra;
4055 	),
4056 	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",
4057 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4058 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4059 		  __entry->level,
4060 		  __entry->nlevels,
4061 		  __entry->nr_this_level,
4062 		  __entry->nr_per_block,
4063 		  __entry->desired_npb,
4064 		  __entry->blocks,
4065 		  __entry->blocks_with_extra)
4066 )
4067 
4068 TRACE_EVENT(xfs_btree_bload_block,
4069 	TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4070 		 uint64_t block_idx, uint64_t nr_blocks,
4071 		 union xfs_btree_ptr *ptr, unsigned int nr_records),
4072 	TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
4073 	TP_STRUCT__entry(
4074 		__field(dev_t, dev)
4075 		__field(xfs_btnum_t, btnum)
4076 		__field(unsigned int, level)
4077 		__field(unsigned long long, block_idx)
4078 		__field(unsigned long long, nr_blocks)
4079 		__field(xfs_agnumber_t, agno)
4080 		__field(xfs_agblock_t, agbno)
4081 		__field(unsigned int, nr_records)
4082 	),
4083 	TP_fast_assign(
4084 		__entry->dev = cur->bc_mp->m_super->s_dev;
4085 		__entry->btnum = cur->bc_btnum;
4086 		__entry->level = level;
4087 		__entry->block_idx = block_idx;
4088 		__entry->nr_blocks = nr_blocks;
4089 		if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
4090 			xfs_fsblock_t	fsb = be64_to_cpu(ptr->l);
4091 
4092 			__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
4093 			__entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
4094 		} else {
4095 			__entry->agno = cur->bc_ag.pag->pag_agno;
4096 			__entry->agbno = be32_to_cpu(ptr->s);
4097 		}
4098 		__entry->nr_records = nr_records;
4099 	),
4100 	TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
4101 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4102 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4103 		  __entry->level,
4104 		  __entry->block_idx,
4105 		  __entry->nr_blocks,
4106 		  __entry->agno,
4107 		  __entry->agbno,
4108 		  __entry->nr_records)
4109 )
4110 
4111 DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
4112 	TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
4113 	TP_ARGS(mp, min, max),
4114 	TP_STRUCT__entry(
4115 		__field(dev_t, dev)
4116 		__field(long long, min)
4117 		__field(long long, max)
4118 	),
4119 	TP_fast_assign(
4120 		__entry->dev = mp->m_super->s_dev;
4121 		__entry->min = min;
4122 		__entry->max = max;
4123 	),
4124 	TP_printk("dev %d:%d min %lld max %lld",
4125 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4126 		  __entry->min,
4127 		  __entry->max)
4128 )
4129 
4130 #define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
4131 DEFINE_EVENT(xfs_timestamp_range_class, name, \
4132 	TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
4133 	TP_ARGS(mp, min, max))
4134 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
4135 DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
4136 
4137 DECLARE_EVENT_CLASS(xfs_icwalk_class,
4138 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4139 		 unsigned long caller_ip),
4140 	TP_ARGS(mp, icw, caller_ip),
4141 	TP_STRUCT__entry(
4142 		__field(dev_t, dev)
4143 		__field(__u32, flags)
4144 		__field(uint32_t, uid)
4145 		__field(uint32_t, gid)
4146 		__field(prid_t, prid)
4147 		__field(__u64, min_file_size)
4148 		__field(long, scan_limit)
4149 		__field(unsigned long, caller_ip)
4150 	),
4151 	TP_fast_assign(
4152 		__entry->dev = mp->m_super->s_dev;
4153 		__entry->flags = icw ? icw->icw_flags : 0;
4154 		__entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
4155 						icw->icw_uid) : 0;
4156 		__entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
4157 						icw->icw_gid) : 0;
4158 		__entry->prid = icw ? icw->icw_prid : 0;
4159 		__entry->min_file_size = icw ? icw->icw_min_file_size : 0;
4160 		__entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4161 		__entry->caller_ip = caller_ip;
4162 	),
4163 	TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4164 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4165 		  __entry->flags,
4166 		  __entry->uid,
4167 		  __entry->gid,
4168 		  __entry->prid,
4169 		  __entry->min_file_size,
4170 		  __entry->scan_limit,
4171 		  (char *)__entry->caller_ip)
4172 );
4173 #define DEFINE_ICWALK_EVENT(name)	\
4174 DEFINE_EVENT(xfs_icwalk_class, name,	\
4175 	TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4176 		 unsigned long caller_ip), \
4177 	TP_ARGS(mp, icw, caller_ip))
4178 DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4179 DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4180 
4181 TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4182 TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4183 TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4184 TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4185 TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4186 TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
4187 
4188 DECLARE_EVENT_CLASS(xlog_iclog_class,
4189 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4190 	TP_ARGS(iclog, caller_ip),
4191 	TP_STRUCT__entry(
4192 		__field(dev_t, dev)
4193 		__field(uint32_t, state)
4194 		__field(int32_t, refcount)
4195 		__field(uint32_t, offset)
4196 		__field(uint32_t, flags)
4197 		__field(unsigned long long, lsn)
4198 		__field(unsigned long, caller_ip)
4199 	),
4200 	TP_fast_assign(
4201 		__entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4202 		__entry->state = iclog->ic_state;
4203 		__entry->refcount = atomic_read(&iclog->ic_refcnt);
4204 		__entry->offset = iclog->ic_offset;
4205 		__entry->flags = iclog->ic_flags;
4206 		__entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4207 		__entry->caller_ip = caller_ip;
4208 	),
4209 	TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
4210 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4211 		  __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4212 		  __entry->refcount,
4213 		  __entry->offset,
4214 		  __entry->lsn,
4215 		  __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
4216 		  (char *)__entry->caller_ip)
4217 
4218 );
4219 
4220 #define DEFINE_ICLOG_EVENT(name)	\
4221 DEFINE_EVENT(xlog_iclog_class, name,	\
4222 	TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4223 	TP_ARGS(iclog, caller_ip))
4224 
4225 DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4226 DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4227 DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4228 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4229 DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4230 DEFINE_ICLOG_EVENT(xlog_iclog_force);
4231 DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4232 DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4233 DEFINE_ICLOG_EVENT(xlog_iclog_release);
4234 DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4235 DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4236 DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4237 DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4238 DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4239 DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4240 DEFINE_ICLOG_EVENT(xlog_iclog_write);
4241 
4242 TRACE_DEFINE_ENUM(XFS_DAS_UNINIT);
4243 TRACE_DEFINE_ENUM(XFS_DAS_SF_ADD);
4244 TRACE_DEFINE_ENUM(XFS_DAS_SF_REMOVE);
4245 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ADD);
4246 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE);
4247 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ADD);
4248 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE);
4249 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_SET_RMT);
4250 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ALLOC_RMT);
4251 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REPLACE);
4252 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_OLD);
4253 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_RMT);
4254 TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_ATTR);
4255 TRACE_DEFINE_ENUM(XFS_DAS_NODE_SET_RMT);
4256 TRACE_DEFINE_ENUM(XFS_DAS_NODE_ALLOC_RMT);
4257 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REPLACE);
4258 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_OLD);
4259 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_RMT);
4260 TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_ATTR);
4261 TRACE_DEFINE_ENUM(XFS_DAS_DONE);
4262 
4263 DECLARE_EVENT_CLASS(xfs_das_state_class,
4264 	TP_PROTO(int das, struct xfs_inode *ip),
4265 	TP_ARGS(das, ip),
4266 	TP_STRUCT__entry(
4267 		__field(int, das)
4268 		__field(xfs_ino_t, ino)
4269 	),
4270 	TP_fast_assign(
4271 		__entry->das = das;
4272 		__entry->ino = ip->i_ino;
4273 	),
4274 	TP_printk("state change %s ino 0x%llx",
4275 		  __print_symbolic(__entry->das, XFS_DAS_STRINGS),
4276 		  __entry->ino)
4277 )
4278 
4279 #define DEFINE_DAS_STATE_EVENT(name) \
4280 DEFINE_EVENT(xfs_das_state_class, name, \
4281 	TP_PROTO(int das, struct xfs_inode *ip), \
4282 	TP_ARGS(das, ip))
4283 DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4284 DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4285 DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4286 DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4287 DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4288 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
4289 DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4290 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
4291 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_replace);
4292 DEFINE_DAS_STATE_EVENT(xfs_attr_defer_remove);
4293 
4294 
4295 TRACE_EVENT(xfs_force_shutdown,
4296 	TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4297 		 int line_num),
4298 	TP_ARGS(mp, ptag, flags, fname, line_num),
4299 	TP_STRUCT__entry(
4300 		__field(dev_t, dev)
4301 		__field(int, ptag)
4302 		__field(int, flags)
4303 		__string(fname, fname)
4304 		__field(int, line_num)
4305 	),
4306 	TP_fast_assign(
4307 		__entry->dev = mp->m_super->s_dev;
4308 		__entry->ptag = ptag;
4309 		__entry->flags = flags;
4310 		__assign_str(fname, fname);
4311 		__entry->line_num = line_num;
4312 	),
4313 	TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4314 		  MAJOR(__entry->dev), MINOR(__entry->dev),
4315 		__print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4316 		__print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4317 		__get_str(fname),
4318 		__entry->line_num)
4319 );
4320 
4321 #endif /* _TRACE_XFS_H */
4322 
4323 #undef TRACE_INCLUDE_PATH
4324 #define TRACE_INCLUDE_PATH .
4325 #define TRACE_INCLUDE_FILE xfs_trace
4326 #include <trace/define_trace.h>
4327