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