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