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