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