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