xref: /openbmc/linux/fs/xfs/xfs_trace.h (revision 483eb062)
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 %pf",
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 %pf",
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 %pf",
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 %pf",
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_iorequest);
353 DEFINE_BUF_EVENT(xfs_buf_bawrite);
354 DEFINE_BUF_EVENT(xfs_buf_lock);
355 DEFINE_BUF_EVENT(xfs_buf_lock_done);
356 DEFINE_BUF_EVENT(xfs_buf_trylock);
357 DEFINE_BUF_EVENT(xfs_buf_unlock);
358 DEFINE_BUF_EVENT(xfs_buf_iowait);
359 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
360 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
361 DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
362 DEFINE_BUF_EVENT(xfs_buf_delwri_split);
363 DEFINE_BUF_EVENT(xfs_buf_get_uncached);
364 DEFINE_BUF_EVENT(xfs_bdstrat_shut);
365 DEFINE_BUF_EVENT(xfs_buf_item_relse);
366 DEFINE_BUF_EVENT(xfs_buf_item_iodone);
367 DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
368 DEFINE_BUF_EVENT(xfs_buf_error_relse);
369 DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
370 DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
371 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
372 
373 /* not really buffer traces, but the buf provides useful information */
374 DEFINE_BUF_EVENT(xfs_btree_corrupt);
375 DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
376 DEFINE_BUF_EVENT(xfs_reset_dqcounts);
377 DEFINE_BUF_EVENT(xfs_inode_item_push);
378 
379 /* pass flags explicitly */
380 DECLARE_EVENT_CLASS(xfs_buf_flags_class,
381 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
382 	TP_ARGS(bp, flags, caller_ip),
383 	TP_STRUCT__entry(
384 		__field(dev_t, dev)
385 		__field(xfs_daddr_t, bno)
386 		__field(size_t, buffer_length)
387 		__field(int, hold)
388 		__field(int, pincount)
389 		__field(unsigned, lockval)
390 		__field(unsigned, flags)
391 		__field(unsigned long, caller_ip)
392 	),
393 	TP_fast_assign(
394 		__entry->dev = bp->b_target->bt_dev;
395 		__entry->bno = bp->b_bn;
396 		__entry->buffer_length = BBTOB(bp->b_length);
397 		__entry->flags = flags;
398 		__entry->hold = atomic_read(&bp->b_hold);
399 		__entry->pincount = atomic_read(&bp->b_pin_count);
400 		__entry->lockval = bp->b_sema.count;
401 		__entry->caller_ip = caller_ip;
402 	),
403 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
404 		  "lock %d flags %s caller %pf",
405 		  MAJOR(__entry->dev), MINOR(__entry->dev),
406 		  (unsigned long long)__entry->bno,
407 		  __entry->buffer_length,
408 		  __entry->hold,
409 		  __entry->pincount,
410 		  __entry->lockval,
411 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
412 		  (void *)__entry->caller_ip)
413 )
414 
415 #define DEFINE_BUF_FLAGS_EVENT(name) \
416 DEFINE_EVENT(xfs_buf_flags_class, name, \
417 	TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
418 	TP_ARGS(bp, flags, caller_ip))
419 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
420 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
421 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
422 
423 TRACE_EVENT(xfs_buf_ioerror,
424 	TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
425 	TP_ARGS(bp, error, caller_ip),
426 	TP_STRUCT__entry(
427 		__field(dev_t, dev)
428 		__field(xfs_daddr_t, bno)
429 		__field(size_t, buffer_length)
430 		__field(unsigned, flags)
431 		__field(int, hold)
432 		__field(int, pincount)
433 		__field(unsigned, lockval)
434 		__field(int, error)
435 		__field(unsigned long, caller_ip)
436 	),
437 	TP_fast_assign(
438 		__entry->dev = bp->b_target->bt_dev;
439 		__entry->bno = bp->b_bn;
440 		__entry->buffer_length = BBTOB(bp->b_length);
441 		__entry->hold = atomic_read(&bp->b_hold);
442 		__entry->pincount = atomic_read(&bp->b_pin_count);
443 		__entry->lockval = bp->b_sema.count;
444 		__entry->error = error;
445 		__entry->flags = bp->b_flags;
446 		__entry->caller_ip = caller_ip;
447 	),
448 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
449 		  "lock %d error %d flags %s caller %pf",
450 		  MAJOR(__entry->dev), MINOR(__entry->dev),
451 		  (unsigned long long)__entry->bno,
452 		  __entry->buffer_length,
453 		  __entry->hold,
454 		  __entry->pincount,
455 		  __entry->lockval,
456 		  __entry->error,
457 		  __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
458 		  (void *)__entry->caller_ip)
459 );
460 
461 DECLARE_EVENT_CLASS(xfs_buf_item_class,
462 	TP_PROTO(struct xfs_buf_log_item *bip),
463 	TP_ARGS(bip),
464 	TP_STRUCT__entry(
465 		__field(dev_t, dev)
466 		__field(xfs_daddr_t, buf_bno)
467 		__field(size_t, buf_len)
468 		__field(int, buf_hold)
469 		__field(int, buf_pincount)
470 		__field(int, buf_lockval)
471 		__field(unsigned, buf_flags)
472 		__field(unsigned, bli_recur)
473 		__field(int, bli_refcount)
474 		__field(unsigned, bli_flags)
475 		__field(void *, li_desc)
476 		__field(unsigned, li_flags)
477 	),
478 	TP_fast_assign(
479 		__entry->dev = bip->bli_buf->b_target->bt_dev;
480 		__entry->bli_flags = bip->bli_flags;
481 		__entry->bli_recur = bip->bli_recur;
482 		__entry->bli_refcount = atomic_read(&bip->bli_refcount);
483 		__entry->buf_bno = bip->bli_buf->b_bn;
484 		__entry->buf_len = BBTOB(bip->bli_buf->b_length);
485 		__entry->buf_flags = bip->bli_buf->b_flags;
486 		__entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
487 		__entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
488 		__entry->buf_lockval = bip->bli_buf->b_sema.count;
489 		__entry->li_desc = bip->bli_item.li_desc;
490 		__entry->li_flags = bip->bli_item.li_flags;
491 	),
492 	TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
493 		  "lock %d flags %s recur %d refcount %d bliflags %s "
494 		  "lidesc 0x%p liflags %s",
495 		  MAJOR(__entry->dev), MINOR(__entry->dev),
496 		  (unsigned long long)__entry->buf_bno,
497 		  __entry->buf_len,
498 		  __entry->buf_hold,
499 		  __entry->buf_pincount,
500 		  __entry->buf_lockval,
501 		  __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
502 		  __entry->bli_recur,
503 		  __entry->bli_refcount,
504 		  __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
505 		  __entry->li_desc,
506 		  __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
507 )
508 
509 #define DEFINE_BUF_ITEM_EVENT(name) \
510 DEFINE_EVENT(xfs_buf_item_class, name, \
511 	TP_PROTO(struct xfs_buf_log_item *bip), \
512 	TP_ARGS(bip))
513 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
514 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
515 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
516 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
517 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
518 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
519 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
520 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
521 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
522 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
523 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
524 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
525 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
526 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
527 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
528 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
529 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
530 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
531 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
532 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
533 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
534 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
535 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
536 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
537 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
538 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
539 DEFINE_BUF_ITEM_EVENT(xfs_trans_buf_ordered);
540 
541 DECLARE_EVENT_CLASS(xfs_lock_class,
542 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
543 		 unsigned long caller_ip),
544 	TP_ARGS(ip,  lock_flags, caller_ip),
545 	TP_STRUCT__entry(
546 		__field(dev_t, dev)
547 		__field(xfs_ino_t, ino)
548 		__field(int, lock_flags)
549 		__field(unsigned long, caller_ip)
550 	),
551 	TP_fast_assign(
552 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
553 		__entry->ino = ip->i_ino;
554 		__entry->lock_flags = lock_flags;
555 		__entry->caller_ip = caller_ip;
556 	),
557 	TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
558 		  MAJOR(__entry->dev), MINOR(__entry->dev),
559 		  __entry->ino,
560 		  __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
561 		  (void *)__entry->caller_ip)
562 )
563 
564 #define DEFINE_LOCK_EVENT(name) \
565 DEFINE_EVENT(xfs_lock_class, name, \
566 	TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
567 		 unsigned long caller_ip), \
568 	TP_ARGS(ip,  lock_flags, caller_ip))
569 DEFINE_LOCK_EVENT(xfs_ilock);
570 DEFINE_LOCK_EVENT(xfs_ilock_nowait);
571 DEFINE_LOCK_EVENT(xfs_ilock_demote);
572 DEFINE_LOCK_EVENT(xfs_iunlock);
573 
574 DECLARE_EVENT_CLASS(xfs_inode_class,
575 	TP_PROTO(struct xfs_inode *ip),
576 	TP_ARGS(ip),
577 	TP_STRUCT__entry(
578 		__field(dev_t, dev)
579 		__field(xfs_ino_t, ino)
580 	),
581 	TP_fast_assign(
582 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
583 		__entry->ino = ip->i_ino;
584 	),
585 	TP_printk("dev %d:%d ino 0x%llx",
586 		  MAJOR(__entry->dev), MINOR(__entry->dev),
587 		  __entry->ino)
588 )
589 
590 #define DEFINE_INODE_EVENT(name) \
591 DEFINE_EVENT(xfs_inode_class, name, \
592 	TP_PROTO(struct xfs_inode *ip), \
593 	TP_ARGS(ip))
594 DEFINE_INODE_EVENT(xfs_iget_skip);
595 DEFINE_INODE_EVENT(xfs_iget_reclaim);
596 DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
597 DEFINE_INODE_EVENT(xfs_iget_hit);
598 DEFINE_INODE_EVENT(xfs_iget_miss);
599 
600 DEFINE_INODE_EVENT(xfs_getattr);
601 DEFINE_INODE_EVENT(xfs_setattr);
602 DEFINE_INODE_EVENT(xfs_readlink);
603 DEFINE_INODE_EVENT(xfs_inactive_symlink);
604 DEFINE_INODE_EVENT(xfs_alloc_file_space);
605 DEFINE_INODE_EVENT(xfs_free_file_space);
606 DEFINE_INODE_EVENT(xfs_readdir);
607 #ifdef CONFIG_XFS_POSIX_ACL
608 DEFINE_INODE_EVENT(xfs_get_acl);
609 #endif
610 DEFINE_INODE_EVENT(xfs_vm_bmap);
611 DEFINE_INODE_EVENT(xfs_file_ioctl);
612 DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
613 DEFINE_INODE_EVENT(xfs_ioctl_setattr);
614 DEFINE_INODE_EVENT(xfs_dir_fsync);
615 DEFINE_INODE_EVENT(xfs_file_fsync);
616 DEFINE_INODE_EVENT(xfs_destroy_inode);
617 DEFINE_INODE_EVENT(xfs_evict_inode);
618 DEFINE_INODE_EVENT(xfs_update_time);
619 
620 DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
621 DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
622 
623 DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
624 DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
625 DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
626 
627 DECLARE_EVENT_CLASS(xfs_iref_class,
628 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
629 	TP_ARGS(ip, caller_ip),
630 	TP_STRUCT__entry(
631 		__field(dev_t, dev)
632 		__field(xfs_ino_t, ino)
633 		__field(int, count)
634 		__field(int, pincount)
635 		__field(unsigned long, caller_ip)
636 	),
637 	TP_fast_assign(
638 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
639 		__entry->ino = ip->i_ino;
640 		__entry->count = atomic_read(&VFS_I(ip)->i_count);
641 		__entry->pincount = atomic_read(&ip->i_pincount);
642 		__entry->caller_ip = caller_ip;
643 	),
644 	TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
645 		  MAJOR(__entry->dev), MINOR(__entry->dev),
646 		  __entry->ino,
647 		  __entry->count,
648 		  __entry->pincount,
649 		  (char *)__entry->caller_ip)
650 )
651 
652 TRACE_EVENT(xfs_iomap_prealloc_size,
653 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
654 		 unsigned int writeio_blocks),
655 	TP_ARGS(ip, blocks, shift, writeio_blocks),
656 	TP_STRUCT__entry(
657 		__field(dev_t, dev)
658 		__field(xfs_ino_t, ino)
659 		__field(xfs_fsblock_t, blocks)
660 		__field(int, shift)
661 		__field(unsigned int, writeio_blocks)
662 	),
663 	TP_fast_assign(
664 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
665 		__entry->ino = ip->i_ino;
666 		__entry->blocks = blocks;
667 		__entry->shift = shift;
668 		__entry->writeio_blocks = writeio_blocks;
669 	),
670 	TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
671 		  "m_writeio_blocks %u",
672 		  MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
673 		  __entry->blocks, __entry->shift, __entry->writeio_blocks)
674 )
675 
676 #define DEFINE_IREF_EVENT(name) \
677 DEFINE_EVENT(xfs_iref_class, name, \
678 	TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
679 	TP_ARGS(ip, caller_ip))
680 DEFINE_IREF_EVENT(xfs_ihold);
681 DEFINE_IREF_EVENT(xfs_irele);
682 DEFINE_IREF_EVENT(xfs_inode_pin);
683 DEFINE_IREF_EVENT(xfs_inode_unpin);
684 DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
685 
686 DECLARE_EVENT_CLASS(xfs_namespace_class,
687 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
688 	TP_ARGS(dp, name),
689 	TP_STRUCT__entry(
690 		__field(dev_t, dev)
691 		__field(xfs_ino_t, dp_ino)
692 		__field(int, namelen)
693 		__dynamic_array(char, name, name->len)
694 	),
695 	TP_fast_assign(
696 		__entry->dev = VFS_I(dp)->i_sb->s_dev;
697 		__entry->dp_ino = dp->i_ino;
698 		__entry->namelen = name->len;
699 		memcpy(__get_str(name), name->name, name->len);
700 	),
701 	TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
702 		  MAJOR(__entry->dev), MINOR(__entry->dev),
703 		  __entry->dp_ino,
704 		  __entry->namelen,
705 		  __get_str(name))
706 )
707 
708 #define DEFINE_NAMESPACE_EVENT(name) \
709 DEFINE_EVENT(xfs_namespace_class, name, \
710 	TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
711 	TP_ARGS(dp, name))
712 DEFINE_NAMESPACE_EVENT(xfs_remove);
713 DEFINE_NAMESPACE_EVENT(xfs_link);
714 DEFINE_NAMESPACE_EVENT(xfs_lookup);
715 DEFINE_NAMESPACE_EVENT(xfs_create);
716 DEFINE_NAMESPACE_EVENT(xfs_symlink);
717 
718 TRACE_EVENT(xfs_rename,
719 	TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
720 		 struct xfs_name *src_name, struct xfs_name *target_name),
721 	TP_ARGS(src_dp, target_dp, src_name, target_name),
722 	TP_STRUCT__entry(
723 		__field(dev_t, dev)
724 		__field(xfs_ino_t, src_dp_ino)
725 		__field(xfs_ino_t, target_dp_ino)
726 		__field(int, src_namelen)
727 		__field(int, target_namelen)
728 		__dynamic_array(char, src_name, src_name->len)
729 		__dynamic_array(char, target_name, target_name->len)
730 	),
731 	TP_fast_assign(
732 		__entry->dev = VFS_I(src_dp)->i_sb->s_dev;
733 		__entry->src_dp_ino = src_dp->i_ino;
734 		__entry->target_dp_ino = target_dp->i_ino;
735 		__entry->src_namelen = src_name->len;
736 		__entry->target_namelen = target_name->len;
737 		memcpy(__get_str(src_name), src_name->name, src_name->len);
738 		memcpy(__get_str(target_name), target_name->name,
739 			target_name->len);
740 	),
741 	TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
742 		  " src name %.*s target name %.*s",
743 		  MAJOR(__entry->dev), MINOR(__entry->dev),
744 		  __entry->src_dp_ino,
745 		  __entry->target_dp_ino,
746 		  __entry->src_namelen,
747 		  __get_str(src_name),
748 		  __entry->target_namelen,
749 		  __get_str(target_name))
750 )
751 
752 DECLARE_EVENT_CLASS(xfs_dquot_class,
753 	TP_PROTO(struct xfs_dquot *dqp),
754 	TP_ARGS(dqp),
755 	TP_STRUCT__entry(
756 		__field(dev_t, dev)
757 		__field(u32, id)
758 		__field(unsigned, flags)
759 		__field(unsigned, nrefs)
760 		__field(unsigned long long, res_bcount)
761 		__field(unsigned long long, bcount)
762 		__field(unsigned long long, icount)
763 		__field(unsigned long long, blk_hardlimit)
764 		__field(unsigned long long, blk_softlimit)
765 		__field(unsigned long long, ino_hardlimit)
766 		__field(unsigned long long, ino_softlimit)
767 	), \
768 	TP_fast_assign(
769 		__entry->dev = dqp->q_mount->m_super->s_dev;
770 		__entry->id = be32_to_cpu(dqp->q_core.d_id);
771 		__entry->flags = dqp->dq_flags;
772 		__entry->nrefs = dqp->q_nrefs;
773 		__entry->res_bcount = dqp->q_res_bcount;
774 		__entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
775 		__entry->icount = be64_to_cpu(dqp->q_core.d_icount);
776 		__entry->blk_hardlimit =
777 			be64_to_cpu(dqp->q_core.d_blk_hardlimit);
778 		__entry->blk_softlimit =
779 			be64_to_cpu(dqp->q_core.d_blk_softlimit);
780 		__entry->ino_hardlimit =
781 			be64_to_cpu(dqp->q_core.d_ino_hardlimit);
782 		__entry->ino_softlimit =
783 			be64_to_cpu(dqp->q_core.d_ino_softlimit);
784 	),
785 	TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
786 		  "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
787 		  "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
788 		  MAJOR(__entry->dev), MINOR(__entry->dev),
789 		  __entry->id,
790 		  __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
791 		  __entry->nrefs,
792 		  __entry->res_bcount,
793 		  __entry->bcount,
794 		  __entry->blk_hardlimit,
795 		  __entry->blk_softlimit,
796 		  __entry->icount,
797 		  __entry->ino_hardlimit,
798 		  __entry->ino_softlimit)
799 )
800 
801 #define DEFINE_DQUOT_EVENT(name) \
802 DEFINE_EVENT(xfs_dquot_class, name, \
803 	TP_PROTO(struct xfs_dquot *dqp), \
804 	TP_ARGS(dqp))
805 DEFINE_DQUOT_EVENT(xfs_dqadjust);
806 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
807 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
808 DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
809 DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
810 DEFINE_DQUOT_EVENT(xfs_dqattach_found);
811 DEFINE_DQUOT_EVENT(xfs_dqattach_get);
812 DEFINE_DQUOT_EVENT(xfs_dqalloc);
813 DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
814 DEFINE_DQUOT_EVENT(xfs_dqread);
815 DEFINE_DQUOT_EVENT(xfs_dqread_fail);
816 DEFINE_DQUOT_EVENT(xfs_dqget_hit);
817 DEFINE_DQUOT_EVENT(xfs_dqget_miss);
818 DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
819 DEFINE_DQUOT_EVENT(xfs_dqget_dup);
820 DEFINE_DQUOT_EVENT(xfs_dqput);
821 DEFINE_DQUOT_EVENT(xfs_dqput_wait);
822 DEFINE_DQUOT_EVENT(xfs_dqput_free);
823 DEFINE_DQUOT_EVENT(xfs_dqrele);
824 DEFINE_DQUOT_EVENT(xfs_dqflush);
825 DEFINE_DQUOT_EVENT(xfs_dqflush_force);
826 DEFINE_DQUOT_EVENT(xfs_dqflush_done);
827 
828 DECLARE_EVENT_CLASS(xfs_loggrant_class,
829 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
830 	TP_ARGS(log, tic),
831 	TP_STRUCT__entry(
832 		__field(dev_t, dev)
833 		__field(unsigned, trans_type)
834 		__field(char, ocnt)
835 		__field(char, cnt)
836 		__field(int, curr_res)
837 		__field(int, unit_res)
838 		__field(unsigned int, flags)
839 		__field(int, reserveq)
840 		__field(int, writeq)
841 		__field(int, grant_reserve_cycle)
842 		__field(int, grant_reserve_bytes)
843 		__field(int, grant_write_cycle)
844 		__field(int, grant_write_bytes)
845 		__field(int, curr_cycle)
846 		__field(int, curr_block)
847 		__field(xfs_lsn_t, tail_lsn)
848 	),
849 	TP_fast_assign(
850 		__entry->dev = log->l_mp->m_super->s_dev;
851 		__entry->trans_type = tic->t_trans_type;
852 		__entry->ocnt = tic->t_ocnt;
853 		__entry->cnt = tic->t_cnt;
854 		__entry->curr_res = tic->t_curr_res;
855 		__entry->unit_res = tic->t_unit_res;
856 		__entry->flags = tic->t_flags;
857 		__entry->reserveq = list_empty(&log->l_reserve_head.waiters);
858 		__entry->writeq = list_empty(&log->l_write_head.waiters);
859 		xlog_crack_grant_head(&log->l_reserve_head.grant,
860 				&__entry->grant_reserve_cycle,
861 				&__entry->grant_reserve_bytes);
862 		xlog_crack_grant_head(&log->l_write_head.grant,
863 				&__entry->grant_write_cycle,
864 				&__entry->grant_write_bytes);
865 		__entry->curr_cycle = log->l_curr_cycle;
866 		__entry->curr_block = log->l_curr_block;
867 		__entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
868 	),
869 	TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
870 		  "t_unit_res %u t_flags %s reserveq %s "
871 		  "writeq %s grant_reserve_cycle %d "
872 		  "grant_reserve_bytes %d grant_write_cycle %d "
873 		  "grant_write_bytes %d curr_cycle %d curr_block %d "
874 		  "tail_cycle %d tail_block %d",
875 		  MAJOR(__entry->dev), MINOR(__entry->dev),
876 		  __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
877 		  __entry->ocnt,
878 		  __entry->cnt,
879 		  __entry->curr_res,
880 		  __entry->unit_res,
881 		  __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
882 		  __entry->reserveq ? "empty" : "active",
883 		  __entry->writeq ? "empty" : "active",
884 		  __entry->grant_reserve_cycle,
885 		  __entry->grant_reserve_bytes,
886 		  __entry->grant_write_cycle,
887 		  __entry->grant_write_bytes,
888 		  __entry->curr_cycle,
889 		  __entry->curr_block,
890 		  CYCLE_LSN(__entry->tail_lsn),
891 		  BLOCK_LSN(__entry->tail_lsn)
892 	)
893 )
894 
895 #define DEFINE_LOGGRANT_EVENT(name) \
896 DEFINE_EVENT(xfs_loggrant_class, name, \
897 	TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
898 	TP_ARGS(log, tic))
899 DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
900 DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
901 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
902 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
903 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
904 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
905 DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
906 DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
907 DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
908 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
909 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
910 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
911 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
912 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
913 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
914 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
915 
916 DECLARE_EVENT_CLASS(xfs_log_item_class,
917 	TP_PROTO(struct xfs_log_item *lip),
918 	TP_ARGS(lip),
919 	TP_STRUCT__entry(
920 		__field(dev_t, dev)
921 		__field(void *, lip)
922 		__field(uint, type)
923 		__field(uint, flags)
924 		__field(xfs_lsn_t, lsn)
925 	),
926 	TP_fast_assign(
927 		__entry->dev = lip->li_mountp->m_super->s_dev;
928 		__entry->lip = lip;
929 		__entry->type = lip->li_type;
930 		__entry->flags = lip->li_flags;
931 		__entry->lsn = lip->li_lsn;
932 	),
933 	TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
934 		  MAJOR(__entry->dev), MINOR(__entry->dev),
935 		  __entry->lip,
936 		  CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
937 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
938 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
939 )
940 
941 TRACE_EVENT(xfs_log_force,
942 	TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
943 	TP_ARGS(mp, lsn),
944 	TP_STRUCT__entry(
945 		__field(dev_t, dev)
946 		__field(xfs_lsn_t, lsn)
947 	),
948 	TP_fast_assign(
949 		__entry->dev = mp->m_super->s_dev;
950 		__entry->lsn = lsn;
951 	),
952 	TP_printk("dev %d:%d lsn 0x%llx",
953 		  MAJOR(__entry->dev), MINOR(__entry->dev),
954 		  __entry->lsn)
955 )
956 
957 #define DEFINE_LOG_ITEM_EVENT(name) \
958 DEFINE_EVENT(xfs_log_item_class, name, \
959 	TP_PROTO(struct xfs_log_item *lip), \
960 	TP_ARGS(lip))
961 DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
962 DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
963 DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
964 DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
965 
966 DECLARE_EVENT_CLASS(xfs_ail_class,
967 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
968 	TP_ARGS(lip, old_lsn, new_lsn),
969 	TP_STRUCT__entry(
970 		__field(dev_t, dev)
971 		__field(void *, lip)
972 		__field(uint, type)
973 		__field(uint, flags)
974 		__field(xfs_lsn_t, old_lsn)
975 		__field(xfs_lsn_t, new_lsn)
976 	),
977 	TP_fast_assign(
978 		__entry->dev = lip->li_mountp->m_super->s_dev;
979 		__entry->lip = lip;
980 		__entry->type = lip->li_type;
981 		__entry->flags = lip->li_flags;
982 		__entry->old_lsn = old_lsn;
983 		__entry->new_lsn = new_lsn;
984 	),
985 	TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
986 		  MAJOR(__entry->dev), MINOR(__entry->dev),
987 		  __entry->lip,
988 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
989 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
990 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
991 		  __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
992 )
993 
994 #define DEFINE_AIL_EVENT(name) \
995 DEFINE_EVENT(xfs_ail_class, name, \
996 	TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
997 	TP_ARGS(lip, old_lsn, new_lsn))
998 DEFINE_AIL_EVENT(xfs_ail_insert);
999 DEFINE_AIL_EVENT(xfs_ail_move);
1000 DEFINE_AIL_EVENT(xfs_ail_delete);
1001 
1002 TRACE_EVENT(xfs_log_assign_tail_lsn,
1003 	TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1004 	TP_ARGS(log, new_lsn),
1005 	TP_STRUCT__entry(
1006 		__field(dev_t, dev)
1007 		__field(xfs_lsn_t, new_lsn)
1008 		__field(xfs_lsn_t, old_lsn)
1009 		__field(xfs_lsn_t, last_sync_lsn)
1010 	),
1011 	TP_fast_assign(
1012 		__entry->dev = log->l_mp->m_super->s_dev;
1013 		__entry->new_lsn = new_lsn;
1014 		__entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1015 		__entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1016 	),
1017 	TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1018 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1019 		  CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1020 		  CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1021 		  CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1022 )
1023 
1024 DECLARE_EVENT_CLASS(xfs_file_class,
1025 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
1026 	TP_ARGS(ip, count, offset, flags),
1027 	TP_STRUCT__entry(
1028 		__field(dev_t, dev)
1029 		__field(xfs_ino_t, ino)
1030 		__field(xfs_fsize_t, size)
1031 		__field(loff_t, offset)
1032 		__field(size_t, count)
1033 		__field(int, flags)
1034 	),
1035 	TP_fast_assign(
1036 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1037 		__entry->ino = ip->i_ino;
1038 		__entry->size = ip->i_d.di_size;
1039 		__entry->offset = offset;
1040 		__entry->count = count;
1041 		__entry->flags = flags;
1042 	),
1043 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
1044 		  "offset 0x%llx count 0x%zx ioflags %s",
1045 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1046 		  __entry->ino,
1047 		  __entry->size,
1048 		  __entry->offset,
1049 		  __entry->count,
1050 		  __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
1051 )
1052 
1053 #define DEFINE_RW_EVENT(name)		\
1054 DEFINE_EVENT(xfs_file_class, name,	\
1055 	TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),	\
1056 	TP_ARGS(ip, count, offset, flags))
1057 DEFINE_RW_EVENT(xfs_file_read);
1058 DEFINE_RW_EVENT(xfs_file_buffered_write);
1059 DEFINE_RW_EVENT(xfs_file_direct_write);
1060 DEFINE_RW_EVENT(xfs_file_splice_read);
1061 DEFINE_RW_EVENT(xfs_file_splice_write);
1062 
1063 DECLARE_EVENT_CLASS(xfs_page_class,
1064 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1065 		 unsigned int len),
1066 	TP_ARGS(inode, page, off, len),
1067 	TP_STRUCT__entry(
1068 		__field(dev_t, dev)
1069 		__field(xfs_ino_t, ino)
1070 		__field(pgoff_t, pgoff)
1071 		__field(loff_t, size)
1072 		__field(unsigned long, offset)
1073 		__field(unsigned int, length)
1074 		__field(int, delalloc)
1075 		__field(int, unwritten)
1076 	),
1077 	TP_fast_assign(
1078 		int delalloc = -1, unwritten = -1;
1079 
1080 		if (page_has_buffers(page))
1081 			xfs_count_page_state(page, &delalloc, &unwritten);
1082 		__entry->dev = inode->i_sb->s_dev;
1083 		__entry->ino = XFS_I(inode)->i_ino;
1084 		__entry->pgoff = page_offset(page);
1085 		__entry->size = i_size_read(inode);
1086 		__entry->offset = off;
1087 		__entry->length = len;
1088 		__entry->delalloc = delalloc;
1089 		__entry->unwritten = unwritten;
1090 	),
1091 	TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
1092 		  "length %x delalloc %d unwritten %d",
1093 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1094 		  __entry->ino,
1095 		  __entry->pgoff,
1096 		  __entry->size,
1097 		  __entry->offset,
1098 		  __entry->length,
1099 		  __entry->delalloc,
1100 		  __entry->unwritten)
1101 )
1102 
1103 #define DEFINE_PAGE_EVENT(name)		\
1104 DEFINE_EVENT(xfs_page_class, name,	\
1105 	TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1106 		 unsigned int len),	\
1107 	TP_ARGS(inode, page, off, len))
1108 DEFINE_PAGE_EVENT(xfs_writepage);
1109 DEFINE_PAGE_EVENT(xfs_releasepage);
1110 DEFINE_PAGE_EVENT(xfs_invalidatepage);
1111 
1112 DECLARE_EVENT_CLASS(xfs_imap_class,
1113 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1114 		 int type, struct xfs_bmbt_irec *irec),
1115 	TP_ARGS(ip, offset, count, type, irec),
1116 	TP_STRUCT__entry(
1117 		__field(dev_t, dev)
1118 		__field(xfs_ino_t, ino)
1119 		__field(loff_t, size)
1120 		__field(loff_t, offset)
1121 		__field(size_t, count)
1122 		__field(int, type)
1123 		__field(xfs_fileoff_t, startoff)
1124 		__field(xfs_fsblock_t, startblock)
1125 		__field(xfs_filblks_t, blockcount)
1126 	),
1127 	TP_fast_assign(
1128 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1129 		__entry->ino = ip->i_ino;
1130 		__entry->size = ip->i_d.di_size;
1131 		__entry->offset = offset;
1132 		__entry->count = count;
1133 		__entry->type = type;
1134 		__entry->startoff = irec ? irec->br_startoff : 0;
1135 		__entry->startblock = irec ? irec->br_startblock : 0;
1136 		__entry->blockcount = irec ? irec->br_blockcount : 0;
1137 	),
1138 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1139 		  "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1140 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1141 		  __entry->ino,
1142 		  __entry->size,
1143 		  __entry->offset,
1144 		  __entry->count,
1145 		  __print_symbolic(__entry->type, XFS_IO_TYPES),
1146 		  __entry->startoff,
1147 		  (__int64_t)__entry->startblock,
1148 		  __entry->blockcount)
1149 )
1150 
1151 #define DEFINE_IOMAP_EVENT(name)	\
1152 DEFINE_EVENT(xfs_imap_class, name,	\
1153 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,	\
1154 		 int type, struct xfs_bmbt_irec *irec),		\
1155 	TP_ARGS(ip, offset, count, type, irec))
1156 DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1157 DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1158 DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1159 DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1160 
1161 DECLARE_EVENT_CLASS(xfs_simple_io_class,
1162 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1163 	TP_ARGS(ip, offset, count),
1164 	TP_STRUCT__entry(
1165 		__field(dev_t, dev)
1166 		__field(xfs_ino_t, ino)
1167 		__field(loff_t, isize)
1168 		__field(loff_t, disize)
1169 		__field(loff_t, offset)
1170 		__field(size_t, count)
1171 	),
1172 	TP_fast_assign(
1173 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1174 		__entry->ino = ip->i_ino;
1175 		__entry->isize = VFS_I(ip)->i_size;
1176 		__entry->disize = ip->i_d.di_size;
1177 		__entry->offset = offset;
1178 		__entry->count = count;
1179 	),
1180 	TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1181 		  "offset 0x%llx count %zd",
1182 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1183 		  __entry->ino,
1184 		  __entry->isize,
1185 		  __entry->disize,
1186 		  __entry->offset,
1187 		  __entry->count)
1188 );
1189 
1190 #define DEFINE_SIMPLE_IO_EVENT(name)	\
1191 DEFINE_EVENT(xfs_simple_io_class, name,	\
1192 	TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),	\
1193 	TP_ARGS(ip, offset, count))
1194 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1195 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1196 DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1197 DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1198 
1199 DECLARE_EVENT_CLASS(xfs_itrunc_class,
1200 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1201 	TP_ARGS(ip, new_size),
1202 	TP_STRUCT__entry(
1203 		__field(dev_t, dev)
1204 		__field(xfs_ino_t, ino)
1205 		__field(xfs_fsize_t, size)
1206 		__field(xfs_fsize_t, new_size)
1207 	),
1208 	TP_fast_assign(
1209 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1210 		__entry->ino = ip->i_ino;
1211 		__entry->size = ip->i_d.di_size;
1212 		__entry->new_size = new_size;
1213 	),
1214 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1215 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1216 		  __entry->ino,
1217 		  __entry->size,
1218 		  __entry->new_size)
1219 )
1220 
1221 #define DEFINE_ITRUNC_EVENT(name) \
1222 DEFINE_EVENT(xfs_itrunc_class, name, \
1223 	TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1224 	TP_ARGS(ip, new_size))
1225 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1226 DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1227 
1228 TRACE_EVENT(xfs_pagecache_inval,
1229 	TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1230 	TP_ARGS(ip, start, finish),
1231 	TP_STRUCT__entry(
1232 		__field(dev_t, dev)
1233 		__field(xfs_ino_t, ino)
1234 		__field(xfs_fsize_t, size)
1235 		__field(xfs_off_t, start)
1236 		__field(xfs_off_t, finish)
1237 	),
1238 	TP_fast_assign(
1239 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1240 		__entry->ino = ip->i_ino;
1241 		__entry->size = ip->i_d.di_size;
1242 		__entry->start = start;
1243 		__entry->finish = finish;
1244 	),
1245 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1246 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1247 		  __entry->ino,
1248 		  __entry->size,
1249 		  __entry->start,
1250 		  __entry->finish)
1251 );
1252 
1253 TRACE_EVENT(xfs_bunmap,
1254 	TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1255 		 int flags, unsigned long caller_ip),
1256 	TP_ARGS(ip, bno, len, flags, caller_ip),
1257 	TP_STRUCT__entry(
1258 		__field(dev_t, dev)
1259 		__field(xfs_ino_t, ino)
1260 		__field(xfs_fsize_t, size)
1261 		__field(xfs_fileoff_t, bno)
1262 		__field(xfs_filblks_t, len)
1263 		__field(unsigned long, caller_ip)
1264 		__field(int, flags)
1265 	),
1266 	TP_fast_assign(
1267 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1268 		__entry->ino = ip->i_ino;
1269 		__entry->size = ip->i_d.di_size;
1270 		__entry->bno = bno;
1271 		__entry->len = len;
1272 		__entry->caller_ip = caller_ip;
1273 		__entry->flags = flags;
1274 	),
1275 	TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1276 		  "flags %s caller %pf",
1277 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1278 		  __entry->ino,
1279 		  __entry->size,
1280 		  __entry->bno,
1281 		  __entry->len,
1282 		  __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1283 		  (void *)__entry->caller_ip)
1284 
1285 );
1286 
1287 DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1288 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1289 		 xfs_agblock_t agbno, xfs_extlen_t len),
1290 	TP_ARGS(mp, agno, agbno, len),
1291 	TP_STRUCT__entry(
1292 		__field(dev_t, dev)
1293 		__field(xfs_agnumber_t, agno)
1294 		__field(xfs_agblock_t, agbno)
1295 		__field(xfs_extlen_t, len)
1296 	),
1297 	TP_fast_assign(
1298 		__entry->dev = mp->m_super->s_dev;
1299 		__entry->agno = agno;
1300 		__entry->agbno = agbno;
1301 		__entry->len = len;
1302 	),
1303 	TP_printk("dev %d:%d agno %u agbno %u len %u",
1304 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1305 		  __entry->agno,
1306 		  __entry->agbno,
1307 		  __entry->len)
1308 );
1309 #define DEFINE_BUSY_EVENT(name) \
1310 DEFINE_EVENT(xfs_extent_busy_class, name, \
1311 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1312 		 xfs_agblock_t agbno, xfs_extlen_t len), \
1313 	TP_ARGS(mp, agno, agbno, len))
1314 DEFINE_BUSY_EVENT(xfs_extent_busy);
1315 DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1316 DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1317 DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1318 DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1319 
1320 TRACE_EVENT(xfs_extent_busy_trim,
1321 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1322 		 xfs_agblock_t agbno, xfs_extlen_t len,
1323 		 xfs_agblock_t tbno, xfs_extlen_t tlen),
1324 	TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1325 	TP_STRUCT__entry(
1326 		__field(dev_t, dev)
1327 		__field(xfs_agnumber_t, agno)
1328 		__field(xfs_agblock_t, agbno)
1329 		__field(xfs_extlen_t, len)
1330 		__field(xfs_agblock_t, tbno)
1331 		__field(xfs_extlen_t, tlen)
1332 	),
1333 	TP_fast_assign(
1334 		__entry->dev = mp->m_super->s_dev;
1335 		__entry->agno = agno;
1336 		__entry->agbno = agbno;
1337 		__entry->len = len;
1338 		__entry->tbno = tbno;
1339 		__entry->tlen = tlen;
1340 	),
1341 	TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1342 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1343 		  __entry->agno,
1344 		  __entry->agbno,
1345 		  __entry->len,
1346 		  __entry->tbno,
1347 		  __entry->tlen)
1348 );
1349 
1350 TRACE_EVENT(xfs_trans_commit_lsn,
1351 	TP_PROTO(struct xfs_trans *trans),
1352 	TP_ARGS(trans),
1353 	TP_STRUCT__entry(
1354 		__field(dev_t, dev)
1355 		__field(struct xfs_trans *, tp)
1356 		__field(xfs_lsn_t, lsn)
1357 	),
1358 	TP_fast_assign(
1359 		__entry->dev = trans->t_mountp->m_super->s_dev;
1360 		__entry->tp = trans;
1361 		__entry->lsn = trans->t_commit_lsn;
1362 	),
1363 	TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1364 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1365 		  __entry->tp,
1366 		  __entry->lsn)
1367 );
1368 
1369 TRACE_EVENT(xfs_agf,
1370 	TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1371 		 unsigned long caller_ip),
1372 	TP_ARGS(mp, agf, flags, caller_ip),
1373 	TP_STRUCT__entry(
1374 		__field(dev_t, dev)
1375 		__field(xfs_agnumber_t, agno)
1376 		__field(int, flags)
1377 		__field(__u32, length)
1378 		__field(__u32, bno_root)
1379 		__field(__u32, cnt_root)
1380 		__field(__u32, bno_level)
1381 		__field(__u32, cnt_level)
1382 		__field(__u32, flfirst)
1383 		__field(__u32, fllast)
1384 		__field(__u32, flcount)
1385 		__field(__u32, freeblks)
1386 		__field(__u32, longest)
1387 		__field(unsigned long, caller_ip)
1388 	),
1389 	TP_fast_assign(
1390 		__entry->dev = mp->m_super->s_dev;
1391 		__entry->agno = be32_to_cpu(agf->agf_seqno),
1392 		__entry->flags = flags;
1393 		__entry->length = be32_to_cpu(agf->agf_length),
1394 		__entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1395 		__entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1396 		__entry->bno_level =
1397 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1398 		__entry->cnt_level =
1399 				be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1400 		__entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1401 		__entry->fllast = be32_to_cpu(agf->agf_fllast),
1402 		__entry->flcount = be32_to_cpu(agf->agf_flcount),
1403 		__entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1404 		__entry->longest = be32_to_cpu(agf->agf_longest);
1405 		__entry->caller_ip = caller_ip;
1406 	),
1407 	TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1408 		  "levels b %u c %u flfirst %u fllast %u flcount %u "
1409 		  "freeblks %u longest %u caller %pf",
1410 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1411 		  __entry->agno,
1412 		  __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1413 		  __entry->length,
1414 		  __entry->bno_root,
1415 		  __entry->cnt_root,
1416 		  __entry->bno_level,
1417 		  __entry->cnt_level,
1418 		  __entry->flfirst,
1419 		  __entry->fllast,
1420 		  __entry->flcount,
1421 		  __entry->freeblks,
1422 		  __entry->longest,
1423 		  (void *)__entry->caller_ip)
1424 );
1425 
1426 TRACE_EVENT(xfs_free_extent,
1427 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1428 		 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1429 	TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1430 	TP_STRUCT__entry(
1431 		__field(dev_t, dev)
1432 		__field(xfs_agnumber_t, agno)
1433 		__field(xfs_agblock_t, agbno)
1434 		__field(xfs_extlen_t, len)
1435 		__field(int, isfl)
1436 		__field(int, haveleft)
1437 		__field(int, haveright)
1438 	),
1439 	TP_fast_assign(
1440 		__entry->dev = mp->m_super->s_dev;
1441 		__entry->agno = agno;
1442 		__entry->agbno = agbno;
1443 		__entry->len = len;
1444 		__entry->isfl = isfl;
1445 		__entry->haveleft = haveleft;
1446 		__entry->haveright = haveright;
1447 	),
1448 	TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1449 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1450 		  __entry->agno,
1451 		  __entry->agbno,
1452 		  __entry->len,
1453 		  __entry->isfl,
1454 		  __entry->haveleft ?
1455 			(__entry->haveright ? "both" : "left") :
1456 			(__entry->haveright ? "right" : "none"))
1457 
1458 );
1459 
1460 DECLARE_EVENT_CLASS(xfs_alloc_class,
1461 	TP_PROTO(struct xfs_alloc_arg *args),
1462 	TP_ARGS(args),
1463 	TP_STRUCT__entry(
1464 		__field(dev_t, dev)
1465 		__field(xfs_agnumber_t, agno)
1466 		__field(xfs_agblock_t, agbno)
1467 		__field(xfs_extlen_t, minlen)
1468 		__field(xfs_extlen_t, maxlen)
1469 		__field(xfs_extlen_t, mod)
1470 		__field(xfs_extlen_t, prod)
1471 		__field(xfs_extlen_t, minleft)
1472 		__field(xfs_extlen_t, total)
1473 		__field(xfs_extlen_t, alignment)
1474 		__field(xfs_extlen_t, minalignslop)
1475 		__field(xfs_extlen_t, len)
1476 		__field(short, type)
1477 		__field(short, otype)
1478 		__field(char, wasdel)
1479 		__field(char, wasfromfl)
1480 		__field(char, isfl)
1481 		__field(char, userdata)
1482 		__field(xfs_fsblock_t, firstblock)
1483 	),
1484 	TP_fast_assign(
1485 		__entry->dev = args->mp->m_super->s_dev;
1486 		__entry->agno = args->agno;
1487 		__entry->agbno = args->agbno;
1488 		__entry->minlen = args->minlen;
1489 		__entry->maxlen = args->maxlen;
1490 		__entry->mod = args->mod;
1491 		__entry->prod = args->prod;
1492 		__entry->minleft = args->minleft;
1493 		__entry->total = args->total;
1494 		__entry->alignment = args->alignment;
1495 		__entry->minalignslop = args->minalignslop;
1496 		__entry->len = args->len;
1497 		__entry->type = args->type;
1498 		__entry->otype = args->otype;
1499 		__entry->wasdel = args->wasdel;
1500 		__entry->wasfromfl = args->wasfromfl;
1501 		__entry->isfl = args->isfl;
1502 		__entry->userdata = args->userdata;
1503 		__entry->firstblock = args->firstblock;
1504 	),
1505 	TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1506 		  "prod %u minleft %u total %u alignment %u minalignslop %u "
1507 		  "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1508 		  "userdata %d firstblock 0x%llx",
1509 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1510 		  __entry->agno,
1511 		  __entry->agbno,
1512 		  __entry->minlen,
1513 		  __entry->maxlen,
1514 		  __entry->mod,
1515 		  __entry->prod,
1516 		  __entry->minleft,
1517 		  __entry->total,
1518 		  __entry->alignment,
1519 		  __entry->minalignslop,
1520 		  __entry->len,
1521 		  __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1522 		  __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1523 		  __entry->wasdel,
1524 		  __entry->wasfromfl,
1525 		  __entry->isfl,
1526 		  __entry->userdata,
1527 		  (unsigned long long)__entry->firstblock)
1528 )
1529 
1530 #define DEFINE_ALLOC_EVENT(name) \
1531 DEFINE_EVENT(xfs_alloc_class, name, \
1532 	TP_PROTO(struct xfs_alloc_arg *args), \
1533 	TP_ARGS(args))
1534 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1535 DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1536 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1537 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1538 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1539 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1540 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1541 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1542 DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1543 DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1544 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1545 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1546 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1547 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1548 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1549 DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1550 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1551 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1552 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1553 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1554 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1555 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1556 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1557 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1558 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1559 
1560 DECLARE_EVENT_CLASS(xfs_da_class,
1561 	TP_PROTO(struct xfs_da_args *args),
1562 	TP_ARGS(args),
1563 	TP_STRUCT__entry(
1564 		__field(dev_t, dev)
1565 		__field(xfs_ino_t, ino)
1566 		__dynamic_array(char, name, args->namelen)
1567 		__field(int, namelen)
1568 		__field(xfs_dahash_t, hashval)
1569 		__field(xfs_ino_t, inumber)
1570 		__field(int, op_flags)
1571 	),
1572 	TP_fast_assign(
1573 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1574 		__entry->ino = args->dp->i_ino;
1575 		if (args->namelen)
1576 			memcpy(__get_str(name), args->name, args->namelen);
1577 		__entry->namelen = args->namelen;
1578 		__entry->hashval = args->hashval;
1579 		__entry->inumber = args->inumber;
1580 		__entry->op_flags = args->op_flags;
1581 	),
1582 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1583 		  "inumber 0x%llx op_flags %s",
1584 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1585 		  __entry->ino,
1586 		  __entry->namelen,
1587 		  __entry->namelen ? __get_str(name) : NULL,
1588 		  __entry->namelen,
1589 		  __entry->hashval,
1590 		  __entry->inumber,
1591 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1592 )
1593 
1594 #define DEFINE_DIR2_EVENT(name) \
1595 DEFINE_EVENT(xfs_da_class, name, \
1596 	TP_PROTO(struct xfs_da_args *args), \
1597 	TP_ARGS(args))
1598 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1599 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1600 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1601 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1602 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1603 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1604 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1605 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1606 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1607 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1608 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1609 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1610 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1611 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1612 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1613 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1614 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1615 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1616 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1617 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1618 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1619 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1620 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1621 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1622 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1623 
1624 DECLARE_EVENT_CLASS(xfs_attr_class,
1625 	TP_PROTO(struct xfs_da_args *args),
1626 	TP_ARGS(args),
1627 	TP_STRUCT__entry(
1628 		__field(dev_t, dev)
1629 		__field(xfs_ino_t, ino)
1630 		__dynamic_array(char, name, args->namelen)
1631 		__field(int, namelen)
1632 		__field(int, valuelen)
1633 		__field(xfs_dahash_t, hashval)
1634 		__field(int, op_flags)
1635 	),
1636 	TP_fast_assign(
1637 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1638 		__entry->ino = args->dp->i_ino;
1639 		if (args->namelen)
1640 			memcpy(__get_str(name), args->name, args->namelen);
1641 		__entry->namelen = args->namelen;
1642 		__entry->valuelen = args->valuelen;
1643 		__entry->hashval = args->hashval;
1644 		__entry->op_flags = args->op_flags;
1645 	),
1646 	TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1647 		  "hashval 0x%x op_flags %s",
1648 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1649 		  __entry->ino,
1650 		  __entry->namelen,
1651 		  __entry->namelen ? __get_str(name) : NULL,
1652 		  __entry->namelen,
1653 		  __entry->valuelen,
1654 		  __entry->hashval,
1655 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1656 )
1657 
1658 #define DEFINE_ATTR_EVENT(name) \
1659 DEFINE_EVENT(xfs_attr_class, name, \
1660 	TP_PROTO(struct xfs_da_args *args), \
1661 	TP_ARGS(args))
1662 DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1663 DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1664 DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1665 DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1666 DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1667 DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1668 DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1669 
1670 DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1671 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1672 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1673 DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
1674 DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1675 DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1676 DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1677 DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
1678 DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1679 DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1680 DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
1681 DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1682 DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1683 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1684 DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1685 DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1686 DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1687 DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1688 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1689 DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1690 DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1691 DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1692 DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
1693 
1694 DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1695 DEFINE_ATTR_EVENT(xfs_attr_node_get);
1696 DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1697 DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1698 DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1699 
1700 DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1701 DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1702 
1703 DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1704 DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1705 DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1706 
1707 #define DEFINE_DA_EVENT(name) \
1708 DEFINE_EVENT(xfs_da_class, name, \
1709 	TP_PROTO(struct xfs_da_args *args), \
1710 	TP_ARGS(args))
1711 DEFINE_DA_EVENT(xfs_da_split);
1712 DEFINE_DA_EVENT(xfs_da_join);
1713 DEFINE_DA_EVENT(xfs_da_link_before);
1714 DEFINE_DA_EVENT(xfs_da_link_after);
1715 DEFINE_DA_EVENT(xfs_da_unlink_back);
1716 DEFINE_DA_EVENT(xfs_da_unlink_forward);
1717 DEFINE_DA_EVENT(xfs_da_root_split);
1718 DEFINE_DA_EVENT(xfs_da_root_join);
1719 DEFINE_DA_EVENT(xfs_da_node_add);
1720 DEFINE_DA_EVENT(xfs_da_node_create);
1721 DEFINE_DA_EVENT(xfs_da_node_split);
1722 DEFINE_DA_EVENT(xfs_da_node_remove);
1723 DEFINE_DA_EVENT(xfs_da_node_rebalance);
1724 DEFINE_DA_EVENT(xfs_da_node_unbalance);
1725 DEFINE_DA_EVENT(xfs_da_node_toosmall);
1726 DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1727 DEFINE_DA_EVENT(xfs_da_grow_inode);
1728 DEFINE_DA_EVENT(xfs_da_shrink_inode);
1729 DEFINE_DA_EVENT(xfs_da_fixhashpath);
1730 DEFINE_DA_EVENT(xfs_da_path_shift);
1731 
1732 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1733 	TP_PROTO(struct xfs_da_args *args, int idx),
1734 	TP_ARGS(args, idx),
1735 	TP_STRUCT__entry(
1736 		__field(dev_t, dev)
1737 		__field(xfs_ino_t, ino)
1738 		__field(int, op_flags)
1739 		__field(int, idx)
1740 	),
1741 	TP_fast_assign(
1742 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1743 		__entry->ino = args->dp->i_ino;
1744 		__entry->op_flags = args->op_flags;
1745 		__entry->idx = idx;
1746 	),
1747 	TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1748 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1749 		  __entry->ino,
1750 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1751 		  __entry->idx)
1752 )
1753 
1754 #define DEFINE_DIR2_SPACE_EVENT(name) \
1755 DEFINE_EVENT(xfs_dir2_space_class, name, \
1756 	TP_PROTO(struct xfs_da_args *args, int idx), \
1757 	TP_ARGS(args, idx))
1758 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1759 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1760 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1761 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1762 
1763 TRACE_EVENT(xfs_dir2_leafn_moveents,
1764 	TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1765 	TP_ARGS(args, src_idx, dst_idx, count),
1766 	TP_STRUCT__entry(
1767 		__field(dev_t, dev)
1768 		__field(xfs_ino_t, ino)
1769 		__field(int, op_flags)
1770 		__field(int, src_idx)
1771 		__field(int, dst_idx)
1772 		__field(int, count)
1773 	),
1774 	TP_fast_assign(
1775 		__entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1776 		__entry->ino = args->dp->i_ino;
1777 		__entry->op_flags = args->op_flags;
1778 		__entry->src_idx = src_idx;
1779 		__entry->dst_idx = dst_idx;
1780 		__entry->count = count;
1781 	),
1782 	TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1783 		  "src_idx %d dst_idx %d count %d",
1784 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1785 		  __entry->ino,
1786 		  __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1787 		  __entry->src_idx,
1788 		  __entry->dst_idx,
1789 		  __entry->count)
1790 );
1791 
1792 #define XFS_SWAPEXT_INODES \
1793 	{ 0,	"target" }, \
1794 	{ 1,	"temp" }
1795 
1796 #define XFS_INODE_FORMAT_STR \
1797 	{ 0,	"invalid" }, \
1798 	{ 1,	"local" }, \
1799 	{ 2,	"extent" }, \
1800 	{ 3,	"btree" }
1801 
1802 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1803 	TP_PROTO(struct xfs_inode *ip, int which),
1804 	TP_ARGS(ip, which),
1805 	TP_STRUCT__entry(
1806 		__field(dev_t, dev)
1807 		__field(int, which)
1808 		__field(xfs_ino_t, ino)
1809 		__field(int, format)
1810 		__field(int, nex)
1811 		__field(int, broot_size)
1812 		__field(int, fork_off)
1813 	),
1814 	TP_fast_assign(
1815 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
1816 		__entry->which = which;
1817 		__entry->ino = ip->i_ino;
1818 		__entry->format = ip->i_d.di_format;
1819 		__entry->nex = ip->i_d.di_nextents;
1820 		__entry->broot_size = ip->i_df.if_broot_bytes;
1821 		__entry->fork_off = XFS_IFORK_BOFF(ip);
1822 	),
1823 	TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1824 		  "broot size %d, fork offset %d",
1825 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1826 		  __entry->ino,
1827 		  __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1828 		  __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1829 		  __entry->nex,
1830 		  __entry->broot_size,
1831 		  __entry->fork_off)
1832 )
1833 
1834 #define DEFINE_SWAPEXT_EVENT(name) \
1835 DEFINE_EVENT(xfs_swap_extent_class, name, \
1836 	TP_PROTO(struct xfs_inode *ip, int which), \
1837 	TP_ARGS(ip, which))
1838 
1839 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1840 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1841 
1842 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1843 	TP_PROTO(struct xlog *log, struct xlog_recover *trans,
1844 		struct xlog_recover_item *item, int pass),
1845 	TP_ARGS(log, trans, item, pass),
1846 	TP_STRUCT__entry(
1847 		__field(dev_t, dev)
1848 		__field(unsigned long, item)
1849 		__field(xlog_tid_t, tid)
1850 		__field(int, type)
1851 		__field(int, pass)
1852 		__field(int, count)
1853 		__field(int, total)
1854 	),
1855 	TP_fast_assign(
1856 		__entry->dev = log->l_mp->m_super->s_dev;
1857 		__entry->item = (unsigned long)item;
1858 		__entry->tid = trans->r_log_tid;
1859 		__entry->type = ITEM_TYPE(item);
1860 		__entry->pass = pass;
1861 		__entry->count = item->ri_cnt;
1862 		__entry->total = item->ri_total;
1863 	),
1864 	TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1865 		  "item region count/total %d/%d",
1866 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1867 		  __entry->tid,
1868 		  __entry->pass,
1869 		  (void *)__entry->item,
1870 		  __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1871 		  __entry->count,
1872 		  __entry->total)
1873 )
1874 
1875 #define DEFINE_LOG_RECOVER_ITEM(name) \
1876 DEFINE_EVENT(xfs_log_recover_item_class, name, \
1877 	TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
1878 		struct xlog_recover_item *item, int pass), \
1879 	TP_ARGS(log, trans, item, pass))
1880 
1881 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1882 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1883 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1884 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1885 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1886 
1887 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1888 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
1889 	TP_ARGS(log, buf_f),
1890 	TP_STRUCT__entry(
1891 		__field(dev_t, dev)
1892 		__field(__int64_t, blkno)
1893 		__field(unsigned short, len)
1894 		__field(unsigned short, flags)
1895 		__field(unsigned short, size)
1896 		__field(unsigned int, map_size)
1897 	),
1898 	TP_fast_assign(
1899 		__entry->dev = log->l_mp->m_super->s_dev;
1900 		__entry->blkno = buf_f->blf_blkno;
1901 		__entry->len = buf_f->blf_len;
1902 		__entry->flags = buf_f->blf_flags;
1903 		__entry->size = buf_f->blf_size;
1904 		__entry->map_size = buf_f->blf_map_size;
1905 	),
1906 	TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1907 			"map_size %d",
1908 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1909 		  __entry->blkno,
1910 		  __entry->len,
1911 		  __entry->flags,
1912 		  __entry->size,
1913 		  __entry->map_size)
1914 )
1915 
1916 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1917 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1918 	TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
1919 	TP_ARGS(log, buf_f))
1920 
1921 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1922 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1923 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1924 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1925 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1926 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1927 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1928 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1929 
1930 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1931 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
1932 	TP_ARGS(log, in_f),
1933 	TP_STRUCT__entry(
1934 		__field(dev_t, dev)
1935 		__field(xfs_ino_t, ino)
1936 		__field(unsigned short, size)
1937 		__field(int, fields)
1938 		__field(unsigned short, asize)
1939 		__field(unsigned short, dsize)
1940 		__field(__int64_t, blkno)
1941 		__field(int, len)
1942 		__field(int, boffset)
1943 	),
1944 	TP_fast_assign(
1945 		__entry->dev = log->l_mp->m_super->s_dev;
1946 		__entry->ino = in_f->ilf_ino;
1947 		__entry->size = in_f->ilf_size;
1948 		__entry->fields = in_f->ilf_fields;
1949 		__entry->asize = in_f->ilf_asize;
1950 		__entry->dsize = in_f->ilf_dsize;
1951 		__entry->blkno = in_f->ilf_blkno;
1952 		__entry->len = in_f->ilf_len;
1953 		__entry->boffset = in_f->ilf_boffset;
1954 	),
1955 	TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1956 			"dsize %d, blkno 0x%llx, len %d, boffset %d",
1957 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1958 		  __entry->ino,
1959 		  __entry->size,
1960 		  __entry->fields,
1961 		  __entry->asize,
1962 		  __entry->dsize,
1963 		  __entry->blkno,
1964 		  __entry->len,
1965 		  __entry->boffset)
1966 )
1967 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1968 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1969 	TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
1970 	TP_ARGS(log, in_f))
1971 
1972 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1973 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1974 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1975 
1976 DECLARE_EVENT_CLASS(xfs_discard_class,
1977 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1978 		 xfs_agblock_t agbno, xfs_extlen_t len),
1979 	TP_ARGS(mp, agno, agbno, len),
1980 	TP_STRUCT__entry(
1981 		__field(dev_t, dev)
1982 		__field(xfs_agnumber_t, agno)
1983 		__field(xfs_agblock_t, agbno)
1984 		__field(xfs_extlen_t, len)
1985 	),
1986 	TP_fast_assign(
1987 		__entry->dev = mp->m_super->s_dev;
1988 		__entry->agno = agno;
1989 		__entry->agbno = agbno;
1990 		__entry->len = len;
1991 	),
1992 	TP_printk("dev %d:%d agno %u agbno %u len %u\n",
1993 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1994 		  __entry->agno,
1995 		  __entry->agbno,
1996 		  __entry->len)
1997 )
1998 
1999 #define DEFINE_DISCARD_EVENT(name) \
2000 DEFINE_EVENT(xfs_discard_class, name, \
2001 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2002 		 xfs_agblock_t agbno, xfs_extlen_t len), \
2003 	TP_ARGS(mp, agno, agbno, len))
2004 DEFINE_DISCARD_EVENT(xfs_discard_extent);
2005 DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2006 DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2007 DEFINE_DISCARD_EVENT(xfs_discard_busy);
2008 
2009 #endif /* _TRACE_XFS_H */
2010 
2011 #undef TRACE_INCLUDE_PATH
2012 #define TRACE_INCLUDE_PATH .
2013 #define TRACE_INCLUDE_FILE xfs_trace
2014 #include <trace/define_trace.h>
2015