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