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