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