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