xref: /openbmc/linux/fs/xfs/xfs_trace.h (revision 94cdda6b)
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_page_mkwrite);
691 
692 DECLARE_EVENT_CLASS(xfs_iref_class,
693 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
694 	TP_ARGS(ip, caller_ip),
695 	TP_STRUCT__entry(
696 		__field(dev_t, dev)
697 		__field(xfs_ino_t, ino)
698 		__field(int, count)
699 		__field(int, pincount)
700 		__field(unsigned long, caller_ip)
701 	),
702 	TP_fast_assign(
703 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
704 		__entry->ino = ip->i_ino;
705 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
706 		__entry->pincount = atomic_read(&ip->i_pincount);
707 		__entry->caller_ip = caller_ip;
708 	),
709 	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
710 		  MAJOR(__entry->dev), MINOR(__entry->dev),
711 		  __entry->ino,
712 		  __entry->count,
713 		  __entry->pincount,
714 		  (char *)__entry->caller_ip)
715 )
716 
717 TRACE_EVENT(xfs_iomap_prealloc_size,
718 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
719 		 unsigned int writeio_blocks),
720 	TP_ARGS(ip, blocks, shift, writeio_blocks),
721 	TP_STRUCT__entry(
722 		__field(dev_t, dev)
723 		__field(xfs_ino_t, ino)
724 		__field(xfs_fsblock_t, blocks)
725 		__field(int, shift)
726 		__field(unsigned int, writeio_blocks)
727 	),
728 	TP_fast_assign(
729 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
730 		__entry->ino = ip->i_ino;
731 		__entry->blocks = blocks;
732 		__entry->shift = shift;
733 		__entry->writeio_blocks = writeio_blocks;
734 	),
735 	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
736 		  "m_writeio_blocks %u",
737 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
738 		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
739 )
740 
741 #define DEFINE_IREF_EVENT(name) \
742 DEFINE_EVENT(xfs_iref_class, name, \
743 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
744 	TP_ARGS(ip, caller_ip))
745 DEFINE_IREF_EVENT(xfs_ihold);
746 DEFINE_IREF_EVENT(xfs_irele);
747 DEFINE_IREF_EVENT(xfs_inode_pin);
748 DEFINE_IREF_EVENT(xfs_inode_unpin);
749 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
750 
751 DECLARE_EVENT_CLASS(xfs_namespace_class,
752 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
753 	TP_ARGS(dp, name),
754 	TP_STRUCT__entry(
755 		__field(dev_t, dev)
756 		__field(xfs_ino_t, dp_ino)
757 		__field(int, namelen)
758 		__dynamic_array(char, name, name->len)
759 	),
760 	TP_fast_assign(
761 		__entry->dev = VFS_I(dp)->i_sb->s_dev;
762 		__entry->dp_ino = dp->i_ino;
763 		__entry->namelen = name->len;
764 		memcpy(__get_str(name), name->name, name->len);
765 	),
766 	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
767 		  MAJOR(__entry->dev), MINOR(__entry->dev),
768 		  __entry->dp_ino,
769 		  __entry->namelen,
770 		  __get_str(name))
771 )
772 
773 #define DEFINE_NAMESPACE_EVENT(name) \
774 DEFINE_EVENT(xfs_namespace_class, name, \
775 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
776 	TP_ARGS(dp, name))
777 DEFINE_NAMESPACE_EVENT(xfs_remove);
778 DEFINE_NAMESPACE_EVENT(xfs_link);
779 DEFINE_NAMESPACE_EVENT(xfs_lookup);
780 DEFINE_NAMESPACE_EVENT(xfs_create);
781 DEFINE_NAMESPACE_EVENT(xfs_symlink);
782 
783 TRACE_EVENT(xfs_rename,
784 	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
785 		 struct xfs_name *src_name, struct xfs_name *target_name),
786 	TP_ARGS(src_dp, target_dp, src_name, target_name),
787 	TP_STRUCT__entry(
788 		__field(dev_t, dev)
789 		__field(xfs_ino_t, src_dp_ino)
790 		__field(xfs_ino_t, target_dp_ino)
791 		__field(int, src_namelen)
792 		__field(int, target_namelen)
793 		__dynamic_array(char, src_name, src_name->len)
794 		__dynamic_array(char, target_name, target_name->len)
795 	),
796 	TP_fast_assign(
797 		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
798 		__entry->src_dp_ino = src_dp->i_ino;
799 		__entry->target_dp_ino = target_dp->i_ino;
800 		__entry->src_namelen = src_name->len;
801 		__entry->target_namelen = target_name->len;
802 		memcpy(__get_str(src_name), src_name->name, src_name->len);
803 		memcpy(__get_str(target_name), target_name->name,
804 			target_name->len);
805 	),
806 	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
807 		  " src name %.*s target name %.*s",
808 		  MAJOR(__entry->dev), MINOR(__entry->dev),
809 		  __entry->src_dp_ino,
810 		  __entry->target_dp_ino,
811 		  __entry->src_namelen,
812 		  __get_str(src_name),
813 		  __entry->target_namelen,
814 		  __get_str(target_name))
815 )
816 
817 DECLARE_EVENT_CLASS(xfs_dquot_class,
818 	TP_PROTO(struct xfs_dquot *dqp),
819 	TP_ARGS(dqp),
820 	TP_STRUCT__entry(
821 		__field(dev_t, dev)
822 		__field(u32, id)
823 		__field(unsigned, flags)
824 		__field(unsigned, nrefs)
825 		__field(unsigned long long, res_bcount)
826 		__field(unsigned long long, bcount)
827 		__field(unsigned long long, icount)
828 		__field(unsigned long long, blk_hardlimit)
829 		__field(unsigned long long, blk_softlimit)
830 		__field(unsigned long long, ino_hardlimit)
831 		__field(unsigned long long, ino_softlimit)
832 	), \
833 	TP_fast_assign(
834 		__entry->dev = dqp->q_mount->m_super->s_dev;
835 		__entry->id = be32_to_cpu(dqp->q_core.d_id);
836 		__entry->flags = dqp->dq_flags;
837 		__entry->nrefs = dqp->q_nrefs;
838 		__entry->res_bcount = dqp->q_res_bcount;
839 		__entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
840 		__entry->icount = be64_to_cpu(dqp->q_core.d_icount);
841 		__entry->blk_hardlimit =
842 			be64_to_cpu(dqp->q_core.d_blk_hardlimit);
843 		__entry->blk_softlimit =
844 			be64_to_cpu(dqp->q_core.d_blk_softlimit);
845 		__entry->ino_hardlimit =
846 			be64_to_cpu(dqp->q_core.d_ino_hardlimit);
847 		__entry->ino_softlimit =
848 			be64_to_cpu(dqp->q_core.d_ino_softlimit);
849 	),
850 	TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
851 		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
852 		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
853 		  MAJOR(__entry->dev), MINOR(__entry->dev),
854 		  __entry->id,
855 		  __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
856 		  __entry->nrefs,
857 		  __entry->res_bcount,
858 		  __entry->bcount,
859 		  __entry->blk_hardlimit,
860 		  __entry->blk_softlimit,
861 		  __entry->icount,
862 		  __entry->ino_hardlimit,
863 		  __entry->ino_softlimit)
864 )
865 
866 #define DEFINE_DQUOT_EVENT(name) \
867 DEFINE_EVENT(xfs_dquot_class, name, \
868 	TP_PROTO(struct xfs_dquot *dqp), \
869 	TP_ARGS(dqp))
870 DEFINE_DQUOT_EVENT(xfs_dqadjust);
871 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
872 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
873 DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
874 DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
875 DEFINE_DQUOT_EVENT(xfs_dqattach_found);
876 DEFINE_DQUOT_EVENT(xfs_dqattach_get);
877 DEFINE_DQUOT_EVENT(xfs_dqalloc);
878 DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
879 DEFINE_DQUOT_EVENT(xfs_dqread);
880 DEFINE_DQUOT_EVENT(xfs_dqread_fail);
881 DEFINE_DQUOT_EVENT(xfs_dqget_hit);
882 DEFINE_DQUOT_EVENT(xfs_dqget_miss);
883 DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
884 DEFINE_DQUOT_EVENT(xfs_dqget_dup);
885 DEFINE_DQUOT_EVENT(xfs_dqput);
886 DEFINE_DQUOT_EVENT(xfs_dqput_wait);
887 DEFINE_DQUOT_EVENT(xfs_dqput_free);
888 DEFINE_DQUOT_EVENT(xfs_dqrele);
889 DEFINE_DQUOT_EVENT(xfs_dqflush);
890 DEFINE_DQUOT_EVENT(xfs_dqflush_force);
891 DEFINE_DQUOT_EVENT(xfs_dqflush_done);
892 
893 DECLARE_EVENT_CLASS(xfs_loggrant_class,
894 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
895 	TP_ARGS(log, tic),
896 	TP_STRUCT__entry(
897 		__field(dev_t, dev)
898 		__field(unsigned, trans_type)
899 		__field(char, ocnt)
900 		__field(char, cnt)
901 		__field(int, curr_res)
902 		__field(int, unit_res)
903 		__field(unsigned int, flags)
904 		__field(int, reserveq)
905 		__field(int, writeq)
906 		__field(int, grant_reserve_cycle)
907 		__field(int, grant_reserve_bytes)
908 		__field(int, grant_write_cycle)
909 		__field(int, grant_write_bytes)
910 		__field(int, curr_cycle)
911 		__field(int, curr_block)
912 		__field(xfs_lsn_t, tail_lsn)
913 	),
914 	TP_fast_assign(
915 		__entry->dev = log->l_mp->m_super->s_dev;
916 		__entry->trans_type = tic->t_trans_type;
917 		__entry->ocnt = tic->t_ocnt;
918 		__entry->cnt = tic->t_cnt;
919 		__entry->curr_res = tic->t_curr_res;
920 		__entry->unit_res = tic->t_unit_res;
921 		__entry->flags = tic->t_flags;
922 		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
923 		__entry->writeq = list_empty(&log->l_write_head.waiters);
924 		xlog_crack_grant_head(&log->l_reserve_head.grant,
925 				&__entry->grant_reserve_cycle,
926 				&__entry->grant_reserve_bytes);
927 		xlog_crack_grant_head(&log->l_write_head.grant,
928 				&__entry->grant_write_cycle,
929 				&__entry->grant_write_bytes);
930 		__entry->curr_cycle = log->l_curr_cycle;
931 		__entry->curr_block = log->l_curr_block;
932 		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
933 	),
934 	TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
935 		  "t_unit_res %u t_flags %s reserveq %s "
936 		  "writeq %s grant_reserve_cycle %d "
937 		  "grant_reserve_bytes %d grant_write_cycle %d "
938 		  "grant_write_bytes %d curr_cycle %d curr_block %d "
939 		  "tail_cycle %d tail_block %d",
940 		  MAJOR(__entry->dev), MINOR(__entry->dev),
941 		  __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
942 		  __entry->ocnt,
943 		  __entry->cnt,
944 		  __entry->curr_res,
945 		  __entry->unit_res,
946 		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
947 		  __entry->reserveq ? "empty" : "active",
948 		  __entry->writeq ? "empty" : "active",
949 		  __entry->grant_reserve_cycle,
950 		  __entry->grant_reserve_bytes,
951 		  __entry->grant_write_cycle,
952 		  __entry->grant_write_bytes,
953 		  __entry->curr_cycle,
954 		  __entry->curr_block,
955 		  CYCLE_LSN(__entry->tail_lsn),
956 		  BLOCK_LSN(__entry->tail_lsn)
957 	)
958 )
959 
960 #define DEFINE_LOGGRANT_EVENT(name) \
961 DEFINE_EVENT(xfs_loggrant_class, name, \
962 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
963 	TP_ARGS(log, tic))
964 DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
965 DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
966 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
967 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
968 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
969 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
970 DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
971 DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
972 DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
973 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
974 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
975 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
976 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
977 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
978 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
979 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
980 
981 DECLARE_EVENT_CLASS(xfs_log_item_class,
982 	TP_PROTO(struct xfs_log_item *lip),
983 	TP_ARGS(lip),
984 	TP_STRUCT__entry(
985 		__field(dev_t, dev)
986 		__field(void *, lip)
987 		__field(uint, type)
988 		__field(uint, flags)
989 		__field(xfs_lsn_t, lsn)
990 	),
991 	TP_fast_assign(
992 		__entry->dev = lip->li_mountp->m_super->s_dev;
993 		__entry->lip = lip;
994 		__entry->type = lip->li_type;
995 		__entry->flags = lip->li_flags;
996 		__entry->lsn = lip->li_lsn;
997 	),
998 	TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
999 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1000 		  __entry->lip,
1001 		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1002 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1003 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1004 )
1005 
1006 TRACE_EVENT(xfs_log_force,
1007 	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
1008 	TP_ARGS(mp, lsn),
1009 	TP_STRUCT__entry(
1010 		__field(dev_t, dev)
1011 		__field(xfs_lsn_t, lsn)
1012 	),
1013 	TP_fast_assign(
1014 		__entry->dev = mp->m_super->s_dev;
1015 		__entry->lsn = lsn;
1016 	),
1017 	TP_printk("dev %d:%d lsn 0x%llx",
1018 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1019 		  __entry->lsn)
1020 )
1021 
1022 #define DEFINE_LOG_ITEM_EVENT(name) \
1023 DEFINE_EVENT(xfs_log_item_class, name, \
1024 	TP_PROTO(struct xfs_log_item *lip), \
1025 	TP_ARGS(lip))
1026 DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1027 DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1028 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1029 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1030 
1031 DECLARE_EVENT_CLASS(xfs_ail_class,
1032 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1033 	TP_ARGS(lip, old_lsn, new_lsn),
1034 	TP_STRUCT__entry(
1035 		__field(dev_t, dev)
1036 		__field(void *, lip)
1037 		__field(uint, type)
1038 		__field(uint, flags)
1039 		__field(xfs_lsn_t, old_lsn)
1040 		__field(xfs_lsn_t, new_lsn)
1041 	),
1042 	TP_fast_assign(
1043 		__entry->dev = lip->li_mountp->m_super->s_dev;
1044 		__entry->lip = lip;
1045 		__entry->type = lip->li_type;
1046 		__entry->flags = lip->li_flags;
1047 		__entry->old_lsn = old_lsn;
1048 		__entry->new_lsn = new_lsn;
1049 	),
1050 	TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1051 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1052 		  __entry->lip,
1053 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1054 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1055 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1056 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1057 )
1058 
1059 #define DEFINE_AIL_EVENT(name) \
1060 DEFINE_EVENT(xfs_ail_class, name, \
1061 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1062 	TP_ARGS(lip, old_lsn, new_lsn))
1063 DEFINE_AIL_EVENT(xfs_ail_insert);
1064 DEFINE_AIL_EVENT(xfs_ail_move);
1065 DEFINE_AIL_EVENT(xfs_ail_delete);
1066 
1067 TRACE_EVENT(xfs_log_assign_tail_lsn,
1068 	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1069 	TP_ARGS(log, new_lsn),
1070 	TP_STRUCT__entry(
1071 		__field(dev_t, dev)
1072 		__field(xfs_lsn_t, new_lsn)
1073 		__field(xfs_lsn_t, old_lsn)
1074 		__field(xfs_lsn_t, last_sync_lsn)
1075 	),
1076 	TP_fast_assign(
1077 		__entry->dev = log->l_mp->m_super->s_dev;
1078 		__entry->new_lsn = new_lsn;
1079 		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1080 		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1081 	),
1082 	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1083 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1084 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1085 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1086 		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1087 )
1088 
1089 DECLARE_EVENT_CLASS(xfs_file_class,
1090 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
1091 	TP_ARGS(ip, count, offset, flags),
1092 	TP_STRUCT__entry(
1093 		__field(dev_t, dev)
1094 		__field(xfs_ino_t, ino)
1095 		__field(xfs_fsize_t, size)
1096 		__field(loff_t, offset)
1097 		__field(size_t, count)
1098 		__field(int, flags)
1099 	),
1100 	TP_fast_assign(
1101 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1102 		__entry->ino = ip->i_ino;
1103 		__entry->size = ip->i_d.di_size;
1104 		__entry->offset = offset;
1105 		__entry->count = count;
1106 		__entry->flags = flags;
1107 	),
1108 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
1109 		  "offset 0x%llx count 0x%zx ioflags %s",
1110 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1111 		  __entry->ino,
1112 		  __entry->size,
1113 		  __entry->offset,
1114 		  __entry->count,
1115 		  __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
1116 )
1117 
1118 #define DEFINE_RW_EVENT(name)		\
1119 DEFINE_EVENT(xfs_file_class, name,	\
1120 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),	\
1121 	TP_ARGS(ip, count, offset, flags))
1122 DEFINE_RW_EVENT(xfs_file_read);
1123 DEFINE_RW_EVENT(xfs_file_buffered_write);
1124 DEFINE_RW_EVENT(xfs_file_direct_write);
1125 DEFINE_RW_EVENT(xfs_file_splice_read);
1126 
1127 DECLARE_EVENT_CLASS(xfs_page_class,
1128 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1129 		 unsigned int len),
1130 	TP_ARGS(inode, page, off, len),
1131 	TP_STRUCT__entry(
1132 		__field(dev_t, dev)
1133 		__field(xfs_ino_t, ino)
1134 		__field(pgoff_t, pgoff)
1135 		__field(loff_t, size)
1136 		__field(unsigned long, offset)
1137 		__field(unsigned int, length)
1138 		__field(int, delalloc)
1139 		__field(int, unwritten)
1140 	),
1141 	TP_fast_assign(
1142 		int delalloc = -1, unwritten = -1;
1143 
1144 		if (page_has_buffers(page))
1145 			xfs_count_page_state(page, &delalloc, &unwritten);
1146 		__entry->dev = inode->i_sb->s_dev;
1147 		__entry->ino = XFS_I(inode)->i_ino;
1148 		__entry->pgoff = page_offset(page);
1149 		__entry->size = i_size_read(inode);
1150 		__entry->offset = off;
1151 		__entry->length = len;
1152 		__entry->delalloc = delalloc;
1153 		__entry->unwritten = unwritten;
1154 	),
1155 	TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
1156 		  "length %x delalloc %d unwritten %d",
1157 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1158 		  __entry->ino,
1159 		  __entry->pgoff,
1160 		  __entry->size,
1161 		  __entry->offset,
1162 		  __entry->length,
1163 		  __entry->delalloc,
1164 		  __entry->unwritten)
1165 )
1166 
1167 #define DEFINE_PAGE_EVENT(name)		\
1168 DEFINE_EVENT(xfs_page_class, name,	\
1169 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1170 		 unsigned int len),	\
1171 	TP_ARGS(inode, page, off, len))
1172 DEFINE_PAGE_EVENT(xfs_writepage);
1173 DEFINE_PAGE_EVENT(xfs_releasepage);
1174 DEFINE_PAGE_EVENT(xfs_invalidatepage);
1175 
1176 DECLARE_EVENT_CLASS(xfs_imap_class,
1177 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1178 		 int type, struct xfs_bmbt_irec *irec),
1179 	TP_ARGS(ip, offset, count, type, irec),
1180 	TP_STRUCT__entry(
1181 		__field(dev_t, dev)
1182 		__field(xfs_ino_t, ino)
1183 		__field(loff_t, size)
1184 		__field(loff_t, offset)
1185 		__field(size_t, count)
1186 		__field(int, type)
1187 		__field(xfs_fileoff_t, startoff)
1188 		__field(xfs_fsblock_t, startblock)
1189 		__field(xfs_filblks_t, blockcount)
1190 	),
1191 	TP_fast_assign(
1192 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1193 		__entry->ino = ip->i_ino;
1194 		__entry->size = ip->i_d.di_size;
1195 		__entry->offset = offset;
1196 		__entry->count = count;
1197 		__entry->type = type;
1198 		__entry->startoff = irec ? irec->br_startoff : 0;
1199 		__entry->startblock = irec ? irec->br_startblock : 0;
1200 		__entry->blockcount = irec ? irec->br_blockcount : 0;
1201 	),
1202 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1203 		  "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1204 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1205 		  __entry->ino,
1206 		  __entry->size,
1207 		  __entry->offset,
1208 		  __entry->count,
1209 		  __print_symbolic(__entry->type, XFS_IO_TYPES),
1210 		  __entry->startoff,
1211 		  (__int64_t)__entry->startblock,
1212 		  __entry->blockcount)
1213 )
1214 
1215 #define DEFINE_IOMAP_EVENT(name)	\
1216 DEFINE_EVENT(xfs_imap_class, name,	\
1217 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1218 		 int type, struct xfs_bmbt_irec *irec),		\
1219 	TP_ARGS(ip, offset, count, type, irec))
1220 DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1221 DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1222 DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1223 DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1224 DEFINE_IOMAP_EVENT(xfs_gbmap_direct);
1225 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_new);
1226 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_update);
1227 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_none);
1228 DEFINE_IOMAP_EVENT(xfs_gbmap_direct_endio);
1229 
1230 DECLARE_EVENT_CLASS(xfs_simple_io_class,
1231 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1232 	TP_ARGS(ip, offset, count),
1233 	TP_STRUCT__entry(
1234 		__field(dev_t, dev)
1235 		__field(xfs_ino_t, ino)
1236 		__field(loff_t, isize)
1237 		__field(loff_t, disize)
1238 		__field(loff_t, offset)
1239 		__field(size_t, count)
1240 	),
1241 	TP_fast_assign(
1242 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1243 		__entry->ino = ip->i_ino;
1244 		__entry->isize = VFS_I(ip)->i_size;
1245 		__entry->disize = ip->i_d.di_size;
1246 		__entry->offset = offset;
1247 		__entry->count = count;
1248 	),
1249 	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1250 		  "offset 0x%llx count %zd",
1251 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1252 		  __entry->ino,
1253 		  __entry->isize,
1254 		  __entry->disize,
1255 		  __entry->offset,
1256 		  __entry->count)
1257 );
1258 
1259 #define DEFINE_SIMPLE_IO_EVENT(name)	\
1260 DEFINE_EVENT(xfs_simple_io_class, name,	\
1261 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1262 	TP_ARGS(ip, offset, count))
1263 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1264 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1265 DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1266 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1267 
1268 DECLARE_EVENT_CLASS(xfs_itrunc_class,
1269 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1270 	TP_ARGS(ip, new_size),
1271 	TP_STRUCT__entry(
1272 		__field(dev_t, dev)
1273 		__field(xfs_ino_t, ino)
1274 		__field(xfs_fsize_t, size)
1275 		__field(xfs_fsize_t, new_size)
1276 	),
1277 	TP_fast_assign(
1278 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1279 		__entry->ino = ip->i_ino;
1280 		__entry->size = ip->i_d.di_size;
1281 		__entry->new_size = new_size;
1282 	),
1283 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1284 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1285 		  __entry->ino,
1286 		  __entry->size,
1287 		  __entry->new_size)
1288 )
1289 
1290 #define DEFINE_ITRUNC_EVENT(name) \
1291 DEFINE_EVENT(xfs_itrunc_class, name, \
1292 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1293 	TP_ARGS(ip, new_size))
1294 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1295 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1296 
1297 TRACE_EVENT(xfs_pagecache_inval,
1298 	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1299 	TP_ARGS(ip, start, finish),
1300 	TP_STRUCT__entry(
1301 		__field(dev_t, dev)
1302 		__field(xfs_ino_t, ino)
1303 		__field(xfs_fsize_t, size)
1304 		__field(xfs_off_t, start)
1305 		__field(xfs_off_t, finish)
1306 	),
1307 	TP_fast_assign(
1308 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1309 		__entry->ino = ip->i_ino;
1310 		__entry->size = ip->i_d.di_size;
1311 		__entry->start = start;
1312 		__entry->finish = finish;
1313 	),
1314 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1315 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1316 		  __entry->ino,
1317 		  __entry->size,
1318 		  __entry->start,
1319 		  __entry->finish)
1320 );
1321 
1322 TRACE_EVENT(xfs_bunmap,
1323 	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1324 		 int flags, unsigned long caller_ip),
1325 	TP_ARGS(ip, bno, len, flags, caller_ip),
1326 	TP_STRUCT__entry(
1327 		__field(dev_t, dev)
1328 		__field(xfs_ino_t, ino)
1329 		__field(xfs_fsize_t, size)
1330 		__field(xfs_fileoff_t, bno)
1331 		__field(xfs_filblks_t, len)
1332 		__field(unsigned long, caller_ip)
1333 		__field(int, flags)
1334 	),
1335 	TP_fast_assign(
1336 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1337 		__entry->ino = ip->i_ino;
1338 		__entry->size = ip->i_d.di_size;
1339 		__entry->bno = bno;
1340 		__entry->len = len;
1341 		__entry->caller_ip = caller_ip;
1342 		__entry->flags = flags;
1343 	),
1344 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1345 		  "flags %s caller %ps",
1346 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1347 		  __entry->ino,
1348 		  __entry->size,
1349 		  __entry->bno,
1350 		  __entry->len,
1351 		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1352 		  (void *)__entry->caller_ip)
1353 
1354 );
1355 
1356 DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1357 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1358 		 xfs_agblock_t agbno, xfs_extlen_t len),
1359 	TP_ARGS(mp, agno, agbno, len),
1360 	TP_STRUCT__entry(
1361 		__field(dev_t, dev)
1362 		__field(xfs_agnumber_t, agno)
1363 		__field(xfs_agblock_t, agbno)
1364 		__field(xfs_extlen_t, len)
1365 	),
1366 	TP_fast_assign(
1367 		__entry->dev = mp->m_super->s_dev;
1368 		__entry->agno = agno;
1369 		__entry->agbno = agbno;
1370 		__entry->len = len;
1371 	),
1372 	TP_printk("dev %d:%d agno %u agbno %u len %u",
1373 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1374 		  __entry->agno,
1375 		  __entry->agbno,
1376 		  __entry->len)
1377 );
1378 #define DEFINE_BUSY_EVENT(name) \
1379 DEFINE_EVENT(xfs_extent_busy_class, name, \
1380 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1381 		 xfs_agblock_t agbno, xfs_extlen_t len), \
1382 	TP_ARGS(mp, agno, agbno, len))
1383 DEFINE_BUSY_EVENT(xfs_extent_busy);
1384 DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1385 DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1386 DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1387 DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1388 
1389 TRACE_EVENT(xfs_extent_busy_trim,
1390 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1391 		 xfs_agblock_t agbno, xfs_extlen_t len,
1392 		 xfs_agblock_t tbno, xfs_extlen_t tlen),
1393 	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1394 	TP_STRUCT__entry(
1395 		__field(dev_t, dev)
1396 		__field(xfs_agnumber_t, agno)
1397 		__field(xfs_agblock_t, agbno)
1398 		__field(xfs_extlen_t, len)
1399 		__field(xfs_agblock_t, tbno)
1400 		__field(xfs_extlen_t, tlen)
1401 	),
1402 	TP_fast_assign(
1403 		__entry->dev = mp->m_super->s_dev;
1404 		__entry->agno = agno;
1405 		__entry->agbno = agbno;
1406 		__entry->len = len;
1407 		__entry->tbno = tbno;
1408 		__entry->tlen = tlen;
1409 	),
1410 	TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1411 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1412 		  __entry->agno,
1413 		  __entry->agbno,
1414 		  __entry->len,
1415 		  __entry->tbno,
1416 		  __entry->tlen)
1417 );
1418 
1419 TRACE_EVENT(xfs_trans_commit_lsn,
1420 	TP_PROTO(struct xfs_trans *trans),
1421 	TP_ARGS(trans),
1422 	TP_STRUCT__entry(
1423 		__field(dev_t, dev)
1424 		__field(struct xfs_trans *, tp)
1425 		__field(xfs_lsn_t, lsn)
1426 	),
1427 	TP_fast_assign(
1428 		__entry->dev = trans->t_mountp->m_super->s_dev;
1429 		__entry->tp = trans;
1430 		__entry->lsn = trans->t_commit_lsn;
1431 	),
1432 	TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1433 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1434 		  __entry->tp,
1435 		  __entry->lsn)
1436 );
1437 
1438 TRACE_EVENT(xfs_agf,
1439 	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1440 		 unsigned long caller_ip),
1441 	TP_ARGS(mp, agf, flags, caller_ip),
1442 	TP_STRUCT__entry(
1443 		__field(dev_t, dev)
1444 		__field(xfs_agnumber_t, agno)
1445 		__field(int, flags)
1446 		__field(__u32, length)
1447 		__field(__u32, bno_root)
1448 		__field(__u32, cnt_root)
1449 		__field(__u32, bno_level)
1450 		__field(__u32, cnt_level)
1451 		__field(__u32, flfirst)
1452 		__field(__u32, fllast)
1453 		__field(__u32, flcount)
1454 		__field(__u32, freeblks)
1455 		__field(__u32, longest)
1456 		__field(unsigned long, caller_ip)
1457 	),
1458 	TP_fast_assign(
1459 		__entry->dev = mp->m_super->s_dev;
1460 		__entry->agno = be32_to_cpu(agf->agf_seqno),
1461 		__entry->flags = flags;
1462 		__entry->length = be32_to_cpu(agf->agf_length),
1463 		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1464 		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1465 		__entry->bno_level =
1466 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1467 		__entry->cnt_level =
1468 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1469 		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1470 		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1471 		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1472 		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1473 		__entry->longest = be32_to_cpu(agf->agf_longest);
1474 		__entry->caller_ip = caller_ip;
1475 	),
1476 	TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1477 		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1478 		  "freeblks %u longest %u caller %ps",
1479 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1480 		  __entry->agno,
1481 		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1482 		  __entry->length,
1483 		  __entry->bno_root,
1484 		  __entry->cnt_root,
1485 		  __entry->bno_level,
1486 		  __entry->cnt_level,
1487 		  __entry->flfirst,
1488 		  __entry->fllast,
1489 		  __entry->flcount,
1490 		  __entry->freeblks,
1491 		  __entry->longest,
1492 		  (void *)__entry->caller_ip)
1493 );
1494 
1495 TRACE_EVENT(xfs_free_extent,
1496 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1497 		 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1498 	TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1499 	TP_STRUCT__entry(
1500 		__field(dev_t, dev)
1501 		__field(xfs_agnumber_t, agno)
1502 		__field(xfs_agblock_t, agbno)
1503 		__field(xfs_extlen_t, len)
1504 		__field(int, isfl)
1505 		__field(int, haveleft)
1506 		__field(int, haveright)
1507 	),
1508 	TP_fast_assign(
1509 		__entry->dev = mp->m_super->s_dev;
1510 		__entry->agno = agno;
1511 		__entry->agbno = agbno;
1512 		__entry->len = len;
1513 		__entry->isfl = isfl;
1514 		__entry->haveleft = haveleft;
1515 		__entry->haveright = haveright;
1516 	),
1517 	TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1518 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1519 		  __entry->agno,
1520 		  __entry->agbno,
1521 		  __entry->len,
1522 		  __entry->isfl,
1523 		  __entry->haveleft ?
1524 			(__entry->haveright ? "both" : "left") :
1525 			(__entry->haveright ? "right" : "none"))
1526 
1527 );
1528 
1529 DECLARE_EVENT_CLASS(xfs_alloc_class,
1530 	TP_PROTO(struct xfs_alloc_arg *args),
1531 	TP_ARGS(args),
1532 	TP_STRUCT__entry(
1533 		__field(dev_t, dev)
1534 		__field(xfs_agnumber_t, agno)
1535 		__field(xfs_agblock_t, agbno)
1536 		__field(xfs_extlen_t, minlen)
1537 		__field(xfs_extlen_t, maxlen)
1538 		__field(xfs_extlen_t, mod)
1539 		__field(xfs_extlen_t, prod)
1540 		__field(xfs_extlen_t, minleft)
1541 		__field(xfs_extlen_t, total)
1542 		__field(xfs_extlen_t, alignment)
1543 		__field(xfs_extlen_t, minalignslop)
1544 		__field(xfs_extlen_t, len)
1545 		__field(short, type)
1546 		__field(short, otype)
1547 		__field(char, wasdel)
1548 		__field(char, wasfromfl)
1549 		__field(char, isfl)
1550 		__field(char, userdata)
1551 		__field(xfs_fsblock_t, firstblock)
1552 	),
1553 	TP_fast_assign(
1554 		__entry->dev = args->mp->m_super->s_dev;
1555 		__entry->agno = args->agno;
1556 		__entry->agbno = args->agbno;
1557 		__entry->minlen = args->minlen;
1558 		__entry->maxlen = args->maxlen;
1559 		__entry->mod = args->mod;
1560 		__entry->prod = args->prod;
1561 		__entry->minleft = args->minleft;
1562 		__entry->total = args->total;
1563 		__entry->alignment = args->alignment;
1564 		__entry->minalignslop = args->minalignslop;
1565 		__entry->len = args->len;
1566 		__entry->type = args->type;
1567 		__entry->otype = args->otype;
1568 		__entry->wasdel = args->wasdel;
1569 		__entry->wasfromfl = args->wasfromfl;
1570 		__entry->isfl = args->isfl;
1571 		__entry->userdata = args->userdata;
1572 		__entry->firstblock = args->firstblock;
1573 	),
1574 	TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1575 		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1576 		  "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1577 		  "userdata %d firstblock 0x%llx",
1578 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1579 		  __entry->agno,
1580 		  __entry->agbno,
1581 		  __entry->minlen,
1582 		  __entry->maxlen,
1583 		  __entry->mod,
1584 		  __entry->prod,
1585 		  __entry->minleft,
1586 		  __entry->total,
1587 		  __entry->alignment,
1588 		  __entry->minalignslop,
1589 		  __entry->len,
1590 		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1591 		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1592 		  __entry->wasdel,
1593 		  __entry->wasfromfl,
1594 		  __entry->isfl,
1595 		  __entry->userdata,
1596 		  (unsigned long long)__entry->firstblock)
1597 )
1598 
1599 #define DEFINE_ALLOC_EVENT(name) \
1600 DEFINE_EVENT(xfs_alloc_class, name, \
1601 	TP_PROTO(struct xfs_alloc_arg *args), \
1602 	TP_ARGS(args))
1603 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1604 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1605 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1606 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1607 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1608 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1609 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1610 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1611 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1612 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1613 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1614 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1615 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1616 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1617 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1618 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1619 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1620 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1621 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1622 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1623 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1624 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1625 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1626 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1627 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1628 
1629 DECLARE_EVENT_CLASS(xfs_da_class,
1630 	TP_PROTO(struct xfs_da_args *args),
1631 	TP_ARGS(args),
1632 	TP_STRUCT__entry(
1633 		__field(dev_t, dev)
1634 		__field(xfs_ino_t, ino)
1635 		__dynamic_array(char, name, args->namelen)
1636 		__field(int, namelen)
1637 		__field(xfs_dahash_t, hashval)
1638 		__field(xfs_ino_t, inumber)
1639 		__field(int, op_flags)
1640 	),
1641 	TP_fast_assign(
1642 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1643 		__entry->ino = args->dp->i_ino;
1644 		if (args->namelen)
1645 			memcpy(__get_str(name), args->name, args->namelen);
1646 		__entry->namelen = args->namelen;
1647 		__entry->hashval = args->hashval;
1648 		__entry->inumber = args->inumber;
1649 		__entry->op_flags = args->op_flags;
1650 	),
1651 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1652 		  "inumber 0x%llx op_flags %s",
1653 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1654 		  __entry->ino,
1655 		  __entry->namelen,
1656 		  __entry->namelen ? __get_str(name) : NULL,
1657 		  __entry->namelen,
1658 		  __entry->hashval,
1659 		  __entry->inumber,
1660 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1661 )
1662 
1663 #define DEFINE_DIR2_EVENT(name) \
1664 DEFINE_EVENT(xfs_da_class, name, \
1665 	TP_PROTO(struct xfs_da_args *args), \
1666 	TP_ARGS(args))
1667 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1668 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1669 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1670 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1671 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1672 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1673 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1674 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1675 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1676 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1677 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1678 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1679 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1680 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1681 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1682 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1683 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1684 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1685 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1686 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1687 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1688 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1689 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1690 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1691 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1692 
1693 DECLARE_EVENT_CLASS(xfs_attr_class,
1694 	TP_PROTO(struct xfs_da_args *args),
1695 	TP_ARGS(args),
1696 	TP_STRUCT__entry(
1697 		__field(dev_t, dev)
1698 		__field(xfs_ino_t, ino)
1699 		__dynamic_array(char, name, args->namelen)
1700 		__field(int, namelen)
1701 		__field(int, valuelen)
1702 		__field(xfs_dahash_t, hashval)
1703 		__field(int, op_flags)
1704 	),
1705 	TP_fast_assign(
1706 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1707 		__entry->ino = args->dp->i_ino;
1708 		if (args->namelen)
1709 			memcpy(__get_str(name), args->name, args->namelen);
1710 		__entry->namelen = args->namelen;
1711 		__entry->valuelen = args->valuelen;
1712 		__entry->hashval = args->hashval;
1713 		__entry->op_flags = args->op_flags;
1714 	),
1715 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1716 		  "hashval 0x%x op_flags %s",
1717 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1718 		  __entry->ino,
1719 		  __entry->namelen,
1720 		  __entry->namelen ? __get_str(name) : NULL,
1721 		  __entry->namelen,
1722 		  __entry->valuelen,
1723 		  __entry->hashval,
1724 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1725 )
1726 
1727 #define DEFINE_ATTR_EVENT(name) \
1728 DEFINE_EVENT(xfs_attr_class, name, \
1729 	TP_PROTO(struct xfs_da_args *args), \
1730 	TP_ARGS(args))
1731 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1732 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1733 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1734 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1735 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1736 DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1737 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1738 
1739 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1740 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1741 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1742 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
1743 DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1744 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1745 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1746 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
1747 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1748 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1749 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
1750 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1751 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1752 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1753 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1754 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1755 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1756 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1757 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1758 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1759 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1760 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1761 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
1762 
1763 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1764 DEFINE_ATTR_EVENT(xfs_attr_node_get);
1765 DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1766 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1767 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1768 
1769 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1770 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1771 
1772 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1773 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1774 DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1775 
1776 #define DEFINE_DA_EVENT(name) \
1777 DEFINE_EVENT(xfs_da_class, name, \
1778 	TP_PROTO(struct xfs_da_args *args), \
1779 	TP_ARGS(args))
1780 DEFINE_DA_EVENT(xfs_da_split);
1781 DEFINE_DA_EVENT(xfs_da_join);
1782 DEFINE_DA_EVENT(xfs_da_link_before);
1783 DEFINE_DA_EVENT(xfs_da_link_after);
1784 DEFINE_DA_EVENT(xfs_da_unlink_back);
1785 DEFINE_DA_EVENT(xfs_da_unlink_forward);
1786 DEFINE_DA_EVENT(xfs_da_root_split);
1787 DEFINE_DA_EVENT(xfs_da_root_join);
1788 DEFINE_DA_EVENT(xfs_da_node_add);
1789 DEFINE_DA_EVENT(xfs_da_node_create);
1790 DEFINE_DA_EVENT(xfs_da_node_split);
1791 DEFINE_DA_EVENT(xfs_da_node_remove);
1792 DEFINE_DA_EVENT(xfs_da_node_rebalance);
1793 DEFINE_DA_EVENT(xfs_da_node_unbalance);
1794 DEFINE_DA_EVENT(xfs_da_node_toosmall);
1795 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1796 DEFINE_DA_EVENT(xfs_da_grow_inode);
1797 DEFINE_DA_EVENT(xfs_da_shrink_inode);
1798 DEFINE_DA_EVENT(xfs_da_fixhashpath);
1799 DEFINE_DA_EVENT(xfs_da_path_shift);
1800 
1801 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1802 	TP_PROTO(struct xfs_da_args *args, int idx),
1803 	TP_ARGS(args, idx),
1804 	TP_STRUCT__entry(
1805 		__field(dev_t, dev)
1806 		__field(xfs_ino_t, ino)
1807 		__field(int, op_flags)
1808 		__field(int, idx)
1809 	),
1810 	TP_fast_assign(
1811 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1812 		__entry->ino = args->dp->i_ino;
1813 		__entry->op_flags = args->op_flags;
1814 		__entry->idx = idx;
1815 	),
1816 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1817 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1818 		  __entry->ino,
1819 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1820 		  __entry->idx)
1821 )
1822 
1823 #define DEFINE_DIR2_SPACE_EVENT(name) \
1824 DEFINE_EVENT(xfs_dir2_space_class, name, \
1825 	TP_PROTO(struct xfs_da_args *args, int idx), \
1826 	TP_ARGS(args, idx))
1827 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1828 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1829 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1830 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1831 
1832 TRACE_EVENT(xfs_dir2_leafn_moveents,
1833 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1834 	TP_ARGS(args, src_idx, dst_idx, count),
1835 	TP_STRUCT__entry(
1836 		__field(dev_t, dev)
1837 		__field(xfs_ino_t, ino)
1838 		__field(int, op_flags)
1839 		__field(int, src_idx)
1840 		__field(int, dst_idx)
1841 		__field(int, count)
1842 	),
1843 	TP_fast_assign(
1844 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1845 		__entry->ino = args->dp->i_ino;
1846 		__entry->op_flags = args->op_flags;
1847 		__entry->src_idx = src_idx;
1848 		__entry->dst_idx = dst_idx;
1849 		__entry->count = count;
1850 	),
1851 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1852 		  "src_idx %d dst_idx %d count %d",
1853 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1854 		  __entry->ino,
1855 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1856 		  __entry->src_idx,
1857 		  __entry->dst_idx,
1858 		  __entry->count)
1859 );
1860 
1861 #define XFS_SWAPEXT_INODES \
1862 	{ 0,	"target" }, \
1863 	{ 1,	"temp" }
1864 
1865 #define XFS_INODE_FORMAT_STR \
1866 	{ 0,	"invalid" }, \
1867 	{ 1,	"local" }, \
1868 	{ 2,	"extent" }, \
1869 	{ 3,	"btree" }
1870 
1871 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1872 	TP_PROTO(struct xfs_inode *ip, int which),
1873 	TP_ARGS(ip, which),
1874 	TP_STRUCT__entry(
1875 		__field(dev_t, dev)
1876 		__field(int, which)
1877 		__field(xfs_ino_t, ino)
1878 		__field(int, format)
1879 		__field(int, nex)
1880 		__field(int, broot_size)
1881 		__field(int, fork_off)
1882 	),
1883 	TP_fast_assign(
1884 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1885 		__entry->which = which;
1886 		__entry->ino = ip->i_ino;
1887 		__entry->format = ip->i_d.di_format;
1888 		__entry->nex = ip->i_d.di_nextents;
1889 		__entry->broot_size = ip->i_df.if_broot_bytes;
1890 		__entry->fork_off = XFS_IFORK_BOFF(ip);
1891 	),
1892 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1893 		  "broot size %d, fork offset %d",
1894 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1895 		  __entry->ino,
1896 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1897 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1898 		  __entry->nex,
1899 		  __entry->broot_size,
1900 		  __entry->fork_off)
1901 )
1902 
1903 #define DEFINE_SWAPEXT_EVENT(name) \
1904 DEFINE_EVENT(xfs_swap_extent_class, name, \
1905 	TP_PROTO(struct xfs_inode *ip, int which), \
1906 	TP_ARGS(ip, which))
1907 
1908 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1909 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1910 
1911 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1912 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1913 		struct xlog_recover_item *item, int pass),
1914 	TP_ARGS(log, trans, item, pass),
1915 	TP_STRUCT__entry(
1916 		__field(dev_t, dev)
1917 		__field(unsigned long, item)
1918 		__field(xlog_tid_t, tid)
1919 		__field(int, type)
1920 		__field(int, pass)
1921 		__field(int, count)
1922 		__field(int, total)
1923 	),
1924 	TP_fast_assign(
1925 		__entry->dev = log->l_mp->m_super->s_dev;
1926 		__entry->item = (unsigned long)item;
1927 		__entry->tid = trans->r_log_tid;
1928 		__entry->type = ITEM_TYPE(item);
1929 		__entry->pass = pass;
1930 		__entry->count = item->ri_cnt;
1931 		__entry->total = item->ri_total;
1932 	),
1933 	TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1934 		  "item region count/total %d/%d",
1935 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1936 		  __entry->tid,
1937 		  __entry->pass,
1938 		  (void *)__entry->item,
1939 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1940 		  __entry->count,
1941 		  __entry->total)
1942 )
1943 
1944 #define DEFINE_LOG_RECOVER_ITEM(name) \
1945 DEFINE_EVENT(xfs_log_recover_item_class, name, \
1946 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
1947 		struct xlog_recover_item *item, int pass), \
1948 	TP_ARGS(log, trans, item, pass))
1949 
1950 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1951 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1952 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1953 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1954 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1955 
1956 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1957 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
1958 	TP_ARGS(log, buf_f),
1959 	TP_STRUCT__entry(
1960 		__field(dev_t, dev)
1961 		__field(__int64_t, blkno)
1962 		__field(unsigned short, len)
1963 		__field(unsigned short, flags)
1964 		__field(unsigned short, size)
1965 		__field(unsigned int, map_size)
1966 	),
1967 	TP_fast_assign(
1968 		__entry->dev = log->l_mp->m_super->s_dev;
1969 		__entry->blkno = buf_f->blf_blkno;
1970 		__entry->len = buf_f->blf_len;
1971 		__entry->flags = buf_f->blf_flags;
1972 		__entry->size = buf_f->blf_size;
1973 		__entry->map_size = buf_f->blf_map_size;
1974 	),
1975 	TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1976 			"map_size %d",
1977 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1978 		  __entry->blkno,
1979 		  __entry->len,
1980 		  __entry->flags,
1981 		  __entry->size,
1982 		  __entry->map_size)
1983 )
1984 
1985 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1986 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1987 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
1988 	TP_ARGS(log, buf_f))
1989 
1990 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1991 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1992 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1993 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1994 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1995 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1996 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1997 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1998 
1999 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2000 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2001 	TP_ARGS(log, in_f),
2002 	TP_STRUCT__entry(
2003 		__field(dev_t, dev)
2004 		__field(xfs_ino_t, ino)
2005 		__field(unsigned short, size)
2006 		__field(int, fields)
2007 		__field(unsigned short, asize)
2008 		__field(unsigned short, dsize)
2009 		__field(__int64_t, blkno)
2010 		__field(int, len)
2011 		__field(int, boffset)
2012 	),
2013 	TP_fast_assign(
2014 		__entry->dev = log->l_mp->m_super->s_dev;
2015 		__entry->ino = in_f->ilf_ino;
2016 		__entry->size = in_f->ilf_size;
2017 		__entry->fields = in_f->ilf_fields;
2018 		__entry->asize = in_f->ilf_asize;
2019 		__entry->dsize = in_f->ilf_dsize;
2020 		__entry->blkno = in_f->ilf_blkno;
2021 		__entry->len = in_f->ilf_len;
2022 		__entry->boffset = in_f->ilf_boffset;
2023 	),
2024 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2025 			"dsize %d, blkno 0x%llx, len %d, boffset %d",
2026 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2027 		  __entry->ino,
2028 		  __entry->size,
2029 		  __entry->fields,
2030 		  __entry->asize,
2031 		  __entry->dsize,
2032 		  __entry->blkno,
2033 		  __entry->len,
2034 		  __entry->boffset)
2035 )
2036 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2037 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2038 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2039 	TP_ARGS(log, in_f))
2040 
2041 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2042 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2043 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2044 
2045 DECLARE_EVENT_CLASS(xfs_discard_class,
2046 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2047 		 xfs_agblock_t agbno, xfs_extlen_t len),
2048 	TP_ARGS(mp, agno, agbno, len),
2049 	TP_STRUCT__entry(
2050 		__field(dev_t, dev)
2051 		__field(xfs_agnumber_t, agno)
2052 		__field(xfs_agblock_t, agbno)
2053 		__field(xfs_extlen_t, len)
2054 	),
2055 	TP_fast_assign(
2056 		__entry->dev = mp->m_super->s_dev;
2057 		__entry->agno = agno;
2058 		__entry->agbno = agbno;
2059 		__entry->len = len;
2060 	),
2061 	TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2062 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2063 		  __entry->agno,
2064 		  __entry->agbno,
2065 		  __entry->len)
2066 )
2067 
2068 #define DEFINE_DISCARD_EVENT(name) \
2069 DEFINE_EVENT(xfs_discard_class, name, \
2070 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2071 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2072 	TP_ARGS(mp, agno, agbno, len))
2073 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2074 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2075 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2076 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2077 
2078 #endif /* _TRACE_XFS_H */
2079 
2080 #undef TRACE_INCLUDE_PATH
2081 #define TRACE_INCLUDE_PATH .
2082 #define TRACE_INCLUDE_FILE xfs_trace
2083 #include <trace/define_trace.h>
2084