xref: /openbmc/linux/fs/xfs/xfs_trace.h (revision ca55b2fe)
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 
42 DECLARE_EVENT_CLASS(xfs_attr_list_class,
43 	TP_PROTO(struct xfs_attr_list_context *ctx),
44 	TP_ARGS(ctx),
45 	TP_STRUCT__entry(
46 		__field(dev_t, dev)
47 		__field(xfs_ino_t, ino)
48 		__field(u32, hashval)
49 		__field(u32, blkno)
50 		__field(u32, offset)
51 		__field(void *, alist)
52 		__field(int, bufsize)
53 		__field(int, count)
54 		__field(int, firstu)
55 		__field(int, dupcnt)
56 		__field(int, flags)
57 	),
58 	TP_fast_assign(
59 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
60 		__entry->ino = ctx->dp->i_ino;
61 		__entry->hashval = ctx->cursor->hashval;
62 		__entry->blkno = ctx->cursor->blkno;
63 		__entry->offset = ctx->cursor->offset;
64 		__entry->alist = ctx->alist;
65 		__entry->bufsize = ctx->bufsize;
66 		__entry->count = ctx->count;
67 		__entry->firstu = ctx->firstu;
68 		__entry->flags = ctx->flags;
69 	),
70 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
71 		  "alist 0x%p size %u count %u firstu %u flags %d %s",
72 		  MAJOR(__entry->dev), MINOR(__entry->dev),
73 		   __entry->ino,
74 		   __entry->hashval,
75 		   __entry->blkno,
76 		   __entry->offset,
77 		   __entry->dupcnt,
78 		   __entry->alist,
79 		   __entry->bufsize,
80 		   __entry->count,
81 		   __entry->firstu,
82 		   __entry->flags,
83 		   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
84 	)
85 )
86 
87 #define DEFINE_ATTR_LIST_EVENT(name) \
88 DEFINE_EVENT(xfs_attr_list_class, name, \
89 	TP_PROTO(struct xfs_attr_list_context *ctx), \
90 	TP_ARGS(ctx))
91 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
92 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
93 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
94 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
95 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
96 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
97 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
98 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
99 DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
100 DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
101 
102 DECLARE_EVENT_CLASS(xfs_perag_class,
103 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
104 		 unsigned long caller_ip),
105 	TP_ARGS(mp, agno, refcount, caller_ip),
106 	TP_STRUCT__entry(
107 		__field(dev_t, dev)
108 		__field(xfs_agnumber_t, agno)
109 		__field(int, refcount)
110 		__field(unsigned long, caller_ip)
111 	),
112 	TP_fast_assign(
113 		__entry->dev = mp->m_super->s_dev;
114 		__entry->agno = agno;
115 		__entry->refcount = refcount;
116 		__entry->caller_ip = caller_ip;
117 	),
118 	TP_printk("dev %d:%d agno %u refcount %d caller %ps",
119 		  MAJOR(__entry->dev), MINOR(__entry->dev),
120 		  __entry->agno,
121 		  __entry->refcount,
122 		  (char *)__entry->caller_ip)
123 );
124 
125 #define DEFINE_PERAG_REF_EVENT(name)	\
126 DEFINE_EVENT(xfs_perag_class, name,	\
127 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,	\
128 		 unsigned long caller_ip),					\
129 	TP_ARGS(mp, agno, refcount, caller_ip))
130 DEFINE_PERAG_REF_EVENT(xfs_perag_get);
131 DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
132 DEFINE_PERAG_REF_EVENT(xfs_perag_put);
133 DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
134 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
135 DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
136 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
137 
138 DECLARE_EVENT_CLASS(xfs_ag_class,
139 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
140 	TP_ARGS(mp, agno),
141 	TP_STRUCT__entry(
142 		__field(dev_t, dev)
143 		__field(xfs_agnumber_t, agno)
144 	),
145 	TP_fast_assign(
146 		__entry->dev = mp->m_super->s_dev;
147 		__entry->agno = agno;
148 	),
149 	TP_printk("dev %d:%d agno %u",
150 		  MAJOR(__entry->dev), MINOR(__entry->dev),
151 		  __entry->agno)
152 );
153 #define DEFINE_AG_EVENT(name)	\
154 DEFINE_EVENT(xfs_ag_class, name,	\
155 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),	\
156 	TP_ARGS(mp, agno))
157 
158 DEFINE_AG_EVENT(xfs_read_agf);
159 DEFINE_AG_EVENT(xfs_alloc_read_agf);
160 DEFINE_AG_EVENT(xfs_read_agi);
161 DEFINE_AG_EVENT(xfs_ialloc_read_agi);
162 
163 TRACE_EVENT(xfs_attr_list_node_descend,
164 	TP_PROTO(struct xfs_attr_list_context *ctx,
165 		 struct xfs_da_node_entry *btree),
166 	TP_ARGS(ctx, btree),
167 	TP_STRUCT__entry(
168 		__field(dev_t, dev)
169 		__field(xfs_ino_t, ino)
170 		__field(u32, hashval)
171 		__field(u32, blkno)
172 		__field(u32, offset)
173 		__field(void *, alist)
174 		__field(int, bufsize)
175 		__field(int, count)
176 		__field(int, firstu)
177 		__field(int, dupcnt)
178 		__field(int, flags)
179 		__field(u32, bt_hashval)
180 		__field(u32, bt_before)
181 	),
182 	TP_fast_assign(
183 		__entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
184 		__entry->ino = ctx->dp->i_ino;
185 		__entry->hashval = ctx->cursor->hashval;
186 		__entry->blkno = ctx->cursor->blkno;
187 		__entry->offset = ctx->cursor->offset;
188 		__entry->alist = ctx->alist;
189 		__entry->bufsize = ctx->bufsize;
190 		__entry->count = ctx->count;
191 		__entry->firstu = ctx->firstu;
192 		__entry->flags = ctx->flags;
193 		__entry->bt_hashval = be32_to_cpu(btree->hashval);
194 		__entry->bt_before = be32_to_cpu(btree->before);
195 	),
196 	TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
197 		  "alist 0x%p size %u count %u firstu %u flags %d %s "
198 		  "node hashval %u, node before %u",
199 		  MAJOR(__entry->dev), MINOR(__entry->dev),
200 		   __entry->ino,
201 		   __entry->hashval,
202 		   __entry->blkno,
203 		   __entry->offset,
204 		   __entry->dupcnt,
205 		   __entry->alist,
206 		   __entry->bufsize,
207 		   __entry->count,
208 		   __entry->firstu,
209 		   __entry->flags,
210 		   __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
211 		   __entry->bt_hashval,
212 		   __entry->bt_before)
213 );
214 
215 TRACE_EVENT(xfs_iext_insert,
216 	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
217 		 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
218 	TP_ARGS(ip, idx, r, state, caller_ip),
219 	TP_STRUCT__entry(
220 		__field(dev_t, dev)
221 		__field(xfs_ino_t, ino)
222 		__field(xfs_extnum_t, idx)
223 		__field(xfs_fileoff_t, startoff)
224 		__field(xfs_fsblock_t, startblock)
225 		__field(xfs_filblks_t, blockcount)
226 		__field(xfs_exntst_t, state)
227 		__field(int, bmap_state)
228 		__field(unsigned long, caller_ip)
229 	),
230 	TP_fast_assign(
231 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
232 		__entry->ino = ip->i_ino;
233 		__entry->idx = idx;
234 		__entry->startoff = r->br_startoff;
235 		__entry->startblock = r->br_startblock;
236 		__entry->blockcount = r->br_blockcount;
237 		__entry->state = r->br_state;
238 		__entry->bmap_state = state;
239 		__entry->caller_ip = caller_ip;
240 	),
241 	TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
242 		  "offset %lld block %lld count %lld flag %d caller %ps",
243 		  MAJOR(__entry->dev), MINOR(__entry->dev),
244 		  __entry->ino,
245 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
246 		  (long)__entry->idx,
247 		  __entry->startoff,
248 		  (__int64_t)__entry->startblock,
249 		  __entry->blockcount,
250 		  __entry->state,
251 		  (char *)__entry->caller_ip)
252 );
253 
254 DECLARE_EVENT_CLASS(xfs_bmap_class,
255 	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
256 		 unsigned long caller_ip),
257 	TP_ARGS(ip, idx, state, caller_ip),
258 	TP_STRUCT__entry(
259 		__field(dev_t, dev)
260 		__field(xfs_ino_t, ino)
261 		__field(xfs_extnum_t, idx)
262 		__field(xfs_fileoff_t, startoff)
263 		__field(xfs_fsblock_t, startblock)
264 		__field(xfs_filblks_t, blockcount)
265 		__field(xfs_exntst_t, state)
266 		__field(int, bmap_state)
267 		__field(unsigned long, caller_ip)
268 	),
269 	TP_fast_assign(
270 		struct xfs_ifork	*ifp = (state & BMAP_ATTRFORK) ?
271 						ip->i_afp : &ip->i_df;
272 		struct xfs_bmbt_irec	r;
273 
274 		xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
275 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
276 		__entry->ino = ip->i_ino;
277 		__entry->idx = idx;
278 		__entry->startoff = r.br_startoff;
279 		__entry->startblock = r.br_startblock;
280 		__entry->blockcount = r.br_blockcount;
281 		__entry->state = r.br_state;
282 		__entry->bmap_state = state;
283 		__entry->caller_ip = caller_ip;
284 	),
285 	TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
286 		  "offset %lld block %lld count %lld flag %d caller %ps",
287 		  MAJOR(__entry->dev), MINOR(__entry->dev),
288 		  __entry->ino,
289 		  __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
290 		  (long)__entry->idx,
291 		  __entry->startoff,
292 		  (__int64_t)__entry->startblock,
293 		  __entry->blockcount,
294 		  __entry->state,
295 		  (char *)__entry->caller_ip)
296 )
297 
298 #define DEFINE_BMAP_EVENT(name) \
299 DEFINE_EVENT(xfs_bmap_class, name, \
300 	TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
301 		 unsigned long caller_ip), \
302 	TP_ARGS(ip, idx, state, caller_ip))
303 DEFINE_BMAP_EVENT(xfs_iext_remove);
304 DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
305 DEFINE_BMAP_EVENT(xfs_bmap_post_update);
306 DEFINE_BMAP_EVENT(xfs_extlist);
307 
308 DECLARE_EVENT_CLASS(xfs_buf_class,
309 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
310 	TP_ARGS(bp, caller_ip),
311 	TP_STRUCT__entry(
312 		__field(dev_t, dev)
313 		__field(xfs_daddr_t, bno)
314 		__field(int, nblks)
315 		__field(int, hold)
316 		__field(int, pincount)
317 		__field(unsigned, lockval)
318 		__field(unsigned, flags)
319 		__field(unsigned long, caller_ip)
320 	),
321 	TP_fast_assign(
322 		__entry->dev = bp->b_target->bt_dev;
323 		__entry->bno = bp->b_bn;
324 		__entry->nblks = bp->b_length;
325 		__entry->hold = atomic_read(&bp->b_hold);
326 		__entry->pincount = atomic_read(&bp->b_pin_count);
327 		__entry->lockval = bp->b_sema.count;
328 		__entry->flags = bp->b_flags;
329 		__entry->caller_ip = caller_ip;
330 	),
331 	TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
332 		  "lock %d flags %s caller %ps",
333 		  MAJOR(__entry->dev), MINOR(__entry->dev),
334 		  (unsigned long long)__entry->bno,
335 		  __entry->nblks,
336 		  __entry->hold,
337 		  __entry->pincount,
338 		  __entry->lockval,
339 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
340 		  (void *)__entry->caller_ip)
341 )
342 
343 #define DEFINE_BUF_EVENT(name) \
344 DEFINE_EVENT(xfs_buf_class, name, \
345 	TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
346 	TP_ARGS(bp, caller_ip))
347 DEFINE_BUF_EVENT(xfs_buf_init);
348 DEFINE_BUF_EVENT(xfs_buf_free);
349 DEFINE_BUF_EVENT(xfs_buf_hold);
350 DEFINE_BUF_EVENT(xfs_buf_rele);
351 DEFINE_BUF_EVENT(xfs_buf_iodone);
352 DEFINE_BUF_EVENT(xfs_buf_submit);
353 DEFINE_BUF_EVENT(xfs_buf_submit_wait);
354 DEFINE_BUF_EVENT(xfs_buf_bawrite);
355 DEFINE_BUF_EVENT(xfs_buf_lock);
356 DEFINE_BUF_EVENT(xfs_buf_lock_done);
357 DEFINE_BUF_EVENT(xfs_buf_trylock);
358 DEFINE_BUF_EVENT(xfs_buf_unlock);
359 DEFINE_BUF_EVENT(xfs_buf_iowait);
360 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
361 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
362 DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
363 DEFINE_BUF_EVENT(xfs_buf_delwri_split);
364 DEFINE_BUF_EVENT(xfs_buf_get_uncached);
365 DEFINE_BUF_EVENT(xfs_bdstrat_shut);
366 DEFINE_BUF_EVENT(xfs_buf_item_relse);
367 DEFINE_BUF_EVENT(xfs_buf_item_iodone);
368 DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
369 DEFINE_BUF_EVENT(xfs_buf_error_relse);
370 DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
371 DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
372 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
373 
374 /* not really buffer traces, but the buf provides useful information */
375 DEFINE_BUF_EVENT(xfs_btree_corrupt);
376 DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
377 DEFINE_BUF_EVENT(xfs_reset_dqcounts);
378 DEFINE_BUF_EVENT(xfs_inode_item_push);
379 
380 /* pass flags explicitly */
381 DECLARE_EVENT_CLASS(xfs_buf_flags_class,
382 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
383 	TP_ARGS(bp, flags, caller_ip),
384 	TP_STRUCT__entry(
385 		__field(dev_t, dev)
386 		__field(xfs_daddr_t, bno)
387 		__field(size_t, buffer_length)
388 		__field(int, hold)
389 		__field(int, pincount)
390 		__field(unsigned, lockval)
391 		__field(unsigned, flags)
392 		__field(unsigned long, caller_ip)
393 	),
394 	TP_fast_assign(
395 		__entry->dev = bp->b_target->bt_dev;
396 		__entry->bno = bp->b_bn;
397 		__entry->buffer_length = BBTOB(bp->b_length);
398 		__entry->flags = flags;
399 		__entry->hold = atomic_read(&bp->b_hold);
400 		__entry->pincount = atomic_read(&bp->b_pin_count);
401 		__entry->lockval = bp->b_sema.count;
402 		__entry->caller_ip = caller_ip;
403 	),
404 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
405 		  "lock %d flags %s caller %ps",
406 		  MAJOR(__entry->dev), MINOR(__entry->dev),
407 		  (unsigned long long)__entry->bno,
408 		  __entry->buffer_length,
409 		  __entry->hold,
410 		  __entry->pincount,
411 		  __entry->lockval,
412 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
413 		  (void *)__entry->caller_ip)
414 )
415 
416 #define DEFINE_BUF_FLAGS_EVENT(name) \
417 DEFINE_EVENT(xfs_buf_flags_class, name, \
418 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
419 	TP_ARGS(bp, flags, caller_ip))
420 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
421 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
422 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
423 
424 TRACE_EVENT(xfs_buf_ioerror,
425 	TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
426 	TP_ARGS(bp, error, caller_ip),
427 	TP_STRUCT__entry(
428 		__field(dev_t, dev)
429 		__field(xfs_daddr_t, bno)
430 		__field(size_t, buffer_length)
431 		__field(unsigned, flags)
432 		__field(int, hold)
433 		__field(int, pincount)
434 		__field(unsigned, lockval)
435 		__field(int, error)
436 		__field(unsigned long, caller_ip)
437 	),
438 	TP_fast_assign(
439 		__entry->dev = bp->b_target->bt_dev;
440 		__entry->bno = bp->b_bn;
441 		__entry->buffer_length = BBTOB(bp->b_length);
442 		__entry->hold = atomic_read(&bp->b_hold);
443 		__entry->pincount = atomic_read(&bp->b_pin_count);
444 		__entry->lockval = bp->b_sema.count;
445 		__entry->error = error;
446 		__entry->flags = bp->b_flags;
447 		__entry->caller_ip = caller_ip;
448 	),
449 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
450 		  "lock %d error %d flags %s caller %ps",
451 		  MAJOR(__entry->dev), MINOR(__entry->dev),
452 		  (unsigned long long)__entry->bno,
453 		  __entry->buffer_length,
454 		  __entry->hold,
455 		  __entry->pincount,
456 		  __entry->lockval,
457 		  __entry->error,
458 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
459 		  (void *)__entry->caller_ip)
460 );
461 
462 DECLARE_EVENT_CLASS(xfs_buf_item_class,
463 	TP_PROTO(struct xfs_buf_log_item *bip),
464 	TP_ARGS(bip),
465 	TP_STRUCT__entry(
466 		__field(dev_t, dev)
467 		__field(xfs_daddr_t, buf_bno)
468 		__field(size_t, buf_len)
469 		__field(int, buf_hold)
470 		__field(int, buf_pincount)
471 		__field(int, buf_lockval)
472 		__field(unsigned, buf_flags)
473 		__field(unsigned, bli_recur)
474 		__field(int, bli_refcount)
475 		__field(unsigned, bli_flags)
476 		__field(void *, li_desc)
477 		__field(unsigned, li_flags)
478 	),
479 	TP_fast_assign(
480 		__entry->dev = bip->bli_buf->b_target->bt_dev;
481 		__entry->bli_flags = bip->bli_flags;
482 		__entry->bli_recur = bip->bli_recur;
483 		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
484 		__entry->buf_bno = bip->bli_buf->b_bn;
485 		__entry->buf_len = BBTOB(bip->bli_buf->b_length);
486 		__entry->buf_flags = bip->bli_buf->b_flags;
487 		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
488 		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
489 		__entry->buf_lockval = bip->bli_buf->b_sema.count;
490 		__entry->li_desc = bip->bli_item.li_desc;
491 		__entry->li_flags = bip->bli_item.li_flags;
492 	),
493 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
494 		  "lock %d flags %s recur %d refcount %d bliflags %s "
495 		  "lidesc 0x%p liflags %s",
496 		  MAJOR(__entry->dev), MINOR(__entry->dev),
497 		  (unsigned long long)__entry->buf_bno,
498 		  __entry->buf_len,
499 		  __entry->buf_hold,
500 		  __entry->buf_pincount,
501 		  __entry->buf_lockval,
502 		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
503 		  __entry->bli_recur,
504 		  __entry->bli_refcount,
505 		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
506 		  __entry->li_desc,
507 		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
508 )
509 
510 #define DEFINE_BUF_ITEM_EVENT(name) \
511 DEFINE_EVENT(xfs_buf_item_class, name, \
512 	TP_PROTO(struct xfs_buf_log_item *bip), \
513 	TP_ARGS(bip))
514 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
515 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
516 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
517 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
518 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
519 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
520 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
521 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
522 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
523 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
524 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
525 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
526 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
527 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
528 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
529 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
530 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
531 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
532 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
533 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
534 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
535 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
536 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
537 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
538 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
539 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
540 DEFINE_BUF_ITEM_EVENT(xfs_trans_buf_ordered);
541 
542 DECLARE_EVENT_CLASS(xfs_filestream_class,
543 	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
544 	TP_ARGS(ip, agno),
545 	TP_STRUCT__entry(
546 		__field(dev_t, dev)
547 		__field(xfs_ino_t, ino)
548 		__field(xfs_agnumber_t, agno)
549 		__field(int, streams)
550 	),
551 	TP_fast_assign(
552 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
553 		__entry->ino = ip->i_ino;
554 		__entry->agno = agno;
555 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
556 	),
557 	TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
558 		  MAJOR(__entry->dev), MINOR(__entry->dev),
559 		  __entry->ino,
560 		  __entry->agno,
561 		  __entry->streams)
562 )
563 #define DEFINE_FILESTREAM_EVENT(name) \
564 DEFINE_EVENT(xfs_filestream_class, name, \
565 	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
566 	TP_ARGS(ip, agno))
567 DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
568 DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
569 DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
570 
571 TRACE_EVENT(xfs_filestream_pick,
572 	TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
573 		 xfs_extlen_t free, int nscan),
574 	TP_ARGS(ip, agno, free, nscan),
575 	TP_STRUCT__entry(
576 		__field(dev_t, dev)
577 		__field(xfs_ino_t, ino)
578 		__field(xfs_agnumber_t, agno)
579 		__field(int, streams)
580 		__field(xfs_extlen_t, free)
581 		__field(int, nscan)
582 	),
583 	TP_fast_assign(
584 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
585 		__entry->ino = ip->i_ino;
586 		__entry->agno = agno;
587 		__entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
588 		__entry->free = free;
589 		__entry->nscan = nscan;
590 	),
591 	TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
592 		  MAJOR(__entry->dev), MINOR(__entry->dev),
593 		  __entry->ino,
594 		  __entry->agno,
595 		  __entry->streams,
596 		  __entry->free,
597 		  __entry->nscan)
598 );
599 
600 DECLARE_EVENT_CLASS(xfs_lock_class,
601 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
602 		 unsigned long caller_ip),
603 	TP_ARGS(ip,  lock_flags, caller_ip),
604 	TP_STRUCT__entry(
605 		__field(dev_t, dev)
606 		__field(xfs_ino_t, ino)
607 		__field(int, lock_flags)
608 		__field(unsigned long, caller_ip)
609 	),
610 	TP_fast_assign(
611 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
612 		__entry->ino = ip->i_ino;
613 		__entry->lock_flags = lock_flags;
614 		__entry->caller_ip = caller_ip;
615 	),
616 	TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
617 		  MAJOR(__entry->dev), MINOR(__entry->dev),
618 		  __entry->ino,
619 		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
620 		  (void *)__entry->caller_ip)
621 )
622 
623 #define DEFINE_LOCK_EVENT(name) \
624 DEFINE_EVENT(xfs_lock_class, name, \
625 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
626 		 unsigned long caller_ip), \
627 	TP_ARGS(ip,  lock_flags, caller_ip))
628 DEFINE_LOCK_EVENT(xfs_ilock);
629 DEFINE_LOCK_EVENT(xfs_ilock_nowait);
630 DEFINE_LOCK_EVENT(xfs_ilock_demote);
631 DEFINE_LOCK_EVENT(xfs_iunlock);
632 
633 DECLARE_EVENT_CLASS(xfs_inode_class,
634 	TP_PROTO(struct xfs_inode *ip),
635 	TP_ARGS(ip),
636 	TP_STRUCT__entry(
637 		__field(dev_t, dev)
638 		__field(xfs_ino_t, ino)
639 	),
640 	TP_fast_assign(
641 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
642 		__entry->ino = ip->i_ino;
643 	),
644 	TP_printk("dev %d:%d ino 0x%llx",
645 		  MAJOR(__entry->dev), MINOR(__entry->dev),
646 		  __entry->ino)
647 )
648 
649 #define DEFINE_INODE_EVENT(name) \
650 DEFINE_EVENT(xfs_inode_class, name, \
651 	TP_PROTO(struct xfs_inode *ip), \
652 	TP_ARGS(ip))
653 DEFINE_INODE_EVENT(xfs_iget_skip);
654 DEFINE_INODE_EVENT(xfs_iget_reclaim);
655 DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
656 DEFINE_INODE_EVENT(xfs_iget_hit);
657 DEFINE_INODE_EVENT(xfs_iget_miss);
658 
659 DEFINE_INODE_EVENT(xfs_getattr);
660 DEFINE_INODE_EVENT(xfs_setattr);
661 DEFINE_INODE_EVENT(xfs_readlink);
662 DEFINE_INODE_EVENT(xfs_inactive_symlink);
663 DEFINE_INODE_EVENT(xfs_alloc_file_space);
664 DEFINE_INODE_EVENT(xfs_free_file_space);
665 DEFINE_INODE_EVENT(xfs_zero_file_space);
666 DEFINE_INODE_EVENT(xfs_collapse_file_space);
667 DEFINE_INODE_EVENT(xfs_insert_file_space);
668 DEFINE_INODE_EVENT(xfs_readdir);
669 #ifdef CONFIG_XFS_POSIX_ACL
670 DEFINE_INODE_EVENT(xfs_get_acl);
671 #endif
672 DEFINE_INODE_EVENT(xfs_vm_bmap);
673 DEFINE_INODE_EVENT(xfs_file_ioctl);
674 DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
675 DEFINE_INODE_EVENT(xfs_ioctl_setattr);
676 DEFINE_INODE_EVENT(xfs_dir_fsync);
677 DEFINE_INODE_EVENT(xfs_file_fsync);
678 DEFINE_INODE_EVENT(xfs_destroy_inode);
679 DEFINE_INODE_EVENT(xfs_evict_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 
689 DEFINE_INODE_EVENT(xfs_filemap_fault);
690 DEFINE_INODE_EVENT(xfs_filemap_pmd_fault);
691 DEFINE_INODE_EVENT(xfs_filemap_page_mkwrite);
692 
693 DECLARE_EVENT_CLASS(xfs_iref_class,
694 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
695 	TP_ARGS(ip, caller_ip),
696 	TP_STRUCT__entry(
697 		__field(dev_t, dev)
698 		__field(xfs_ino_t, ino)
699 		__field(int, count)
700 		__field(int, pincount)
701 		__field(unsigned long, caller_ip)
702 	),
703 	TP_fast_assign(
704 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
705 		__entry->ino = ip->i_ino;
706 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
707 		__entry->pincount = atomic_read(&ip->i_pincount);
708 		__entry->caller_ip = caller_ip;
709 	),
710 	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
711 		  MAJOR(__entry->dev), MINOR(__entry->dev),
712 		  __entry->ino,
713 		  __entry->count,
714 		  __entry->pincount,
715 		  (char *)__entry->caller_ip)
716 )
717 
718 TRACE_EVENT(xfs_iomap_prealloc_size,
719 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
720 		 unsigned int writeio_blocks),
721 	TP_ARGS(ip, blocks, shift, writeio_blocks),
722 	TP_STRUCT__entry(
723 		__field(dev_t, dev)
724 		__field(xfs_ino_t, ino)
725 		__field(xfs_fsblock_t, blocks)
726 		__field(int, shift)
727 		__field(unsigned int, writeio_blocks)
728 	),
729 	TP_fast_assign(
730 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
731 		__entry->ino = ip->i_ino;
732 		__entry->blocks = blocks;
733 		__entry->shift = shift;
734 		__entry->writeio_blocks = writeio_blocks;
735 	),
736 	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
737 		  "m_writeio_blocks %u",
738 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
739 		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
740 )
741 
742 TRACE_EVENT(xfs_irec_merge_pre,
743 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
744 		 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
745 	TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
746 	TP_STRUCT__entry(
747 		__field(dev_t, dev)
748 		__field(xfs_agnumber_t, agno)
749 		__field(xfs_agino_t, agino)
750 		__field(uint16_t, holemask)
751 		__field(xfs_agino_t, nagino)
752 		__field(uint16_t, nholemask)
753 	),
754 	TP_fast_assign(
755 		__entry->dev = mp->m_super->s_dev;
756 		__entry->agno = agno;
757 		__entry->agino = agino;
758 		__entry->holemask = holemask;
759 		__entry->nagino = nagino;
760 		__entry->nholemask = holemask;
761 	),
762 	TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
763 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
764 		  __entry->agino, __entry->holemask, __entry->nagino,
765 		  __entry->nholemask)
766 )
767 
768 TRACE_EVENT(xfs_irec_merge_post,
769 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
770 		 uint16_t holemask),
771 	TP_ARGS(mp, agno, agino, holemask),
772 	TP_STRUCT__entry(
773 		__field(dev_t, dev)
774 		__field(xfs_agnumber_t, agno)
775 		__field(xfs_agino_t, agino)
776 		__field(uint16_t, holemask)
777 	),
778 	TP_fast_assign(
779 		__entry->dev = mp->m_super->s_dev;
780 		__entry->agno = agno;
781 		__entry->agino = agino;
782 		__entry->holemask = holemask;
783 	),
784 	TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
785 		  MINOR(__entry->dev), __entry->agno, __entry->agino,
786 		  __entry->holemask)
787 )
788 
789 #define DEFINE_IREF_EVENT(name) \
790 DEFINE_EVENT(xfs_iref_class, name, \
791 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
792 	TP_ARGS(ip, caller_ip))
793 DEFINE_IREF_EVENT(xfs_ihold);
794 DEFINE_IREF_EVENT(xfs_irele);
795 DEFINE_IREF_EVENT(xfs_inode_pin);
796 DEFINE_IREF_EVENT(xfs_inode_unpin);
797 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
798 
799 DECLARE_EVENT_CLASS(xfs_namespace_class,
800 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
801 	TP_ARGS(dp, name),
802 	TP_STRUCT__entry(
803 		__field(dev_t, dev)
804 		__field(xfs_ino_t, dp_ino)
805 		__field(int, namelen)
806 		__dynamic_array(char, name, name->len)
807 	),
808 	TP_fast_assign(
809 		__entry->dev = VFS_I(dp)->i_sb->s_dev;
810 		__entry->dp_ino = dp->i_ino;
811 		__entry->namelen = name->len;
812 		memcpy(__get_str(name), name->name, name->len);
813 	),
814 	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
815 		  MAJOR(__entry->dev), MINOR(__entry->dev),
816 		  __entry->dp_ino,
817 		  __entry->namelen,
818 		  __get_str(name))
819 )
820 
821 #define DEFINE_NAMESPACE_EVENT(name) \
822 DEFINE_EVENT(xfs_namespace_class, name, \
823 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
824 	TP_ARGS(dp, name))
825 DEFINE_NAMESPACE_EVENT(xfs_remove);
826 DEFINE_NAMESPACE_EVENT(xfs_link);
827 DEFINE_NAMESPACE_EVENT(xfs_lookup);
828 DEFINE_NAMESPACE_EVENT(xfs_create);
829 DEFINE_NAMESPACE_EVENT(xfs_symlink);
830 
831 TRACE_EVENT(xfs_rename,
832 	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
833 		 struct xfs_name *src_name, struct xfs_name *target_name),
834 	TP_ARGS(src_dp, target_dp, src_name, target_name),
835 	TP_STRUCT__entry(
836 		__field(dev_t, dev)
837 		__field(xfs_ino_t, src_dp_ino)
838 		__field(xfs_ino_t, target_dp_ino)
839 		__field(int, src_namelen)
840 		__field(int, target_namelen)
841 		__dynamic_array(char, src_name, src_name->len)
842 		__dynamic_array(char, target_name, target_name->len)
843 	),
844 	TP_fast_assign(
845 		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
846 		__entry->src_dp_ino = src_dp->i_ino;
847 		__entry->target_dp_ino = target_dp->i_ino;
848 		__entry->src_namelen = src_name->len;
849 		__entry->target_namelen = target_name->len;
850 		memcpy(__get_str(src_name), src_name->name, src_name->len);
851 		memcpy(__get_str(target_name), target_name->name,
852 			target_name->len);
853 	),
854 	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
855 		  " src name %.*s target name %.*s",
856 		  MAJOR(__entry->dev), MINOR(__entry->dev),
857 		  __entry->src_dp_ino,
858 		  __entry->target_dp_ino,
859 		  __entry->src_namelen,
860 		  __get_str(src_name),
861 		  __entry->target_namelen,
862 		  __get_str(target_name))
863 )
864 
865 DECLARE_EVENT_CLASS(xfs_dquot_class,
866 	TP_PROTO(struct xfs_dquot *dqp),
867 	TP_ARGS(dqp),
868 	TP_STRUCT__entry(
869 		__field(dev_t, dev)
870 		__field(u32, id)
871 		__field(unsigned, flags)
872 		__field(unsigned, nrefs)
873 		__field(unsigned long long, res_bcount)
874 		__field(unsigned long long, bcount)
875 		__field(unsigned long long, icount)
876 		__field(unsigned long long, blk_hardlimit)
877 		__field(unsigned long long, blk_softlimit)
878 		__field(unsigned long long, ino_hardlimit)
879 		__field(unsigned long long, ino_softlimit)
880 	), \
881 	TP_fast_assign(
882 		__entry->dev = dqp->q_mount->m_super->s_dev;
883 		__entry->id = be32_to_cpu(dqp->q_core.d_id);
884 		__entry->flags = dqp->dq_flags;
885 		__entry->nrefs = dqp->q_nrefs;
886 		__entry->res_bcount = dqp->q_res_bcount;
887 		__entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
888 		__entry->icount = be64_to_cpu(dqp->q_core.d_icount);
889 		__entry->blk_hardlimit =
890 			be64_to_cpu(dqp->q_core.d_blk_hardlimit);
891 		__entry->blk_softlimit =
892 			be64_to_cpu(dqp->q_core.d_blk_softlimit);
893 		__entry->ino_hardlimit =
894 			be64_to_cpu(dqp->q_core.d_ino_hardlimit);
895 		__entry->ino_softlimit =
896 			be64_to_cpu(dqp->q_core.d_ino_softlimit);
897 	),
898 	TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
899 		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
900 		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
901 		  MAJOR(__entry->dev), MINOR(__entry->dev),
902 		  __entry->id,
903 		  __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
904 		  __entry->nrefs,
905 		  __entry->res_bcount,
906 		  __entry->bcount,
907 		  __entry->blk_hardlimit,
908 		  __entry->blk_softlimit,
909 		  __entry->icount,
910 		  __entry->ino_hardlimit,
911 		  __entry->ino_softlimit)
912 )
913 
914 #define DEFINE_DQUOT_EVENT(name) \
915 DEFINE_EVENT(xfs_dquot_class, name, \
916 	TP_PROTO(struct xfs_dquot *dqp), \
917 	TP_ARGS(dqp))
918 DEFINE_DQUOT_EVENT(xfs_dqadjust);
919 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
920 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
921 DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
922 DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
923 DEFINE_DQUOT_EVENT(xfs_dqattach_found);
924 DEFINE_DQUOT_EVENT(xfs_dqattach_get);
925 DEFINE_DQUOT_EVENT(xfs_dqalloc);
926 DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
927 DEFINE_DQUOT_EVENT(xfs_dqread);
928 DEFINE_DQUOT_EVENT(xfs_dqread_fail);
929 DEFINE_DQUOT_EVENT(xfs_dqget_hit);
930 DEFINE_DQUOT_EVENT(xfs_dqget_miss);
931 DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
932 DEFINE_DQUOT_EVENT(xfs_dqget_dup);
933 DEFINE_DQUOT_EVENT(xfs_dqput);
934 DEFINE_DQUOT_EVENT(xfs_dqput_wait);
935 DEFINE_DQUOT_EVENT(xfs_dqput_free);
936 DEFINE_DQUOT_EVENT(xfs_dqrele);
937 DEFINE_DQUOT_EVENT(xfs_dqflush);
938 DEFINE_DQUOT_EVENT(xfs_dqflush_force);
939 DEFINE_DQUOT_EVENT(xfs_dqflush_done);
940 
941 DECLARE_EVENT_CLASS(xfs_loggrant_class,
942 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
943 	TP_ARGS(log, tic),
944 	TP_STRUCT__entry(
945 		__field(dev_t, dev)
946 		__field(unsigned, trans_type)
947 		__field(char, ocnt)
948 		__field(char, cnt)
949 		__field(int, curr_res)
950 		__field(int, unit_res)
951 		__field(unsigned int, flags)
952 		__field(int, reserveq)
953 		__field(int, writeq)
954 		__field(int, grant_reserve_cycle)
955 		__field(int, grant_reserve_bytes)
956 		__field(int, grant_write_cycle)
957 		__field(int, grant_write_bytes)
958 		__field(int, curr_cycle)
959 		__field(int, curr_block)
960 		__field(xfs_lsn_t, tail_lsn)
961 	),
962 	TP_fast_assign(
963 		__entry->dev = log->l_mp->m_super->s_dev;
964 		__entry->trans_type = tic->t_trans_type;
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 type %s 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 		  __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
990 		  __entry->ocnt,
991 		  __entry->cnt,
992 		  __entry->curr_res,
993 		  __entry->unit_res,
994 		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
995 		  __entry->reserveq ? "empty" : "active",
996 		  __entry->writeq ? "empty" : "active",
997 		  __entry->grant_reserve_cycle,
998 		  __entry->grant_reserve_bytes,
999 		  __entry->grant_write_cycle,
1000 		  __entry->grant_write_bytes,
1001 		  __entry->curr_cycle,
1002 		  __entry->curr_block,
1003 		  CYCLE_LSN(__entry->tail_lsn),
1004 		  BLOCK_LSN(__entry->tail_lsn)
1005 	)
1006 )
1007 
1008 #define DEFINE_LOGGRANT_EVENT(name) \
1009 DEFINE_EVENT(xfs_loggrant_class, name, \
1010 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1011 	TP_ARGS(log, tic))
1012 DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1013 DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
1014 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1015 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1016 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1017 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1018 DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1019 DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1020 DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1021 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1022 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1023 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1024 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1025 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1026 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1027 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1028 
1029 DECLARE_EVENT_CLASS(xfs_log_item_class,
1030 	TP_PROTO(struct xfs_log_item *lip),
1031 	TP_ARGS(lip),
1032 	TP_STRUCT__entry(
1033 		__field(dev_t, dev)
1034 		__field(void *, lip)
1035 		__field(uint, type)
1036 		__field(uint, flags)
1037 		__field(xfs_lsn_t, lsn)
1038 	),
1039 	TP_fast_assign(
1040 		__entry->dev = lip->li_mountp->m_super->s_dev;
1041 		__entry->lip = lip;
1042 		__entry->type = lip->li_type;
1043 		__entry->flags = lip->li_flags;
1044 		__entry->lsn = lip->li_lsn;
1045 	),
1046 	TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1047 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1048 		  __entry->lip,
1049 		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1050 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1051 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1052 )
1053 
1054 TRACE_EVENT(xfs_log_force,
1055 	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
1056 	TP_ARGS(mp, lsn),
1057 	TP_STRUCT__entry(
1058 		__field(dev_t, dev)
1059 		__field(xfs_lsn_t, lsn)
1060 	),
1061 	TP_fast_assign(
1062 		__entry->dev = mp->m_super->s_dev;
1063 		__entry->lsn = lsn;
1064 	),
1065 	TP_printk("dev %d:%d lsn 0x%llx",
1066 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1067 		  __entry->lsn)
1068 )
1069 
1070 #define DEFINE_LOG_ITEM_EVENT(name) \
1071 DEFINE_EVENT(xfs_log_item_class, name, \
1072 	TP_PROTO(struct xfs_log_item *lip), \
1073 	TP_ARGS(lip))
1074 DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1075 DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1076 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1077 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1078 
1079 DECLARE_EVENT_CLASS(xfs_ail_class,
1080 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1081 	TP_ARGS(lip, old_lsn, new_lsn),
1082 	TP_STRUCT__entry(
1083 		__field(dev_t, dev)
1084 		__field(void *, lip)
1085 		__field(uint, type)
1086 		__field(uint, flags)
1087 		__field(xfs_lsn_t, old_lsn)
1088 		__field(xfs_lsn_t, new_lsn)
1089 	),
1090 	TP_fast_assign(
1091 		__entry->dev = lip->li_mountp->m_super->s_dev;
1092 		__entry->lip = lip;
1093 		__entry->type = lip->li_type;
1094 		__entry->flags = lip->li_flags;
1095 		__entry->old_lsn = old_lsn;
1096 		__entry->new_lsn = new_lsn;
1097 	),
1098 	TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1099 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1100 		  __entry->lip,
1101 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1102 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1103 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1104 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1105 )
1106 
1107 #define DEFINE_AIL_EVENT(name) \
1108 DEFINE_EVENT(xfs_ail_class, name, \
1109 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1110 	TP_ARGS(lip, old_lsn, new_lsn))
1111 DEFINE_AIL_EVENT(xfs_ail_insert);
1112 DEFINE_AIL_EVENT(xfs_ail_move);
1113 DEFINE_AIL_EVENT(xfs_ail_delete);
1114 
1115 TRACE_EVENT(xfs_log_assign_tail_lsn,
1116 	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1117 	TP_ARGS(log, new_lsn),
1118 	TP_STRUCT__entry(
1119 		__field(dev_t, dev)
1120 		__field(xfs_lsn_t, new_lsn)
1121 		__field(xfs_lsn_t, old_lsn)
1122 		__field(xfs_lsn_t, last_sync_lsn)
1123 	),
1124 	TP_fast_assign(
1125 		__entry->dev = log->l_mp->m_super->s_dev;
1126 		__entry->new_lsn = new_lsn;
1127 		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1128 		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1129 	),
1130 	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1131 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1132 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1133 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1134 		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1135 )
1136 
1137 DECLARE_EVENT_CLASS(xfs_file_class,
1138 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
1139 	TP_ARGS(ip, count, offset, flags),
1140 	TP_STRUCT__entry(
1141 		__field(dev_t, dev)
1142 		__field(xfs_ino_t, ino)
1143 		__field(xfs_fsize_t, size)
1144 		__field(loff_t, offset)
1145 		__field(size_t, count)
1146 		__field(int, flags)
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 		__entry->flags = flags;
1155 	),
1156 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
1157 		  "offset 0x%llx count 0x%zx ioflags %s",
1158 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1159 		  __entry->ino,
1160 		  __entry->size,
1161 		  __entry->offset,
1162 		  __entry->count,
1163 		  __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
1164 )
1165 
1166 #define DEFINE_RW_EVENT(name)		\
1167 DEFINE_EVENT(xfs_file_class, name,	\
1168 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),	\
1169 	TP_ARGS(ip, count, offset, flags))
1170 DEFINE_RW_EVENT(xfs_file_read);
1171 DEFINE_RW_EVENT(xfs_file_buffered_write);
1172 DEFINE_RW_EVENT(xfs_file_direct_write);
1173 DEFINE_RW_EVENT(xfs_file_splice_read);
1174 
1175 DECLARE_EVENT_CLASS(xfs_page_class,
1176 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1177 		 unsigned int len),
1178 	TP_ARGS(inode, page, off, len),
1179 	TP_STRUCT__entry(
1180 		__field(dev_t, dev)
1181 		__field(xfs_ino_t, ino)
1182 		__field(pgoff_t, pgoff)
1183 		__field(loff_t, size)
1184 		__field(unsigned long, offset)
1185 		__field(unsigned int, length)
1186 		__field(int, delalloc)
1187 		__field(int, unwritten)
1188 	),
1189 	TP_fast_assign(
1190 		int delalloc = -1, unwritten = -1;
1191 
1192 		if (page_has_buffers(page))
1193 			xfs_count_page_state(page, &delalloc, &unwritten);
1194 		__entry->dev = inode->i_sb->s_dev;
1195 		__entry->ino = XFS_I(inode)->i_ino;
1196 		__entry->pgoff = page_offset(page);
1197 		__entry->size = i_size_read(inode);
1198 		__entry->offset = off;
1199 		__entry->length = len;
1200 		__entry->delalloc = delalloc;
1201 		__entry->unwritten = unwritten;
1202 	),
1203 	TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
1204 		  "length %x delalloc %d unwritten %d",
1205 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1206 		  __entry->ino,
1207 		  __entry->pgoff,
1208 		  __entry->size,
1209 		  __entry->offset,
1210 		  __entry->length,
1211 		  __entry->delalloc,
1212 		  __entry->unwritten)
1213 )
1214 
1215 #define DEFINE_PAGE_EVENT(name)		\
1216 DEFINE_EVENT(xfs_page_class, name,	\
1217 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1218 		 unsigned int len),	\
1219 	TP_ARGS(inode, page, off, len))
1220 DEFINE_PAGE_EVENT(xfs_writepage);
1221 DEFINE_PAGE_EVENT(xfs_releasepage);
1222 DEFINE_PAGE_EVENT(xfs_invalidatepage);
1223 
1224 DECLARE_EVENT_CLASS(xfs_imap_class,
1225 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1226 		 int type, struct xfs_bmbt_irec *irec),
1227 	TP_ARGS(ip, offset, count, type, irec),
1228 	TP_STRUCT__entry(
1229 		__field(dev_t, dev)
1230 		__field(xfs_ino_t, ino)
1231 		__field(loff_t, size)
1232 		__field(loff_t, offset)
1233 		__field(size_t, count)
1234 		__field(int, type)
1235 		__field(xfs_fileoff_t, startoff)
1236 		__field(xfs_fsblock_t, startblock)
1237 		__field(xfs_filblks_t, blockcount)
1238 	),
1239 	TP_fast_assign(
1240 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1241 		__entry->ino = ip->i_ino;
1242 		__entry->size = ip->i_d.di_size;
1243 		__entry->offset = offset;
1244 		__entry->count = count;
1245 		__entry->type = type;
1246 		__entry->startoff = irec ? irec->br_startoff : 0;
1247 		__entry->startblock = irec ? irec->br_startblock : 0;
1248 		__entry->blockcount = irec ? irec->br_blockcount : 0;
1249 	),
1250 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1251 		  "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1252 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1253 		  __entry->ino,
1254 		  __entry->size,
1255 		  __entry->offset,
1256 		  __entry->count,
1257 		  __print_symbolic(__entry->type, XFS_IO_TYPES),
1258 		  __entry->startoff,
1259 		  (__int64_t)__entry->startblock,
1260 		  __entry->blockcount)
1261 )
1262 
1263 #define DEFINE_IOMAP_EVENT(name)	\
1264 DEFINE_EVENT(xfs_imap_class, name,	\
1265 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1266 		 int type, struct xfs_bmbt_irec *irec),		\
1267 	TP_ARGS(ip, offset, count, type, irec))
1268 DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1269 DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1270 DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1271 DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1272 DEFINE_IOMAP_EVENT(xfs_gbmap_direct);
1273 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_new);
1274 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_update);
1275 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_none);
1276 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_endio);
1277 
1278 DECLARE_EVENT_CLASS(xfs_simple_io_class,
1279 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1280 	TP_ARGS(ip, offset, count),
1281 	TP_STRUCT__entry(
1282 		__field(dev_t, dev)
1283 		__field(xfs_ino_t, ino)
1284 		__field(loff_t, isize)
1285 		__field(loff_t, disize)
1286 		__field(loff_t, offset)
1287 		__field(size_t, count)
1288 	),
1289 	TP_fast_assign(
1290 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1291 		__entry->ino = ip->i_ino;
1292 		__entry->isize = VFS_I(ip)->i_size;
1293 		__entry->disize = ip->i_d.di_size;
1294 		__entry->offset = offset;
1295 		__entry->count = count;
1296 	),
1297 	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1298 		  "offset 0x%llx count %zd",
1299 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1300 		  __entry->ino,
1301 		  __entry->isize,
1302 		  __entry->disize,
1303 		  __entry->offset,
1304 		  __entry->count)
1305 );
1306 
1307 #define DEFINE_SIMPLE_IO_EVENT(name)	\
1308 DEFINE_EVENT(xfs_simple_io_class, name,	\
1309 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1310 	TP_ARGS(ip, offset, count))
1311 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1312 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1313 DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1314 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1315 
1316 DECLARE_EVENT_CLASS(xfs_itrunc_class,
1317 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1318 	TP_ARGS(ip, new_size),
1319 	TP_STRUCT__entry(
1320 		__field(dev_t, dev)
1321 		__field(xfs_ino_t, ino)
1322 		__field(xfs_fsize_t, size)
1323 		__field(xfs_fsize_t, new_size)
1324 	),
1325 	TP_fast_assign(
1326 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1327 		__entry->ino = ip->i_ino;
1328 		__entry->size = ip->i_d.di_size;
1329 		__entry->new_size = new_size;
1330 	),
1331 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1332 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1333 		  __entry->ino,
1334 		  __entry->size,
1335 		  __entry->new_size)
1336 )
1337 
1338 #define DEFINE_ITRUNC_EVENT(name) \
1339 DEFINE_EVENT(xfs_itrunc_class, name, \
1340 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1341 	TP_ARGS(ip, new_size))
1342 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1343 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1344 
1345 TRACE_EVENT(xfs_pagecache_inval,
1346 	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1347 	TP_ARGS(ip, start, finish),
1348 	TP_STRUCT__entry(
1349 		__field(dev_t, dev)
1350 		__field(xfs_ino_t, ino)
1351 		__field(xfs_fsize_t, size)
1352 		__field(xfs_off_t, start)
1353 		__field(xfs_off_t, finish)
1354 	),
1355 	TP_fast_assign(
1356 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1357 		__entry->ino = ip->i_ino;
1358 		__entry->size = ip->i_d.di_size;
1359 		__entry->start = start;
1360 		__entry->finish = finish;
1361 	),
1362 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1363 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1364 		  __entry->ino,
1365 		  __entry->size,
1366 		  __entry->start,
1367 		  __entry->finish)
1368 );
1369 
1370 TRACE_EVENT(xfs_bunmap,
1371 	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1372 		 int flags, unsigned long caller_ip),
1373 	TP_ARGS(ip, bno, len, flags, caller_ip),
1374 	TP_STRUCT__entry(
1375 		__field(dev_t, dev)
1376 		__field(xfs_ino_t, ino)
1377 		__field(xfs_fsize_t, size)
1378 		__field(xfs_fileoff_t, bno)
1379 		__field(xfs_filblks_t, len)
1380 		__field(unsigned long, caller_ip)
1381 		__field(int, flags)
1382 	),
1383 	TP_fast_assign(
1384 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1385 		__entry->ino = ip->i_ino;
1386 		__entry->size = ip->i_d.di_size;
1387 		__entry->bno = bno;
1388 		__entry->len = len;
1389 		__entry->caller_ip = caller_ip;
1390 		__entry->flags = flags;
1391 	),
1392 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1393 		  "flags %s caller %ps",
1394 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1395 		  __entry->ino,
1396 		  __entry->size,
1397 		  __entry->bno,
1398 		  __entry->len,
1399 		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1400 		  (void *)__entry->caller_ip)
1401 
1402 );
1403 
1404 DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1405 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1406 		 xfs_agblock_t agbno, xfs_extlen_t len),
1407 	TP_ARGS(mp, agno, agbno, len),
1408 	TP_STRUCT__entry(
1409 		__field(dev_t, dev)
1410 		__field(xfs_agnumber_t, agno)
1411 		__field(xfs_agblock_t, agbno)
1412 		__field(xfs_extlen_t, len)
1413 	),
1414 	TP_fast_assign(
1415 		__entry->dev = mp->m_super->s_dev;
1416 		__entry->agno = agno;
1417 		__entry->agbno = agbno;
1418 		__entry->len = len;
1419 	),
1420 	TP_printk("dev %d:%d agno %u agbno %u len %u",
1421 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1422 		  __entry->agno,
1423 		  __entry->agbno,
1424 		  __entry->len)
1425 );
1426 #define DEFINE_BUSY_EVENT(name) \
1427 DEFINE_EVENT(xfs_extent_busy_class, name, \
1428 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1429 		 xfs_agblock_t agbno, xfs_extlen_t len), \
1430 	TP_ARGS(mp, agno, agbno, len))
1431 DEFINE_BUSY_EVENT(xfs_extent_busy);
1432 DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1433 DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1434 DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1435 DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1436 
1437 TRACE_EVENT(xfs_extent_busy_trim,
1438 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1439 		 xfs_agblock_t agbno, xfs_extlen_t len,
1440 		 xfs_agblock_t tbno, xfs_extlen_t tlen),
1441 	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1442 	TP_STRUCT__entry(
1443 		__field(dev_t, dev)
1444 		__field(xfs_agnumber_t, agno)
1445 		__field(xfs_agblock_t, agbno)
1446 		__field(xfs_extlen_t, len)
1447 		__field(xfs_agblock_t, tbno)
1448 		__field(xfs_extlen_t, tlen)
1449 	),
1450 	TP_fast_assign(
1451 		__entry->dev = mp->m_super->s_dev;
1452 		__entry->agno = agno;
1453 		__entry->agbno = agbno;
1454 		__entry->len = len;
1455 		__entry->tbno = tbno;
1456 		__entry->tlen = tlen;
1457 	),
1458 	TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1459 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1460 		  __entry->agno,
1461 		  __entry->agbno,
1462 		  __entry->len,
1463 		  __entry->tbno,
1464 		  __entry->tlen)
1465 );
1466 
1467 TRACE_EVENT(xfs_trans_commit_lsn,
1468 	TP_PROTO(struct xfs_trans *trans),
1469 	TP_ARGS(trans),
1470 	TP_STRUCT__entry(
1471 		__field(dev_t, dev)
1472 		__field(struct xfs_trans *, tp)
1473 		__field(xfs_lsn_t, lsn)
1474 	),
1475 	TP_fast_assign(
1476 		__entry->dev = trans->t_mountp->m_super->s_dev;
1477 		__entry->tp = trans;
1478 		__entry->lsn = trans->t_commit_lsn;
1479 	),
1480 	TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1481 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1482 		  __entry->tp,
1483 		  __entry->lsn)
1484 );
1485 
1486 TRACE_EVENT(xfs_agf,
1487 	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1488 		 unsigned long caller_ip),
1489 	TP_ARGS(mp, agf, flags, caller_ip),
1490 	TP_STRUCT__entry(
1491 		__field(dev_t, dev)
1492 		__field(xfs_agnumber_t, agno)
1493 		__field(int, flags)
1494 		__field(__u32, length)
1495 		__field(__u32, bno_root)
1496 		__field(__u32, cnt_root)
1497 		__field(__u32, bno_level)
1498 		__field(__u32, cnt_level)
1499 		__field(__u32, flfirst)
1500 		__field(__u32, fllast)
1501 		__field(__u32, flcount)
1502 		__field(__u32, freeblks)
1503 		__field(__u32, longest)
1504 		__field(unsigned long, caller_ip)
1505 	),
1506 	TP_fast_assign(
1507 		__entry->dev = mp->m_super->s_dev;
1508 		__entry->agno = be32_to_cpu(agf->agf_seqno),
1509 		__entry->flags = flags;
1510 		__entry->length = be32_to_cpu(agf->agf_length),
1511 		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1512 		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1513 		__entry->bno_level =
1514 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1515 		__entry->cnt_level =
1516 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1517 		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1518 		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1519 		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1520 		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1521 		__entry->longest = be32_to_cpu(agf->agf_longest);
1522 		__entry->caller_ip = caller_ip;
1523 	),
1524 	TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1525 		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1526 		  "freeblks %u longest %u caller %ps",
1527 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1528 		  __entry->agno,
1529 		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1530 		  __entry->length,
1531 		  __entry->bno_root,
1532 		  __entry->cnt_root,
1533 		  __entry->bno_level,
1534 		  __entry->cnt_level,
1535 		  __entry->flfirst,
1536 		  __entry->fllast,
1537 		  __entry->flcount,
1538 		  __entry->freeblks,
1539 		  __entry->longest,
1540 		  (void *)__entry->caller_ip)
1541 );
1542 
1543 TRACE_EVENT(xfs_free_extent,
1544 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1545 		 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1546 	TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1547 	TP_STRUCT__entry(
1548 		__field(dev_t, dev)
1549 		__field(xfs_agnumber_t, agno)
1550 		__field(xfs_agblock_t, agbno)
1551 		__field(xfs_extlen_t, len)
1552 		__field(int, isfl)
1553 		__field(int, haveleft)
1554 		__field(int, haveright)
1555 	),
1556 	TP_fast_assign(
1557 		__entry->dev = mp->m_super->s_dev;
1558 		__entry->agno = agno;
1559 		__entry->agbno = agbno;
1560 		__entry->len = len;
1561 		__entry->isfl = isfl;
1562 		__entry->haveleft = haveleft;
1563 		__entry->haveright = haveright;
1564 	),
1565 	TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1566 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1567 		  __entry->agno,
1568 		  __entry->agbno,
1569 		  __entry->len,
1570 		  __entry->isfl,
1571 		  __entry->haveleft ?
1572 			(__entry->haveright ? "both" : "left") :
1573 			(__entry->haveright ? "right" : "none"))
1574 
1575 );
1576 
1577 DECLARE_EVENT_CLASS(xfs_alloc_class,
1578 	TP_PROTO(struct xfs_alloc_arg *args),
1579 	TP_ARGS(args),
1580 	TP_STRUCT__entry(
1581 		__field(dev_t, dev)
1582 		__field(xfs_agnumber_t, agno)
1583 		__field(xfs_agblock_t, agbno)
1584 		__field(xfs_extlen_t, minlen)
1585 		__field(xfs_extlen_t, maxlen)
1586 		__field(xfs_extlen_t, mod)
1587 		__field(xfs_extlen_t, prod)
1588 		__field(xfs_extlen_t, minleft)
1589 		__field(xfs_extlen_t, total)
1590 		__field(xfs_extlen_t, alignment)
1591 		__field(xfs_extlen_t, minalignslop)
1592 		__field(xfs_extlen_t, len)
1593 		__field(short, type)
1594 		__field(short, otype)
1595 		__field(char, wasdel)
1596 		__field(char, wasfromfl)
1597 		__field(char, isfl)
1598 		__field(char, userdata)
1599 		__field(xfs_fsblock_t, firstblock)
1600 	),
1601 	TP_fast_assign(
1602 		__entry->dev = args->mp->m_super->s_dev;
1603 		__entry->agno = args->agno;
1604 		__entry->agbno = args->agbno;
1605 		__entry->minlen = args->minlen;
1606 		__entry->maxlen = args->maxlen;
1607 		__entry->mod = args->mod;
1608 		__entry->prod = args->prod;
1609 		__entry->minleft = args->minleft;
1610 		__entry->total = args->total;
1611 		__entry->alignment = args->alignment;
1612 		__entry->minalignslop = args->minalignslop;
1613 		__entry->len = args->len;
1614 		__entry->type = args->type;
1615 		__entry->otype = args->otype;
1616 		__entry->wasdel = args->wasdel;
1617 		__entry->wasfromfl = args->wasfromfl;
1618 		__entry->isfl = args->isfl;
1619 		__entry->userdata = args->userdata;
1620 		__entry->firstblock = args->firstblock;
1621 	),
1622 	TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1623 		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1624 		  "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1625 		  "userdata %d firstblock 0x%llx",
1626 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1627 		  __entry->agno,
1628 		  __entry->agbno,
1629 		  __entry->minlen,
1630 		  __entry->maxlen,
1631 		  __entry->mod,
1632 		  __entry->prod,
1633 		  __entry->minleft,
1634 		  __entry->total,
1635 		  __entry->alignment,
1636 		  __entry->minalignslop,
1637 		  __entry->len,
1638 		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1639 		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1640 		  __entry->wasdel,
1641 		  __entry->wasfromfl,
1642 		  __entry->isfl,
1643 		  __entry->userdata,
1644 		  (unsigned long long)__entry->firstblock)
1645 )
1646 
1647 #define DEFINE_ALLOC_EVENT(name) \
1648 DEFINE_EVENT(xfs_alloc_class, name, \
1649 	TP_PROTO(struct xfs_alloc_arg *args), \
1650 	TP_ARGS(args))
1651 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1652 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1653 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1654 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1655 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1656 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1657 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1658 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1659 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1660 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1661 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1662 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1663 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1664 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1665 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1666 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1667 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1668 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1669 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1670 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1671 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1672 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1673 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1674 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1675 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1676 
1677 DECLARE_EVENT_CLASS(xfs_da_class,
1678 	TP_PROTO(struct xfs_da_args *args),
1679 	TP_ARGS(args),
1680 	TP_STRUCT__entry(
1681 		__field(dev_t, dev)
1682 		__field(xfs_ino_t, ino)
1683 		__dynamic_array(char, name, args->namelen)
1684 		__field(int, namelen)
1685 		__field(xfs_dahash_t, hashval)
1686 		__field(xfs_ino_t, inumber)
1687 		__field(int, op_flags)
1688 	),
1689 	TP_fast_assign(
1690 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1691 		__entry->ino = args->dp->i_ino;
1692 		if (args->namelen)
1693 			memcpy(__get_str(name), args->name, args->namelen);
1694 		__entry->namelen = args->namelen;
1695 		__entry->hashval = args->hashval;
1696 		__entry->inumber = args->inumber;
1697 		__entry->op_flags = args->op_flags;
1698 	),
1699 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1700 		  "inumber 0x%llx op_flags %s",
1701 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1702 		  __entry->ino,
1703 		  __entry->namelen,
1704 		  __entry->namelen ? __get_str(name) : NULL,
1705 		  __entry->namelen,
1706 		  __entry->hashval,
1707 		  __entry->inumber,
1708 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1709 )
1710 
1711 #define DEFINE_DIR2_EVENT(name) \
1712 DEFINE_EVENT(xfs_da_class, name, \
1713 	TP_PROTO(struct xfs_da_args *args), \
1714 	TP_ARGS(args))
1715 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1716 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1717 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1718 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1719 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1720 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1721 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1722 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1723 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1724 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1725 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1726 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1727 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1728 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1729 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1730 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1731 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1732 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1733 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1734 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1735 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1736 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1737 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1738 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1739 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1740 
1741 DECLARE_EVENT_CLASS(xfs_attr_class,
1742 	TP_PROTO(struct xfs_da_args *args),
1743 	TP_ARGS(args),
1744 	TP_STRUCT__entry(
1745 		__field(dev_t, dev)
1746 		__field(xfs_ino_t, ino)
1747 		__dynamic_array(char, name, args->namelen)
1748 		__field(int, namelen)
1749 		__field(int, valuelen)
1750 		__field(xfs_dahash_t, hashval)
1751 		__field(int, op_flags)
1752 	),
1753 	TP_fast_assign(
1754 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1755 		__entry->ino = args->dp->i_ino;
1756 		if (args->namelen)
1757 			memcpy(__get_str(name), args->name, args->namelen);
1758 		__entry->namelen = args->namelen;
1759 		__entry->valuelen = args->valuelen;
1760 		__entry->hashval = args->hashval;
1761 		__entry->op_flags = args->op_flags;
1762 	),
1763 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1764 		  "hashval 0x%x op_flags %s",
1765 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1766 		  __entry->ino,
1767 		  __entry->namelen,
1768 		  __entry->namelen ? __get_str(name) : NULL,
1769 		  __entry->namelen,
1770 		  __entry->valuelen,
1771 		  __entry->hashval,
1772 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1773 )
1774 
1775 #define DEFINE_ATTR_EVENT(name) \
1776 DEFINE_EVENT(xfs_attr_class, name, \
1777 	TP_PROTO(struct xfs_da_args *args), \
1778 	TP_ARGS(args))
1779 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1780 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1781 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1782 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1783 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1784 DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1785 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1786 
1787 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1788 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1789 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1790 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
1791 DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1792 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1793 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1794 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
1795 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1796 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1797 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
1798 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1799 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1800 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1801 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1802 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1803 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1804 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1805 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1806 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1807 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1808 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1809 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
1810 
1811 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1812 DEFINE_ATTR_EVENT(xfs_attr_node_get);
1813 DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1814 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1815 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1816 
1817 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1818 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1819 
1820 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1821 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1822 DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1823 
1824 #define DEFINE_DA_EVENT(name) \
1825 DEFINE_EVENT(xfs_da_class, name, \
1826 	TP_PROTO(struct xfs_da_args *args), \
1827 	TP_ARGS(args))
1828 DEFINE_DA_EVENT(xfs_da_split);
1829 DEFINE_DA_EVENT(xfs_da_join);
1830 DEFINE_DA_EVENT(xfs_da_link_before);
1831 DEFINE_DA_EVENT(xfs_da_link_after);
1832 DEFINE_DA_EVENT(xfs_da_unlink_back);
1833 DEFINE_DA_EVENT(xfs_da_unlink_forward);
1834 DEFINE_DA_EVENT(xfs_da_root_split);
1835 DEFINE_DA_EVENT(xfs_da_root_join);
1836 DEFINE_DA_EVENT(xfs_da_node_add);
1837 DEFINE_DA_EVENT(xfs_da_node_create);
1838 DEFINE_DA_EVENT(xfs_da_node_split);
1839 DEFINE_DA_EVENT(xfs_da_node_remove);
1840 DEFINE_DA_EVENT(xfs_da_node_rebalance);
1841 DEFINE_DA_EVENT(xfs_da_node_unbalance);
1842 DEFINE_DA_EVENT(xfs_da_node_toosmall);
1843 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1844 DEFINE_DA_EVENT(xfs_da_grow_inode);
1845 DEFINE_DA_EVENT(xfs_da_shrink_inode);
1846 DEFINE_DA_EVENT(xfs_da_fixhashpath);
1847 DEFINE_DA_EVENT(xfs_da_path_shift);
1848 
1849 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1850 	TP_PROTO(struct xfs_da_args *args, int idx),
1851 	TP_ARGS(args, idx),
1852 	TP_STRUCT__entry(
1853 		__field(dev_t, dev)
1854 		__field(xfs_ino_t, ino)
1855 		__field(int, op_flags)
1856 		__field(int, idx)
1857 	),
1858 	TP_fast_assign(
1859 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1860 		__entry->ino = args->dp->i_ino;
1861 		__entry->op_flags = args->op_flags;
1862 		__entry->idx = idx;
1863 	),
1864 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1865 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1866 		  __entry->ino,
1867 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1868 		  __entry->idx)
1869 )
1870 
1871 #define DEFINE_DIR2_SPACE_EVENT(name) \
1872 DEFINE_EVENT(xfs_dir2_space_class, name, \
1873 	TP_PROTO(struct xfs_da_args *args, int idx), \
1874 	TP_ARGS(args, idx))
1875 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1876 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1877 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1878 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1879 
1880 TRACE_EVENT(xfs_dir2_leafn_moveents,
1881 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1882 	TP_ARGS(args, src_idx, dst_idx, count),
1883 	TP_STRUCT__entry(
1884 		__field(dev_t, dev)
1885 		__field(xfs_ino_t, ino)
1886 		__field(int, op_flags)
1887 		__field(int, src_idx)
1888 		__field(int, dst_idx)
1889 		__field(int, count)
1890 	),
1891 	TP_fast_assign(
1892 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1893 		__entry->ino = args->dp->i_ino;
1894 		__entry->op_flags = args->op_flags;
1895 		__entry->src_idx = src_idx;
1896 		__entry->dst_idx = dst_idx;
1897 		__entry->count = count;
1898 	),
1899 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1900 		  "src_idx %d dst_idx %d count %d",
1901 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1902 		  __entry->ino,
1903 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1904 		  __entry->src_idx,
1905 		  __entry->dst_idx,
1906 		  __entry->count)
1907 );
1908 
1909 #define XFS_SWAPEXT_INODES \
1910 	{ 0,	"target" }, \
1911 	{ 1,	"temp" }
1912 
1913 #define XFS_INODE_FORMAT_STR \
1914 	{ 0,	"invalid" }, \
1915 	{ 1,	"local" }, \
1916 	{ 2,	"extent" }, \
1917 	{ 3,	"btree" }
1918 
1919 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1920 	TP_PROTO(struct xfs_inode *ip, int which),
1921 	TP_ARGS(ip, which),
1922 	TP_STRUCT__entry(
1923 		__field(dev_t, dev)
1924 		__field(int, which)
1925 		__field(xfs_ino_t, ino)
1926 		__field(int, format)
1927 		__field(int, nex)
1928 		__field(int, broot_size)
1929 		__field(int, fork_off)
1930 	),
1931 	TP_fast_assign(
1932 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1933 		__entry->which = which;
1934 		__entry->ino = ip->i_ino;
1935 		__entry->format = ip->i_d.di_format;
1936 		__entry->nex = ip->i_d.di_nextents;
1937 		__entry->broot_size = ip->i_df.if_broot_bytes;
1938 		__entry->fork_off = XFS_IFORK_BOFF(ip);
1939 	),
1940 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1941 		  "broot size %d, fork offset %d",
1942 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1943 		  __entry->ino,
1944 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1945 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1946 		  __entry->nex,
1947 		  __entry->broot_size,
1948 		  __entry->fork_off)
1949 )
1950 
1951 #define DEFINE_SWAPEXT_EVENT(name) \
1952 DEFINE_EVENT(xfs_swap_extent_class, name, \
1953 	TP_PROTO(struct xfs_inode *ip, int which), \
1954 	TP_ARGS(ip, which))
1955 
1956 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1957 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1958 
1959 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1960 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1961 		struct xlog_recover_item *item, int pass),
1962 	TP_ARGS(log, trans, item, pass),
1963 	TP_STRUCT__entry(
1964 		__field(dev_t, dev)
1965 		__field(unsigned long, item)
1966 		__field(xlog_tid_t, tid)
1967 		__field(int, type)
1968 		__field(int, pass)
1969 		__field(int, count)
1970 		__field(int, total)
1971 	),
1972 	TP_fast_assign(
1973 		__entry->dev = log->l_mp->m_super->s_dev;
1974 		__entry->item = (unsigned long)item;
1975 		__entry->tid = trans->r_log_tid;
1976 		__entry->type = ITEM_TYPE(item);
1977 		__entry->pass = pass;
1978 		__entry->count = item->ri_cnt;
1979 		__entry->total = item->ri_total;
1980 	),
1981 	TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1982 		  "item region count/total %d/%d",
1983 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1984 		  __entry->tid,
1985 		  __entry->pass,
1986 		  (void *)__entry->item,
1987 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1988 		  __entry->count,
1989 		  __entry->total)
1990 )
1991 
1992 #define DEFINE_LOG_RECOVER_ITEM(name) \
1993 DEFINE_EVENT(xfs_log_recover_item_class, name, \
1994 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
1995 		struct xlog_recover_item *item, int pass), \
1996 	TP_ARGS(log, trans, item, pass))
1997 
1998 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1999 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2000 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2001 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2002 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2003 
2004 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2005 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2006 	TP_ARGS(log, buf_f),
2007 	TP_STRUCT__entry(
2008 		__field(dev_t, dev)
2009 		__field(__int64_t, blkno)
2010 		__field(unsigned short, len)
2011 		__field(unsigned short, flags)
2012 		__field(unsigned short, size)
2013 		__field(unsigned int, map_size)
2014 	),
2015 	TP_fast_assign(
2016 		__entry->dev = log->l_mp->m_super->s_dev;
2017 		__entry->blkno = buf_f->blf_blkno;
2018 		__entry->len = buf_f->blf_len;
2019 		__entry->flags = buf_f->blf_flags;
2020 		__entry->size = buf_f->blf_size;
2021 		__entry->map_size = buf_f->blf_map_size;
2022 	),
2023 	TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2024 			"map_size %d",
2025 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2026 		  __entry->blkno,
2027 		  __entry->len,
2028 		  __entry->flags,
2029 		  __entry->size,
2030 		  __entry->map_size)
2031 )
2032 
2033 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2034 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2035 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2036 	TP_ARGS(log, buf_f))
2037 
2038 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2039 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2040 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2041 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2042 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2043 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2044 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2045 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2046 
2047 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2048 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2049 	TP_ARGS(log, in_f),
2050 	TP_STRUCT__entry(
2051 		__field(dev_t, dev)
2052 		__field(xfs_ino_t, ino)
2053 		__field(unsigned short, size)
2054 		__field(int, fields)
2055 		__field(unsigned short, asize)
2056 		__field(unsigned short, dsize)
2057 		__field(__int64_t, blkno)
2058 		__field(int, len)
2059 		__field(int, boffset)
2060 	),
2061 	TP_fast_assign(
2062 		__entry->dev = log->l_mp->m_super->s_dev;
2063 		__entry->ino = in_f->ilf_ino;
2064 		__entry->size = in_f->ilf_size;
2065 		__entry->fields = in_f->ilf_fields;
2066 		__entry->asize = in_f->ilf_asize;
2067 		__entry->dsize = in_f->ilf_dsize;
2068 		__entry->blkno = in_f->ilf_blkno;
2069 		__entry->len = in_f->ilf_len;
2070 		__entry->boffset = in_f->ilf_boffset;
2071 	),
2072 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2073 			"dsize %d, blkno 0x%llx, len %d, boffset %d",
2074 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2075 		  __entry->ino,
2076 		  __entry->size,
2077 		  __entry->fields,
2078 		  __entry->asize,
2079 		  __entry->dsize,
2080 		  __entry->blkno,
2081 		  __entry->len,
2082 		  __entry->boffset)
2083 )
2084 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2085 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2086 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2087 	TP_ARGS(log, in_f))
2088 
2089 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2090 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2091 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2092 
2093 DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2094 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2095 	TP_ARGS(log, in_f),
2096 	TP_STRUCT__entry(
2097 		__field(dev_t, dev)
2098 		__field(xfs_agnumber_t, agno)
2099 		__field(xfs_agblock_t, agbno)
2100 		__field(unsigned int, count)
2101 		__field(unsigned int, isize)
2102 		__field(xfs_agblock_t, length)
2103 		__field(unsigned int, gen)
2104 	),
2105 	TP_fast_assign(
2106 		__entry->dev = log->l_mp->m_super->s_dev;
2107 		__entry->agno = be32_to_cpu(in_f->icl_ag);
2108 		__entry->agbno = be32_to_cpu(in_f->icl_agbno);
2109 		__entry->count = be32_to_cpu(in_f->icl_count);
2110 		__entry->isize = be32_to_cpu(in_f->icl_isize);
2111 		__entry->length = be32_to_cpu(in_f->icl_length);
2112 		__entry->gen = be32_to_cpu(in_f->icl_gen);
2113 	),
2114 	TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2115 		  "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2116 		  __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2117 		  __entry->length, __entry->gen)
2118 )
2119 #define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2120 DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2121 	TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2122 	TP_ARGS(log, in_f))
2123 
2124 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2125 DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2126 
2127 DECLARE_EVENT_CLASS(xfs_discard_class,
2128 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2129 		 xfs_agblock_t agbno, xfs_extlen_t len),
2130 	TP_ARGS(mp, agno, agbno, len),
2131 	TP_STRUCT__entry(
2132 		__field(dev_t, dev)
2133 		__field(xfs_agnumber_t, agno)
2134 		__field(xfs_agblock_t, agbno)
2135 		__field(xfs_extlen_t, len)
2136 	),
2137 	TP_fast_assign(
2138 		__entry->dev = mp->m_super->s_dev;
2139 		__entry->agno = agno;
2140 		__entry->agbno = agbno;
2141 		__entry->len = len;
2142 	),
2143 	TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2144 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2145 		  __entry->agno,
2146 		  __entry->agbno,
2147 		  __entry->len)
2148 )
2149 
2150 #define DEFINE_DISCARD_EVENT(name) \
2151 DEFINE_EVENT(xfs_discard_class, name, \
2152 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2153 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2154 	TP_ARGS(mp, agno, agbno, len))
2155 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2156 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2157 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2158 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2159 
2160 #endif /* _TRACE_XFS_H */
2161 
2162 #undef TRACE_INCLUDE_PATH
2163 #define TRACE_INCLUDE_PATH .
2164 #define TRACE_INCLUDE_FILE xfs_trace
2165 #include <trace/define_trace.h>
2166