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