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