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