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