Loading...
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
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
33struct xfs_log_item;
34struct xlog;
35struct xlog_ticket;
36struct xlog_recover;
37struct xlog_recover_item;
38struct xfs_buf_log_format;
39struct xfs_inode_log_format;
40struct xfs_bmbt_irec;
41struct xfs_btree_cur;
42struct xfs_refcount_irec;
43
44DECLARE_EVENT_CLASS(xfs_attr_list_class,
45 TP_PROTO(struct xfs_attr_list_context *ctx),
46 TP_ARGS(ctx),
47 TP_STRUCT__entry(
48 __field(dev_t, dev)
49 __field(xfs_ino_t, ino)
50 __field(u32, hashval)
51 __field(u32, blkno)
52 __field(u32, offset)
53 __field(void *, alist)
54 __field(int, bufsize)
55 __field(int, count)
56 __field(int, firstu)
57 __field(int, dupcnt)
58 __field(int, flags)
59 ),
60 TP_fast_assign(
61 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
62 __entry->ino = ctx->dp->i_ino;
63 __entry->hashval = ctx->cursor->hashval;
64 __entry->blkno = ctx->cursor->blkno;
65 __entry->offset = ctx->cursor->offset;
66 __entry->alist = ctx->alist;
67 __entry->bufsize = ctx->bufsize;
68 __entry->count = ctx->count;
69 __entry->firstu = ctx->firstu;
70 __entry->flags = ctx->flags;
71 ),
72 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
73 "alist 0x%p size %u count %u firstu %u flags %d %s",
74 MAJOR(__entry->dev), MINOR(__entry->dev),
75 __entry->ino,
76 __entry->hashval,
77 __entry->blkno,
78 __entry->offset,
79 __entry->dupcnt,
80 __entry->alist,
81 __entry->bufsize,
82 __entry->count,
83 __entry->firstu,
84 __entry->flags,
85 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
86 )
87)
88
89#define DEFINE_ATTR_LIST_EVENT(name) \
90DEFINE_EVENT(xfs_attr_list_class, name, \
91 TP_PROTO(struct xfs_attr_list_context *ctx), \
92 TP_ARGS(ctx))
93DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
94DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
101DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
102DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
103
104DECLARE_EVENT_CLASS(xfs_perag_class,
105 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
106 unsigned long caller_ip),
107 TP_ARGS(mp, agno, refcount, caller_ip),
108 TP_STRUCT__entry(
109 __field(dev_t, dev)
110 __field(xfs_agnumber_t, agno)
111 __field(int, refcount)
112 __field(unsigned long, caller_ip)
113 ),
114 TP_fast_assign(
115 __entry->dev = mp->m_super->s_dev;
116 __entry->agno = agno;
117 __entry->refcount = refcount;
118 __entry->caller_ip = caller_ip;
119 ),
120 TP_printk("dev %d:%d agno %u refcount %d caller %ps",
121 MAJOR(__entry->dev), MINOR(__entry->dev),
122 __entry->agno,
123 __entry->refcount,
124 (char *)__entry->caller_ip)
125);
126
127#define DEFINE_PERAG_REF_EVENT(name) \
128DEFINE_EVENT(xfs_perag_class, name, \
129 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
130 unsigned long caller_ip), \
131 TP_ARGS(mp, agno, refcount, caller_ip))
132DEFINE_PERAG_REF_EVENT(xfs_perag_get);
133DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
134DEFINE_PERAG_REF_EVENT(xfs_perag_put);
135DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
136DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
137DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
138DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
139DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
140DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
141
142DECLARE_EVENT_CLASS(xfs_ag_class,
143 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
144 TP_ARGS(mp, agno),
145 TP_STRUCT__entry(
146 __field(dev_t, dev)
147 __field(xfs_agnumber_t, agno)
148 ),
149 TP_fast_assign(
150 __entry->dev = mp->m_super->s_dev;
151 __entry->agno = agno;
152 ),
153 TP_printk("dev %d:%d agno %u",
154 MAJOR(__entry->dev), MINOR(__entry->dev),
155 __entry->agno)
156);
157#define DEFINE_AG_EVENT(name) \
158DEFINE_EVENT(xfs_ag_class, name, \
159 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
160 TP_ARGS(mp, agno))
161
162DEFINE_AG_EVENT(xfs_read_agf);
163DEFINE_AG_EVENT(xfs_alloc_read_agf);
164DEFINE_AG_EVENT(xfs_read_agi);
165DEFINE_AG_EVENT(xfs_ialloc_read_agi);
166
167TRACE_EVENT(xfs_attr_list_node_descend,
168 TP_PROTO(struct xfs_attr_list_context *ctx,
169 struct xfs_da_node_entry *btree),
170 TP_ARGS(ctx, btree),
171 TP_STRUCT__entry(
172 __field(dev_t, dev)
173 __field(xfs_ino_t, ino)
174 __field(u32, hashval)
175 __field(u32, blkno)
176 __field(u32, offset)
177 __field(void *, alist)
178 __field(int, bufsize)
179 __field(int, count)
180 __field(int, firstu)
181 __field(int, dupcnt)
182 __field(int, flags)
183 __field(u32, bt_hashval)
184 __field(u32, bt_before)
185 ),
186 TP_fast_assign(
187 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
188 __entry->ino = ctx->dp->i_ino;
189 __entry->hashval = ctx->cursor->hashval;
190 __entry->blkno = ctx->cursor->blkno;
191 __entry->offset = ctx->cursor->offset;
192 __entry->alist = ctx->alist;
193 __entry->bufsize = ctx->bufsize;
194 __entry->count = ctx->count;
195 __entry->firstu = ctx->firstu;
196 __entry->flags = ctx->flags;
197 __entry->bt_hashval = be32_to_cpu(btree->hashval);
198 __entry->bt_before = be32_to_cpu(btree->before);
199 ),
200 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
201 "alist 0x%p size %u count %u firstu %u flags %d %s "
202 "node hashval %u, node before %u",
203 MAJOR(__entry->dev), MINOR(__entry->dev),
204 __entry->ino,
205 __entry->hashval,
206 __entry->blkno,
207 __entry->offset,
208 __entry->dupcnt,
209 __entry->alist,
210 __entry->bufsize,
211 __entry->count,
212 __entry->firstu,
213 __entry->flags,
214 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
215 __entry->bt_hashval,
216 __entry->bt_before)
217);
218
219TRACE_EVENT(xfs_iext_insert,
220 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
221 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
222 TP_ARGS(ip, idx, r, state, caller_ip),
223 TP_STRUCT__entry(
224 __field(dev_t, dev)
225 __field(xfs_ino_t, ino)
226 __field(xfs_extnum_t, idx)
227 __field(xfs_fileoff_t, startoff)
228 __field(xfs_fsblock_t, startblock)
229 __field(xfs_filblks_t, blockcount)
230 __field(xfs_exntst_t, state)
231 __field(int, bmap_state)
232 __field(unsigned long, caller_ip)
233 ),
234 TP_fast_assign(
235 __entry->dev = VFS_I(ip)->i_sb->s_dev;
236 __entry->ino = ip->i_ino;
237 __entry->idx = idx;
238 __entry->startoff = r->br_startoff;
239 __entry->startblock = r->br_startblock;
240 __entry->blockcount = r->br_blockcount;
241 __entry->state = r->br_state;
242 __entry->bmap_state = state;
243 __entry->caller_ip = caller_ip;
244 ),
245 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
246 "offset %lld block %lld count %lld flag %d caller %ps",
247 MAJOR(__entry->dev), MINOR(__entry->dev),
248 __entry->ino,
249 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
250 (long)__entry->idx,
251 __entry->startoff,
252 (__int64_t)__entry->startblock,
253 __entry->blockcount,
254 __entry->state,
255 (char *)__entry->caller_ip)
256);
257
258DECLARE_EVENT_CLASS(xfs_bmap_class,
259 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
260 unsigned long caller_ip),
261 TP_ARGS(ip, idx, state, caller_ip),
262 TP_STRUCT__entry(
263 __field(dev_t, dev)
264 __field(xfs_ino_t, ino)
265 __field(xfs_extnum_t, idx)
266 __field(xfs_fileoff_t, startoff)
267 __field(xfs_fsblock_t, startblock)
268 __field(xfs_filblks_t, blockcount)
269 __field(xfs_exntst_t, state)
270 __field(int, bmap_state)
271 __field(unsigned long, caller_ip)
272 ),
273 TP_fast_assign(
274 struct xfs_ifork *ifp;
275 struct xfs_bmbt_irec r;
276
277 ifp = xfs_iext_state_to_fork(ip, state);
278 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
279 __entry->dev = VFS_I(ip)->i_sb->s_dev;
280 __entry->ino = ip->i_ino;
281 __entry->idx = idx;
282 __entry->startoff = r.br_startoff;
283 __entry->startblock = r.br_startblock;
284 __entry->blockcount = r.br_blockcount;
285 __entry->state = r.br_state;
286 __entry->bmap_state = state;
287 __entry->caller_ip = caller_ip;
288 ),
289 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
290 "offset %lld block %lld count %lld flag %d caller %ps",
291 MAJOR(__entry->dev), MINOR(__entry->dev),
292 __entry->ino,
293 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
294 (long)__entry->idx,
295 __entry->startoff,
296 (__int64_t)__entry->startblock,
297 __entry->blockcount,
298 __entry->state,
299 (char *)__entry->caller_ip)
300)
301
302#define DEFINE_BMAP_EVENT(name) \
303DEFINE_EVENT(xfs_bmap_class, name, \
304 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
305 unsigned long caller_ip), \
306 TP_ARGS(ip, idx, state, caller_ip))
307DEFINE_BMAP_EVENT(xfs_iext_remove);
308DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
309DEFINE_BMAP_EVENT(xfs_bmap_post_update);
310DEFINE_BMAP_EVENT(xfs_extlist);
311
312DECLARE_EVENT_CLASS(xfs_buf_class,
313 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
314 TP_ARGS(bp, caller_ip),
315 TP_STRUCT__entry(
316 __field(dev_t, dev)
317 __field(xfs_daddr_t, bno)
318 __field(int, nblks)
319 __field(int, hold)
320 __field(int, pincount)
321 __field(unsigned, lockval)
322 __field(unsigned, flags)
323 __field(unsigned long, caller_ip)
324 ),
325 TP_fast_assign(
326 __entry->dev = bp->b_target->bt_dev;
327 __entry->bno = bp->b_bn;
328 __entry->nblks = bp->b_length;
329 __entry->hold = atomic_read(&bp->b_hold);
330 __entry->pincount = atomic_read(&bp->b_pin_count);
331 __entry->lockval = bp->b_sema.count;
332 __entry->flags = bp->b_flags;
333 __entry->caller_ip = caller_ip;
334 ),
335 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
336 "lock %d flags %s caller %ps",
337 MAJOR(__entry->dev), MINOR(__entry->dev),
338 (unsigned long long)__entry->bno,
339 __entry->nblks,
340 __entry->hold,
341 __entry->pincount,
342 __entry->lockval,
343 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
344 (void *)__entry->caller_ip)
345)
346
347#define DEFINE_BUF_EVENT(name) \
348DEFINE_EVENT(xfs_buf_class, name, \
349 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
350 TP_ARGS(bp, caller_ip))
351DEFINE_BUF_EVENT(xfs_buf_init);
352DEFINE_BUF_EVENT(xfs_buf_free);
353DEFINE_BUF_EVENT(xfs_buf_hold);
354DEFINE_BUF_EVENT(xfs_buf_rele);
355DEFINE_BUF_EVENT(xfs_buf_iodone);
356DEFINE_BUF_EVENT(xfs_buf_submit);
357DEFINE_BUF_EVENT(xfs_buf_submit_wait);
358DEFINE_BUF_EVENT(xfs_buf_lock);
359DEFINE_BUF_EVENT(xfs_buf_lock_done);
360DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
361DEFINE_BUF_EVENT(xfs_buf_trylock);
362DEFINE_BUF_EVENT(xfs_buf_unlock);
363DEFINE_BUF_EVENT(xfs_buf_iowait);
364DEFINE_BUF_EVENT(xfs_buf_iowait_done);
365DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
366DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
367DEFINE_BUF_EVENT(xfs_buf_delwri_split);
368DEFINE_BUF_EVENT(xfs_buf_get_uncached);
369DEFINE_BUF_EVENT(xfs_buf_item_relse);
370DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
371DEFINE_BUF_EVENT(xfs_buf_error_relse);
372DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
373DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
374
375/* not really buffer traces, but the buf provides useful information */
376DEFINE_BUF_EVENT(xfs_btree_corrupt);
377DEFINE_BUF_EVENT(xfs_reset_dqcounts);
378
379/* pass flags explicitly */
380DECLARE_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 %ps",
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) \
416DEFINE_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))
419DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
420DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
421DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
422
423TRACE_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 %ps",
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
461DECLARE_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) \
510DEFINE_EVENT(xfs_buf_item_class, name, \
511 TP_PROTO(struct xfs_buf_log_item *bip), \
512 TP_ARGS(bip))
513DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
514DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
515DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
516DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
517DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
523DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
524DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
525DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
526DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
527DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
528DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
529DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
530DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
531DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
532DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
533DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
534DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
535DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
536DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
537DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
538DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
539
540DECLARE_EVENT_CLASS(xfs_filestream_class,
541 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
542 TP_ARGS(ip, agno),
543 TP_STRUCT__entry(
544 __field(dev_t, dev)
545 __field(xfs_ino_t, ino)
546 __field(xfs_agnumber_t, agno)
547 __field(int, streams)
548 ),
549 TP_fast_assign(
550 __entry->dev = VFS_I(ip)->i_sb->s_dev;
551 __entry->ino = ip->i_ino;
552 __entry->agno = agno;
553 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
554 ),
555 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
556 MAJOR(__entry->dev), MINOR(__entry->dev),
557 __entry->ino,
558 __entry->agno,
559 __entry->streams)
560)
561#define DEFINE_FILESTREAM_EVENT(name) \
562DEFINE_EVENT(xfs_filestream_class, name, \
563 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
564 TP_ARGS(ip, agno))
565DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
566DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
567DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
568
569TRACE_EVENT(xfs_filestream_pick,
570 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
571 xfs_extlen_t free, int nscan),
572 TP_ARGS(ip, agno, free, nscan),
573 TP_STRUCT__entry(
574 __field(dev_t, dev)
575 __field(xfs_ino_t, ino)
576 __field(xfs_agnumber_t, agno)
577 __field(int, streams)
578 __field(xfs_extlen_t, free)
579 __field(int, nscan)
580 ),
581 TP_fast_assign(
582 __entry->dev = VFS_I(ip)->i_sb->s_dev;
583 __entry->ino = ip->i_ino;
584 __entry->agno = agno;
585 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
586 __entry->free = free;
587 __entry->nscan = nscan;
588 ),
589 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
590 MAJOR(__entry->dev), MINOR(__entry->dev),
591 __entry->ino,
592 __entry->agno,
593 __entry->streams,
594 __entry->free,
595 __entry->nscan)
596);
597
598DECLARE_EVENT_CLASS(xfs_lock_class,
599 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
600 unsigned long caller_ip),
601 TP_ARGS(ip, lock_flags, caller_ip),
602 TP_STRUCT__entry(
603 __field(dev_t, dev)
604 __field(xfs_ino_t, ino)
605 __field(int, lock_flags)
606 __field(unsigned long, caller_ip)
607 ),
608 TP_fast_assign(
609 __entry->dev = VFS_I(ip)->i_sb->s_dev;
610 __entry->ino = ip->i_ino;
611 __entry->lock_flags = lock_flags;
612 __entry->caller_ip = caller_ip;
613 ),
614 TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
615 MAJOR(__entry->dev), MINOR(__entry->dev),
616 __entry->ino,
617 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
618 (void *)__entry->caller_ip)
619)
620
621#define DEFINE_LOCK_EVENT(name) \
622DEFINE_EVENT(xfs_lock_class, name, \
623 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
624 unsigned long caller_ip), \
625 TP_ARGS(ip, lock_flags, caller_ip))
626DEFINE_LOCK_EVENT(xfs_ilock);
627DEFINE_LOCK_EVENT(xfs_ilock_nowait);
628DEFINE_LOCK_EVENT(xfs_ilock_demote);
629DEFINE_LOCK_EVENT(xfs_iunlock);
630
631DECLARE_EVENT_CLASS(xfs_inode_class,
632 TP_PROTO(struct xfs_inode *ip),
633 TP_ARGS(ip),
634 TP_STRUCT__entry(
635 __field(dev_t, dev)
636 __field(xfs_ino_t, ino)
637 ),
638 TP_fast_assign(
639 __entry->dev = VFS_I(ip)->i_sb->s_dev;
640 __entry->ino = ip->i_ino;
641 ),
642 TP_printk("dev %d:%d ino 0x%llx",
643 MAJOR(__entry->dev), MINOR(__entry->dev),
644 __entry->ino)
645)
646
647#define DEFINE_INODE_EVENT(name) \
648DEFINE_EVENT(xfs_inode_class, name, \
649 TP_PROTO(struct xfs_inode *ip), \
650 TP_ARGS(ip))
651DEFINE_INODE_EVENT(xfs_iget_skip);
652DEFINE_INODE_EVENT(xfs_iget_reclaim);
653DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
654DEFINE_INODE_EVENT(xfs_iget_hit);
655DEFINE_INODE_EVENT(xfs_iget_miss);
656
657DEFINE_INODE_EVENT(xfs_getattr);
658DEFINE_INODE_EVENT(xfs_setattr);
659DEFINE_INODE_EVENT(xfs_readlink);
660DEFINE_INODE_EVENT(xfs_inactive_symlink);
661DEFINE_INODE_EVENT(xfs_alloc_file_space);
662DEFINE_INODE_EVENT(xfs_free_file_space);
663DEFINE_INODE_EVENT(xfs_zero_file_space);
664DEFINE_INODE_EVENT(xfs_collapse_file_space);
665DEFINE_INODE_EVENT(xfs_insert_file_space);
666DEFINE_INODE_EVENT(xfs_readdir);
667#ifdef CONFIG_XFS_POSIX_ACL
668DEFINE_INODE_EVENT(xfs_get_acl);
669#endif
670DEFINE_INODE_EVENT(xfs_vm_bmap);
671DEFINE_INODE_EVENT(xfs_file_ioctl);
672DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
673DEFINE_INODE_EVENT(xfs_ioctl_setattr);
674DEFINE_INODE_EVENT(xfs_dir_fsync);
675DEFINE_INODE_EVENT(xfs_file_fsync);
676DEFINE_INODE_EVENT(xfs_destroy_inode);
677DEFINE_INODE_EVENT(xfs_update_time);
678
679DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
680DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
681
682DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
683DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
684DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
685DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
686DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
687DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
688
689DEFINE_INODE_EVENT(xfs_filemap_fault);
690DEFINE_INODE_EVENT(xfs_filemap_pmd_fault);
691DEFINE_INODE_EVENT(xfs_filemap_page_mkwrite);
692DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
693
694DECLARE_EVENT_CLASS(xfs_iref_class,
695 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
696 TP_ARGS(ip, caller_ip),
697 TP_STRUCT__entry(
698 __field(dev_t, dev)
699 __field(xfs_ino_t, ino)
700 __field(int, count)
701 __field(int, pincount)
702 __field(unsigned long, caller_ip)
703 ),
704 TP_fast_assign(
705 __entry->dev = VFS_I(ip)->i_sb->s_dev;
706 __entry->ino = ip->i_ino;
707 __entry->count = atomic_read(&VFS_I(ip)->i_count);
708 __entry->pincount = atomic_read(&ip->i_pincount);
709 __entry->caller_ip = caller_ip;
710 ),
711 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
712 MAJOR(__entry->dev), MINOR(__entry->dev),
713 __entry->ino,
714 __entry->count,
715 __entry->pincount,
716 (char *)__entry->caller_ip)
717)
718
719TRACE_EVENT(xfs_iomap_prealloc_size,
720 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
721 unsigned int writeio_blocks),
722 TP_ARGS(ip, blocks, shift, writeio_blocks),
723 TP_STRUCT__entry(
724 __field(dev_t, dev)
725 __field(xfs_ino_t, ino)
726 __field(xfs_fsblock_t, blocks)
727 __field(int, shift)
728 __field(unsigned int, writeio_blocks)
729 ),
730 TP_fast_assign(
731 __entry->dev = VFS_I(ip)->i_sb->s_dev;
732 __entry->ino = ip->i_ino;
733 __entry->blocks = blocks;
734 __entry->shift = shift;
735 __entry->writeio_blocks = writeio_blocks;
736 ),
737 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
738 "m_writeio_blocks %u",
739 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
740 __entry->blocks, __entry->shift, __entry->writeio_blocks)
741)
742
743TRACE_EVENT(xfs_irec_merge_pre,
744 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
745 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
746 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
747 TP_STRUCT__entry(
748 __field(dev_t, dev)
749 __field(xfs_agnumber_t, agno)
750 __field(xfs_agino_t, agino)
751 __field(uint16_t, holemask)
752 __field(xfs_agino_t, nagino)
753 __field(uint16_t, nholemask)
754 ),
755 TP_fast_assign(
756 __entry->dev = mp->m_super->s_dev;
757 __entry->agno = agno;
758 __entry->agino = agino;
759 __entry->holemask = holemask;
760 __entry->nagino = nagino;
761 __entry->nholemask = holemask;
762 ),
763 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
764 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
765 __entry->agino, __entry->holemask, __entry->nagino,
766 __entry->nholemask)
767)
768
769TRACE_EVENT(xfs_irec_merge_post,
770 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
771 uint16_t holemask),
772 TP_ARGS(mp, agno, agino, holemask),
773 TP_STRUCT__entry(
774 __field(dev_t, dev)
775 __field(xfs_agnumber_t, agno)
776 __field(xfs_agino_t, agino)
777 __field(uint16_t, holemask)
778 ),
779 TP_fast_assign(
780 __entry->dev = mp->m_super->s_dev;
781 __entry->agno = agno;
782 __entry->agino = agino;
783 __entry->holemask = holemask;
784 ),
785 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
786 MINOR(__entry->dev), __entry->agno, __entry->agino,
787 __entry->holemask)
788)
789
790#define DEFINE_IREF_EVENT(name) \
791DEFINE_EVENT(xfs_iref_class, name, \
792 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
793 TP_ARGS(ip, caller_ip))
794DEFINE_IREF_EVENT(xfs_irele);
795DEFINE_IREF_EVENT(xfs_inode_pin);
796DEFINE_IREF_EVENT(xfs_inode_unpin);
797DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
798
799DECLARE_EVENT_CLASS(xfs_namespace_class,
800 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
801 TP_ARGS(dp, name),
802 TP_STRUCT__entry(
803 __field(dev_t, dev)
804 __field(xfs_ino_t, dp_ino)
805 __field(int, namelen)
806 __dynamic_array(char, name, name->len)
807 ),
808 TP_fast_assign(
809 __entry->dev = VFS_I(dp)->i_sb->s_dev;
810 __entry->dp_ino = dp->i_ino;
811 __entry->namelen = name->len;
812 memcpy(__get_str(name), name->name, name->len);
813 ),
814 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
815 MAJOR(__entry->dev), MINOR(__entry->dev),
816 __entry->dp_ino,
817 __entry->namelen,
818 __get_str(name))
819)
820
821#define DEFINE_NAMESPACE_EVENT(name) \
822DEFINE_EVENT(xfs_namespace_class, name, \
823 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
824 TP_ARGS(dp, name))
825DEFINE_NAMESPACE_EVENT(xfs_remove);
826DEFINE_NAMESPACE_EVENT(xfs_link);
827DEFINE_NAMESPACE_EVENT(xfs_lookup);
828DEFINE_NAMESPACE_EVENT(xfs_create);
829DEFINE_NAMESPACE_EVENT(xfs_symlink);
830
831TRACE_EVENT(xfs_rename,
832 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
833 struct xfs_name *src_name, struct xfs_name *target_name),
834 TP_ARGS(src_dp, target_dp, src_name, target_name),
835 TP_STRUCT__entry(
836 __field(dev_t, dev)
837 __field(xfs_ino_t, src_dp_ino)
838 __field(xfs_ino_t, target_dp_ino)
839 __field(int, src_namelen)
840 __field(int, target_namelen)
841 __dynamic_array(char, src_name, src_name->len)
842 __dynamic_array(char, target_name, target_name->len)
843 ),
844 TP_fast_assign(
845 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
846 __entry->src_dp_ino = src_dp->i_ino;
847 __entry->target_dp_ino = target_dp->i_ino;
848 __entry->src_namelen = src_name->len;
849 __entry->target_namelen = target_name->len;
850 memcpy(__get_str(src_name), src_name->name, src_name->len);
851 memcpy(__get_str(target_name), target_name->name,
852 target_name->len);
853 ),
854 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
855 " src name %.*s target name %.*s",
856 MAJOR(__entry->dev), MINOR(__entry->dev),
857 __entry->src_dp_ino,
858 __entry->target_dp_ino,
859 __entry->src_namelen,
860 __get_str(src_name),
861 __entry->target_namelen,
862 __get_str(target_name))
863)
864
865DECLARE_EVENT_CLASS(xfs_dquot_class,
866 TP_PROTO(struct xfs_dquot *dqp),
867 TP_ARGS(dqp),
868 TP_STRUCT__entry(
869 __field(dev_t, dev)
870 __field(u32, id)
871 __field(unsigned, flags)
872 __field(unsigned, nrefs)
873 __field(unsigned long long, res_bcount)
874 __field(unsigned long long, bcount)
875 __field(unsigned long long, icount)
876 __field(unsigned long long, blk_hardlimit)
877 __field(unsigned long long, blk_softlimit)
878 __field(unsigned long long, ino_hardlimit)
879 __field(unsigned long long, ino_softlimit)
880 ), \
881 TP_fast_assign(
882 __entry->dev = dqp->q_mount->m_super->s_dev;
883 __entry->id = be32_to_cpu(dqp->q_core.d_id);
884 __entry->flags = dqp->dq_flags;
885 __entry->nrefs = dqp->q_nrefs;
886 __entry->res_bcount = dqp->q_res_bcount;
887 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
888 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
889 __entry->blk_hardlimit =
890 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
891 __entry->blk_softlimit =
892 be64_to_cpu(dqp->q_core.d_blk_softlimit);
893 __entry->ino_hardlimit =
894 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
895 __entry->ino_softlimit =
896 be64_to_cpu(dqp->q_core.d_ino_softlimit);
897 ),
898 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
899 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
900 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
901 MAJOR(__entry->dev), MINOR(__entry->dev),
902 __entry->id,
903 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
904 __entry->nrefs,
905 __entry->res_bcount,
906 __entry->bcount,
907 __entry->blk_hardlimit,
908 __entry->blk_softlimit,
909 __entry->icount,
910 __entry->ino_hardlimit,
911 __entry->ino_softlimit)
912)
913
914#define DEFINE_DQUOT_EVENT(name) \
915DEFINE_EVENT(xfs_dquot_class, name, \
916 TP_PROTO(struct xfs_dquot *dqp), \
917 TP_ARGS(dqp))
918DEFINE_DQUOT_EVENT(xfs_dqadjust);
919DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
920DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
921DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
922DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
923DEFINE_DQUOT_EVENT(xfs_dqattach_found);
924DEFINE_DQUOT_EVENT(xfs_dqattach_get);
925DEFINE_DQUOT_EVENT(xfs_dqalloc);
926DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
927DEFINE_DQUOT_EVENT(xfs_dqread);
928DEFINE_DQUOT_EVENT(xfs_dqread_fail);
929DEFINE_DQUOT_EVENT(xfs_dqget_hit);
930DEFINE_DQUOT_EVENT(xfs_dqget_miss);
931DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
932DEFINE_DQUOT_EVENT(xfs_dqget_dup);
933DEFINE_DQUOT_EVENT(xfs_dqput);
934DEFINE_DQUOT_EVENT(xfs_dqput_free);
935DEFINE_DQUOT_EVENT(xfs_dqrele);
936DEFINE_DQUOT_EVENT(xfs_dqflush);
937DEFINE_DQUOT_EVENT(xfs_dqflush_force);
938DEFINE_DQUOT_EVENT(xfs_dqflush_done);
939
940DECLARE_EVENT_CLASS(xfs_loggrant_class,
941 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
942 TP_ARGS(log, tic),
943 TP_STRUCT__entry(
944 __field(dev_t, dev)
945 __field(char, ocnt)
946 __field(char, cnt)
947 __field(int, curr_res)
948 __field(int, unit_res)
949 __field(unsigned int, flags)
950 __field(int, reserveq)
951 __field(int, writeq)
952 __field(int, grant_reserve_cycle)
953 __field(int, grant_reserve_bytes)
954 __field(int, grant_write_cycle)
955 __field(int, grant_write_bytes)
956 __field(int, curr_cycle)
957 __field(int, curr_block)
958 __field(xfs_lsn_t, tail_lsn)
959 ),
960 TP_fast_assign(
961 __entry->dev = log->l_mp->m_super->s_dev;
962 __entry->ocnt = tic->t_ocnt;
963 __entry->cnt = tic->t_cnt;
964 __entry->curr_res = tic->t_curr_res;
965 __entry->unit_res = tic->t_unit_res;
966 __entry->flags = tic->t_flags;
967 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
968 __entry->writeq = list_empty(&log->l_write_head.waiters);
969 xlog_crack_grant_head(&log->l_reserve_head.grant,
970 &__entry->grant_reserve_cycle,
971 &__entry->grant_reserve_bytes);
972 xlog_crack_grant_head(&log->l_write_head.grant,
973 &__entry->grant_write_cycle,
974 &__entry->grant_write_bytes);
975 __entry->curr_cycle = log->l_curr_cycle;
976 __entry->curr_block = log->l_curr_block;
977 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
978 ),
979 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
980 "t_unit_res %u t_flags %s reserveq %s "
981 "writeq %s grant_reserve_cycle %d "
982 "grant_reserve_bytes %d grant_write_cycle %d "
983 "grant_write_bytes %d curr_cycle %d curr_block %d "
984 "tail_cycle %d tail_block %d",
985 MAJOR(__entry->dev), MINOR(__entry->dev),
986 __entry->ocnt,
987 __entry->cnt,
988 __entry->curr_res,
989 __entry->unit_res,
990 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
991 __entry->reserveq ? "empty" : "active",
992 __entry->writeq ? "empty" : "active",
993 __entry->grant_reserve_cycle,
994 __entry->grant_reserve_bytes,
995 __entry->grant_write_cycle,
996 __entry->grant_write_bytes,
997 __entry->curr_cycle,
998 __entry->curr_block,
999 CYCLE_LSN(__entry->tail_lsn),
1000 BLOCK_LSN(__entry->tail_lsn)
1001 )
1002)
1003
1004#define DEFINE_LOGGRANT_EVENT(name) \
1005DEFINE_EVENT(xfs_loggrant_class, name, \
1006 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1007 TP_ARGS(log, tic))
1008DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1009DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
1010DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1011DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1012DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1013DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1014DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1015DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1016DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1017DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1018DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1019DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1020DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1021DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1022DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1023DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1024
1025DECLARE_EVENT_CLASS(xfs_log_item_class,
1026 TP_PROTO(struct xfs_log_item *lip),
1027 TP_ARGS(lip),
1028 TP_STRUCT__entry(
1029 __field(dev_t, dev)
1030 __field(void *, lip)
1031 __field(uint, type)
1032 __field(uint, flags)
1033 __field(xfs_lsn_t, lsn)
1034 ),
1035 TP_fast_assign(
1036 __entry->dev = lip->li_mountp->m_super->s_dev;
1037 __entry->lip = lip;
1038 __entry->type = lip->li_type;
1039 __entry->flags = lip->li_flags;
1040 __entry->lsn = lip->li_lsn;
1041 ),
1042 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1043 MAJOR(__entry->dev), MINOR(__entry->dev),
1044 __entry->lip,
1045 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1046 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1047 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1048)
1049
1050TRACE_EVENT(xfs_log_force,
1051 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1052 TP_ARGS(mp, lsn, caller_ip),
1053 TP_STRUCT__entry(
1054 __field(dev_t, dev)
1055 __field(xfs_lsn_t, lsn)
1056 __field(unsigned long, caller_ip)
1057 ),
1058 TP_fast_assign(
1059 __entry->dev = mp->m_super->s_dev;
1060 __entry->lsn = lsn;
1061 __entry->caller_ip = caller_ip;
1062 ),
1063 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
1064 MAJOR(__entry->dev), MINOR(__entry->dev),
1065 __entry->lsn, (void *)__entry->caller_ip)
1066)
1067
1068#define DEFINE_LOG_ITEM_EVENT(name) \
1069DEFINE_EVENT(xfs_log_item_class, name, \
1070 TP_PROTO(struct xfs_log_item *lip), \
1071 TP_ARGS(lip))
1072DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1073DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1074DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1075DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1076
1077DECLARE_EVENT_CLASS(xfs_ail_class,
1078 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1079 TP_ARGS(lip, old_lsn, new_lsn),
1080 TP_STRUCT__entry(
1081 __field(dev_t, dev)
1082 __field(void *, lip)
1083 __field(uint, type)
1084 __field(uint, flags)
1085 __field(xfs_lsn_t, old_lsn)
1086 __field(xfs_lsn_t, new_lsn)
1087 ),
1088 TP_fast_assign(
1089 __entry->dev = lip->li_mountp->m_super->s_dev;
1090 __entry->lip = lip;
1091 __entry->type = lip->li_type;
1092 __entry->flags = lip->li_flags;
1093 __entry->old_lsn = old_lsn;
1094 __entry->new_lsn = new_lsn;
1095 ),
1096 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1097 MAJOR(__entry->dev), MINOR(__entry->dev),
1098 __entry->lip,
1099 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1100 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1101 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1102 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1103)
1104
1105#define DEFINE_AIL_EVENT(name) \
1106DEFINE_EVENT(xfs_ail_class, name, \
1107 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1108 TP_ARGS(lip, old_lsn, new_lsn))
1109DEFINE_AIL_EVENT(xfs_ail_insert);
1110DEFINE_AIL_EVENT(xfs_ail_move);
1111DEFINE_AIL_EVENT(xfs_ail_delete);
1112
1113TRACE_EVENT(xfs_log_assign_tail_lsn,
1114 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1115 TP_ARGS(log, new_lsn),
1116 TP_STRUCT__entry(
1117 __field(dev_t, dev)
1118 __field(xfs_lsn_t, new_lsn)
1119 __field(xfs_lsn_t, old_lsn)
1120 __field(xfs_lsn_t, last_sync_lsn)
1121 ),
1122 TP_fast_assign(
1123 __entry->dev = log->l_mp->m_super->s_dev;
1124 __entry->new_lsn = new_lsn;
1125 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1126 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1127 ),
1128 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1129 MAJOR(__entry->dev), MINOR(__entry->dev),
1130 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1131 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1132 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1133)
1134
1135DECLARE_EVENT_CLASS(xfs_file_class,
1136 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1137 TP_ARGS(ip, count, offset),
1138 TP_STRUCT__entry(
1139 __field(dev_t, dev)
1140 __field(xfs_ino_t, ino)
1141 __field(xfs_fsize_t, size)
1142 __field(loff_t, offset)
1143 __field(size_t, count)
1144 ),
1145 TP_fast_assign(
1146 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1147 __entry->ino = ip->i_ino;
1148 __entry->size = ip->i_d.di_size;
1149 __entry->offset = offset;
1150 __entry->count = count;
1151 ),
1152 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
1153 MAJOR(__entry->dev), MINOR(__entry->dev),
1154 __entry->ino,
1155 __entry->size,
1156 __entry->offset,
1157 __entry->count)
1158)
1159
1160#define DEFINE_RW_EVENT(name) \
1161DEFINE_EVENT(xfs_file_class, name, \
1162 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1163 TP_ARGS(ip, count, offset))
1164DEFINE_RW_EVENT(xfs_file_buffered_read);
1165DEFINE_RW_EVENT(xfs_file_direct_read);
1166DEFINE_RW_EVENT(xfs_file_dax_read);
1167DEFINE_RW_EVENT(xfs_file_buffered_write);
1168DEFINE_RW_EVENT(xfs_file_direct_write);
1169DEFINE_RW_EVENT(xfs_file_dax_write);
1170
1171DECLARE_EVENT_CLASS(xfs_page_class,
1172 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1173 unsigned int len),
1174 TP_ARGS(inode, page, off, len),
1175 TP_STRUCT__entry(
1176 __field(dev_t, dev)
1177 __field(xfs_ino_t, ino)
1178 __field(pgoff_t, pgoff)
1179 __field(loff_t, size)
1180 __field(unsigned long, offset)
1181 __field(unsigned int, length)
1182 __field(int, delalloc)
1183 __field(int, unwritten)
1184 ),
1185 TP_fast_assign(
1186 int delalloc = -1, unwritten = -1;
1187
1188 if (page_has_buffers(page))
1189 xfs_count_page_state(page, &delalloc, &unwritten);
1190 __entry->dev = inode->i_sb->s_dev;
1191 __entry->ino = XFS_I(inode)->i_ino;
1192 __entry->pgoff = page_offset(page);
1193 __entry->size = i_size_read(inode);
1194 __entry->offset = off;
1195 __entry->length = len;
1196 __entry->delalloc = delalloc;
1197 __entry->unwritten = unwritten;
1198 ),
1199 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
1200 "length %x delalloc %d unwritten %d",
1201 MAJOR(__entry->dev), MINOR(__entry->dev),
1202 __entry->ino,
1203 __entry->pgoff,
1204 __entry->size,
1205 __entry->offset,
1206 __entry->length,
1207 __entry->delalloc,
1208 __entry->unwritten)
1209)
1210
1211#define DEFINE_PAGE_EVENT(name) \
1212DEFINE_EVENT(xfs_page_class, name, \
1213 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1214 unsigned int len), \
1215 TP_ARGS(inode, page, off, len))
1216DEFINE_PAGE_EVENT(xfs_writepage);
1217DEFINE_PAGE_EVENT(xfs_releasepage);
1218DEFINE_PAGE_EVENT(xfs_invalidatepage);
1219
1220DECLARE_EVENT_CLASS(xfs_readpage_class,
1221 TP_PROTO(struct inode *inode, int nr_pages),
1222 TP_ARGS(inode, nr_pages),
1223 TP_STRUCT__entry(
1224 __field(dev_t, dev)
1225 __field(xfs_ino_t, ino)
1226 __field(int, nr_pages)
1227 ),
1228 TP_fast_assign(
1229 __entry->dev = inode->i_sb->s_dev;
1230 __entry->ino = inode->i_ino;
1231 __entry->nr_pages = nr_pages;
1232 ),
1233 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1234 MAJOR(__entry->dev), MINOR(__entry->dev),
1235 __entry->ino,
1236 __entry->nr_pages)
1237)
1238
1239#define DEFINE_READPAGE_EVENT(name) \
1240DEFINE_EVENT(xfs_readpage_class, name, \
1241 TP_PROTO(struct inode *inode, int nr_pages), \
1242 TP_ARGS(inode, nr_pages))
1243DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1244DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1245
1246DECLARE_EVENT_CLASS(xfs_imap_class,
1247 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1248 int type, struct xfs_bmbt_irec *irec),
1249 TP_ARGS(ip, offset, count, type, irec),
1250 TP_STRUCT__entry(
1251 __field(dev_t, dev)
1252 __field(xfs_ino_t, ino)
1253 __field(loff_t, size)
1254 __field(loff_t, offset)
1255 __field(size_t, count)
1256 __field(int, type)
1257 __field(xfs_fileoff_t, startoff)
1258 __field(xfs_fsblock_t, startblock)
1259 __field(xfs_filblks_t, blockcount)
1260 ),
1261 TP_fast_assign(
1262 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1263 __entry->ino = ip->i_ino;
1264 __entry->size = ip->i_d.di_size;
1265 __entry->offset = offset;
1266 __entry->count = count;
1267 __entry->type = type;
1268 __entry->startoff = irec ? irec->br_startoff : 0;
1269 __entry->startblock = irec ? irec->br_startblock : 0;
1270 __entry->blockcount = irec ? irec->br_blockcount : 0;
1271 ),
1272 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1273 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
1274 MAJOR(__entry->dev), MINOR(__entry->dev),
1275 __entry->ino,
1276 __entry->size,
1277 __entry->offset,
1278 __entry->count,
1279 __print_symbolic(__entry->type, XFS_IO_TYPES),
1280 __entry->startoff,
1281 (__int64_t)__entry->startblock,
1282 __entry->blockcount)
1283)
1284
1285#define DEFINE_IOMAP_EVENT(name) \
1286DEFINE_EVENT(xfs_imap_class, name, \
1287 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
1288 int type, struct xfs_bmbt_irec *irec), \
1289 TP_ARGS(ip, offset, count, type, irec))
1290DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1291DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1292DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1293DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
1294DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
1295DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1296DEFINE_IOMAP_EVENT(xfs_iomap_found);
1297
1298DECLARE_EVENT_CLASS(xfs_simple_io_class,
1299 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1300 TP_ARGS(ip, offset, count),
1301 TP_STRUCT__entry(
1302 __field(dev_t, dev)
1303 __field(xfs_ino_t, ino)
1304 __field(loff_t, isize)
1305 __field(loff_t, disize)
1306 __field(loff_t, offset)
1307 __field(size_t, count)
1308 ),
1309 TP_fast_assign(
1310 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1311 __entry->ino = ip->i_ino;
1312 __entry->isize = VFS_I(ip)->i_size;
1313 __entry->disize = ip->i_d.di_size;
1314 __entry->offset = offset;
1315 __entry->count = count;
1316 ),
1317 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1318 "offset 0x%llx count %zd",
1319 MAJOR(__entry->dev), MINOR(__entry->dev),
1320 __entry->ino,
1321 __entry->isize,
1322 __entry->disize,
1323 __entry->offset,
1324 __entry->count)
1325);
1326
1327#define DEFINE_SIMPLE_IO_EVENT(name) \
1328DEFINE_EVENT(xfs_simple_io_class, name, \
1329 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1330 TP_ARGS(ip, offset, count))
1331DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1332DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1333DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
1334DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1335DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1336DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1337DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1338DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
1339
1340DECLARE_EVENT_CLASS(xfs_itrunc_class,
1341 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1342 TP_ARGS(ip, new_size),
1343 TP_STRUCT__entry(
1344 __field(dev_t, dev)
1345 __field(xfs_ino_t, ino)
1346 __field(xfs_fsize_t, size)
1347 __field(xfs_fsize_t, new_size)
1348 ),
1349 TP_fast_assign(
1350 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1351 __entry->ino = ip->i_ino;
1352 __entry->size = ip->i_d.di_size;
1353 __entry->new_size = new_size;
1354 ),
1355 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1356 MAJOR(__entry->dev), MINOR(__entry->dev),
1357 __entry->ino,
1358 __entry->size,
1359 __entry->new_size)
1360)
1361
1362#define DEFINE_ITRUNC_EVENT(name) \
1363DEFINE_EVENT(xfs_itrunc_class, name, \
1364 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1365 TP_ARGS(ip, new_size))
1366DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1367DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1368
1369TRACE_EVENT(xfs_pagecache_inval,
1370 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1371 TP_ARGS(ip, start, finish),
1372 TP_STRUCT__entry(
1373 __field(dev_t, dev)
1374 __field(xfs_ino_t, ino)
1375 __field(xfs_fsize_t, size)
1376 __field(xfs_off_t, start)
1377 __field(xfs_off_t, finish)
1378 ),
1379 TP_fast_assign(
1380 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1381 __entry->ino = ip->i_ino;
1382 __entry->size = ip->i_d.di_size;
1383 __entry->start = start;
1384 __entry->finish = finish;
1385 ),
1386 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1387 MAJOR(__entry->dev), MINOR(__entry->dev),
1388 __entry->ino,
1389 __entry->size,
1390 __entry->start,
1391 __entry->finish)
1392);
1393
1394TRACE_EVENT(xfs_bunmap,
1395 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1396 int flags, unsigned long caller_ip),
1397 TP_ARGS(ip, bno, len, flags, caller_ip),
1398 TP_STRUCT__entry(
1399 __field(dev_t, dev)
1400 __field(xfs_ino_t, ino)
1401 __field(xfs_fsize_t, size)
1402 __field(xfs_fileoff_t, bno)
1403 __field(xfs_filblks_t, len)
1404 __field(unsigned long, caller_ip)
1405 __field(int, flags)
1406 ),
1407 TP_fast_assign(
1408 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1409 __entry->ino = ip->i_ino;
1410 __entry->size = ip->i_d.di_size;
1411 __entry->bno = bno;
1412 __entry->len = len;
1413 __entry->caller_ip = caller_ip;
1414 __entry->flags = flags;
1415 ),
1416 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1417 "flags %s caller %ps",
1418 MAJOR(__entry->dev), MINOR(__entry->dev),
1419 __entry->ino,
1420 __entry->size,
1421 __entry->bno,
1422 __entry->len,
1423 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1424 (void *)__entry->caller_ip)
1425
1426);
1427
1428DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1429 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1430 xfs_agblock_t agbno, xfs_extlen_t len),
1431 TP_ARGS(mp, agno, agbno, len),
1432 TP_STRUCT__entry(
1433 __field(dev_t, dev)
1434 __field(xfs_agnumber_t, agno)
1435 __field(xfs_agblock_t, agbno)
1436 __field(xfs_extlen_t, len)
1437 ),
1438 TP_fast_assign(
1439 __entry->dev = mp->m_super->s_dev;
1440 __entry->agno = agno;
1441 __entry->agbno = agbno;
1442 __entry->len = len;
1443 ),
1444 TP_printk("dev %d:%d agno %u agbno %u len %u",
1445 MAJOR(__entry->dev), MINOR(__entry->dev),
1446 __entry->agno,
1447 __entry->agbno,
1448 __entry->len)
1449);
1450#define DEFINE_BUSY_EVENT(name) \
1451DEFINE_EVENT(xfs_extent_busy_class, name, \
1452 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1453 xfs_agblock_t agbno, xfs_extlen_t len), \
1454 TP_ARGS(mp, agno, agbno, len))
1455DEFINE_BUSY_EVENT(xfs_extent_busy);
1456DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1457DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1458DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1459DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1460
1461TRACE_EVENT(xfs_extent_busy_trim,
1462 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1463 xfs_agblock_t agbno, xfs_extlen_t len,
1464 xfs_agblock_t tbno, xfs_extlen_t tlen),
1465 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1466 TP_STRUCT__entry(
1467 __field(dev_t, dev)
1468 __field(xfs_agnumber_t, agno)
1469 __field(xfs_agblock_t, agbno)
1470 __field(xfs_extlen_t, len)
1471 __field(xfs_agblock_t, tbno)
1472 __field(xfs_extlen_t, tlen)
1473 ),
1474 TP_fast_assign(
1475 __entry->dev = mp->m_super->s_dev;
1476 __entry->agno = agno;
1477 __entry->agbno = agbno;
1478 __entry->len = len;
1479 __entry->tbno = tbno;
1480 __entry->tlen = tlen;
1481 ),
1482 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1483 MAJOR(__entry->dev), MINOR(__entry->dev),
1484 __entry->agno,
1485 __entry->agbno,
1486 __entry->len,
1487 __entry->tbno,
1488 __entry->tlen)
1489);
1490
1491TRACE_EVENT(xfs_trans_commit_lsn,
1492 TP_PROTO(struct xfs_trans *trans),
1493 TP_ARGS(trans),
1494 TP_STRUCT__entry(
1495 __field(dev_t, dev)
1496 __field(struct xfs_trans *, tp)
1497 __field(xfs_lsn_t, lsn)
1498 ),
1499 TP_fast_assign(
1500 __entry->dev = trans->t_mountp->m_super->s_dev;
1501 __entry->tp = trans;
1502 __entry->lsn = trans->t_commit_lsn;
1503 ),
1504 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1505 MAJOR(__entry->dev), MINOR(__entry->dev),
1506 __entry->tp,
1507 __entry->lsn)
1508);
1509
1510TRACE_EVENT(xfs_agf,
1511 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1512 unsigned long caller_ip),
1513 TP_ARGS(mp, agf, flags, caller_ip),
1514 TP_STRUCT__entry(
1515 __field(dev_t, dev)
1516 __field(xfs_agnumber_t, agno)
1517 __field(int, flags)
1518 __field(__u32, length)
1519 __field(__u32, bno_root)
1520 __field(__u32, cnt_root)
1521 __field(__u32, bno_level)
1522 __field(__u32, cnt_level)
1523 __field(__u32, flfirst)
1524 __field(__u32, fllast)
1525 __field(__u32, flcount)
1526 __field(__u32, freeblks)
1527 __field(__u32, longest)
1528 __field(unsigned long, caller_ip)
1529 ),
1530 TP_fast_assign(
1531 __entry->dev = mp->m_super->s_dev;
1532 __entry->agno = be32_to_cpu(agf->agf_seqno),
1533 __entry->flags = flags;
1534 __entry->length = be32_to_cpu(agf->agf_length),
1535 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1536 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1537 __entry->bno_level =
1538 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1539 __entry->cnt_level =
1540 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1541 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1542 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1543 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1544 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1545 __entry->longest = be32_to_cpu(agf->agf_longest);
1546 __entry->caller_ip = caller_ip;
1547 ),
1548 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1549 "levels b %u c %u flfirst %u fllast %u flcount %u "
1550 "freeblks %u longest %u caller %ps",
1551 MAJOR(__entry->dev), MINOR(__entry->dev),
1552 __entry->agno,
1553 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1554 __entry->length,
1555 __entry->bno_root,
1556 __entry->cnt_root,
1557 __entry->bno_level,
1558 __entry->cnt_level,
1559 __entry->flfirst,
1560 __entry->fllast,
1561 __entry->flcount,
1562 __entry->freeblks,
1563 __entry->longest,
1564 (void *)__entry->caller_ip)
1565);
1566
1567TRACE_EVENT(xfs_free_extent,
1568 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1569 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1570 int haveright),
1571 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
1572 TP_STRUCT__entry(
1573 __field(dev_t, dev)
1574 __field(xfs_agnumber_t, agno)
1575 __field(xfs_agblock_t, agbno)
1576 __field(xfs_extlen_t, len)
1577 __field(int, resv)
1578 __field(int, haveleft)
1579 __field(int, haveright)
1580 ),
1581 TP_fast_assign(
1582 __entry->dev = mp->m_super->s_dev;
1583 __entry->agno = agno;
1584 __entry->agbno = agbno;
1585 __entry->len = len;
1586 __entry->resv = resv;
1587 __entry->haveleft = haveleft;
1588 __entry->haveright = haveright;
1589 ),
1590 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
1591 MAJOR(__entry->dev), MINOR(__entry->dev),
1592 __entry->agno,
1593 __entry->agbno,
1594 __entry->len,
1595 __entry->resv,
1596 __entry->haveleft ?
1597 (__entry->haveright ? "both" : "left") :
1598 (__entry->haveright ? "right" : "none"))
1599
1600);
1601
1602DECLARE_EVENT_CLASS(xfs_alloc_class,
1603 TP_PROTO(struct xfs_alloc_arg *args),
1604 TP_ARGS(args),
1605 TP_STRUCT__entry(
1606 __field(dev_t, dev)
1607 __field(xfs_agnumber_t, agno)
1608 __field(xfs_agblock_t, agbno)
1609 __field(xfs_extlen_t, minlen)
1610 __field(xfs_extlen_t, maxlen)
1611 __field(xfs_extlen_t, mod)
1612 __field(xfs_extlen_t, prod)
1613 __field(xfs_extlen_t, minleft)
1614 __field(xfs_extlen_t, total)
1615 __field(xfs_extlen_t, alignment)
1616 __field(xfs_extlen_t, minalignslop)
1617 __field(xfs_extlen_t, len)
1618 __field(short, type)
1619 __field(short, otype)
1620 __field(char, wasdel)
1621 __field(char, wasfromfl)
1622 __field(int, resv)
1623 __field(int, datatype)
1624 __field(xfs_fsblock_t, firstblock)
1625 ),
1626 TP_fast_assign(
1627 __entry->dev = args->mp->m_super->s_dev;
1628 __entry->agno = args->agno;
1629 __entry->agbno = args->agbno;
1630 __entry->minlen = args->minlen;
1631 __entry->maxlen = args->maxlen;
1632 __entry->mod = args->mod;
1633 __entry->prod = args->prod;
1634 __entry->minleft = args->minleft;
1635 __entry->total = args->total;
1636 __entry->alignment = args->alignment;
1637 __entry->minalignslop = args->minalignslop;
1638 __entry->len = args->len;
1639 __entry->type = args->type;
1640 __entry->otype = args->otype;
1641 __entry->wasdel = args->wasdel;
1642 __entry->wasfromfl = args->wasfromfl;
1643 __entry->resv = args->resv;
1644 __entry->datatype = args->datatype;
1645 __entry->firstblock = args->firstblock;
1646 ),
1647 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1648 "prod %u minleft %u total %u alignment %u minalignslop %u "
1649 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
1650 "datatype 0x%x firstblock 0x%llx",
1651 MAJOR(__entry->dev), MINOR(__entry->dev),
1652 __entry->agno,
1653 __entry->agbno,
1654 __entry->minlen,
1655 __entry->maxlen,
1656 __entry->mod,
1657 __entry->prod,
1658 __entry->minleft,
1659 __entry->total,
1660 __entry->alignment,
1661 __entry->minalignslop,
1662 __entry->len,
1663 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1664 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1665 __entry->wasdel,
1666 __entry->wasfromfl,
1667 __entry->resv,
1668 __entry->datatype,
1669 (unsigned long long)__entry->firstblock)
1670)
1671
1672#define DEFINE_ALLOC_EVENT(name) \
1673DEFINE_EVENT(xfs_alloc_class, name, \
1674 TP_PROTO(struct xfs_alloc_arg *args), \
1675 TP_ARGS(args))
1676DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1677DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1678DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1679DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1680DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1681DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1682DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1683DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1684DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1685DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1686DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1687DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1688DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1689DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1690DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1691DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1692DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1693DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1694DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1695DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1696DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1697DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1698DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1699DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1700DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1701
1702DECLARE_EVENT_CLASS(xfs_da_class,
1703 TP_PROTO(struct xfs_da_args *args),
1704 TP_ARGS(args),
1705 TP_STRUCT__entry(
1706 __field(dev_t, dev)
1707 __field(xfs_ino_t, ino)
1708 __dynamic_array(char, name, args->namelen)
1709 __field(int, namelen)
1710 __field(xfs_dahash_t, hashval)
1711 __field(xfs_ino_t, inumber)
1712 __field(int, op_flags)
1713 ),
1714 TP_fast_assign(
1715 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1716 __entry->ino = args->dp->i_ino;
1717 if (args->namelen)
1718 memcpy(__get_str(name), args->name, args->namelen);
1719 __entry->namelen = args->namelen;
1720 __entry->hashval = args->hashval;
1721 __entry->inumber = args->inumber;
1722 __entry->op_flags = args->op_flags;
1723 ),
1724 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1725 "inumber 0x%llx op_flags %s",
1726 MAJOR(__entry->dev), MINOR(__entry->dev),
1727 __entry->ino,
1728 __entry->namelen,
1729 __entry->namelen ? __get_str(name) : NULL,
1730 __entry->namelen,
1731 __entry->hashval,
1732 __entry->inumber,
1733 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1734)
1735
1736#define DEFINE_DIR2_EVENT(name) \
1737DEFINE_EVENT(xfs_da_class, name, \
1738 TP_PROTO(struct xfs_da_args *args), \
1739 TP_ARGS(args))
1740DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1741DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1742DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1743DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1744DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1745DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1746DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1747DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1748DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1749DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1750DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1751DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1752DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1753DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1754DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1755DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1756DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1757DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1758DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1759DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1760DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1761DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1762DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1763DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1764DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1765
1766DECLARE_EVENT_CLASS(xfs_attr_class,
1767 TP_PROTO(struct xfs_da_args *args),
1768 TP_ARGS(args),
1769 TP_STRUCT__entry(
1770 __field(dev_t, dev)
1771 __field(xfs_ino_t, ino)
1772 __dynamic_array(char, name, args->namelen)
1773 __field(int, namelen)
1774 __field(int, valuelen)
1775 __field(xfs_dahash_t, hashval)
1776 __field(int, op_flags)
1777 ),
1778 TP_fast_assign(
1779 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1780 __entry->ino = args->dp->i_ino;
1781 if (args->namelen)
1782 memcpy(__get_str(name), args->name, args->namelen);
1783 __entry->namelen = args->namelen;
1784 __entry->valuelen = args->valuelen;
1785 __entry->hashval = args->hashval;
1786 __entry->op_flags = args->op_flags;
1787 ),
1788 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1789 "hashval 0x%x op_flags %s",
1790 MAJOR(__entry->dev), MINOR(__entry->dev),
1791 __entry->ino,
1792 __entry->namelen,
1793 __entry->namelen ? __get_str(name) : NULL,
1794 __entry->namelen,
1795 __entry->valuelen,
1796 __entry->hashval,
1797 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1798)
1799
1800#define DEFINE_ATTR_EVENT(name) \
1801DEFINE_EVENT(xfs_attr_class, name, \
1802 TP_PROTO(struct xfs_da_args *args), \
1803 TP_ARGS(args))
1804DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1805DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1806DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1807DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1808DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1809DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1810
1811DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1812DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1813DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
1814DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
1815DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1816DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
1817DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1818DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
1819DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1820DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
1821DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1823DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1824DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1825DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1827DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1828DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1829DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1831DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1832DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
1834
1835DEFINE_ATTR_EVENT(xfs_attr_node_addname);
1836DEFINE_ATTR_EVENT(xfs_attr_node_get);
1837DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1838DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1839
1840DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1841DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1842
1843DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1844DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1845DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1846
1847#define DEFINE_DA_EVENT(name) \
1848DEFINE_EVENT(xfs_da_class, name, \
1849 TP_PROTO(struct xfs_da_args *args), \
1850 TP_ARGS(args))
1851DEFINE_DA_EVENT(xfs_da_split);
1852DEFINE_DA_EVENT(xfs_da_join);
1853DEFINE_DA_EVENT(xfs_da_link_before);
1854DEFINE_DA_EVENT(xfs_da_link_after);
1855DEFINE_DA_EVENT(xfs_da_unlink_back);
1856DEFINE_DA_EVENT(xfs_da_unlink_forward);
1857DEFINE_DA_EVENT(xfs_da_root_split);
1858DEFINE_DA_EVENT(xfs_da_root_join);
1859DEFINE_DA_EVENT(xfs_da_node_add);
1860DEFINE_DA_EVENT(xfs_da_node_create);
1861DEFINE_DA_EVENT(xfs_da_node_split);
1862DEFINE_DA_EVENT(xfs_da_node_remove);
1863DEFINE_DA_EVENT(xfs_da_node_rebalance);
1864DEFINE_DA_EVENT(xfs_da_node_unbalance);
1865DEFINE_DA_EVENT(xfs_da_node_toosmall);
1866DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1867DEFINE_DA_EVENT(xfs_da_grow_inode);
1868DEFINE_DA_EVENT(xfs_da_shrink_inode);
1869DEFINE_DA_EVENT(xfs_da_fixhashpath);
1870DEFINE_DA_EVENT(xfs_da_path_shift);
1871
1872DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1873 TP_PROTO(struct xfs_da_args *args, int idx),
1874 TP_ARGS(args, idx),
1875 TP_STRUCT__entry(
1876 __field(dev_t, dev)
1877 __field(xfs_ino_t, ino)
1878 __field(int, op_flags)
1879 __field(int, idx)
1880 ),
1881 TP_fast_assign(
1882 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1883 __entry->ino = args->dp->i_ino;
1884 __entry->op_flags = args->op_flags;
1885 __entry->idx = idx;
1886 ),
1887 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1888 MAJOR(__entry->dev), MINOR(__entry->dev),
1889 __entry->ino,
1890 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1891 __entry->idx)
1892)
1893
1894#define DEFINE_DIR2_SPACE_EVENT(name) \
1895DEFINE_EVENT(xfs_dir2_space_class, name, \
1896 TP_PROTO(struct xfs_da_args *args, int idx), \
1897 TP_ARGS(args, idx))
1898DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1899DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1900DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1901DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1902
1903TRACE_EVENT(xfs_dir2_leafn_moveents,
1904 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1905 TP_ARGS(args, src_idx, dst_idx, count),
1906 TP_STRUCT__entry(
1907 __field(dev_t, dev)
1908 __field(xfs_ino_t, ino)
1909 __field(int, op_flags)
1910 __field(int, src_idx)
1911 __field(int, dst_idx)
1912 __field(int, count)
1913 ),
1914 TP_fast_assign(
1915 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1916 __entry->ino = args->dp->i_ino;
1917 __entry->op_flags = args->op_flags;
1918 __entry->src_idx = src_idx;
1919 __entry->dst_idx = dst_idx;
1920 __entry->count = count;
1921 ),
1922 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1923 "src_idx %d dst_idx %d count %d",
1924 MAJOR(__entry->dev), MINOR(__entry->dev),
1925 __entry->ino,
1926 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1927 __entry->src_idx,
1928 __entry->dst_idx,
1929 __entry->count)
1930);
1931
1932#define XFS_SWAPEXT_INODES \
1933 { 0, "target" }, \
1934 { 1, "temp" }
1935
1936#define XFS_INODE_FORMAT_STR \
1937 { 0, "invalid" }, \
1938 { 1, "local" }, \
1939 { 2, "extent" }, \
1940 { 3, "btree" }
1941
1942DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1943 TP_PROTO(struct xfs_inode *ip, int which),
1944 TP_ARGS(ip, which),
1945 TP_STRUCT__entry(
1946 __field(dev_t, dev)
1947 __field(int, which)
1948 __field(xfs_ino_t, ino)
1949 __field(int, format)
1950 __field(int, nex)
1951 __field(int, broot_size)
1952 __field(int, fork_off)
1953 ),
1954 TP_fast_assign(
1955 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1956 __entry->which = which;
1957 __entry->ino = ip->i_ino;
1958 __entry->format = ip->i_d.di_format;
1959 __entry->nex = ip->i_d.di_nextents;
1960 __entry->broot_size = ip->i_df.if_broot_bytes;
1961 __entry->fork_off = XFS_IFORK_BOFF(ip);
1962 ),
1963 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1964 "broot size %d, fork offset %d",
1965 MAJOR(__entry->dev), MINOR(__entry->dev),
1966 __entry->ino,
1967 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1968 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1969 __entry->nex,
1970 __entry->broot_size,
1971 __entry->fork_off)
1972)
1973
1974#define DEFINE_SWAPEXT_EVENT(name) \
1975DEFINE_EVENT(xfs_swap_extent_class, name, \
1976 TP_PROTO(struct xfs_inode *ip, int which), \
1977 TP_ARGS(ip, which))
1978
1979DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1980DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1981
1982TRACE_EVENT(xfs_log_recover_record,
1983 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1984 TP_ARGS(log, rhead, pass),
1985 TP_STRUCT__entry(
1986 __field(dev_t, dev)
1987 __field(xfs_lsn_t, lsn)
1988 __field(int, len)
1989 __field(int, num_logops)
1990 __field(int, pass)
1991 ),
1992 TP_fast_assign(
1993 __entry->dev = log->l_mp->m_super->s_dev;
1994 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1995 __entry->len = be32_to_cpu(rhead->h_len);
1996 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1997 __entry->pass = pass;
1998 ),
1999 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2000 MAJOR(__entry->dev), MINOR(__entry->dev),
2001 __entry->lsn, __entry->len, __entry->num_logops,
2002 __entry->pass)
2003)
2004
2005DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2006 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2007 struct xlog_recover_item *item, int pass),
2008 TP_ARGS(log, trans, item, pass),
2009 TP_STRUCT__entry(
2010 __field(dev_t, dev)
2011 __field(unsigned long, item)
2012 __field(xlog_tid_t, tid)
2013 __field(xfs_lsn_t, lsn)
2014 __field(int, type)
2015 __field(int, pass)
2016 __field(int, count)
2017 __field(int, total)
2018 ),
2019 TP_fast_assign(
2020 __entry->dev = log->l_mp->m_super->s_dev;
2021 __entry->item = (unsigned long)item;
2022 __entry->tid = trans->r_log_tid;
2023 __entry->lsn = trans->r_lsn;
2024 __entry->type = ITEM_TYPE(item);
2025 __entry->pass = pass;
2026 __entry->count = item->ri_cnt;
2027 __entry->total = item->ri_total;
2028 ),
2029 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2030 "item type %s item region count/total %d/%d",
2031 MAJOR(__entry->dev), MINOR(__entry->dev),
2032 __entry->tid,
2033 __entry->lsn,
2034 __entry->pass,
2035 (void *)__entry->item,
2036 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2037 __entry->count,
2038 __entry->total)
2039)
2040
2041#define DEFINE_LOG_RECOVER_ITEM(name) \
2042DEFINE_EVENT(xfs_log_recover_item_class, name, \
2043 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2044 struct xlog_recover_item *item, int pass), \
2045 TP_ARGS(log, trans, item, pass))
2046
2047DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2048DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2049DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2050DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2051DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2052
2053DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2054 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2055 TP_ARGS(log, buf_f),
2056 TP_STRUCT__entry(
2057 __field(dev_t, dev)
2058 __field(__int64_t, blkno)
2059 __field(unsigned short, len)
2060 __field(unsigned short, flags)
2061 __field(unsigned short, size)
2062 __field(unsigned int, map_size)
2063 ),
2064 TP_fast_assign(
2065 __entry->dev = log->l_mp->m_super->s_dev;
2066 __entry->blkno = buf_f->blf_blkno;
2067 __entry->len = buf_f->blf_len;
2068 __entry->flags = buf_f->blf_flags;
2069 __entry->size = buf_f->blf_size;
2070 __entry->map_size = buf_f->blf_map_size;
2071 ),
2072 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2073 "map_size %d",
2074 MAJOR(__entry->dev), MINOR(__entry->dev),
2075 __entry->blkno,
2076 __entry->len,
2077 __entry->flags,
2078 __entry->size,
2079 __entry->map_size)
2080)
2081
2082#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2083DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2084 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2085 TP_ARGS(log, buf_f))
2086
2087DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2088DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2089DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2090DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2091DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2092DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2093DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2094DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2095DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2096
2097DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2098 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2099 TP_ARGS(log, in_f),
2100 TP_STRUCT__entry(
2101 __field(dev_t, dev)
2102 __field(xfs_ino_t, ino)
2103 __field(unsigned short, size)
2104 __field(int, fields)
2105 __field(unsigned short, asize)
2106 __field(unsigned short, dsize)
2107 __field(__int64_t, blkno)
2108 __field(int, len)
2109 __field(int, boffset)
2110 ),
2111 TP_fast_assign(
2112 __entry->dev = log->l_mp->m_super->s_dev;
2113 __entry->ino = in_f->ilf_ino;
2114 __entry->size = in_f->ilf_size;
2115 __entry->fields = in_f->ilf_fields;
2116 __entry->asize = in_f->ilf_asize;
2117 __entry->dsize = in_f->ilf_dsize;
2118 __entry->blkno = in_f->ilf_blkno;
2119 __entry->len = in_f->ilf_len;
2120 __entry->boffset = in_f->ilf_boffset;
2121 ),
2122 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2123 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2124 MAJOR(__entry->dev), MINOR(__entry->dev),
2125 __entry->ino,
2126 __entry->size,
2127 __entry->fields,
2128 __entry->asize,
2129 __entry->dsize,
2130 __entry->blkno,
2131 __entry->len,
2132 __entry->boffset)
2133)
2134#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2135DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2136 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2137 TP_ARGS(log, in_f))
2138
2139DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2140DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2141DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2142
2143DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2144 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2145 TP_ARGS(log, in_f),
2146 TP_STRUCT__entry(
2147 __field(dev_t, dev)
2148 __field(xfs_agnumber_t, agno)
2149 __field(xfs_agblock_t, agbno)
2150 __field(unsigned int, count)
2151 __field(unsigned int, isize)
2152 __field(xfs_agblock_t, length)
2153 __field(unsigned int, gen)
2154 ),
2155 TP_fast_assign(
2156 __entry->dev = log->l_mp->m_super->s_dev;
2157 __entry->agno = be32_to_cpu(in_f->icl_ag);
2158 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2159 __entry->count = be32_to_cpu(in_f->icl_count);
2160 __entry->isize = be32_to_cpu(in_f->icl_isize);
2161 __entry->length = be32_to_cpu(in_f->icl_length);
2162 __entry->gen = be32_to_cpu(in_f->icl_gen);
2163 ),
2164 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2165 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2166 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2167 __entry->length, __entry->gen)
2168)
2169#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2170DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2171 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2172 TP_ARGS(log, in_f))
2173
2174DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2175DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2176
2177DECLARE_EVENT_CLASS(xfs_discard_class,
2178 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2179 xfs_agblock_t agbno, xfs_extlen_t len),
2180 TP_ARGS(mp, agno, agbno, len),
2181 TP_STRUCT__entry(
2182 __field(dev_t, dev)
2183 __field(xfs_agnumber_t, agno)
2184 __field(xfs_agblock_t, agbno)
2185 __field(xfs_extlen_t, len)
2186 ),
2187 TP_fast_assign(
2188 __entry->dev = mp->m_super->s_dev;
2189 __entry->agno = agno;
2190 __entry->agbno = agbno;
2191 __entry->len = len;
2192 ),
2193 TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2194 MAJOR(__entry->dev), MINOR(__entry->dev),
2195 __entry->agno,
2196 __entry->agbno,
2197 __entry->len)
2198)
2199
2200#define DEFINE_DISCARD_EVENT(name) \
2201DEFINE_EVENT(xfs_discard_class, name, \
2202 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2203 xfs_agblock_t agbno, xfs_extlen_t len), \
2204 TP_ARGS(mp, agno, agbno, len))
2205DEFINE_DISCARD_EVENT(xfs_discard_extent);
2206DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2207DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2208DEFINE_DISCARD_EVENT(xfs_discard_busy);
2209
2210/* btree cursor events */
2211DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2212 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2213 TP_ARGS(cur, level, bp),
2214 TP_STRUCT__entry(
2215 __field(dev_t, dev)
2216 __field(xfs_btnum_t, btnum)
2217 __field(int, level)
2218 __field(int, nlevels)
2219 __field(int, ptr)
2220 __field(xfs_daddr_t, daddr)
2221 ),
2222 TP_fast_assign(
2223 __entry->dev = cur->bc_mp->m_super->s_dev;
2224 __entry->btnum = cur->bc_btnum;
2225 __entry->level = level;
2226 __entry->nlevels = cur->bc_nlevels;
2227 __entry->ptr = cur->bc_ptrs[level];
2228 __entry->daddr = bp ? bp->b_bn : -1;
2229 ),
2230 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2231 MAJOR(__entry->dev), MINOR(__entry->dev),
2232 __entry->btnum,
2233 __entry->level,
2234 __entry->nlevels,
2235 __entry->ptr,
2236 (unsigned long long)__entry->daddr)
2237)
2238
2239#define DEFINE_BTREE_CUR_EVENT(name) \
2240DEFINE_EVENT(xfs_btree_cur_class, name, \
2241 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2242 TP_ARGS(cur, level, bp))
2243DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2244DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2245
2246/* deferred ops */
2247struct xfs_defer_pending;
2248struct xfs_defer_intake;
2249struct xfs_defer_ops;
2250
2251DECLARE_EVENT_CLASS(xfs_defer_class,
2252 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2253 TP_ARGS(mp, dop),
2254 TP_STRUCT__entry(
2255 __field(dev_t, dev)
2256 __field(void *, dop)
2257 __field(bool, committed)
2258 __field(bool, low)
2259 ),
2260 TP_fast_assign(
2261 __entry->dev = mp ? mp->m_super->s_dev : 0;
2262 __entry->dop = dop;
2263 __entry->committed = dop->dop_committed;
2264 __entry->low = dop->dop_low;
2265 ),
2266 TP_printk("dev %d:%d ops %p committed %d low %d\n",
2267 MAJOR(__entry->dev), MINOR(__entry->dev),
2268 __entry->dop,
2269 __entry->committed,
2270 __entry->low)
2271)
2272#define DEFINE_DEFER_EVENT(name) \
2273DEFINE_EVENT(xfs_defer_class, name, \
2274 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2275 TP_ARGS(mp, dop))
2276
2277DECLARE_EVENT_CLASS(xfs_defer_error_class,
2278 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2279 TP_ARGS(mp, dop, error),
2280 TP_STRUCT__entry(
2281 __field(dev_t, dev)
2282 __field(void *, dop)
2283 __field(bool, committed)
2284 __field(bool, low)
2285 __field(int, error)
2286 ),
2287 TP_fast_assign(
2288 __entry->dev = mp ? mp->m_super->s_dev : 0;
2289 __entry->dop = dop;
2290 __entry->committed = dop->dop_committed;
2291 __entry->low = dop->dop_low;
2292 __entry->error = error;
2293 ),
2294 TP_printk("dev %d:%d ops %p committed %d low %d err %d\n",
2295 MAJOR(__entry->dev), MINOR(__entry->dev),
2296 __entry->dop,
2297 __entry->committed,
2298 __entry->low,
2299 __entry->error)
2300)
2301#define DEFINE_DEFER_ERROR_EVENT(name) \
2302DEFINE_EVENT(xfs_defer_error_class, name, \
2303 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2304 TP_ARGS(mp, dop, error))
2305
2306DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2307 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2308 TP_ARGS(mp, dfp),
2309 TP_STRUCT__entry(
2310 __field(dev_t, dev)
2311 __field(int, type)
2312 __field(void *, intent)
2313 __field(bool, committed)
2314 __field(int, nr)
2315 ),
2316 TP_fast_assign(
2317 __entry->dev = mp ? mp->m_super->s_dev : 0;
2318 __entry->type = dfp->dfp_type->type;
2319 __entry->intent = dfp->dfp_intent;
2320 __entry->committed = dfp->dfp_done != NULL;
2321 __entry->nr = dfp->dfp_count;
2322 ),
2323 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d\n",
2324 MAJOR(__entry->dev), MINOR(__entry->dev),
2325 __entry->type,
2326 __entry->intent,
2327 __entry->committed,
2328 __entry->nr)
2329)
2330#define DEFINE_DEFER_PENDING_EVENT(name) \
2331DEFINE_EVENT(xfs_defer_pending_class, name, \
2332 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2333 TP_ARGS(mp, dfp))
2334
2335DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2336 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2337 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2338 TP_ARGS(mp, agno, type, agbno, len),
2339 TP_STRUCT__entry(
2340 __field(dev_t, dev)
2341 __field(xfs_agnumber_t, agno)
2342 __field(int, type)
2343 __field(xfs_agblock_t, agbno)
2344 __field(xfs_extlen_t, len)
2345 ),
2346 TP_fast_assign(
2347 __entry->dev = mp->m_super->s_dev;
2348 __entry->agno = agno;
2349 __entry->type = type;
2350 __entry->agbno = agbno;
2351 __entry->len = len;
2352 ),
2353 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2354 MAJOR(__entry->dev), MINOR(__entry->dev),
2355 __entry->type,
2356 __entry->agno,
2357 __entry->agbno,
2358 __entry->len)
2359);
2360#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2361DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2362 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2363 int type, \
2364 xfs_agblock_t bno, \
2365 xfs_extlen_t len), \
2366 TP_ARGS(mp, agno, type, bno, len))
2367
2368DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2369 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2370 int op,
2371 xfs_agblock_t agbno,
2372 xfs_ino_t ino,
2373 int whichfork,
2374 xfs_fileoff_t offset,
2375 xfs_filblks_t len,
2376 xfs_exntst_t state),
2377 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2378 TP_STRUCT__entry(
2379 __field(dev_t, dev)
2380 __field(xfs_agnumber_t, agno)
2381 __field(xfs_ino_t, ino)
2382 __field(xfs_agblock_t, agbno)
2383 __field(int, whichfork)
2384 __field(xfs_fileoff_t, l_loff)
2385 __field(xfs_filblks_t, l_len)
2386 __field(xfs_exntst_t, l_state)
2387 __field(int, op)
2388 ),
2389 TP_fast_assign(
2390 __entry->dev = mp->m_super->s_dev;
2391 __entry->agno = agno;
2392 __entry->ino = ino;
2393 __entry->agbno = agbno;
2394 __entry->whichfork = whichfork;
2395 __entry->l_loff = offset;
2396 __entry->l_len = len;
2397 __entry->l_state = state;
2398 __entry->op = op;
2399 ),
2400 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2401 MAJOR(__entry->dev), MINOR(__entry->dev),
2402 __entry->op,
2403 __entry->agno,
2404 __entry->agbno,
2405 __entry->ino,
2406 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2407 __entry->l_loff,
2408 __entry->l_len,
2409 __entry->l_state)
2410);
2411#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2412DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2413 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2414 int op, \
2415 xfs_agblock_t agbno, \
2416 xfs_ino_t ino, \
2417 int whichfork, \
2418 xfs_fileoff_t offset, \
2419 xfs_filblks_t len, \
2420 xfs_exntst_t state), \
2421 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2422
2423DEFINE_DEFER_EVENT(xfs_defer_init);
2424DEFINE_DEFER_EVENT(xfs_defer_cancel);
2425DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2426DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2427DEFINE_DEFER_EVENT(xfs_defer_finish);
2428DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2429
2430DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2431DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2432
2433DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2434DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
2435DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2436DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2437DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2438
2439#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2440DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2441DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2442
2443/* rmap tracepoints */
2444DECLARE_EVENT_CLASS(xfs_rmap_class,
2445 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2446 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2447 struct xfs_owner_info *oinfo),
2448 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2449 TP_STRUCT__entry(
2450 __field(dev_t, dev)
2451 __field(xfs_agnumber_t, agno)
2452 __field(xfs_agblock_t, agbno)
2453 __field(xfs_extlen_t, len)
2454 __field(uint64_t, owner)
2455 __field(uint64_t, offset)
2456 __field(unsigned long, flags)
2457 ),
2458 TP_fast_assign(
2459 __entry->dev = mp->m_super->s_dev;
2460 __entry->agno = agno;
2461 __entry->agbno = agbno;
2462 __entry->len = len;
2463 __entry->owner = oinfo->oi_owner;
2464 __entry->offset = oinfo->oi_offset;
2465 __entry->flags = oinfo->oi_flags;
2466 if (unwritten)
2467 __entry->flags |= XFS_RMAP_UNWRITTEN;
2468 ),
2469 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2470 MAJOR(__entry->dev), MINOR(__entry->dev),
2471 __entry->agno,
2472 __entry->agbno,
2473 __entry->len,
2474 __entry->owner,
2475 __entry->offset,
2476 __entry->flags)
2477);
2478#define DEFINE_RMAP_EVENT(name) \
2479DEFINE_EVENT(xfs_rmap_class, name, \
2480 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2481 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2482 struct xfs_owner_info *oinfo), \
2483 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2484
2485/* simple AG-based error/%ip tracepoint class */
2486DECLARE_EVENT_CLASS(xfs_ag_error_class,
2487 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2488 unsigned long caller_ip),
2489 TP_ARGS(mp, agno, error, caller_ip),
2490 TP_STRUCT__entry(
2491 __field(dev_t, dev)
2492 __field(xfs_agnumber_t, agno)
2493 __field(int, error)
2494 __field(unsigned long, caller_ip)
2495 ),
2496 TP_fast_assign(
2497 __entry->dev = mp->m_super->s_dev;
2498 __entry->agno = agno;
2499 __entry->error = error;
2500 __entry->caller_ip = caller_ip;
2501 ),
2502 TP_printk("dev %d:%d agno %u error %d caller %ps",
2503 MAJOR(__entry->dev), MINOR(__entry->dev),
2504 __entry->agno,
2505 __entry->error,
2506 (char *)__entry->caller_ip)
2507);
2508
2509#define DEFINE_AG_ERROR_EVENT(name) \
2510DEFINE_EVENT(xfs_ag_error_class, name, \
2511 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2512 unsigned long caller_ip), \
2513 TP_ARGS(mp, agno, error, caller_ip))
2514
2515DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2516DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2517DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2518DEFINE_RMAP_EVENT(xfs_rmap_map);
2519DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2520DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2521DEFINE_RMAP_EVENT(xfs_rmap_convert);
2522DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2523DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2524DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2525
2526DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2527 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2528 xfs_agblock_t agbno, xfs_extlen_t len,
2529 uint64_t owner, uint64_t offset, unsigned int flags),
2530 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2531 TP_STRUCT__entry(
2532 __field(dev_t, dev)
2533 __field(xfs_agnumber_t, agno)
2534 __field(xfs_agblock_t, agbno)
2535 __field(xfs_extlen_t, len)
2536 __field(uint64_t, owner)
2537 __field(uint64_t, offset)
2538 __field(unsigned int, flags)
2539 ),
2540 TP_fast_assign(
2541 __entry->dev = mp->m_super->s_dev;
2542 __entry->agno = agno;
2543 __entry->agbno = agbno;
2544 __entry->len = len;
2545 __entry->owner = owner;
2546 __entry->offset = offset;
2547 __entry->flags = flags;
2548 ),
2549 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2550 MAJOR(__entry->dev), MINOR(__entry->dev),
2551 __entry->agno,
2552 __entry->agbno,
2553 __entry->len,
2554 __entry->owner,
2555 __entry->offset,
2556 __entry->flags)
2557);
2558#define DEFINE_RMAPBT_EVENT(name) \
2559DEFINE_EVENT(xfs_rmapbt_class, name, \
2560 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2561 xfs_agblock_t agbno, xfs_extlen_t len, \
2562 uint64_t owner, uint64_t offset, unsigned int flags), \
2563 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2564
2565#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2566DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2567DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2568
2569DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2570DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2571DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2572DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2573DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2574DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2575DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2576DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2577
2578DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2579DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2580DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2581DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2582DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2583DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2584DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
2585
2586/* deferred bmbt updates */
2587#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2588DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2589DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2590
2591/* per-AG reservation */
2592DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2593 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2594 xfs_extlen_t len),
2595 TP_ARGS(pag, resv, len),
2596 TP_STRUCT__entry(
2597 __field(dev_t, dev)
2598 __field(xfs_agnumber_t, agno)
2599 __field(int, resv)
2600 __field(xfs_extlen_t, freeblks)
2601 __field(xfs_extlen_t, flcount)
2602 __field(xfs_extlen_t, reserved)
2603 __field(xfs_extlen_t, asked)
2604 __field(xfs_extlen_t, len)
2605 ),
2606 TP_fast_assign(
2607 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2608
2609 __entry->dev = pag->pag_mount->m_super->s_dev;
2610 __entry->agno = pag->pag_agno;
2611 __entry->resv = resv;
2612 __entry->freeblks = pag->pagf_freeblks;
2613 __entry->flcount = pag->pagf_flcount;
2614 __entry->reserved = r ? r->ar_reserved : 0;
2615 __entry->asked = r ? r->ar_asked : 0;
2616 __entry->len = len;
2617 ),
2618 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u resv %u ask %u len %u\n",
2619 MAJOR(__entry->dev), MINOR(__entry->dev),
2620 __entry->agno,
2621 __entry->resv,
2622 __entry->freeblks,
2623 __entry->flcount,
2624 __entry->reserved,
2625 __entry->asked,
2626 __entry->len)
2627)
2628#define DEFINE_AG_RESV_EVENT(name) \
2629DEFINE_EVENT(xfs_ag_resv_class, name, \
2630 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2631 xfs_extlen_t len), \
2632 TP_ARGS(pag, type, len))
2633
2634/* per-AG reservation tracepoints */
2635DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2636DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2637DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2638DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2639DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2640DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2641
2642DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2643DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2644
2645/* refcount tracepoint classes */
2646
2647/* reuse the discard trace class for agbno/aglen-based traces */
2648#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2649
2650/* ag btree lookup tracepoint class */
2651#define XFS_AG_BTREE_CMP_FORMAT_STR \
2652 { XFS_LOOKUP_EQ, "eq" }, \
2653 { XFS_LOOKUP_LE, "le" }, \
2654 { XFS_LOOKUP_GE, "ge" }
2655DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2656 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2657 xfs_agblock_t agbno, xfs_lookup_t dir),
2658 TP_ARGS(mp, agno, agbno, dir),
2659 TP_STRUCT__entry(
2660 __field(dev_t, dev)
2661 __field(xfs_agnumber_t, agno)
2662 __field(xfs_agblock_t, agbno)
2663 __field(xfs_lookup_t, dir)
2664 ),
2665 TP_fast_assign(
2666 __entry->dev = mp->m_super->s_dev;
2667 __entry->agno = agno;
2668 __entry->agbno = agbno;
2669 __entry->dir = dir;
2670 ),
2671 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)\n",
2672 MAJOR(__entry->dev), MINOR(__entry->dev),
2673 __entry->agno,
2674 __entry->agbno,
2675 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2676 __entry->dir)
2677)
2678
2679#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2680DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2681 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2682 xfs_agblock_t agbno, xfs_lookup_t dir), \
2683 TP_ARGS(mp, agno, agbno, dir))
2684
2685/* single-rcext tracepoint class */
2686DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2687 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2688 struct xfs_refcount_irec *irec),
2689 TP_ARGS(mp, agno, irec),
2690 TP_STRUCT__entry(
2691 __field(dev_t, dev)
2692 __field(xfs_agnumber_t, agno)
2693 __field(xfs_agblock_t, startblock)
2694 __field(xfs_extlen_t, blockcount)
2695 __field(xfs_nlink_t, refcount)
2696 ),
2697 TP_fast_assign(
2698 __entry->dev = mp->m_super->s_dev;
2699 __entry->agno = agno;
2700 __entry->startblock = irec->rc_startblock;
2701 __entry->blockcount = irec->rc_blockcount;
2702 __entry->refcount = irec->rc_refcount;
2703 ),
2704 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u\n",
2705 MAJOR(__entry->dev), MINOR(__entry->dev),
2706 __entry->agno,
2707 __entry->startblock,
2708 __entry->blockcount,
2709 __entry->refcount)
2710)
2711
2712#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2713DEFINE_EVENT(xfs_refcount_extent_class, name, \
2714 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2715 struct xfs_refcount_irec *irec), \
2716 TP_ARGS(mp, agno, irec))
2717
2718/* single-rcext and an agbno tracepoint class */
2719DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2720 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2721 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2722 TP_ARGS(mp, agno, irec, agbno),
2723 TP_STRUCT__entry(
2724 __field(dev_t, dev)
2725 __field(xfs_agnumber_t, agno)
2726 __field(xfs_agblock_t, startblock)
2727 __field(xfs_extlen_t, blockcount)
2728 __field(xfs_nlink_t, refcount)
2729 __field(xfs_agblock_t, agbno)
2730 ),
2731 TP_fast_assign(
2732 __entry->dev = mp->m_super->s_dev;
2733 __entry->agno = agno;
2734 __entry->startblock = irec->rc_startblock;
2735 __entry->blockcount = irec->rc_blockcount;
2736 __entry->refcount = irec->rc_refcount;
2737 __entry->agbno = agbno;
2738 ),
2739 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u\n",
2740 MAJOR(__entry->dev), MINOR(__entry->dev),
2741 __entry->agno,
2742 __entry->startblock,
2743 __entry->blockcount,
2744 __entry->refcount,
2745 __entry->agbno)
2746)
2747
2748#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2749DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2750 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2751 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2752 TP_ARGS(mp, agno, irec, agbno))
2753
2754/* double-rcext tracepoint class */
2755DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2756 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2757 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2758 TP_ARGS(mp, agno, i1, i2),
2759 TP_STRUCT__entry(
2760 __field(dev_t, dev)
2761 __field(xfs_agnumber_t, agno)
2762 __field(xfs_agblock_t, i1_startblock)
2763 __field(xfs_extlen_t, i1_blockcount)
2764 __field(xfs_nlink_t, i1_refcount)
2765 __field(xfs_agblock_t, i2_startblock)
2766 __field(xfs_extlen_t, i2_blockcount)
2767 __field(xfs_nlink_t, i2_refcount)
2768 ),
2769 TP_fast_assign(
2770 __entry->dev = mp->m_super->s_dev;
2771 __entry->agno = agno;
2772 __entry->i1_startblock = i1->rc_startblock;
2773 __entry->i1_blockcount = i1->rc_blockcount;
2774 __entry->i1_refcount = i1->rc_refcount;
2775 __entry->i2_startblock = i2->rc_startblock;
2776 __entry->i2_blockcount = i2->rc_blockcount;
2777 __entry->i2_refcount = i2->rc_refcount;
2778 ),
2779 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2780 "agbno %u len %u refcount %u\n",
2781 MAJOR(__entry->dev), MINOR(__entry->dev),
2782 __entry->agno,
2783 __entry->i1_startblock,
2784 __entry->i1_blockcount,
2785 __entry->i1_refcount,
2786 __entry->i2_startblock,
2787 __entry->i2_blockcount,
2788 __entry->i2_refcount)
2789)
2790
2791#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2792DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2793 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2794 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2795 TP_ARGS(mp, agno, i1, i2))
2796
2797/* double-rcext and an agbno tracepoint class */
2798DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2799 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2800 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2801 xfs_agblock_t agbno),
2802 TP_ARGS(mp, agno, i1, i2, agbno),
2803 TP_STRUCT__entry(
2804 __field(dev_t, dev)
2805 __field(xfs_agnumber_t, agno)
2806 __field(xfs_agblock_t, i1_startblock)
2807 __field(xfs_extlen_t, i1_blockcount)
2808 __field(xfs_nlink_t, i1_refcount)
2809 __field(xfs_agblock_t, i2_startblock)
2810 __field(xfs_extlen_t, i2_blockcount)
2811 __field(xfs_nlink_t, i2_refcount)
2812 __field(xfs_agblock_t, agbno)
2813 ),
2814 TP_fast_assign(
2815 __entry->dev = mp->m_super->s_dev;
2816 __entry->agno = agno;
2817 __entry->i1_startblock = i1->rc_startblock;
2818 __entry->i1_blockcount = i1->rc_blockcount;
2819 __entry->i1_refcount = i1->rc_refcount;
2820 __entry->i2_startblock = i2->rc_startblock;
2821 __entry->i2_blockcount = i2->rc_blockcount;
2822 __entry->i2_refcount = i2->rc_refcount;
2823 __entry->agbno = agbno;
2824 ),
2825 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2826 "agbno %u len %u refcount %u @ agbno %u\n",
2827 MAJOR(__entry->dev), MINOR(__entry->dev),
2828 __entry->agno,
2829 __entry->i1_startblock,
2830 __entry->i1_blockcount,
2831 __entry->i1_refcount,
2832 __entry->i2_startblock,
2833 __entry->i2_blockcount,
2834 __entry->i2_refcount,
2835 __entry->agbno)
2836)
2837
2838#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2839DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2840 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2841 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2842 xfs_agblock_t agbno), \
2843 TP_ARGS(mp, agno, i1, i2, agbno))
2844
2845/* triple-rcext tracepoint class */
2846DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2847 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2848 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2849 struct xfs_refcount_irec *i3),
2850 TP_ARGS(mp, agno, i1, i2, i3),
2851 TP_STRUCT__entry(
2852 __field(dev_t, dev)
2853 __field(xfs_agnumber_t, agno)
2854 __field(xfs_agblock_t, i1_startblock)
2855 __field(xfs_extlen_t, i1_blockcount)
2856 __field(xfs_nlink_t, i1_refcount)
2857 __field(xfs_agblock_t, i2_startblock)
2858 __field(xfs_extlen_t, i2_blockcount)
2859 __field(xfs_nlink_t, i2_refcount)
2860 __field(xfs_agblock_t, i3_startblock)
2861 __field(xfs_extlen_t, i3_blockcount)
2862 __field(xfs_nlink_t, i3_refcount)
2863 ),
2864 TP_fast_assign(
2865 __entry->dev = mp->m_super->s_dev;
2866 __entry->agno = agno;
2867 __entry->i1_startblock = i1->rc_startblock;
2868 __entry->i1_blockcount = i1->rc_blockcount;
2869 __entry->i1_refcount = i1->rc_refcount;
2870 __entry->i2_startblock = i2->rc_startblock;
2871 __entry->i2_blockcount = i2->rc_blockcount;
2872 __entry->i2_refcount = i2->rc_refcount;
2873 __entry->i3_startblock = i3->rc_startblock;
2874 __entry->i3_blockcount = i3->rc_blockcount;
2875 __entry->i3_refcount = i3->rc_refcount;
2876 ),
2877 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2878 "agbno %u len %u refcount %u -- "
2879 "agbno %u len %u refcount %u\n",
2880 MAJOR(__entry->dev), MINOR(__entry->dev),
2881 __entry->agno,
2882 __entry->i1_startblock,
2883 __entry->i1_blockcount,
2884 __entry->i1_refcount,
2885 __entry->i2_startblock,
2886 __entry->i2_blockcount,
2887 __entry->i2_refcount,
2888 __entry->i3_startblock,
2889 __entry->i3_blockcount,
2890 __entry->i3_refcount)
2891);
2892
2893#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2894DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2895 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2896 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2897 struct xfs_refcount_irec *i3), \
2898 TP_ARGS(mp, agno, i1, i2, i3))
2899
2900/* refcount btree tracepoints */
2901DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2902DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2903DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2904DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2905DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2906DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2907DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2908DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2909DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2910DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2911
2912/* refcount adjustment tracepoints */
2913DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2914DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
2915DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2916DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
2917DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2918DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
2919DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
2920DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2921DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2922DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2923DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2924DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2925DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
2926DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
2927DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2928DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2929DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2930DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2931DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2932DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2933DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2934
2935/* reflink helpers */
2936DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2937DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2938DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
2939#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2940DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2941DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
2942
2943TRACE_EVENT(xfs_refcount_finish_one_leftover,
2944 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2945 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2946 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2947 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2948 TP_STRUCT__entry(
2949 __field(dev_t, dev)
2950 __field(xfs_agnumber_t, agno)
2951 __field(int, type)
2952 __field(xfs_agblock_t, agbno)
2953 __field(xfs_extlen_t, len)
2954 __field(xfs_agblock_t, new_agbno)
2955 __field(xfs_extlen_t, new_len)
2956 ),
2957 TP_fast_assign(
2958 __entry->dev = mp->m_super->s_dev;
2959 __entry->agno = agno;
2960 __entry->type = type;
2961 __entry->agbno = agbno;
2962 __entry->len = len;
2963 __entry->new_agbno = new_agbno;
2964 __entry->new_len = new_len;
2965 ),
2966 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2967 MAJOR(__entry->dev), MINOR(__entry->dev),
2968 __entry->type,
2969 __entry->agno,
2970 __entry->agbno,
2971 __entry->len,
2972 __entry->new_agbno,
2973 __entry->new_len)
2974);
2975
2976/* simple inode-based error/%ip tracepoint class */
2977DECLARE_EVENT_CLASS(xfs_inode_error_class,
2978 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2979 TP_ARGS(ip, error, caller_ip),
2980 TP_STRUCT__entry(
2981 __field(dev_t, dev)
2982 __field(xfs_ino_t, ino)
2983 __field(int, error)
2984 __field(unsigned long, caller_ip)
2985 ),
2986 TP_fast_assign(
2987 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2988 __entry->ino = ip->i_ino;
2989 __entry->error = error;
2990 __entry->caller_ip = caller_ip;
2991 ),
2992 TP_printk("dev %d:%d ino %llx error %d caller %ps",
2993 MAJOR(__entry->dev), MINOR(__entry->dev),
2994 __entry->ino,
2995 __entry->error,
2996 (char *)__entry->caller_ip)
2997);
2998
2999#define DEFINE_INODE_ERROR_EVENT(name) \
3000DEFINE_EVENT(xfs_inode_error_class, name, \
3001 TP_PROTO(struct xfs_inode *ip, int error, \
3002 unsigned long caller_ip), \
3003 TP_ARGS(ip, error, caller_ip))
3004
3005/* reflink allocator */
3006TRACE_EVENT(xfs_bmap_remap_alloc,
3007 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t fsbno,
3008 xfs_extlen_t len),
3009 TP_ARGS(ip, fsbno, len),
3010 TP_STRUCT__entry(
3011 __field(dev_t, dev)
3012 __field(xfs_ino_t, ino)
3013 __field(xfs_fsblock_t, fsbno)
3014 __field(xfs_extlen_t, len)
3015 ),
3016 TP_fast_assign(
3017 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3018 __entry->ino = ip->i_ino;
3019 __entry->fsbno = fsbno;
3020 __entry->len = len;
3021 ),
3022 TP_printk("dev %d:%d ino 0x%llx fsbno 0x%llx len %x",
3023 MAJOR(__entry->dev), MINOR(__entry->dev),
3024 __entry->ino,
3025 __entry->fsbno,
3026 __entry->len)
3027);
3028DEFINE_INODE_ERROR_EVENT(xfs_bmap_remap_alloc_error);
3029
3030/* reflink tracepoint classes */
3031
3032/* two-file io tracepoint class */
3033DECLARE_EVENT_CLASS(xfs_double_io_class,
3034 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3035 struct xfs_inode *dest, xfs_off_t doffset),
3036 TP_ARGS(src, soffset, len, dest, doffset),
3037 TP_STRUCT__entry(
3038 __field(dev_t, dev)
3039 __field(xfs_ino_t, src_ino)
3040 __field(loff_t, src_isize)
3041 __field(loff_t, src_disize)
3042 __field(loff_t, src_offset)
3043 __field(size_t, len)
3044 __field(xfs_ino_t, dest_ino)
3045 __field(loff_t, dest_isize)
3046 __field(loff_t, dest_disize)
3047 __field(loff_t, dest_offset)
3048 ),
3049 TP_fast_assign(
3050 __entry->dev = VFS_I(src)->i_sb->s_dev;
3051 __entry->src_ino = src->i_ino;
3052 __entry->src_isize = VFS_I(src)->i_size;
3053 __entry->src_disize = src->i_d.di_size;
3054 __entry->src_offset = soffset;
3055 __entry->len = len;
3056 __entry->dest_ino = dest->i_ino;
3057 __entry->dest_isize = VFS_I(dest)->i_size;
3058 __entry->dest_disize = dest->i_d.di_size;
3059 __entry->dest_offset = doffset;
3060 ),
3061 TP_printk("dev %d:%d count %zd "
3062 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3063 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3064 MAJOR(__entry->dev), MINOR(__entry->dev),
3065 __entry->len,
3066 __entry->src_ino,
3067 __entry->src_isize,
3068 __entry->src_disize,
3069 __entry->src_offset,
3070 __entry->dest_ino,
3071 __entry->dest_isize,
3072 __entry->dest_disize,
3073 __entry->dest_offset)
3074)
3075
3076#define DEFINE_DOUBLE_IO_EVENT(name) \
3077DEFINE_EVENT(xfs_double_io_class, name, \
3078 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3079 struct xfs_inode *dest, xfs_off_t doffset), \
3080 TP_ARGS(src, soffset, len, dest, doffset))
3081
3082/* inode/irec events */
3083DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3084 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3085 TP_ARGS(ip, irec),
3086 TP_STRUCT__entry(
3087 __field(dev_t, dev)
3088 __field(xfs_ino_t, ino)
3089 __field(xfs_fileoff_t, lblk)
3090 __field(xfs_extlen_t, len)
3091 __field(xfs_fsblock_t, pblk)
3092 __field(int, state)
3093 ),
3094 TP_fast_assign(
3095 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3096 __entry->ino = ip->i_ino;
3097 __entry->lblk = irec->br_startoff;
3098 __entry->len = irec->br_blockcount;
3099 __entry->pblk = irec->br_startblock;
3100 __entry->state = irec->br_state;
3101 ),
3102 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu st %d",
3103 MAJOR(__entry->dev), MINOR(__entry->dev),
3104 __entry->ino,
3105 __entry->lblk,
3106 __entry->len,
3107 __entry->pblk,
3108 __entry->state)
3109);
3110#define DEFINE_INODE_IREC_EVENT(name) \
3111DEFINE_EVENT(xfs_inode_irec_class, name, \
3112 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3113 TP_ARGS(ip, irec))
3114
3115/* refcount/reflink tracepoint definitions */
3116
3117/* reflink tracepoints */
3118DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3119DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3120DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3121DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3122TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3123 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3124 xfs_filblks_t len, struct xfs_inode *dest,
3125 xfs_fileoff_t doffset),
3126 TP_ARGS(src, soffset, len, dest, doffset),
3127 TP_STRUCT__entry(
3128 __field(dev_t, dev)
3129 __field(xfs_ino_t, src_ino)
3130 __field(xfs_fileoff_t, src_lblk)
3131 __field(xfs_filblks_t, len)
3132 __field(xfs_ino_t, dest_ino)
3133 __field(xfs_fileoff_t, dest_lblk)
3134 ),
3135 TP_fast_assign(
3136 __entry->dev = VFS_I(src)->i_sb->s_dev;
3137 __entry->src_ino = src->i_ino;
3138 __entry->src_lblk = soffset;
3139 __entry->len = len;
3140 __entry->dest_ino = dest->i_ino;
3141 __entry->dest_lblk = doffset;
3142 ),
3143 TP_printk("dev %d:%d len 0x%llx "
3144 "ino 0x%llx offset 0x%llx blocks -> "
3145 "ino 0x%llx offset 0x%llx blocks",
3146 MAJOR(__entry->dev), MINOR(__entry->dev),
3147 __entry->len,
3148 __entry->src_ino,
3149 __entry->src_lblk,
3150 __entry->dest_ino,
3151 __entry->dest_lblk)
3152);
3153TRACE_EVENT(xfs_reflink_punch_range,
3154 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3155 xfs_extlen_t len),
3156 TP_ARGS(ip, lblk, len),
3157 TP_STRUCT__entry(
3158 __field(dev_t, dev)
3159 __field(xfs_ino_t, ino)
3160 __field(xfs_fileoff_t, lblk)
3161 __field(xfs_extlen_t, len)
3162 ),
3163 TP_fast_assign(
3164 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3165 __entry->ino = ip->i_ino;
3166 __entry->lblk = lblk;
3167 __entry->len = len;
3168 ),
3169 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3170 MAJOR(__entry->dev), MINOR(__entry->dev),
3171 __entry->ino,
3172 __entry->lblk,
3173 __entry->len)
3174);
3175TRACE_EVENT(xfs_reflink_remap,
3176 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3177 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3178 TP_ARGS(ip, lblk, len, new_pblk),
3179 TP_STRUCT__entry(
3180 __field(dev_t, dev)
3181 __field(xfs_ino_t, ino)
3182 __field(xfs_fileoff_t, lblk)
3183 __field(xfs_extlen_t, len)
3184 __field(xfs_fsblock_t, new_pblk)
3185 ),
3186 TP_fast_assign(
3187 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3188 __entry->ino = ip->i_ino;
3189 __entry->lblk = lblk;
3190 __entry->len = len;
3191 __entry->new_pblk = new_pblk;
3192 ),
3193 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3194 MAJOR(__entry->dev), MINOR(__entry->dev),
3195 __entry->ino,
3196 __entry->lblk,
3197 __entry->len,
3198 __entry->new_pblk)
3199);
3200DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3201DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3202DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3203DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3204DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3205DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3206
3207/* dedupe tracepoints */
3208DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3209DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3210
3211/* ioctl tracepoints */
3212TRACE_EVENT(xfs_ioctl_clone,
3213 TP_PROTO(struct inode *src, struct inode *dest),
3214 TP_ARGS(src, dest),
3215 TP_STRUCT__entry(
3216 __field(dev_t, dev)
3217 __field(unsigned long, src_ino)
3218 __field(loff_t, src_isize)
3219 __field(unsigned long, dest_ino)
3220 __field(loff_t, dest_isize)
3221 ),
3222 TP_fast_assign(
3223 __entry->dev = src->i_sb->s_dev;
3224 __entry->src_ino = src->i_ino;
3225 __entry->src_isize = i_size_read(src);
3226 __entry->dest_ino = dest->i_ino;
3227 __entry->dest_isize = i_size_read(dest);
3228 ),
3229 TP_printk("dev %d:%d "
3230 "ino 0x%lx isize 0x%llx -> "
3231 "ino 0x%lx isize 0x%llx\n",
3232 MAJOR(__entry->dev), MINOR(__entry->dev),
3233 __entry->src_ino,
3234 __entry->src_isize,
3235 __entry->dest_ino,
3236 __entry->dest_isize)
3237);
3238
3239/* unshare tracepoints */
3240DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3241DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3242
3243/* copy on write */
3244DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3245DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3246DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3247DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3248DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3249
3250DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
3251DEFINE_RW_EVENT(xfs_reflink_allocate_cow_range);
3252
3253DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
3254DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3255DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
3256
3257DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3258DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3259DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
3260
3261DEFINE_INODE_ERROR_EVENT(xfs_reflink_allocate_cow_range_error);
3262DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3263DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3264
3265
3266DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3267
3268/* rmap swapext tracepoints */
3269DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3270DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3271DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3272
3273#endif /* _TRACE_XFS_H */
3274
3275#undef TRACE_INCLUDE_PATH
3276#define TRACE_INCLUDE_PATH .
3277#define TRACE_INCLUDE_FILE xfs_trace
3278#include <trace/define_trace.h>
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2009, Christoph Hellwig
4 * All Rights Reserved.
5 *
6 * NOTE: none of these tracepoints shall be considered a stable kernel ABI
7 * as they can change at any time.
8 *
9 * Current conventions for printing numbers measuring specific units:
10 *
11 * agno: allocation group number
12 *
13 * agino: per-AG inode number
14 * ino: filesystem inode number
15 *
16 * agbno: per-AG block number in fs blocks
17 * startblock: physical block number for file mappings. This is either a
18 * segmented fsblock for data device mappings, or a rfsblock
19 * for realtime device mappings
20 * fsbcount: number of blocks in an extent, in fs blocks
21 *
22 * daddr: physical block number in 512b blocks
23 * bbcount: number of blocks in a physical extent, in 512b blocks
24 *
25 * rtx: physical rt extent number for extent mappings
26 * rtxcount: number of rt extents in an extent mapping
27 *
28 * owner: reverse-mapping owner, usually inodes
29 *
30 * fileoff: file offset, in fs blocks
31 * pos: file offset, in bytes
32 * bytecount: number of bytes
33 *
34 * disize: ondisk file size, in bytes
35 * isize: incore file size, in bytes
36 *
37 * forkoff: inode fork offset, in bytes
38 *
39 * ireccount: number of inode records
40 *
41 * Numbers describing space allocations (blocks, extents, inodes) should be
42 * formatted in hexadecimal.
43 */
44#undef TRACE_SYSTEM
45#define TRACE_SYSTEM xfs
46
47#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
48#define _TRACE_XFS_H
49
50#include <linux/tracepoint.h>
51
52struct xfs_agf;
53struct xfs_alloc_arg;
54struct xfs_attr_list_context;
55struct xfs_buf_log_item;
56struct xfs_da_args;
57struct xfs_da_node_entry;
58struct xfs_dquot;
59struct xfs_log_item;
60struct xlog;
61struct xlog_ticket;
62struct xlog_recover;
63struct xlog_recover_item;
64struct xlog_rec_header;
65struct xlog_in_core;
66struct xfs_buf_log_format;
67struct xfs_inode_log_format;
68struct xfs_bmbt_irec;
69struct xfs_btree_cur;
70struct xfs_defer_op_type;
71struct xfs_refcount_irec;
72struct xfs_fsmap;
73struct xfs_rmap_irec;
74struct xfs_icreate_log;
75struct xfs_owner_info;
76struct xfs_trans_res;
77struct xfs_inobt_rec_incore;
78union xfs_btree_ptr;
79struct xfs_dqtrx;
80struct xfs_icwalk;
81struct xfs_perag;
82
83#define XFS_ATTR_FILTER_FLAGS \
84 { XFS_ATTR_ROOT, "ROOT" }, \
85 { XFS_ATTR_SECURE, "SECURE" }, \
86 { XFS_ATTR_INCOMPLETE, "INCOMPLETE" }
87
88DECLARE_EVENT_CLASS(xfs_attr_list_class,
89 TP_PROTO(struct xfs_attr_list_context *ctx),
90 TP_ARGS(ctx),
91 TP_STRUCT__entry(
92 __field(dev_t, dev)
93 __field(xfs_ino_t, ino)
94 __field(u32, hashval)
95 __field(u32, blkno)
96 __field(u32, offset)
97 __field(void *, buffer)
98 __field(int, bufsize)
99 __field(int, count)
100 __field(int, firstu)
101 __field(int, dupcnt)
102 __field(unsigned int, attr_filter)
103 ),
104 TP_fast_assign(
105 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
106 __entry->ino = ctx->dp->i_ino;
107 __entry->hashval = ctx->cursor.hashval;
108 __entry->blkno = ctx->cursor.blkno;
109 __entry->offset = ctx->cursor.offset;
110 __entry->buffer = ctx->buffer;
111 __entry->bufsize = ctx->bufsize;
112 __entry->count = ctx->count;
113 __entry->firstu = ctx->firstu;
114 __entry->attr_filter = ctx->attr_filter;
115 ),
116 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
117 "buffer %p size %u count %u firstu %u filter %s",
118 MAJOR(__entry->dev), MINOR(__entry->dev),
119 __entry->ino,
120 __entry->hashval,
121 __entry->blkno,
122 __entry->offset,
123 __entry->dupcnt,
124 __entry->buffer,
125 __entry->bufsize,
126 __entry->count,
127 __entry->firstu,
128 __print_flags(__entry->attr_filter, "|",
129 XFS_ATTR_FILTER_FLAGS)
130 )
131)
132
133#define DEFINE_ATTR_LIST_EVENT(name) \
134DEFINE_EVENT(xfs_attr_list_class, name, \
135 TP_PROTO(struct xfs_attr_list_context *ctx), \
136 TP_ARGS(ctx))
137DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
138DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
139DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
140DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
141DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
142DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
143DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
144DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
145DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
146DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
147
148TRACE_EVENT(xlog_intent_recovery_failed,
149 TP_PROTO(struct xfs_mount *mp, const struct xfs_defer_op_type *ops,
150 int error),
151 TP_ARGS(mp, ops, error),
152 TP_STRUCT__entry(
153 __field(dev_t, dev)
154 __string(name, ops->name)
155 __field(int, error)
156 ),
157 TP_fast_assign(
158 __entry->dev = mp->m_super->s_dev;
159 __assign_str(name, ops->name);
160 __entry->error = error;
161 ),
162 TP_printk("dev %d:%d optype %s error %d",
163 MAJOR(__entry->dev), MINOR(__entry->dev),
164 __get_str(name),
165 __entry->error)
166);
167
168DECLARE_EVENT_CLASS(xfs_perag_class,
169 TP_PROTO(struct xfs_perag *pag, unsigned long caller_ip),
170 TP_ARGS(pag, caller_ip),
171 TP_STRUCT__entry(
172 __field(dev_t, dev)
173 __field(xfs_agnumber_t, agno)
174 __field(int, refcount)
175 __field(int, active_refcount)
176 __field(unsigned long, caller_ip)
177 ),
178 TP_fast_assign(
179 __entry->dev = pag->pag_mount->m_super->s_dev;
180 __entry->agno = pag->pag_agno;
181 __entry->refcount = atomic_read(&pag->pag_ref);
182 __entry->active_refcount = atomic_read(&pag->pag_active_ref);
183 __entry->caller_ip = caller_ip;
184 ),
185 TP_printk("dev %d:%d agno 0x%x passive refs %d active refs %d caller %pS",
186 MAJOR(__entry->dev), MINOR(__entry->dev),
187 __entry->agno,
188 __entry->refcount,
189 __entry->active_refcount,
190 (char *)__entry->caller_ip)
191);
192
193#define DEFINE_PERAG_REF_EVENT(name) \
194DEFINE_EVENT(xfs_perag_class, name, \
195 TP_PROTO(struct xfs_perag *pag, unsigned long caller_ip), \
196 TP_ARGS(pag, caller_ip))
197DEFINE_PERAG_REF_EVENT(xfs_perag_get);
198DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
199DEFINE_PERAG_REF_EVENT(xfs_perag_hold);
200DEFINE_PERAG_REF_EVENT(xfs_perag_put);
201DEFINE_PERAG_REF_EVENT(xfs_perag_grab);
202DEFINE_PERAG_REF_EVENT(xfs_perag_grab_tag);
203DEFINE_PERAG_REF_EVENT(xfs_perag_rele);
204DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
205DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
206
207TRACE_EVENT(xfs_inodegc_worker,
208 TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
209 TP_ARGS(mp, shrinker_hits),
210 TP_STRUCT__entry(
211 __field(dev_t, dev)
212 __field(unsigned int, shrinker_hits)
213 ),
214 TP_fast_assign(
215 __entry->dev = mp->m_super->s_dev;
216 __entry->shrinker_hits = shrinker_hits;
217 ),
218 TP_printk("dev %d:%d shrinker_hits %u",
219 MAJOR(__entry->dev), MINOR(__entry->dev),
220 __entry->shrinker_hits)
221);
222
223DECLARE_EVENT_CLASS(xfs_fs_class,
224 TP_PROTO(struct xfs_mount *mp, void *caller_ip),
225 TP_ARGS(mp, caller_ip),
226 TP_STRUCT__entry(
227 __field(dev_t, dev)
228 __field(unsigned long long, mflags)
229 __field(unsigned long, opstate)
230 __field(unsigned long, sbflags)
231 __field(void *, caller_ip)
232 ),
233 TP_fast_assign(
234 if (mp) {
235 __entry->dev = mp->m_super->s_dev;
236 __entry->mflags = mp->m_features;
237 __entry->opstate = mp->m_opstate;
238 __entry->sbflags = mp->m_super->s_flags;
239 }
240 __entry->caller_ip = caller_ip;
241 ),
242 TP_printk("dev %d:%d m_features 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
243 MAJOR(__entry->dev), MINOR(__entry->dev),
244 __entry->mflags,
245 __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
246 __entry->sbflags,
247 __entry->caller_ip)
248);
249
250#define DEFINE_FS_EVENT(name) \
251DEFINE_EVENT(xfs_fs_class, name, \
252 TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
253 TP_ARGS(mp, caller_ip))
254DEFINE_FS_EVENT(xfs_inodegc_flush);
255DEFINE_FS_EVENT(xfs_inodegc_push);
256DEFINE_FS_EVENT(xfs_inodegc_start);
257DEFINE_FS_EVENT(xfs_inodegc_stop);
258DEFINE_FS_EVENT(xfs_inodegc_queue);
259DEFINE_FS_EVENT(xfs_inodegc_throttle);
260DEFINE_FS_EVENT(xfs_fs_sync_fs);
261DEFINE_FS_EVENT(xfs_blockgc_start);
262DEFINE_FS_EVENT(xfs_blockgc_stop);
263DEFINE_FS_EVENT(xfs_blockgc_worker);
264DEFINE_FS_EVENT(xfs_blockgc_flush_all);
265
266TRACE_EVENT(xfs_inodegc_shrinker_scan,
267 TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
268 void *caller_ip),
269 TP_ARGS(mp, sc, caller_ip),
270 TP_STRUCT__entry(
271 __field(dev_t, dev)
272 __field(unsigned long, nr_to_scan)
273 __field(void *, caller_ip)
274 ),
275 TP_fast_assign(
276 __entry->dev = mp->m_super->s_dev;
277 __entry->nr_to_scan = sc->nr_to_scan;
278 __entry->caller_ip = caller_ip;
279 ),
280 TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
281 MAJOR(__entry->dev), MINOR(__entry->dev),
282 __entry->nr_to_scan,
283 __entry->caller_ip)
284);
285
286DECLARE_EVENT_CLASS(xfs_ag_class,
287 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
288 TP_ARGS(mp, agno),
289 TP_STRUCT__entry(
290 __field(dev_t, dev)
291 __field(xfs_agnumber_t, agno)
292 ),
293 TP_fast_assign(
294 __entry->dev = mp->m_super->s_dev;
295 __entry->agno = agno;
296 ),
297 TP_printk("dev %d:%d agno 0x%x",
298 MAJOR(__entry->dev), MINOR(__entry->dev),
299 __entry->agno)
300);
301#define DEFINE_AG_EVENT(name) \
302DEFINE_EVENT(xfs_ag_class, name, \
303 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
304 TP_ARGS(mp, agno))
305
306DEFINE_AG_EVENT(xfs_read_agf);
307DEFINE_AG_EVENT(xfs_alloc_read_agf);
308DEFINE_AG_EVENT(xfs_read_agi);
309DEFINE_AG_EVENT(xfs_ialloc_read_agi);
310
311TRACE_EVENT(xfs_attr_list_node_descend,
312 TP_PROTO(struct xfs_attr_list_context *ctx,
313 struct xfs_da_node_entry *btree),
314 TP_ARGS(ctx, btree),
315 TP_STRUCT__entry(
316 __field(dev_t, dev)
317 __field(xfs_ino_t, ino)
318 __field(u32, hashval)
319 __field(u32, blkno)
320 __field(u32, offset)
321 __field(void *, buffer)
322 __field(int, bufsize)
323 __field(int, count)
324 __field(int, firstu)
325 __field(int, dupcnt)
326 __field(unsigned int, attr_filter)
327 __field(u32, bt_hashval)
328 __field(u32, bt_before)
329 ),
330 TP_fast_assign(
331 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
332 __entry->ino = ctx->dp->i_ino;
333 __entry->hashval = ctx->cursor.hashval;
334 __entry->blkno = ctx->cursor.blkno;
335 __entry->offset = ctx->cursor.offset;
336 __entry->buffer = ctx->buffer;
337 __entry->bufsize = ctx->bufsize;
338 __entry->count = ctx->count;
339 __entry->firstu = ctx->firstu;
340 __entry->attr_filter = ctx->attr_filter;
341 __entry->bt_hashval = be32_to_cpu(btree->hashval);
342 __entry->bt_before = be32_to_cpu(btree->before);
343 ),
344 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
345 "buffer %p size %u count %u firstu %u filter %s "
346 "node hashval %u, node before %u",
347 MAJOR(__entry->dev), MINOR(__entry->dev),
348 __entry->ino,
349 __entry->hashval,
350 __entry->blkno,
351 __entry->offset,
352 __entry->dupcnt,
353 __entry->buffer,
354 __entry->bufsize,
355 __entry->count,
356 __entry->firstu,
357 __print_flags(__entry->attr_filter, "|",
358 XFS_ATTR_FILTER_FLAGS),
359 __entry->bt_hashval,
360 __entry->bt_before)
361);
362
363DECLARE_EVENT_CLASS(xfs_bmap_class,
364 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
365 unsigned long caller_ip),
366 TP_ARGS(ip, cur, state, caller_ip),
367 TP_STRUCT__entry(
368 __field(dev_t, dev)
369 __field(xfs_ino_t, ino)
370 __field(void *, leaf)
371 __field(int, pos)
372 __field(xfs_fileoff_t, startoff)
373 __field(xfs_fsblock_t, startblock)
374 __field(xfs_filblks_t, blockcount)
375 __field(xfs_exntst_t, state)
376 __field(int, bmap_state)
377 __field(unsigned long, caller_ip)
378 ),
379 TP_fast_assign(
380 struct xfs_ifork *ifp;
381 struct xfs_bmbt_irec r;
382
383 ifp = xfs_iext_state_to_fork(ip, state);
384 xfs_iext_get_extent(ifp, cur, &r);
385 __entry->dev = VFS_I(ip)->i_sb->s_dev;
386 __entry->ino = ip->i_ino;
387 __entry->leaf = cur->leaf;
388 __entry->pos = cur->pos;
389 __entry->startoff = r.br_startoff;
390 __entry->startblock = r.br_startblock;
391 __entry->blockcount = r.br_blockcount;
392 __entry->state = r.br_state;
393 __entry->bmap_state = state;
394 __entry->caller_ip = caller_ip;
395 ),
396 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
397 "fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx flag %d caller %pS",
398 MAJOR(__entry->dev), MINOR(__entry->dev),
399 __entry->ino,
400 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
401 __entry->leaf,
402 __entry->pos,
403 __entry->startoff,
404 (int64_t)__entry->startblock,
405 __entry->blockcount,
406 __entry->state,
407 (char *)__entry->caller_ip)
408)
409
410#define DEFINE_BMAP_EVENT(name) \
411DEFINE_EVENT(xfs_bmap_class, name, \
412 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
413 unsigned long caller_ip), \
414 TP_ARGS(ip, cur, state, caller_ip))
415DEFINE_BMAP_EVENT(xfs_iext_insert);
416DEFINE_BMAP_EVENT(xfs_iext_remove);
417DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
418DEFINE_BMAP_EVENT(xfs_bmap_post_update);
419DEFINE_BMAP_EVENT(xfs_read_extent);
420DEFINE_BMAP_EVENT(xfs_write_extent);
421
422DECLARE_EVENT_CLASS(xfs_buf_class,
423 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
424 TP_ARGS(bp, caller_ip),
425 TP_STRUCT__entry(
426 __field(dev_t, dev)
427 __field(xfs_daddr_t, bno)
428 __field(int, nblks)
429 __field(int, hold)
430 __field(int, pincount)
431 __field(unsigned, lockval)
432 __field(unsigned, flags)
433 __field(unsigned long, caller_ip)
434 __field(const void *, buf_ops)
435 ),
436 TP_fast_assign(
437 __entry->dev = bp->b_target->bt_dev;
438 __entry->bno = xfs_buf_daddr(bp);
439 __entry->nblks = bp->b_length;
440 __entry->hold = atomic_read(&bp->b_hold);
441 __entry->pincount = atomic_read(&bp->b_pin_count);
442 __entry->lockval = bp->b_sema.count;
443 __entry->flags = bp->b_flags;
444 __entry->caller_ip = caller_ip;
445 __entry->buf_ops = bp->b_ops;
446 ),
447 TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
448 "lock %d flags %s bufops %pS caller %pS",
449 MAJOR(__entry->dev), MINOR(__entry->dev),
450 (unsigned long long)__entry->bno,
451 __entry->nblks,
452 __entry->hold,
453 __entry->pincount,
454 __entry->lockval,
455 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
456 __entry->buf_ops,
457 (void *)__entry->caller_ip)
458)
459
460#define DEFINE_BUF_EVENT(name) \
461DEFINE_EVENT(xfs_buf_class, name, \
462 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
463 TP_ARGS(bp, caller_ip))
464DEFINE_BUF_EVENT(xfs_buf_init);
465DEFINE_BUF_EVENT(xfs_buf_free);
466DEFINE_BUF_EVENT(xfs_buf_hold);
467DEFINE_BUF_EVENT(xfs_buf_rele);
468DEFINE_BUF_EVENT(xfs_buf_iodone);
469DEFINE_BUF_EVENT(xfs_buf_submit);
470DEFINE_BUF_EVENT(xfs_buf_lock);
471DEFINE_BUF_EVENT(xfs_buf_lock_done);
472DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
473DEFINE_BUF_EVENT(xfs_buf_trylock);
474DEFINE_BUF_EVENT(xfs_buf_unlock);
475DEFINE_BUF_EVENT(xfs_buf_iowait);
476DEFINE_BUF_EVENT(xfs_buf_iowait_done);
477DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
478DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
479DEFINE_BUF_EVENT(xfs_buf_delwri_split);
480DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
481DEFINE_BUF_EVENT(xfs_buf_get_uncached);
482DEFINE_BUF_EVENT(xfs_buf_item_relse);
483DEFINE_BUF_EVENT(xfs_buf_iodone_async);
484DEFINE_BUF_EVENT(xfs_buf_error_relse);
485DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
486DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
487
488/* not really buffer traces, but the buf provides useful information */
489DEFINE_BUF_EVENT(xfs_btree_corrupt);
490DEFINE_BUF_EVENT(xfs_reset_dqcounts);
491
492/* pass flags explicitly */
493DECLARE_EVENT_CLASS(xfs_buf_flags_class,
494 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
495 TP_ARGS(bp, flags, caller_ip),
496 TP_STRUCT__entry(
497 __field(dev_t, dev)
498 __field(xfs_daddr_t, bno)
499 __field(unsigned int, length)
500 __field(int, hold)
501 __field(int, pincount)
502 __field(unsigned, lockval)
503 __field(unsigned, flags)
504 __field(unsigned long, caller_ip)
505 ),
506 TP_fast_assign(
507 __entry->dev = bp->b_target->bt_dev;
508 __entry->bno = xfs_buf_daddr(bp);
509 __entry->length = bp->b_length;
510 __entry->flags = flags;
511 __entry->hold = atomic_read(&bp->b_hold);
512 __entry->pincount = atomic_read(&bp->b_pin_count);
513 __entry->lockval = bp->b_sema.count;
514 __entry->caller_ip = caller_ip;
515 ),
516 TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
517 "lock %d flags %s caller %pS",
518 MAJOR(__entry->dev), MINOR(__entry->dev),
519 (unsigned long long)__entry->bno,
520 __entry->length,
521 __entry->hold,
522 __entry->pincount,
523 __entry->lockval,
524 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
525 (void *)__entry->caller_ip)
526)
527
528#define DEFINE_BUF_FLAGS_EVENT(name) \
529DEFINE_EVENT(xfs_buf_flags_class, name, \
530 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
531 TP_ARGS(bp, flags, caller_ip))
532DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
533DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
534DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
535
536TRACE_EVENT(xfs_buf_ioerror,
537 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
538 TP_ARGS(bp, error, caller_ip),
539 TP_STRUCT__entry(
540 __field(dev_t, dev)
541 __field(xfs_daddr_t, bno)
542 __field(unsigned int, length)
543 __field(unsigned, flags)
544 __field(int, hold)
545 __field(int, pincount)
546 __field(unsigned, lockval)
547 __field(int, error)
548 __field(xfs_failaddr_t, caller_ip)
549 ),
550 TP_fast_assign(
551 __entry->dev = bp->b_target->bt_dev;
552 __entry->bno = xfs_buf_daddr(bp);
553 __entry->length = bp->b_length;
554 __entry->hold = atomic_read(&bp->b_hold);
555 __entry->pincount = atomic_read(&bp->b_pin_count);
556 __entry->lockval = bp->b_sema.count;
557 __entry->error = error;
558 __entry->flags = bp->b_flags;
559 __entry->caller_ip = caller_ip;
560 ),
561 TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
562 "lock %d error %d flags %s caller %pS",
563 MAJOR(__entry->dev), MINOR(__entry->dev),
564 (unsigned long long)__entry->bno,
565 __entry->length,
566 __entry->hold,
567 __entry->pincount,
568 __entry->lockval,
569 __entry->error,
570 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
571 (void *)__entry->caller_ip)
572);
573
574DECLARE_EVENT_CLASS(xfs_buf_item_class,
575 TP_PROTO(struct xfs_buf_log_item *bip),
576 TP_ARGS(bip),
577 TP_STRUCT__entry(
578 __field(dev_t, dev)
579 __field(xfs_daddr_t, buf_bno)
580 __field(unsigned int, buf_len)
581 __field(int, buf_hold)
582 __field(int, buf_pincount)
583 __field(int, buf_lockval)
584 __field(unsigned, buf_flags)
585 __field(unsigned, bli_recur)
586 __field(int, bli_refcount)
587 __field(unsigned, bli_flags)
588 __field(unsigned long, li_flags)
589 ),
590 TP_fast_assign(
591 __entry->dev = bip->bli_buf->b_target->bt_dev;
592 __entry->bli_flags = bip->bli_flags;
593 __entry->bli_recur = bip->bli_recur;
594 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
595 __entry->buf_bno = xfs_buf_daddr(bip->bli_buf);
596 __entry->buf_len = bip->bli_buf->b_length;
597 __entry->buf_flags = bip->bli_buf->b_flags;
598 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
599 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
600 __entry->buf_lockval = bip->bli_buf->b_sema.count;
601 __entry->li_flags = bip->bli_item.li_flags;
602 ),
603 TP_printk("dev %d:%d daddr 0x%llx bbcount 0x%x hold %d pincount %d "
604 "lock %d flags %s recur %d refcount %d bliflags %s "
605 "liflags %s",
606 MAJOR(__entry->dev), MINOR(__entry->dev),
607 (unsigned long long)__entry->buf_bno,
608 __entry->buf_len,
609 __entry->buf_hold,
610 __entry->buf_pincount,
611 __entry->buf_lockval,
612 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
613 __entry->bli_recur,
614 __entry->bli_refcount,
615 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
616 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
617)
618
619#define DEFINE_BUF_ITEM_EVENT(name) \
620DEFINE_EVENT(xfs_buf_item_class, name, \
621 TP_PROTO(struct xfs_buf_log_item *bip), \
622 TP_ARGS(bip))
623DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
624DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
625DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
626DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
627DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
628DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
629DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
630DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
631DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
632DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
633DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
634DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
635DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
636DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
637DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
638DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
639DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
640DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
641DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
642DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
643DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
644DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
645DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
646DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
647
648DECLARE_EVENT_CLASS(xfs_filestream_class,
649 TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino),
650 TP_ARGS(pag, ino),
651 TP_STRUCT__entry(
652 __field(dev_t, dev)
653 __field(xfs_ino_t, ino)
654 __field(xfs_agnumber_t, agno)
655 __field(int, streams)
656 ),
657 TP_fast_assign(
658 __entry->dev = pag->pag_mount->m_super->s_dev;
659 __entry->ino = ino;
660 __entry->agno = pag->pag_agno;
661 __entry->streams = atomic_read(&pag->pagf_fstrms);
662 ),
663 TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
664 MAJOR(__entry->dev), MINOR(__entry->dev),
665 __entry->ino,
666 __entry->agno,
667 __entry->streams)
668)
669#define DEFINE_FILESTREAM_EVENT(name) \
670DEFINE_EVENT(xfs_filestream_class, name, \
671 TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino), \
672 TP_ARGS(pag, ino))
673DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
674DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
675DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
676
677TRACE_EVENT(xfs_filestream_pick,
678 TP_PROTO(struct xfs_perag *pag, xfs_ino_t ino, xfs_extlen_t free),
679 TP_ARGS(pag, ino, free),
680 TP_STRUCT__entry(
681 __field(dev_t, dev)
682 __field(xfs_ino_t, ino)
683 __field(xfs_agnumber_t, agno)
684 __field(int, streams)
685 __field(xfs_extlen_t, free)
686 ),
687 TP_fast_assign(
688 __entry->dev = pag->pag_mount->m_super->s_dev;
689 __entry->ino = ino;
690 if (pag) {
691 __entry->agno = pag->pag_agno;
692 __entry->streams = atomic_read(&pag->pagf_fstrms);
693 } else {
694 __entry->agno = NULLAGNUMBER;
695 __entry->streams = 0;
696 }
697 __entry->free = free;
698 ),
699 TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d",
700 MAJOR(__entry->dev), MINOR(__entry->dev),
701 __entry->ino,
702 __entry->agno,
703 __entry->streams,
704 __entry->free)
705);
706
707DECLARE_EVENT_CLASS(xfs_lock_class,
708 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
709 unsigned long caller_ip),
710 TP_ARGS(ip, lock_flags, caller_ip),
711 TP_STRUCT__entry(
712 __field(dev_t, dev)
713 __field(xfs_ino_t, ino)
714 __field(int, lock_flags)
715 __field(unsigned long, caller_ip)
716 ),
717 TP_fast_assign(
718 __entry->dev = VFS_I(ip)->i_sb->s_dev;
719 __entry->ino = ip->i_ino;
720 __entry->lock_flags = lock_flags;
721 __entry->caller_ip = caller_ip;
722 ),
723 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
724 MAJOR(__entry->dev), MINOR(__entry->dev),
725 __entry->ino,
726 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
727 (void *)__entry->caller_ip)
728)
729
730#define DEFINE_LOCK_EVENT(name) \
731DEFINE_EVENT(xfs_lock_class, name, \
732 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
733 unsigned long caller_ip), \
734 TP_ARGS(ip, lock_flags, caller_ip))
735DEFINE_LOCK_EVENT(xfs_ilock);
736DEFINE_LOCK_EVENT(xfs_ilock_nowait);
737DEFINE_LOCK_EVENT(xfs_ilock_demote);
738DEFINE_LOCK_EVENT(xfs_iunlock);
739
740DECLARE_EVENT_CLASS(xfs_inode_class,
741 TP_PROTO(struct xfs_inode *ip),
742 TP_ARGS(ip),
743 TP_STRUCT__entry(
744 __field(dev_t, dev)
745 __field(xfs_ino_t, ino)
746 __field(unsigned long, iflags)
747 ),
748 TP_fast_assign(
749 __entry->dev = VFS_I(ip)->i_sb->s_dev;
750 __entry->ino = ip->i_ino;
751 __entry->iflags = ip->i_flags;
752 ),
753 TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
754 MAJOR(__entry->dev), MINOR(__entry->dev),
755 __entry->ino,
756 __entry->iflags)
757)
758
759#define DEFINE_INODE_EVENT(name) \
760DEFINE_EVENT(xfs_inode_class, name, \
761 TP_PROTO(struct xfs_inode *ip), \
762 TP_ARGS(ip))
763DEFINE_INODE_EVENT(xfs_iget_skip);
764DEFINE_INODE_EVENT(xfs_iget_recycle);
765DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
766DEFINE_INODE_EVENT(xfs_iget_hit);
767DEFINE_INODE_EVENT(xfs_iget_miss);
768
769DEFINE_INODE_EVENT(xfs_getattr);
770DEFINE_INODE_EVENT(xfs_setattr);
771DEFINE_INODE_EVENT(xfs_readlink);
772DEFINE_INODE_EVENT(xfs_inactive_symlink);
773DEFINE_INODE_EVENT(xfs_alloc_file_space);
774DEFINE_INODE_EVENT(xfs_free_file_space);
775DEFINE_INODE_EVENT(xfs_zero_file_space);
776DEFINE_INODE_EVENT(xfs_collapse_file_space);
777DEFINE_INODE_EVENT(xfs_insert_file_space);
778DEFINE_INODE_EVENT(xfs_readdir);
779#ifdef CONFIG_XFS_POSIX_ACL
780DEFINE_INODE_EVENT(xfs_get_acl);
781#endif
782DEFINE_INODE_EVENT(xfs_vm_bmap);
783DEFINE_INODE_EVENT(xfs_file_ioctl);
784DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
785DEFINE_INODE_EVENT(xfs_ioctl_setattr);
786DEFINE_INODE_EVENT(xfs_dir_fsync);
787DEFINE_INODE_EVENT(xfs_file_fsync);
788DEFINE_INODE_EVENT(xfs_destroy_inode);
789DEFINE_INODE_EVENT(xfs_update_time);
790
791DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
792DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
793
794DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
795DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
796DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
797DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
798DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
799DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
800DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
801DEFINE_INODE_EVENT(xfs_inode_reclaiming);
802DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
803DEFINE_INODE_EVENT(xfs_inode_inactivating);
804
805/*
806 * ftrace's __print_symbolic requires that all enum values be wrapped in the
807 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
808 * ring buffer. Somehow this was only worth mentioning in the ftrace sample
809 * code.
810 */
811TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
812TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
813
814TRACE_EVENT(xfs_filemap_fault,
815 TP_PROTO(struct xfs_inode *ip, unsigned int order, bool write_fault),
816 TP_ARGS(ip, order, write_fault),
817 TP_STRUCT__entry(
818 __field(dev_t, dev)
819 __field(xfs_ino_t, ino)
820 __field(unsigned int, order)
821 __field(bool, write_fault)
822 ),
823 TP_fast_assign(
824 __entry->dev = VFS_I(ip)->i_sb->s_dev;
825 __entry->ino = ip->i_ino;
826 __entry->order = order;
827 __entry->write_fault = write_fault;
828 ),
829 TP_printk("dev %d:%d ino 0x%llx order %u write_fault %d",
830 MAJOR(__entry->dev), MINOR(__entry->dev),
831 __entry->ino,
832 __entry->order,
833 __entry->write_fault)
834)
835
836DECLARE_EVENT_CLASS(xfs_iref_class,
837 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
838 TP_ARGS(ip, caller_ip),
839 TP_STRUCT__entry(
840 __field(dev_t, dev)
841 __field(xfs_ino_t, ino)
842 __field(int, count)
843 __field(int, pincount)
844 __field(unsigned long, caller_ip)
845 ),
846 TP_fast_assign(
847 __entry->dev = VFS_I(ip)->i_sb->s_dev;
848 __entry->ino = ip->i_ino;
849 __entry->count = atomic_read(&VFS_I(ip)->i_count);
850 __entry->pincount = atomic_read(&ip->i_pincount);
851 __entry->caller_ip = caller_ip;
852 ),
853 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
854 MAJOR(__entry->dev), MINOR(__entry->dev),
855 __entry->ino,
856 __entry->count,
857 __entry->pincount,
858 (char *)__entry->caller_ip)
859)
860
861TRACE_EVENT(xfs_iomap_prealloc_size,
862 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
863 unsigned int writeio_blocks),
864 TP_ARGS(ip, blocks, shift, writeio_blocks),
865 TP_STRUCT__entry(
866 __field(dev_t, dev)
867 __field(xfs_ino_t, ino)
868 __field(xfs_fsblock_t, blocks)
869 __field(int, shift)
870 __field(unsigned int, writeio_blocks)
871 ),
872 TP_fast_assign(
873 __entry->dev = VFS_I(ip)->i_sb->s_dev;
874 __entry->ino = ip->i_ino;
875 __entry->blocks = blocks;
876 __entry->shift = shift;
877 __entry->writeio_blocks = writeio_blocks;
878 ),
879 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
880 "m_allocsize_blocks %u",
881 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
882 __entry->blocks, __entry->shift, __entry->writeio_blocks)
883)
884
885TRACE_EVENT(xfs_irec_merge_pre,
886 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
887 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
888 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
889 TP_STRUCT__entry(
890 __field(dev_t, dev)
891 __field(xfs_agnumber_t, agno)
892 __field(xfs_agino_t, agino)
893 __field(uint16_t, holemask)
894 __field(xfs_agino_t, nagino)
895 __field(uint16_t, nholemask)
896 ),
897 TP_fast_assign(
898 __entry->dev = mp->m_super->s_dev;
899 __entry->agno = agno;
900 __entry->agino = agino;
901 __entry->holemask = holemask;
902 __entry->nagino = nagino;
903 __entry->nholemask = holemask;
904 ),
905 TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x new_agino 0x%x new_holemask 0x%x",
906 MAJOR(__entry->dev), MINOR(__entry->dev),
907 __entry->agno,
908 __entry->agino,
909 __entry->holemask,
910 __entry->nagino,
911 __entry->nholemask)
912)
913
914TRACE_EVENT(xfs_irec_merge_post,
915 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
916 uint16_t holemask),
917 TP_ARGS(mp, agno, agino, holemask),
918 TP_STRUCT__entry(
919 __field(dev_t, dev)
920 __field(xfs_agnumber_t, agno)
921 __field(xfs_agino_t, agino)
922 __field(uint16_t, holemask)
923 ),
924 TP_fast_assign(
925 __entry->dev = mp->m_super->s_dev;
926 __entry->agno = agno;
927 __entry->agino = agino;
928 __entry->holemask = holemask;
929 ),
930 TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x",
931 MAJOR(__entry->dev),
932 MINOR(__entry->dev),
933 __entry->agno,
934 __entry->agino,
935 __entry->holemask)
936)
937
938#define DEFINE_IREF_EVENT(name) \
939DEFINE_EVENT(xfs_iref_class, name, \
940 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
941 TP_ARGS(ip, caller_ip))
942DEFINE_IREF_EVENT(xfs_irele);
943DEFINE_IREF_EVENT(xfs_inode_pin);
944DEFINE_IREF_EVENT(xfs_inode_unpin);
945DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
946
947DECLARE_EVENT_CLASS(xfs_namespace_class,
948 TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name),
949 TP_ARGS(dp, name),
950 TP_STRUCT__entry(
951 __field(dev_t, dev)
952 __field(xfs_ino_t, dp_ino)
953 __field(int, namelen)
954 __dynamic_array(char, name, name->len)
955 ),
956 TP_fast_assign(
957 __entry->dev = VFS_I(dp)->i_sb->s_dev;
958 __entry->dp_ino = dp->i_ino;
959 __entry->namelen = name->len;
960 memcpy(__get_str(name), name->name, name->len);
961 ),
962 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
963 MAJOR(__entry->dev), MINOR(__entry->dev),
964 __entry->dp_ino,
965 __entry->namelen,
966 __get_str(name))
967)
968
969#define DEFINE_NAMESPACE_EVENT(name) \
970DEFINE_EVENT(xfs_namespace_class, name, \
971 TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name), \
972 TP_ARGS(dp, name))
973DEFINE_NAMESPACE_EVENT(xfs_remove);
974DEFINE_NAMESPACE_EVENT(xfs_link);
975DEFINE_NAMESPACE_EVENT(xfs_lookup);
976DEFINE_NAMESPACE_EVENT(xfs_create);
977DEFINE_NAMESPACE_EVENT(xfs_symlink);
978
979TRACE_EVENT(xfs_rename,
980 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
981 struct xfs_name *src_name, struct xfs_name *target_name),
982 TP_ARGS(src_dp, target_dp, src_name, target_name),
983 TP_STRUCT__entry(
984 __field(dev_t, dev)
985 __field(xfs_ino_t, src_dp_ino)
986 __field(xfs_ino_t, target_dp_ino)
987 __field(int, src_namelen)
988 __field(int, target_namelen)
989 __dynamic_array(char, src_name, src_name->len)
990 __dynamic_array(char, target_name, target_name->len)
991 ),
992 TP_fast_assign(
993 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
994 __entry->src_dp_ino = src_dp->i_ino;
995 __entry->target_dp_ino = target_dp->i_ino;
996 __entry->src_namelen = src_name->len;
997 __entry->target_namelen = target_name->len;
998 memcpy(__get_str(src_name), src_name->name, src_name->len);
999 memcpy(__get_str(target_name), target_name->name,
1000 target_name->len);
1001 ),
1002 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
1003 " src name %.*s target name %.*s",
1004 MAJOR(__entry->dev), MINOR(__entry->dev),
1005 __entry->src_dp_ino,
1006 __entry->target_dp_ino,
1007 __entry->src_namelen,
1008 __get_str(src_name),
1009 __entry->target_namelen,
1010 __get_str(target_name))
1011)
1012
1013DECLARE_EVENT_CLASS(xfs_dquot_class,
1014 TP_PROTO(struct xfs_dquot *dqp),
1015 TP_ARGS(dqp),
1016 TP_STRUCT__entry(
1017 __field(dev_t, dev)
1018 __field(u32, id)
1019 __field(xfs_dqtype_t, type)
1020 __field(unsigned, flags)
1021 __field(unsigned, nrefs)
1022 __field(unsigned long long, res_bcount)
1023 __field(unsigned long long, res_rtbcount)
1024 __field(unsigned long long, res_icount)
1025
1026 __field(unsigned long long, bcount)
1027 __field(unsigned long long, rtbcount)
1028 __field(unsigned long long, icount)
1029
1030 __field(unsigned long long, blk_hardlimit)
1031 __field(unsigned long long, blk_softlimit)
1032 __field(unsigned long long, rtb_hardlimit)
1033 __field(unsigned long long, rtb_softlimit)
1034 __field(unsigned long long, ino_hardlimit)
1035 __field(unsigned long long, ino_softlimit)
1036 ),
1037 TP_fast_assign(
1038 __entry->dev = dqp->q_mount->m_super->s_dev;
1039 __entry->id = dqp->q_id;
1040 __entry->type = dqp->q_type;
1041 __entry->flags = dqp->q_flags;
1042 __entry->nrefs = dqp->q_nrefs;
1043
1044 __entry->res_bcount = dqp->q_blk.reserved;
1045 __entry->res_rtbcount = dqp->q_rtb.reserved;
1046 __entry->res_icount = dqp->q_ino.reserved;
1047
1048 __entry->bcount = dqp->q_blk.count;
1049 __entry->rtbcount = dqp->q_rtb.count;
1050 __entry->icount = dqp->q_ino.count;
1051
1052 __entry->blk_hardlimit = dqp->q_blk.hardlimit;
1053 __entry->blk_softlimit = dqp->q_blk.softlimit;
1054 __entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
1055 __entry->rtb_softlimit = dqp->q_rtb.softlimit;
1056 __entry->ino_hardlimit = dqp->q_ino.hardlimit;
1057 __entry->ino_softlimit = dqp->q_ino.softlimit;
1058 ),
1059 TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
1060 "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
1061 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
1062 "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
1063 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
1064 MAJOR(__entry->dev), MINOR(__entry->dev),
1065 __entry->id,
1066 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1067 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1068 __entry->nrefs,
1069 __entry->res_bcount,
1070 __entry->res_rtbcount,
1071 __entry->res_icount,
1072 __entry->bcount,
1073 __entry->blk_hardlimit,
1074 __entry->blk_softlimit,
1075 __entry->rtbcount,
1076 __entry->rtb_hardlimit,
1077 __entry->rtb_softlimit,
1078 __entry->icount,
1079 __entry->ino_hardlimit,
1080 __entry->ino_softlimit)
1081)
1082
1083#define DEFINE_DQUOT_EVENT(name) \
1084DEFINE_EVENT(xfs_dquot_class, name, \
1085 TP_PROTO(struct xfs_dquot *dqp), \
1086 TP_ARGS(dqp))
1087DEFINE_DQUOT_EVENT(xfs_dqadjust);
1088DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
1089DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
1090DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
1091DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
1092DEFINE_DQUOT_EVENT(xfs_dqattach_found);
1093DEFINE_DQUOT_EVENT(xfs_dqattach_get);
1094DEFINE_DQUOT_EVENT(xfs_dqalloc);
1095DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
1096DEFINE_DQUOT_EVENT(xfs_dqread);
1097DEFINE_DQUOT_EVENT(xfs_dqread_fail);
1098DEFINE_DQUOT_EVENT(xfs_dqget_hit);
1099DEFINE_DQUOT_EVENT(xfs_dqget_miss);
1100DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
1101DEFINE_DQUOT_EVENT(xfs_dqget_dup);
1102DEFINE_DQUOT_EVENT(xfs_dqput);
1103DEFINE_DQUOT_EVENT(xfs_dqput_free);
1104DEFINE_DQUOT_EVENT(xfs_dqrele);
1105DEFINE_DQUOT_EVENT(xfs_dqflush);
1106DEFINE_DQUOT_EVENT(xfs_dqflush_force);
1107DEFINE_DQUOT_EVENT(xfs_dqflush_done);
1108DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
1109DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
1110
1111TRACE_EVENT(xfs_trans_mod_dquot,
1112 TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
1113 unsigned int field, int64_t delta),
1114 TP_ARGS(tp, dqp, field, delta),
1115 TP_STRUCT__entry(
1116 __field(dev_t, dev)
1117 __field(xfs_dqtype_t, type)
1118 __field(unsigned int, flags)
1119 __field(unsigned int, dqid)
1120 __field(unsigned int, field)
1121 __field(int64_t, delta)
1122 ),
1123 TP_fast_assign(
1124 __entry->dev = tp->t_mountp->m_super->s_dev;
1125 __entry->type = dqp->q_type;
1126 __entry->flags = dqp->q_flags;
1127 __entry->dqid = dqp->q_id;
1128 __entry->field = field;
1129 __entry->delta = delta;
1130 ),
1131 TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
1132 MAJOR(__entry->dev), MINOR(__entry->dev),
1133 __entry->dqid,
1134 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1135 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1136 __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
1137 __entry->delta)
1138);
1139
1140DECLARE_EVENT_CLASS(xfs_dqtrx_class,
1141 TP_PROTO(struct xfs_dqtrx *qtrx),
1142 TP_ARGS(qtrx),
1143 TP_STRUCT__entry(
1144 __field(dev_t, dev)
1145 __field(xfs_dqtype_t, type)
1146 __field(unsigned int, flags)
1147 __field(u32, dqid)
1148
1149 __field(uint64_t, blk_res)
1150 __field(int64_t, bcount_delta)
1151 __field(int64_t, delbcnt_delta)
1152
1153 __field(uint64_t, rtblk_res)
1154 __field(uint64_t, rtblk_res_used)
1155 __field(int64_t, rtbcount_delta)
1156 __field(int64_t, delrtb_delta)
1157
1158 __field(uint64_t, ino_res)
1159 __field(uint64_t, ino_res_used)
1160 __field(int64_t, icount_delta)
1161 ),
1162 TP_fast_assign(
1163 __entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
1164 __entry->type = qtrx->qt_dquot->q_type;
1165 __entry->flags = qtrx->qt_dquot->q_flags;
1166 __entry->dqid = qtrx->qt_dquot->q_id;
1167
1168 __entry->blk_res = qtrx->qt_blk_res;
1169 __entry->bcount_delta = qtrx->qt_bcount_delta;
1170 __entry->delbcnt_delta = qtrx->qt_delbcnt_delta;
1171
1172 __entry->rtblk_res = qtrx->qt_rtblk_res;
1173 __entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
1174 __entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
1175 __entry->delrtb_delta = qtrx->qt_delrtb_delta;
1176
1177 __entry->ino_res = qtrx->qt_ino_res;
1178 __entry->ino_res_used = qtrx->qt_ino_res_used;
1179 __entry->icount_delta = qtrx->qt_icount_delta;
1180 ),
1181 TP_printk("dev %d:%d dquot id 0x%x type %s flags %s "
1182 "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
1183 "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
1184 "ino_res %llu ino_res_used %llu icount_delta %lld",
1185 MAJOR(__entry->dev), MINOR(__entry->dev),
1186 __entry->dqid,
1187 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
1188 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1189
1190 __entry->blk_res,
1191 __entry->bcount_delta,
1192 __entry->delbcnt_delta,
1193
1194 __entry->rtblk_res,
1195 __entry->rtblk_res_used,
1196 __entry->rtbcount_delta,
1197 __entry->delrtb_delta,
1198
1199 __entry->ino_res,
1200 __entry->ino_res_used,
1201 __entry->icount_delta)
1202)
1203
1204#define DEFINE_DQTRX_EVENT(name) \
1205DEFINE_EVENT(xfs_dqtrx_class, name, \
1206 TP_PROTO(struct xfs_dqtrx *qtrx), \
1207 TP_ARGS(qtrx))
1208DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
1209DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
1210DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
1211
1212DECLARE_EVENT_CLASS(xfs_loggrant_class,
1213 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
1214 TP_ARGS(log, tic),
1215 TP_STRUCT__entry(
1216 __field(dev_t, dev)
1217 __field(char, ocnt)
1218 __field(char, cnt)
1219 __field(int, curr_res)
1220 __field(int, unit_res)
1221 __field(unsigned int, flags)
1222 __field(int, reserveq)
1223 __field(int, writeq)
1224 __field(int, grant_reserve_cycle)
1225 __field(int, grant_reserve_bytes)
1226 __field(int, grant_write_cycle)
1227 __field(int, grant_write_bytes)
1228 __field(int, curr_cycle)
1229 __field(int, curr_block)
1230 __field(xfs_lsn_t, tail_lsn)
1231 ),
1232 TP_fast_assign(
1233 __entry->dev = log->l_mp->m_super->s_dev;
1234 __entry->ocnt = tic->t_ocnt;
1235 __entry->cnt = tic->t_cnt;
1236 __entry->curr_res = tic->t_curr_res;
1237 __entry->unit_res = tic->t_unit_res;
1238 __entry->flags = tic->t_flags;
1239 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
1240 __entry->writeq = list_empty(&log->l_write_head.waiters);
1241 xlog_crack_grant_head(&log->l_reserve_head.grant,
1242 &__entry->grant_reserve_cycle,
1243 &__entry->grant_reserve_bytes);
1244 xlog_crack_grant_head(&log->l_write_head.grant,
1245 &__entry->grant_write_cycle,
1246 &__entry->grant_write_bytes);
1247 __entry->curr_cycle = log->l_curr_cycle;
1248 __entry->curr_block = log->l_curr_block;
1249 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
1250 ),
1251 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
1252 "t_unit_res %u t_flags %s reserveq %s "
1253 "writeq %s grant_reserve_cycle %d "
1254 "grant_reserve_bytes %d grant_write_cycle %d "
1255 "grant_write_bytes %d curr_cycle %d curr_block %d "
1256 "tail_cycle %d tail_block %d",
1257 MAJOR(__entry->dev), MINOR(__entry->dev),
1258 __entry->ocnt,
1259 __entry->cnt,
1260 __entry->curr_res,
1261 __entry->unit_res,
1262 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
1263 __entry->reserveq ? "empty" : "active",
1264 __entry->writeq ? "empty" : "active",
1265 __entry->grant_reserve_cycle,
1266 __entry->grant_reserve_bytes,
1267 __entry->grant_write_cycle,
1268 __entry->grant_write_bytes,
1269 __entry->curr_cycle,
1270 __entry->curr_block,
1271 CYCLE_LSN(__entry->tail_lsn),
1272 BLOCK_LSN(__entry->tail_lsn)
1273 )
1274)
1275
1276#define DEFINE_LOGGRANT_EVENT(name) \
1277DEFINE_EVENT(xfs_loggrant_class, name, \
1278 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
1279 TP_ARGS(log, tic))
1280DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
1281DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1282DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
1283DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
1284DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1285DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1286DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1287DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
1288DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant);
1289DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_exit);
1290DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_sub);
1291DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
1292DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
1293DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
1294DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
1295
1296DECLARE_EVENT_CLASS(xfs_log_item_class,
1297 TP_PROTO(struct xfs_log_item *lip),
1298 TP_ARGS(lip),
1299 TP_STRUCT__entry(
1300 __field(dev_t, dev)
1301 __field(void *, lip)
1302 __field(uint, type)
1303 __field(unsigned long, flags)
1304 __field(xfs_lsn_t, lsn)
1305 ),
1306 TP_fast_assign(
1307 __entry->dev = lip->li_log->l_mp->m_super->s_dev;
1308 __entry->lip = lip;
1309 __entry->type = lip->li_type;
1310 __entry->flags = lip->li_flags;
1311 __entry->lsn = lip->li_lsn;
1312 ),
1313 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
1314 MAJOR(__entry->dev), MINOR(__entry->dev),
1315 __entry->lip,
1316 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1317 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1318 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1319)
1320
1321TRACE_EVENT(xfs_log_force,
1322 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1323 TP_ARGS(mp, lsn, caller_ip),
1324 TP_STRUCT__entry(
1325 __field(dev_t, dev)
1326 __field(xfs_lsn_t, lsn)
1327 __field(unsigned long, caller_ip)
1328 ),
1329 TP_fast_assign(
1330 __entry->dev = mp->m_super->s_dev;
1331 __entry->lsn = lsn;
1332 __entry->caller_ip = caller_ip;
1333 ),
1334 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
1335 MAJOR(__entry->dev), MINOR(__entry->dev),
1336 __entry->lsn, (void *)__entry->caller_ip)
1337)
1338
1339#define DEFINE_LOG_ITEM_EVENT(name) \
1340DEFINE_EVENT(xfs_log_item_class, name, \
1341 TP_PROTO(struct xfs_log_item *lip), \
1342 TP_ARGS(lip))
1343DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
1344DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1345DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
1346DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
1347DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_mark);
1348DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_skip);
1349DEFINE_LOG_ITEM_EVENT(xfs_cil_whiteout_unpin);
1350
1351DECLARE_EVENT_CLASS(xfs_ail_class,
1352 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1353 TP_ARGS(lip, old_lsn, new_lsn),
1354 TP_STRUCT__entry(
1355 __field(dev_t, dev)
1356 __field(void *, lip)
1357 __field(uint, type)
1358 __field(unsigned long, flags)
1359 __field(xfs_lsn_t, old_lsn)
1360 __field(xfs_lsn_t, new_lsn)
1361 ),
1362 TP_fast_assign(
1363 __entry->dev = lip->li_log->l_mp->m_super->s_dev;
1364 __entry->lip = lip;
1365 __entry->type = lip->li_type;
1366 __entry->flags = lip->li_flags;
1367 __entry->old_lsn = old_lsn;
1368 __entry->new_lsn = new_lsn;
1369 ),
1370 TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s",
1371 MAJOR(__entry->dev), MINOR(__entry->dev),
1372 __entry->lip,
1373 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1374 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1375 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1376 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1377)
1378
1379#define DEFINE_AIL_EVENT(name) \
1380DEFINE_EVENT(xfs_ail_class, name, \
1381 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1382 TP_ARGS(lip, old_lsn, new_lsn))
1383DEFINE_AIL_EVENT(xfs_ail_insert);
1384DEFINE_AIL_EVENT(xfs_ail_move);
1385DEFINE_AIL_EVENT(xfs_ail_delete);
1386
1387TRACE_EVENT(xfs_log_assign_tail_lsn,
1388 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1389 TP_ARGS(log, new_lsn),
1390 TP_STRUCT__entry(
1391 __field(dev_t, dev)
1392 __field(xfs_lsn_t, new_lsn)
1393 __field(xfs_lsn_t, old_lsn)
1394 __field(xfs_lsn_t, last_sync_lsn)
1395 ),
1396 TP_fast_assign(
1397 __entry->dev = log->l_mp->m_super->s_dev;
1398 __entry->new_lsn = new_lsn;
1399 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1400 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1401 ),
1402 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1403 MAJOR(__entry->dev), MINOR(__entry->dev),
1404 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1405 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1406 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1407)
1408
1409DECLARE_EVENT_CLASS(xfs_file_class,
1410 TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
1411 TP_ARGS(iocb, iter),
1412 TP_STRUCT__entry(
1413 __field(dev_t, dev)
1414 __field(xfs_ino_t, ino)
1415 __field(xfs_fsize_t, size)
1416 __field(loff_t, offset)
1417 __field(size_t, count)
1418 ),
1419 TP_fast_assign(
1420 __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
1421 __entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
1422 __entry->size = XFS_I(file_inode(iocb->ki_filp))->i_disk_size;
1423 __entry->offset = iocb->ki_pos;
1424 __entry->count = iov_iter_count(iter);
1425 ),
1426 TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx",
1427 MAJOR(__entry->dev), MINOR(__entry->dev),
1428 __entry->ino,
1429 __entry->size,
1430 __entry->offset,
1431 __entry->count)
1432)
1433
1434#define DEFINE_RW_EVENT(name) \
1435DEFINE_EVENT(xfs_file_class, name, \
1436 TP_PROTO(struct kiocb *iocb, struct iov_iter *iter), \
1437 TP_ARGS(iocb, iter))
1438DEFINE_RW_EVENT(xfs_file_buffered_read);
1439DEFINE_RW_EVENT(xfs_file_direct_read);
1440DEFINE_RW_EVENT(xfs_file_dax_read);
1441DEFINE_RW_EVENT(xfs_file_buffered_write);
1442DEFINE_RW_EVENT(xfs_file_direct_write);
1443DEFINE_RW_EVENT(xfs_file_dax_write);
1444DEFINE_RW_EVENT(xfs_reflink_bounce_dio_write);
1445
1446DECLARE_EVENT_CLASS(xfs_imap_class,
1447 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
1448 int whichfork, struct xfs_bmbt_irec *irec),
1449 TP_ARGS(ip, offset, count, whichfork, irec),
1450 TP_STRUCT__entry(
1451 __field(dev_t, dev)
1452 __field(xfs_ino_t, ino)
1453 __field(loff_t, size)
1454 __field(loff_t, offset)
1455 __field(size_t, count)
1456 __field(int, whichfork)
1457 __field(xfs_fileoff_t, startoff)
1458 __field(xfs_fsblock_t, startblock)
1459 __field(xfs_filblks_t, blockcount)
1460 ),
1461 TP_fast_assign(
1462 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1463 __entry->ino = ip->i_ino;
1464 __entry->size = ip->i_disk_size;
1465 __entry->offset = offset;
1466 __entry->count = count;
1467 __entry->whichfork = whichfork;
1468 __entry->startoff = irec ? irec->br_startoff : 0;
1469 __entry->startblock = irec ? irec->br_startblock : 0;
1470 __entry->blockcount = irec ? irec->br_blockcount : 0;
1471 ),
1472 TP_printk("dev %d:%d ino 0x%llx disize 0x%llx pos 0x%llx bytecount 0x%zx "
1473 "fork %s startoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
1474 MAJOR(__entry->dev), MINOR(__entry->dev),
1475 __entry->ino,
1476 __entry->size,
1477 __entry->offset,
1478 __entry->count,
1479 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
1480 __entry->startoff,
1481 (int64_t)__entry->startblock,
1482 __entry->blockcount)
1483)
1484
1485#define DEFINE_IMAP_EVENT(name) \
1486DEFINE_EVENT(xfs_imap_class, name, \
1487 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
1488 int whichfork, struct xfs_bmbt_irec *irec), \
1489 TP_ARGS(ip, offset, count, whichfork, irec))
1490DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1491DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1492DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1493DEFINE_IMAP_EVENT(xfs_iomap_found);
1494
1495DECLARE_EVENT_CLASS(xfs_simple_io_class,
1496 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1497 TP_ARGS(ip, offset, count),
1498 TP_STRUCT__entry(
1499 __field(dev_t, dev)
1500 __field(xfs_ino_t, ino)
1501 __field(loff_t, isize)
1502 __field(loff_t, disize)
1503 __field(loff_t, offset)
1504 __field(size_t, count)
1505 ),
1506 TP_fast_assign(
1507 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1508 __entry->ino = ip->i_ino;
1509 __entry->isize = VFS_I(ip)->i_size;
1510 __entry->disize = ip->i_disk_size;
1511 __entry->offset = offset;
1512 __entry->count = count;
1513 ),
1514 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
1515 "pos 0x%llx bytecount 0x%zx",
1516 MAJOR(__entry->dev), MINOR(__entry->dev),
1517 __entry->ino,
1518 __entry->isize,
1519 __entry->disize,
1520 __entry->offset,
1521 __entry->count)
1522);
1523
1524#define DEFINE_SIMPLE_IO_EVENT(name) \
1525DEFINE_EVENT(xfs_simple_io_class, name, \
1526 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1527 TP_ARGS(ip, offset, count))
1528DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1529DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1530DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
1531DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
1532DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1533DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1534DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
1535DEFINE_SIMPLE_IO_EVENT(xfs_file_splice_read);
1536
1537DECLARE_EVENT_CLASS(xfs_itrunc_class,
1538 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1539 TP_ARGS(ip, new_size),
1540 TP_STRUCT__entry(
1541 __field(dev_t, dev)
1542 __field(xfs_ino_t, ino)
1543 __field(xfs_fsize_t, size)
1544 __field(xfs_fsize_t, new_size)
1545 ),
1546 TP_fast_assign(
1547 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1548 __entry->ino = ip->i_ino;
1549 __entry->size = ip->i_disk_size;
1550 __entry->new_size = new_size;
1551 ),
1552 TP_printk("dev %d:%d ino 0x%llx disize 0x%llx new_size 0x%llx",
1553 MAJOR(__entry->dev), MINOR(__entry->dev),
1554 __entry->ino,
1555 __entry->size,
1556 __entry->new_size)
1557)
1558
1559#define DEFINE_ITRUNC_EVENT(name) \
1560DEFINE_EVENT(xfs_itrunc_class, name, \
1561 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1562 TP_ARGS(ip, new_size))
1563DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1564DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
1565
1566TRACE_EVENT(xfs_pagecache_inval,
1567 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1568 TP_ARGS(ip, start, finish),
1569 TP_STRUCT__entry(
1570 __field(dev_t, dev)
1571 __field(xfs_ino_t, ino)
1572 __field(xfs_fsize_t, size)
1573 __field(xfs_off_t, start)
1574 __field(xfs_off_t, finish)
1575 ),
1576 TP_fast_assign(
1577 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1578 __entry->ino = ip->i_ino;
1579 __entry->size = ip->i_disk_size;
1580 __entry->start = start;
1581 __entry->finish = finish;
1582 ),
1583 TP_printk("dev %d:%d ino 0x%llx disize 0x%llx start 0x%llx finish 0x%llx",
1584 MAJOR(__entry->dev), MINOR(__entry->dev),
1585 __entry->ino,
1586 __entry->size,
1587 __entry->start,
1588 __entry->finish)
1589);
1590
1591TRACE_EVENT(xfs_bunmap,
1592 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t fileoff, xfs_filblks_t len,
1593 int flags, unsigned long caller_ip),
1594 TP_ARGS(ip, fileoff, len, flags, caller_ip),
1595 TP_STRUCT__entry(
1596 __field(dev_t, dev)
1597 __field(xfs_ino_t, ino)
1598 __field(xfs_fsize_t, size)
1599 __field(xfs_fileoff_t, fileoff)
1600 __field(xfs_filblks_t, len)
1601 __field(unsigned long, caller_ip)
1602 __field(int, flags)
1603 ),
1604 TP_fast_assign(
1605 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1606 __entry->ino = ip->i_ino;
1607 __entry->size = ip->i_disk_size;
1608 __entry->fileoff = fileoff;
1609 __entry->len = len;
1610 __entry->caller_ip = caller_ip;
1611 __entry->flags = flags;
1612 ),
1613 TP_printk("dev %d:%d ino 0x%llx disize 0x%llx fileoff 0x%llx fsbcount 0x%llx "
1614 "flags %s caller %pS",
1615 MAJOR(__entry->dev), MINOR(__entry->dev),
1616 __entry->ino,
1617 __entry->size,
1618 __entry->fileoff,
1619 __entry->len,
1620 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1621 (void *)__entry->caller_ip)
1622
1623);
1624
1625DECLARE_EVENT_CLASS(xfs_extent_busy_class,
1626 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1627 xfs_agblock_t agbno, xfs_extlen_t len),
1628 TP_ARGS(mp, agno, agbno, len),
1629 TP_STRUCT__entry(
1630 __field(dev_t, dev)
1631 __field(xfs_agnumber_t, agno)
1632 __field(xfs_agblock_t, agbno)
1633 __field(xfs_extlen_t, len)
1634 ),
1635 TP_fast_assign(
1636 __entry->dev = mp->m_super->s_dev;
1637 __entry->agno = agno;
1638 __entry->agbno = agbno;
1639 __entry->len = len;
1640 ),
1641 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
1642 MAJOR(__entry->dev), MINOR(__entry->dev),
1643 __entry->agno,
1644 __entry->agbno,
1645 __entry->len)
1646);
1647#define DEFINE_BUSY_EVENT(name) \
1648DEFINE_EVENT(xfs_extent_busy_class, name, \
1649 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1650 xfs_agblock_t agbno, xfs_extlen_t len), \
1651 TP_ARGS(mp, agno, agbno, len))
1652DEFINE_BUSY_EVENT(xfs_extent_busy);
1653DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1654DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1655DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1656DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
1657
1658TRACE_EVENT(xfs_extent_busy_trim,
1659 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1660 xfs_agblock_t agbno, xfs_extlen_t len,
1661 xfs_agblock_t tbno, xfs_extlen_t tlen),
1662 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1663 TP_STRUCT__entry(
1664 __field(dev_t, dev)
1665 __field(xfs_agnumber_t, agno)
1666 __field(xfs_agblock_t, agbno)
1667 __field(xfs_extlen_t, len)
1668 __field(xfs_agblock_t, tbno)
1669 __field(xfs_extlen_t, tlen)
1670 ),
1671 TP_fast_assign(
1672 __entry->dev = mp->m_super->s_dev;
1673 __entry->agno = agno;
1674 __entry->agbno = agbno;
1675 __entry->len = len;
1676 __entry->tbno = tbno;
1677 __entry->tlen = tlen;
1678 ),
1679 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x found_agbno 0x%x found_fsbcount 0x%x",
1680 MAJOR(__entry->dev), MINOR(__entry->dev),
1681 __entry->agno,
1682 __entry->agbno,
1683 __entry->len,
1684 __entry->tbno,
1685 __entry->tlen)
1686);
1687
1688DECLARE_EVENT_CLASS(xfs_agf_class,
1689 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1690 unsigned long caller_ip),
1691 TP_ARGS(mp, agf, flags, caller_ip),
1692 TP_STRUCT__entry(
1693 __field(dev_t, dev)
1694 __field(xfs_agnumber_t, agno)
1695 __field(int, flags)
1696 __field(__u32, length)
1697 __field(__u32, bno_root)
1698 __field(__u32, cnt_root)
1699 __field(__u32, bno_level)
1700 __field(__u32, cnt_level)
1701 __field(__u32, flfirst)
1702 __field(__u32, fllast)
1703 __field(__u32, flcount)
1704 __field(__u32, freeblks)
1705 __field(__u32, longest)
1706 __field(unsigned long, caller_ip)
1707 ),
1708 TP_fast_assign(
1709 __entry->dev = mp->m_super->s_dev;
1710 __entry->agno = be32_to_cpu(agf->agf_seqno),
1711 __entry->flags = flags;
1712 __entry->length = be32_to_cpu(agf->agf_length),
1713 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1714 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1715 __entry->bno_level =
1716 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1717 __entry->cnt_level =
1718 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1719 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1720 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1721 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1722 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1723 __entry->longest = be32_to_cpu(agf->agf_longest);
1724 __entry->caller_ip = caller_ip;
1725 ),
1726 TP_printk("dev %d:%d agno 0x%x flags %s length %u roots b %u c %u "
1727 "levels b %u c %u flfirst %u fllast %u flcount %u "
1728 "freeblks %u longest %u caller %pS",
1729 MAJOR(__entry->dev), MINOR(__entry->dev),
1730 __entry->agno,
1731 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1732 __entry->length,
1733 __entry->bno_root,
1734 __entry->cnt_root,
1735 __entry->bno_level,
1736 __entry->cnt_level,
1737 __entry->flfirst,
1738 __entry->fllast,
1739 __entry->flcount,
1740 __entry->freeblks,
1741 __entry->longest,
1742 (void *)__entry->caller_ip)
1743);
1744#define DEFINE_AGF_EVENT(name) \
1745DEFINE_EVENT(xfs_agf_class, name, \
1746 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1747 unsigned long caller_ip), \
1748 TP_ARGS(mp, agf, flags, caller_ip))
1749DEFINE_AGF_EVENT(xfs_agf);
1750DEFINE_AGF_EVENT(xfs_agfl_reset);
1751
1752TRACE_EVENT(xfs_free_extent,
1753 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1754 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1755 int haveright),
1756 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
1757 TP_STRUCT__entry(
1758 __field(dev_t, dev)
1759 __field(xfs_agnumber_t, agno)
1760 __field(xfs_agblock_t, agbno)
1761 __field(xfs_extlen_t, len)
1762 __field(int, resv)
1763 __field(int, haveleft)
1764 __field(int, haveright)
1765 ),
1766 TP_fast_assign(
1767 __entry->dev = mp->m_super->s_dev;
1768 __entry->agno = agno;
1769 __entry->agbno = agbno;
1770 __entry->len = len;
1771 __entry->resv = resv;
1772 __entry->haveleft = haveleft;
1773 __entry->haveright = haveright;
1774 ),
1775 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x resv %d %s",
1776 MAJOR(__entry->dev), MINOR(__entry->dev),
1777 __entry->agno,
1778 __entry->agbno,
1779 __entry->len,
1780 __entry->resv,
1781 __entry->haveleft ?
1782 (__entry->haveright ? "both" : "left") :
1783 (__entry->haveright ? "right" : "none"))
1784
1785);
1786
1787DECLARE_EVENT_CLASS(xfs_alloc_class,
1788 TP_PROTO(struct xfs_alloc_arg *args),
1789 TP_ARGS(args),
1790 TP_STRUCT__entry(
1791 __field(dev_t, dev)
1792 __field(xfs_agnumber_t, agno)
1793 __field(xfs_agblock_t, agbno)
1794 __field(xfs_extlen_t, minlen)
1795 __field(xfs_extlen_t, maxlen)
1796 __field(xfs_extlen_t, mod)
1797 __field(xfs_extlen_t, prod)
1798 __field(xfs_extlen_t, minleft)
1799 __field(xfs_extlen_t, total)
1800 __field(xfs_extlen_t, alignment)
1801 __field(xfs_extlen_t, minalignslop)
1802 __field(xfs_extlen_t, len)
1803 __field(char, wasdel)
1804 __field(char, wasfromfl)
1805 __field(int, resv)
1806 __field(int, datatype)
1807 __field(xfs_agnumber_t, highest_agno)
1808 ),
1809 TP_fast_assign(
1810 __entry->dev = args->mp->m_super->s_dev;
1811 __entry->agno = args->agno;
1812 __entry->agbno = args->agbno;
1813 __entry->minlen = args->minlen;
1814 __entry->maxlen = args->maxlen;
1815 __entry->mod = args->mod;
1816 __entry->prod = args->prod;
1817 __entry->minleft = args->minleft;
1818 __entry->total = args->total;
1819 __entry->alignment = args->alignment;
1820 __entry->minalignslop = args->minalignslop;
1821 __entry->len = args->len;
1822 __entry->wasdel = args->wasdel;
1823 __entry->wasfromfl = args->wasfromfl;
1824 __entry->resv = args->resv;
1825 __entry->datatype = args->datatype;
1826 __entry->highest_agno = args->tp->t_highest_agno;
1827 ),
1828 TP_printk("dev %d:%d agno 0x%x agbno 0x%x minlen %u maxlen %u mod %u "
1829 "prod %u minleft %u total %u alignment %u minalignslop %u "
1830 "len %u wasdel %d wasfromfl %d resv %d "
1831 "datatype 0x%x highest_agno 0x%x",
1832 MAJOR(__entry->dev), MINOR(__entry->dev),
1833 __entry->agno,
1834 __entry->agbno,
1835 __entry->minlen,
1836 __entry->maxlen,
1837 __entry->mod,
1838 __entry->prod,
1839 __entry->minleft,
1840 __entry->total,
1841 __entry->alignment,
1842 __entry->minalignslop,
1843 __entry->len,
1844 __entry->wasdel,
1845 __entry->wasfromfl,
1846 __entry->resv,
1847 __entry->datatype,
1848 __entry->highest_agno)
1849)
1850
1851#define DEFINE_ALLOC_EVENT(name) \
1852DEFINE_EVENT(xfs_alloc_class, name, \
1853 TP_PROTO(struct xfs_alloc_arg *args), \
1854 TP_ARGS(args))
1855DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1856DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
1857DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1858DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1859DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1860DEFINE_ALLOC_EVENT(xfs_alloc_cur);
1861DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1862DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
1863DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
1864DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
1865DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1866DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1867DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
1868DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1869DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1870DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1871DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1872DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1873DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
1874DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1875DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1876DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1877DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1878DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1879DEFINE_ALLOC_EVENT(xfs_alloc_vextent_skip_deadlock);
1880DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1881DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1882DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1883DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1884
1885DEFINE_ALLOC_EVENT(xfs_alloc_vextent_this_ag);
1886DEFINE_ALLOC_EVENT(xfs_alloc_vextent_start_ag);
1887DEFINE_ALLOC_EVENT(xfs_alloc_vextent_first_ag);
1888DEFINE_ALLOC_EVENT(xfs_alloc_vextent_exact_bno);
1889DEFINE_ALLOC_EVENT(xfs_alloc_vextent_near_bno);
1890DEFINE_ALLOC_EVENT(xfs_alloc_vextent_finish);
1891
1892TRACE_EVENT(xfs_alloc_cur_check,
1893 TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1894 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1895 TP_ARGS(mp, btnum, bno, len, diff, new),
1896 TP_STRUCT__entry(
1897 __field(dev_t, dev)
1898 __field(xfs_btnum_t, btnum)
1899 __field(xfs_agblock_t, bno)
1900 __field(xfs_extlen_t, len)
1901 __field(xfs_extlen_t, diff)
1902 __field(bool, new)
1903 ),
1904 TP_fast_assign(
1905 __entry->dev = mp->m_super->s_dev;
1906 __entry->btnum = btnum;
1907 __entry->bno = bno;
1908 __entry->len = len;
1909 __entry->diff = diff;
1910 __entry->new = new;
1911 ),
1912 TP_printk("dev %d:%d btree %s agbno 0x%x fsbcount 0x%x diff 0x%x new %d",
1913 MAJOR(__entry->dev), MINOR(__entry->dev),
1914 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1915 __entry->bno, __entry->len, __entry->diff, __entry->new)
1916)
1917
1918DECLARE_EVENT_CLASS(xfs_da_class,
1919 TP_PROTO(struct xfs_da_args *args),
1920 TP_ARGS(args),
1921 TP_STRUCT__entry(
1922 __field(dev_t, dev)
1923 __field(xfs_ino_t, ino)
1924 __dynamic_array(char, name, args->namelen)
1925 __field(int, namelen)
1926 __field(xfs_dahash_t, hashval)
1927 __field(xfs_ino_t, inumber)
1928 __field(uint32_t, op_flags)
1929 ),
1930 TP_fast_assign(
1931 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1932 __entry->ino = args->dp->i_ino;
1933 if (args->namelen)
1934 memcpy(__get_str(name), args->name, args->namelen);
1935 __entry->namelen = args->namelen;
1936 __entry->hashval = args->hashval;
1937 __entry->inumber = args->inumber;
1938 __entry->op_flags = args->op_flags;
1939 ),
1940 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1941 "inumber 0x%llx op_flags %s",
1942 MAJOR(__entry->dev), MINOR(__entry->dev),
1943 __entry->ino,
1944 __entry->namelen,
1945 __entry->namelen ? __get_str(name) : NULL,
1946 __entry->namelen,
1947 __entry->hashval,
1948 __entry->inumber,
1949 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1950)
1951
1952#define DEFINE_DIR2_EVENT(name) \
1953DEFINE_EVENT(xfs_da_class, name, \
1954 TP_PROTO(struct xfs_da_args *args), \
1955 TP_ARGS(args))
1956DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1957DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1958DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1959DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1960DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1961DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1962DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1963DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1964DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1965DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1966DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1967DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1968DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1969DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1970DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1971DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1972DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1973DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1974DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1975DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1976DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1977DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1978DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1979DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1980DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1981
1982DECLARE_EVENT_CLASS(xfs_attr_class,
1983 TP_PROTO(struct xfs_da_args *args),
1984 TP_ARGS(args),
1985 TP_STRUCT__entry(
1986 __field(dev_t, dev)
1987 __field(xfs_ino_t, ino)
1988 __dynamic_array(char, name, args->namelen)
1989 __field(int, namelen)
1990 __field(int, valuelen)
1991 __field(xfs_dahash_t, hashval)
1992 __field(unsigned int, attr_filter)
1993 __field(unsigned int, attr_flags)
1994 __field(uint32_t, op_flags)
1995 ),
1996 TP_fast_assign(
1997 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1998 __entry->ino = args->dp->i_ino;
1999 if (args->namelen)
2000 memcpy(__get_str(name), args->name, args->namelen);
2001 __entry->namelen = args->namelen;
2002 __entry->valuelen = args->valuelen;
2003 __entry->hashval = args->hashval;
2004 __entry->attr_filter = args->attr_filter;
2005 __entry->attr_flags = args->attr_flags;
2006 __entry->op_flags = args->op_flags;
2007 ),
2008 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
2009 "hashval 0x%x filter %s flags %s op_flags %s",
2010 MAJOR(__entry->dev), MINOR(__entry->dev),
2011 __entry->ino,
2012 __entry->namelen,
2013 __entry->namelen ? __get_str(name) : NULL,
2014 __entry->namelen,
2015 __entry->valuelen,
2016 __entry->hashval,
2017 __print_flags(__entry->attr_filter, "|",
2018 XFS_ATTR_FILTER_FLAGS),
2019 __print_flags(__entry->attr_flags, "|",
2020 { XATTR_CREATE, "CREATE" },
2021 { XATTR_REPLACE, "REPLACE" }),
2022 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
2023)
2024
2025#define DEFINE_ATTR_EVENT(name) \
2026DEFINE_EVENT(xfs_attr_class, name, \
2027 TP_PROTO(struct xfs_da_args *args), \
2028 TP_ARGS(args))
2029DEFINE_ATTR_EVENT(xfs_attr_sf_add);
2030DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
2031DEFINE_ATTR_EVENT(xfs_attr_sf_create);
2032DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2033DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
2034DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2035
2036DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2037DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2038DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
2039DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
2040DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
2041DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2042DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
2043DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2044DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
2045DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
2046DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2047DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2048DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2049DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2050DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2051DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2052DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2053DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2054DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2055DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2056DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
2057DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
2058
2059DEFINE_ATTR_EVENT(xfs_attr_node_addname);
2060DEFINE_ATTR_EVENT(xfs_attr_node_get);
2061DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2062DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2063
2064DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2065DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2066
2067DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2068DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
2069
2070#define DEFINE_DA_EVENT(name) \
2071DEFINE_EVENT(xfs_da_class, name, \
2072 TP_PROTO(struct xfs_da_args *args), \
2073 TP_ARGS(args))
2074DEFINE_DA_EVENT(xfs_da_split);
2075DEFINE_DA_EVENT(xfs_da_join);
2076DEFINE_DA_EVENT(xfs_da_link_before);
2077DEFINE_DA_EVENT(xfs_da_link_after);
2078DEFINE_DA_EVENT(xfs_da_unlink_back);
2079DEFINE_DA_EVENT(xfs_da_unlink_forward);
2080DEFINE_DA_EVENT(xfs_da_root_split);
2081DEFINE_DA_EVENT(xfs_da_root_join);
2082DEFINE_DA_EVENT(xfs_da_node_add);
2083DEFINE_DA_EVENT(xfs_da_node_create);
2084DEFINE_DA_EVENT(xfs_da_node_split);
2085DEFINE_DA_EVENT(xfs_da_node_remove);
2086DEFINE_DA_EVENT(xfs_da_node_rebalance);
2087DEFINE_DA_EVENT(xfs_da_node_unbalance);
2088DEFINE_DA_EVENT(xfs_da_node_toosmall);
2089DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2090DEFINE_DA_EVENT(xfs_da_grow_inode);
2091DEFINE_DA_EVENT(xfs_da_shrink_inode);
2092DEFINE_DA_EVENT(xfs_da_fixhashpath);
2093DEFINE_DA_EVENT(xfs_da_path_shift);
2094
2095DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2096 TP_PROTO(struct xfs_da_args *args, int idx),
2097 TP_ARGS(args, idx),
2098 TP_STRUCT__entry(
2099 __field(dev_t, dev)
2100 __field(xfs_ino_t, ino)
2101 __field(uint32_t, op_flags)
2102 __field(int, idx)
2103 ),
2104 TP_fast_assign(
2105 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2106 __entry->ino = args->dp->i_ino;
2107 __entry->op_flags = args->op_flags;
2108 __entry->idx = idx;
2109 ),
2110 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2111 MAJOR(__entry->dev), MINOR(__entry->dev),
2112 __entry->ino,
2113 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2114 __entry->idx)
2115)
2116
2117#define DEFINE_DIR2_SPACE_EVENT(name) \
2118DEFINE_EVENT(xfs_dir2_space_class, name, \
2119 TP_PROTO(struct xfs_da_args *args, int idx), \
2120 TP_ARGS(args, idx))
2121DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2122DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2123DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2124DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
2125
2126TRACE_EVENT(xfs_dir2_leafn_moveents,
2127 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2128 TP_ARGS(args, src_idx, dst_idx, count),
2129 TP_STRUCT__entry(
2130 __field(dev_t, dev)
2131 __field(xfs_ino_t, ino)
2132 __field(uint32_t, op_flags)
2133 __field(int, src_idx)
2134 __field(int, dst_idx)
2135 __field(int, count)
2136 ),
2137 TP_fast_assign(
2138 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2139 __entry->ino = args->dp->i_ino;
2140 __entry->op_flags = args->op_flags;
2141 __entry->src_idx = src_idx;
2142 __entry->dst_idx = dst_idx;
2143 __entry->count = count;
2144 ),
2145 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2146 "src_idx %d dst_idx %d count %d",
2147 MAJOR(__entry->dev), MINOR(__entry->dev),
2148 __entry->ino,
2149 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2150 __entry->src_idx,
2151 __entry->dst_idx,
2152 __entry->count)
2153);
2154
2155#define XFS_SWAPEXT_INODES \
2156 { 0, "target" }, \
2157 { 1, "temp" }
2158
2159TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2160TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2161TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2162TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2163TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
2164
2165DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2166 TP_PROTO(struct xfs_inode *ip, int which),
2167 TP_ARGS(ip, which),
2168 TP_STRUCT__entry(
2169 __field(dev_t, dev)
2170 __field(int, which)
2171 __field(xfs_ino_t, ino)
2172 __field(int, format)
2173 __field(xfs_extnum_t, nex)
2174 __field(int, broot_size)
2175 __field(int, fork_off)
2176 ),
2177 TP_fast_assign(
2178 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2179 __entry->which = which;
2180 __entry->ino = ip->i_ino;
2181 __entry->format = ip->i_df.if_format;
2182 __entry->nex = ip->i_df.if_nextents;
2183 __entry->broot_size = ip->i_df.if_broot_bytes;
2184 __entry->fork_off = xfs_inode_fork_boff(ip);
2185 ),
2186 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %llu, "
2187 "broot size %d, forkoff 0x%x",
2188 MAJOR(__entry->dev), MINOR(__entry->dev),
2189 __entry->ino,
2190 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2191 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2192 __entry->nex,
2193 __entry->broot_size,
2194 __entry->fork_off)
2195)
2196
2197#define DEFINE_SWAPEXT_EVENT(name) \
2198DEFINE_EVENT(xfs_swap_extent_class, name, \
2199 TP_PROTO(struct xfs_inode *ip, int which), \
2200 TP_ARGS(ip, which))
2201
2202DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2203DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2204
2205TRACE_EVENT(xfs_log_recover,
2206 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2207 TP_ARGS(log, headblk, tailblk),
2208 TP_STRUCT__entry(
2209 __field(dev_t, dev)
2210 __field(xfs_daddr_t, headblk)
2211 __field(xfs_daddr_t, tailblk)
2212 ),
2213 TP_fast_assign(
2214 __entry->dev = log->l_mp->m_super->s_dev;
2215 __entry->headblk = headblk;
2216 __entry->tailblk = tailblk;
2217 ),
2218 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2219 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2220 __entry->tailblk)
2221)
2222
2223TRACE_EVENT(xfs_log_recover_record,
2224 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2225 TP_ARGS(log, rhead, pass),
2226 TP_STRUCT__entry(
2227 __field(dev_t, dev)
2228 __field(xfs_lsn_t, lsn)
2229 __field(int, len)
2230 __field(int, num_logops)
2231 __field(int, pass)
2232 ),
2233 TP_fast_assign(
2234 __entry->dev = log->l_mp->m_super->s_dev;
2235 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2236 __entry->len = be32_to_cpu(rhead->h_len);
2237 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2238 __entry->pass = pass;
2239 ),
2240 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2241 MAJOR(__entry->dev), MINOR(__entry->dev),
2242 __entry->lsn, __entry->len, __entry->num_logops,
2243 __entry->pass)
2244)
2245
2246DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
2247 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
2248 struct xlog_recover_item *item, int pass),
2249 TP_ARGS(log, trans, item, pass),
2250 TP_STRUCT__entry(
2251 __field(dev_t, dev)
2252 __field(unsigned long, item)
2253 __field(xlog_tid_t, tid)
2254 __field(xfs_lsn_t, lsn)
2255 __field(int, type)
2256 __field(int, pass)
2257 __field(int, count)
2258 __field(int, total)
2259 ),
2260 TP_fast_assign(
2261 __entry->dev = log->l_mp->m_super->s_dev;
2262 __entry->item = (unsigned long)item;
2263 __entry->tid = trans->r_log_tid;
2264 __entry->lsn = trans->r_lsn;
2265 __entry->type = ITEM_TYPE(item);
2266 __entry->pass = pass;
2267 __entry->count = item->ri_cnt;
2268 __entry->total = item->ri_total;
2269 ),
2270 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
2271 "item type %s item region count/total %d/%d",
2272 MAJOR(__entry->dev), MINOR(__entry->dev),
2273 __entry->tid,
2274 __entry->lsn,
2275 __entry->pass,
2276 (void *)__entry->item,
2277 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2278 __entry->count,
2279 __entry->total)
2280)
2281
2282#define DEFINE_LOG_RECOVER_ITEM(name) \
2283DEFINE_EVENT(xfs_log_recover_item_class, name, \
2284 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
2285 struct xlog_recover_item *item, int pass), \
2286 TP_ARGS(log, trans, item, pass))
2287
2288DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2289DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2290DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2291DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2292DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2293
2294DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
2295 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
2296 TP_ARGS(log, buf_f),
2297 TP_STRUCT__entry(
2298 __field(dev_t, dev)
2299 __field(int64_t, blkno)
2300 __field(unsigned short, len)
2301 __field(unsigned short, flags)
2302 __field(unsigned short, size)
2303 __field(unsigned int, map_size)
2304 ),
2305 TP_fast_assign(
2306 __entry->dev = log->l_mp->m_super->s_dev;
2307 __entry->blkno = buf_f->blf_blkno;
2308 __entry->len = buf_f->blf_len;
2309 __entry->flags = buf_f->blf_flags;
2310 __entry->size = buf_f->blf_size;
2311 __entry->map_size = buf_f->blf_map_size;
2312 ),
2313 TP_printk("dev %d:%d daddr 0x%llx, bbcount 0x%x, flags 0x%x, size %d, "
2314 "map_size %d",
2315 MAJOR(__entry->dev), MINOR(__entry->dev),
2316 __entry->blkno,
2317 __entry->len,
2318 __entry->flags,
2319 __entry->size,
2320 __entry->map_size)
2321)
2322
2323#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2324DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
2325 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
2326 TP_ARGS(log, buf_f))
2327
2328DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2329DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2330DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2331DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2332DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
2333DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
2334DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2335DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2336DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2337
2338DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
2339 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
2340 TP_ARGS(log, in_f),
2341 TP_STRUCT__entry(
2342 __field(dev_t, dev)
2343 __field(xfs_ino_t, ino)
2344 __field(unsigned short, size)
2345 __field(int, fields)
2346 __field(unsigned short, asize)
2347 __field(unsigned short, dsize)
2348 __field(int64_t, blkno)
2349 __field(int, len)
2350 __field(int, boffset)
2351 ),
2352 TP_fast_assign(
2353 __entry->dev = log->l_mp->m_super->s_dev;
2354 __entry->ino = in_f->ilf_ino;
2355 __entry->size = in_f->ilf_size;
2356 __entry->fields = in_f->ilf_fields;
2357 __entry->asize = in_f->ilf_asize;
2358 __entry->dsize = in_f->ilf_dsize;
2359 __entry->blkno = in_f->ilf_blkno;
2360 __entry->len = in_f->ilf_len;
2361 __entry->boffset = in_f->ilf_boffset;
2362 ),
2363 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2364 "dsize %d, daddr 0x%llx, bbcount 0x%x, boffset %d",
2365 MAJOR(__entry->dev), MINOR(__entry->dev),
2366 __entry->ino,
2367 __entry->size,
2368 __entry->fields,
2369 __entry->asize,
2370 __entry->dsize,
2371 __entry->blkno,
2372 __entry->len,
2373 __entry->boffset)
2374)
2375#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2376DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
2377 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
2378 TP_ARGS(log, in_f))
2379
2380DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2381DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2382DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2383
2384DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2385 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2386 TP_ARGS(log, in_f),
2387 TP_STRUCT__entry(
2388 __field(dev_t, dev)
2389 __field(xfs_agnumber_t, agno)
2390 __field(xfs_agblock_t, agbno)
2391 __field(unsigned int, count)
2392 __field(unsigned int, isize)
2393 __field(xfs_agblock_t, length)
2394 __field(unsigned int, gen)
2395 ),
2396 TP_fast_assign(
2397 __entry->dev = log->l_mp->m_super->s_dev;
2398 __entry->agno = be32_to_cpu(in_f->icl_ag);
2399 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2400 __entry->count = be32_to_cpu(in_f->icl_count);
2401 __entry->isize = be32_to_cpu(in_f->icl_isize);
2402 __entry->length = be32_to_cpu(in_f->icl_length);
2403 __entry->gen = be32_to_cpu(in_f->icl_gen);
2404 ),
2405 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x ireccount %u isize %u gen 0x%x",
2406 MAJOR(__entry->dev), MINOR(__entry->dev),
2407 __entry->agno,
2408 __entry->agbno,
2409 __entry->length,
2410 __entry->count,
2411 __entry->isize,
2412 __entry->gen)
2413)
2414#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2415DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2416 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2417 TP_ARGS(log, in_f))
2418
2419DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2420DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2421
2422DECLARE_EVENT_CLASS(xfs_discard_class,
2423 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2424 xfs_agblock_t agbno, xfs_extlen_t len),
2425 TP_ARGS(mp, agno, agbno, len),
2426 TP_STRUCT__entry(
2427 __field(dev_t, dev)
2428 __field(xfs_agnumber_t, agno)
2429 __field(xfs_agblock_t, agbno)
2430 __field(xfs_extlen_t, len)
2431 ),
2432 TP_fast_assign(
2433 __entry->dev = mp->m_super->s_dev;
2434 __entry->agno = agno;
2435 __entry->agbno = agbno;
2436 __entry->len = len;
2437 ),
2438 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2439 MAJOR(__entry->dev), MINOR(__entry->dev),
2440 __entry->agno,
2441 __entry->agbno,
2442 __entry->len)
2443)
2444
2445#define DEFINE_DISCARD_EVENT(name) \
2446DEFINE_EVENT(xfs_discard_class, name, \
2447 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2448 xfs_agblock_t agbno, xfs_extlen_t len), \
2449 TP_ARGS(mp, agno, agbno, len))
2450DEFINE_DISCARD_EVENT(xfs_discard_extent);
2451DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2452DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2453DEFINE_DISCARD_EVENT(xfs_discard_busy);
2454
2455/* btree cursor events */
2456TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2457TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2458TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2459TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2460TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2461TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2462TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2463
2464DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2465 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2466 TP_ARGS(cur, level, bp),
2467 TP_STRUCT__entry(
2468 __field(dev_t, dev)
2469 __field(xfs_btnum_t, btnum)
2470 __field(int, level)
2471 __field(int, nlevels)
2472 __field(int, ptr)
2473 __field(xfs_daddr_t, daddr)
2474 ),
2475 TP_fast_assign(
2476 __entry->dev = cur->bc_mp->m_super->s_dev;
2477 __entry->btnum = cur->bc_btnum;
2478 __entry->level = level;
2479 __entry->nlevels = cur->bc_nlevels;
2480 __entry->ptr = cur->bc_levels[level].ptr;
2481 __entry->daddr = bp ? xfs_buf_daddr(bp) : -1;
2482 ),
2483 TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
2484 MAJOR(__entry->dev), MINOR(__entry->dev),
2485 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
2486 __entry->level,
2487 __entry->nlevels,
2488 __entry->ptr,
2489 (unsigned long long)__entry->daddr)
2490)
2491
2492#define DEFINE_BTREE_CUR_EVENT(name) \
2493DEFINE_EVENT(xfs_btree_cur_class, name, \
2494 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2495 TP_ARGS(cur, level, bp))
2496DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
2497DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
2498
2499/* deferred ops */
2500struct xfs_defer_pending;
2501
2502DECLARE_EVENT_CLASS(xfs_defer_class,
2503 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2504 TP_ARGS(tp, caller_ip),
2505 TP_STRUCT__entry(
2506 __field(dev_t, dev)
2507 __field(struct xfs_trans *, tp)
2508 __field(char, committed)
2509 __field(unsigned long, caller_ip)
2510 ),
2511 TP_fast_assign(
2512 __entry->dev = tp->t_mountp->m_super->s_dev;
2513 __entry->tp = tp;
2514 __entry->caller_ip = caller_ip;
2515 ),
2516 TP_printk("dev %d:%d tp %p caller %pS",
2517 MAJOR(__entry->dev), MINOR(__entry->dev),
2518 __entry->tp,
2519 (char *)__entry->caller_ip)
2520)
2521#define DEFINE_DEFER_EVENT(name) \
2522DEFINE_EVENT(xfs_defer_class, name, \
2523 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2524 TP_ARGS(tp, caller_ip))
2525
2526DECLARE_EVENT_CLASS(xfs_defer_error_class,
2527 TP_PROTO(struct xfs_trans *tp, int error),
2528 TP_ARGS(tp, error),
2529 TP_STRUCT__entry(
2530 __field(dev_t, dev)
2531 __field(struct xfs_trans *, tp)
2532 __field(char, committed)
2533 __field(int, error)
2534 ),
2535 TP_fast_assign(
2536 __entry->dev = tp->t_mountp->m_super->s_dev;
2537 __entry->tp = tp;
2538 __entry->error = error;
2539 ),
2540 TP_printk("dev %d:%d tp %p err %d",
2541 MAJOR(__entry->dev), MINOR(__entry->dev),
2542 __entry->tp,
2543 __entry->error)
2544)
2545#define DEFINE_DEFER_ERROR_EVENT(name) \
2546DEFINE_EVENT(xfs_defer_error_class, name, \
2547 TP_PROTO(struct xfs_trans *tp, int error), \
2548 TP_ARGS(tp, error))
2549
2550DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2551 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2552 TP_ARGS(mp, dfp),
2553 TP_STRUCT__entry(
2554 __field(dev_t, dev)
2555 __string(name, dfp->dfp_ops->name)
2556 __field(void *, intent)
2557 __field(unsigned int, flags)
2558 __field(char, committed)
2559 __field(int, nr)
2560 ),
2561 TP_fast_assign(
2562 __entry->dev = mp ? mp->m_super->s_dev : 0;
2563 __assign_str(name, dfp->dfp_ops->name);
2564 __entry->intent = dfp->dfp_intent;
2565 __entry->flags = dfp->dfp_flags;
2566 __entry->committed = dfp->dfp_done != NULL;
2567 __entry->nr = dfp->dfp_count;
2568 ),
2569 TP_printk("dev %d:%d optype %s intent %p flags %s committed %d nr %d",
2570 MAJOR(__entry->dev), MINOR(__entry->dev),
2571 __get_str(name),
2572 __entry->intent,
2573 __print_flags(__entry->flags, "|", XFS_DEFER_PENDING_STRINGS),
2574 __entry->committed,
2575 __entry->nr)
2576)
2577#define DEFINE_DEFER_PENDING_EVENT(name) \
2578DEFINE_EVENT(xfs_defer_pending_class, name, \
2579 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2580 TP_ARGS(mp, dfp))
2581
2582DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2583 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2584 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2585 TP_ARGS(mp, agno, type, agbno, len),
2586 TP_STRUCT__entry(
2587 __field(dev_t, dev)
2588 __field(xfs_agnumber_t, agno)
2589 __field(int, type)
2590 __field(xfs_agblock_t, agbno)
2591 __field(xfs_extlen_t, len)
2592 ),
2593 TP_fast_assign(
2594 __entry->dev = mp->m_super->s_dev;
2595 __entry->agno = agno;
2596 __entry->type = type;
2597 __entry->agbno = agbno;
2598 __entry->len = len;
2599 ),
2600 TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x fsbcount 0x%x",
2601 MAJOR(__entry->dev), MINOR(__entry->dev),
2602 __entry->type,
2603 __entry->agno,
2604 __entry->agbno,
2605 __entry->len)
2606);
2607#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2608DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2609 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2610 int type, \
2611 xfs_agblock_t bno, \
2612 xfs_extlen_t len), \
2613 TP_ARGS(mp, agno, type, bno, len))
2614
2615DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2616 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2617 int op,
2618 xfs_agblock_t agbno,
2619 xfs_ino_t ino,
2620 int whichfork,
2621 xfs_fileoff_t offset,
2622 xfs_filblks_t len,
2623 xfs_exntst_t state),
2624 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2625 TP_STRUCT__entry(
2626 __field(dev_t, dev)
2627 __field(xfs_agnumber_t, agno)
2628 __field(xfs_ino_t, ino)
2629 __field(xfs_agblock_t, agbno)
2630 __field(int, whichfork)
2631 __field(xfs_fileoff_t, l_loff)
2632 __field(xfs_filblks_t, l_len)
2633 __field(xfs_exntst_t, l_state)
2634 __field(int, op)
2635 ),
2636 TP_fast_assign(
2637 __entry->dev = mp->m_super->s_dev;
2638 __entry->agno = agno;
2639 __entry->ino = ino;
2640 __entry->agbno = agbno;
2641 __entry->whichfork = whichfork;
2642 __entry->l_loff = offset;
2643 __entry->l_len = len;
2644 __entry->l_state = state;
2645 __entry->op = op;
2646 ),
2647 TP_printk("dev %d:%d op %d agno 0x%x agbno 0x%x owner 0x%llx %s fileoff 0x%llx fsbcount 0x%llx state %d",
2648 MAJOR(__entry->dev), MINOR(__entry->dev),
2649 __entry->op,
2650 __entry->agno,
2651 __entry->agbno,
2652 __entry->ino,
2653 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2654 __entry->l_loff,
2655 __entry->l_len,
2656 __entry->l_state)
2657);
2658#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2659DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2660 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2661 int op, \
2662 xfs_agblock_t agbno, \
2663 xfs_ino_t ino, \
2664 int whichfork, \
2665 xfs_fileoff_t offset, \
2666 xfs_filblks_t len, \
2667 xfs_exntst_t state), \
2668 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2669
2670DEFINE_DEFER_EVENT(xfs_defer_cancel);
2671DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2672DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2673DEFINE_DEFER_EVENT(xfs_defer_finish);
2674DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2675
2676DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2677DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2678
2679DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2680DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
2681DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2682DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2683DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
2684DEFINE_DEFER_PENDING_EVENT(xfs_defer_isolate_paused);
2685DEFINE_DEFER_PENDING_EVENT(xfs_defer_item_pause);
2686DEFINE_DEFER_PENDING_EVENT(xfs_defer_item_unpause);
2687
2688#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2689DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2690DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2691DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2692DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
2693
2694DECLARE_EVENT_CLASS(xfs_defer_pending_item_class,
2695 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp,
2696 void *item),
2697 TP_ARGS(mp, dfp, item),
2698 TP_STRUCT__entry(
2699 __field(dev_t, dev)
2700 __string(name, dfp->dfp_ops->name)
2701 __field(void *, intent)
2702 __field(void *, item)
2703 __field(char, committed)
2704 __field(unsigned int, flags)
2705 __field(int, nr)
2706 ),
2707 TP_fast_assign(
2708 __entry->dev = mp ? mp->m_super->s_dev : 0;
2709 __assign_str(name, dfp->dfp_ops->name);
2710 __entry->intent = dfp->dfp_intent;
2711 __entry->item = item;
2712 __entry->committed = dfp->dfp_done != NULL;
2713 __entry->flags = dfp->dfp_flags;
2714 __entry->nr = dfp->dfp_count;
2715 ),
2716 TP_printk("dev %d:%d optype %s intent %p item %p flags %s committed %d nr %d",
2717 MAJOR(__entry->dev), MINOR(__entry->dev),
2718 __get_str(name),
2719 __entry->intent,
2720 __entry->item,
2721 __print_flags(__entry->flags, "|", XFS_DEFER_PENDING_STRINGS),
2722 __entry->committed,
2723 __entry->nr)
2724)
2725#define DEFINE_DEFER_PENDING_ITEM_EVENT(name) \
2726DEFINE_EVENT(xfs_defer_pending_item_class, name, \
2727 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp, \
2728 void *item), \
2729 TP_ARGS(mp, dfp, item))
2730
2731DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_add_item);
2732DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_cancel_item);
2733DEFINE_DEFER_PENDING_ITEM_EVENT(xfs_defer_finish_item);
2734
2735/* rmap tracepoints */
2736DECLARE_EVENT_CLASS(xfs_rmap_class,
2737 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2738 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2739 const struct xfs_owner_info *oinfo),
2740 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2741 TP_STRUCT__entry(
2742 __field(dev_t, dev)
2743 __field(xfs_agnumber_t, agno)
2744 __field(xfs_agblock_t, agbno)
2745 __field(xfs_extlen_t, len)
2746 __field(uint64_t, owner)
2747 __field(uint64_t, offset)
2748 __field(unsigned long, flags)
2749 ),
2750 TP_fast_assign(
2751 __entry->dev = mp->m_super->s_dev;
2752 __entry->agno = agno;
2753 __entry->agbno = agbno;
2754 __entry->len = len;
2755 __entry->owner = oinfo->oi_owner;
2756 __entry->offset = oinfo->oi_offset;
2757 __entry->flags = oinfo->oi_flags;
2758 if (unwritten)
2759 __entry->flags |= XFS_RMAP_UNWRITTEN;
2760 ),
2761 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%lx",
2762 MAJOR(__entry->dev), MINOR(__entry->dev),
2763 __entry->agno,
2764 __entry->agbno,
2765 __entry->len,
2766 __entry->owner,
2767 __entry->offset,
2768 __entry->flags)
2769);
2770#define DEFINE_RMAP_EVENT(name) \
2771DEFINE_EVENT(xfs_rmap_class, name, \
2772 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2773 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2774 const struct xfs_owner_info *oinfo), \
2775 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2776
2777/* simple AG-based error/%ip tracepoint class */
2778DECLARE_EVENT_CLASS(xfs_ag_error_class,
2779 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2780 unsigned long caller_ip),
2781 TP_ARGS(mp, agno, error, caller_ip),
2782 TP_STRUCT__entry(
2783 __field(dev_t, dev)
2784 __field(xfs_agnumber_t, agno)
2785 __field(int, error)
2786 __field(unsigned long, caller_ip)
2787 ),
2788 TP_fast_assign(
2789 __entry->dev = mp->m_super->s_dev;
2790 __entry->agno = agno;
2791 __entry->error = error;
2792 __entry->caller_ip = caller_ip;
2793 ),
2794 TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
2795 MAJOR(__entry->dev), MINOR(__entry->dev),
2796 __entry->agno,
2797 __entry->error,
2798 (char *)__entry->caller_ip)
2799);
2800
2801#define DEFINE_AG_ERROR_EVENT(name) \
2802DEFINE_EVENT(xfs_ag_error_class, name, \
2803 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2804 unsigned long caller_ip), \
2805 TP_ARGS(mp, agno, error, caller_ip))
2806
2807DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2808DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2809DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2810DEFINE_RMAP_EVENT(xfs_rmap_map);
2811DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2812DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
2813DEFINE_RMAP_EVENT(xfs_rmap_convert);
2814DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2815DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2816DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
2817
2818DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2819 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2820 xfs_agblock_t agbno, xfs_extlen_t len,
2821 uint64_t owner, uint64_t offset, unsigned int flags),
2822 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2823 TP_STRUCT__entry(
2824 __field(dev_t, dev)
2825 __field(xfs_agnumber_t, agno)
2826 __field(xfs_agblock_t, agbno)
2827 __field(xfs_extlen_t, len)
2828 __field(uint64_t, owner)
2829 __field(uint64_t, offset)
2830 __field(unsigned int, flags)
2831 ),
2832 TP_fast_assign(
2833 __entry->dev = mp->m_super->s_dev;
2834 __entry->agno = agno;
2835 __entry->agbno = agbno;
2836 __entry->len = len;
2837 __entry->owner = owner;
2838 __entry->offset = offset;
2839 __entry->flags = flags;
2840 ),
2841 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2842 MAJOR(__entry->dev), MINOR(__entry->dev),
2843 __entry->agno,
2844 __entry->agbno,
2845 __entry->len,
2846 __entry->owner,
2847 __entry->offset,
2848 __entry->flags)
2849);
2850#define DEFINE_RMAPBT_EVENT(name) \
2851DEFINE_EVENT(xfs_rmapbt_class, name, \
2852 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2853 xfs_agblock_t agbno, xfs_extlen_t len, \
2854 uint64_t owner, uint64_t offset, unsigned int flags), \
2855 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2856
2857#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2858DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2859DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2860
2861DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2862DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
2863DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2864DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2865DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2866DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2867DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2868DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
2869
2870DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2871DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2872DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2873DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
2874DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2875DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
2876DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
2877
2878/* deferred bmbt updates */
2879#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2880DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2881DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2882
2883/* per-AG reservation */
2884DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2885 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2886 xfs_extlen_t len),
2887 TP_ARGS(pag, resv, len),
2888 TP_STRUCT__entry(
2889 __field(dev_t, dev)
2890 __field(xfs_agnumber_t, agno)
2891 __field(int, resv)
2892 __field(xfs_extlen_t, freeblks)
2893 __field(xfs_extlen_t, flcount)
2894 __field(xfs_extlen_t, reserved)
2895 __field(xfs_extlen_t, asked)
2896 __field(xfs_extlen_t, len)
2897 ),
2898 TP_fast_assign(
2899 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2900
2901 __entry->dev = pag->pag_mount->m_super->s_dev;
2902 __entry->agno = pag->pag_agno;
2903 __entry->resv = resv;
2904 __entry->freeblks = pag->pagf_freeblks;
2905 __entry->flcount = pag->pagf_flcount;
2906 __entry->reserved = r ? r->ar_reserved : 0;
2907 __entry->asked = r ? r->ar_asked : 0;
2908 __entry->len = len;
2909 ),
2910 TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
2911 "resv %u ask %u len %u",
2912 MAJOR(__entry->dev), MINOR(__entry->dev),
2913 __entry->agno,
2914 __entry->resv,
2915 __entry->freeblks,
2916 __entry->flcount,
2917 __entry->reserved,
2918 __entry->asked,
2919 __entry->len)
2920)
2921#define DEFINE_AG_RESV_EVENT(name) \
2922DEFINE_EVENT(xfs_ag_resv_class, name, \
2923 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2924 xfs_extlen_t len), \
2925 TP_ARGS(pag, type, len))
2926
2927/* per-AG reservation tracepoints */
2928DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2929DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2930DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2931DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2932DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2933DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2934
2935DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2936DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2937
2938/* refcount tracepoint classes */
2939
2940/* reuse the discard trace class for agbno/aglen-based traces */
2941#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2942
2943/* ag btree lookup tracepoint class */
2944TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2945TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2946TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
2947DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2948 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2949 xfs_agblock_t agbno, xfs_lookup_t dir),
2950 TP_ARGS(mp, agno, agbno, dir),
2951 TP_STRUCT__entry(
2952 __field(dev_t, dev)
2953 __field(xfs_agnumber_t, agno)
2954 __field(xfs_agblock_t, agbno)
2955 __field(xfs_lookup_t, dir)
2956 ),
2957 TP_fast_assign(
2958 __entry->dev = mp->m_super->s_dev;
2959 __entry->agno = agno;
2960 __entry->agbno = agbno;
2961 __entry->dir = dir;
2962 ),
2963 TP_printk("dev %d:%d agno 0x%x agbno 0x%x cmp %s(%d)",
2964 MAJOR(__entry->dev), MINOR(__entry->dev),
2965 __entry->agno,
2966 __entry->agbno,
2967 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2968 __entry->dir)
2969)
2970
2971#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2972DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2973 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2974 xfs_agblock_t agbno, xfs_lookup_t dir), \
2975 TP_ARGS(mp, agno, agbno, dir))
2976
2977/* single-rcext tracepoint class */
2978DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2979 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2980 struct xfs_refcount_irec *irec),
2981 TP_ARGS(mp, agno, irec),
2982 TP_STRUCT__entry(
2983 __field(dev_t, dev)
2984 __field(xfs_agnumber_t, agno)
2985 __field(enum xfs_refc_domain, domain)
2986 __field(xfs_agblock_t, startblock)
2987 __field(xfs_extlen_t, blockcount)
2988 __field(xfs_nlink_t, refcount)
2989 ),
2990 TP_fast_assign(
2991 __entry->dev = mp->m_super->s_dev;
2992 __entry->agno = agno;
2993 __entry->domain = irec->rc_domain;
2994 __entry->startblock = irec->rc_startblock;
2995 __entry->blockcount = irec->rc_blockcount;
2996 __entry->refcount = irec->rc_refcount;
2997 ),
2998 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
2999 MAJOR(__entry->dev), MINOR(__entry->dev),
3000 __entry->agno,
3001 __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
3002 __entry->startblock,
3003 __entry->blockcount,
3004 __entry->refcount)
3005)
3006
3007#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
3008DEFINE_EVENT(xfs_refcount_extent_class, name, \
3009 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3010 struct xfs_refcount_irec *irec), \
3011 TP_ARGS(mp, agno, irec))
3012
3013/* single-rcext and an agbno tracepoint class */
3014DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
3015 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3016 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
3017 TP_ARGS(mp, agno, irec, agbno),
3018 TP_STRUCT__entry(
3019 __field(dev_t, dev)
3020 __field(xfs_agnumber_t, agno)
3021 __field(enum xfs_refc_domain, domain)
3022 __field(xfs_agblock_t, startblock)
3023 __field(xfs_extlen_t, blockcount)
3024 __field(xfs_nlink_t, refcount)
3025 __field(xfs_agblock_t, agbno)
3026 ),
3027 TP_fast_assign(
3028 __entry->dev = mp->m_super->s_dev;
3029 __entry->agno = agno;
3030 __entry->domain = irec->rc_domain;
3031 __entry->startblock = irec->rc_startblock;
3032 __entry->blockcount = irec->rc_blockcount;
3033 __entry->refcount = irec->rc_refcount;
3034 __entry->agbno = agbno;
3035 ),
3036 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3037 MAJOR(__entry->dev), MINOR(__entry->dev),
3038 __entry->agno,
3039 __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
3040 __entry->startblock,
3041 __entry->blockcount,
3042 __entry->refcount,
3043 __entry->agbno)
3044)
3045
3046#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
3047DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
3048 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3049 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
3050 TP_ARGS(mp, agno, irec, agbno))
3051
3052/* double-rcext tracepoint class */
3053DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
3054 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3055 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
3056 TP_ARGS(mp, agno, i1, i2),
3057 TP_STRUCT__entry(
3058 __field(dev_t, dev)
3059 __field(xfs_agnumber_t, agno)
3060 __field(enum xfs_refc_domain, i1_domain)
3061 __field(xfs_agblock_t, i1_startblock)
3062 __field(xfs_extlen_t, i1_blockcount)
3063 __field(xfs_nlink_t, i1_refcount)
3064 __field(enum xfs_refc_domain, i2_domain)
3065 __field(xfs_agblock_t, i2_startblock)
3066 __field(xfs_extlen_t, i2_blockcount)
3067 __field(xfs_nlink_t, i2_refcount)
3068 ),
3069 TP_fast_assign(
3070 __entry->dev = mp->m_super->s_dev;
3071 __entry->agno = agno;
3072 __entry->i1_domain = i1->rc_domain;
3073 __entry->i1_startblock = i1->rc_startblock;
3074 __entry->i1_blockcount = i1->rc_blockcount;
3075 __entry->i1_refcount = i1->rc_refcount;
3076 __entry->i2_domain = i2->rc_domain;
3077 __entry->i2_startblock = i2->rc_startblock;
3078 __entry->i2_blockcount = i2->rc_blockcount;
3079 __entry->i2_refcount = i2->rc_refcount;
3080 ),
3081 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3082 "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3083 MAJOR(__entry->dev), MINOR(__entry->dev),
3084 __entry->agno,
3085 __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3086 __entry->i1_startblock,
3087 __entry->i1_blockcount,
3088 __entry->i1_refcount,
3089 __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3090 __entry->i2_startblock,
3091 __entry->i2_blockcount,
3092 __entry->i2_refcount)
3093)
3094
3095#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3096DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3097 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3098 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
3099 TP_ARGS(mp, agno, i1, i2))
3100
3101/* double-rcext and an agbno tracepoint class */
3102DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3103 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3104 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3105 xfs_agblock_t agbno),
3106 TP_ARGS(mp, agno, i1, i2, agbno),
3107 TP_STRUCT__entry(
3108 __field(dev_t, dev)
3109 __field(xfs_agnumber_t, agno)
3110 __field(enum xfs_refc_domain, i1_domain)
3111 __field(xfs_agblock_t, i1_startblock)
3112 __field(xfs_extlen_t, i1_blockcount)
3113 __field(xfs_nlink_t, i1_refcount)
3114 __field(enum xfs_refc_domain, i2_domain)
3115 __field(xfs_agblock_t, i2_startblock)
3116 __field(xfs_extlen_t, i2_blockcount)
3117 __field(xfs_nlink_t, i2_refcount)
3118 __field(xfs_agblock_t, agbno)
3119 ),
3120 TP_fast_assign(
3121 __entry->dev = mp->m_super->s_dev;
3122 __entry->agno = agno;
3123 __entry->i1_domain = i1->rc_domain;
3124 __entry->i1_startblock = i1->rc_startblock;
3125 __entry->i1_blockcount = i1->rc_blockcount;
3126 __entry->i1_refcount = i1->rc_refcount;
3127 __entry->i2_domain = i2->rc_domain;
3128 __entry->i2_startblock = i2->rc_startblock;
3129 __entry->i2_blockcount = i2->rc_blockcount;
3130 __entry->i2_refcount = i2->rc_refcount;
3131 __entry->agbno = agbno;
3132 ),
3133 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3134 "dom %s agbno 0x%x fsbcount 0x%x refcount %u @ agbno 0x%x",
3135 MAJOR(__entry->dev), MINOR(__entry->dev),
3136 __entry->agno,
3137 __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3138 __entry->i1_startblock,
3139 __entry->i1_blockcount,
3140 __entry->i1_refcount,
3141 __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3142 __entry->i2_startblock,
3143 __entry->i2_blockcount,
3144 __entry->i2_refcount,
3145 __entry->agbno)
3146)
3147
3148#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3149DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3150 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3151 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3152 xfs_agblock_t agbno), \
3153 TP_ARGS(mp, agno, i1, i2, agbno))
3154
3155/* triple-rcext tracepoint class */
3156DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3157 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3158 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3159 struct xfs_refcount_irec *i3),
3160 TP_ARGS(mp, agno, i1, i2, i3),
3161 TP_STRUCT__entry(
3162 __field(dev_t, dev)
3163 __field(xfs_agnumber_t, agno)
3164 __field(enum xfs_refc_domain, i1_domain)
3165 __field(xfs_agblock_t, i1_startblock)
3166 __field(xfs_extlen_t, i1_blockcount)
3167 __field(xfs_nlink_t, i1_refcount)
3168 __field(enum xfs_refc_domain, i2_domain)
3169 __field(xfs_agblock_t, i2_startblock)
3170 __field(xfs_extlen_t, i2_blockcount)
3171 __field(xfs_nlink_t, i2_refcount)
3172 __field(enum xfs_refc_domain, i3_domain)
3173 __field(xfs_agblock_t, i3_startblock)
3174 __field(xfs_extlen_t, i3_blockcount)
3175 __field(xfs_nlink_t, i3_refcount)
3176 ),
3177 TP_fast_assign(
3178 __entry->dev = mp->m_super->s_dev;
3179 __entry->agno = agno;
3180 __entry->i1_domain = i1->rc_domain;
3181 __entry->i1_startblock = i1->rc_startblock;
3182 __entry->i1_blockcount = i1->rc_blockcount;
3183 __entry->i1_refcount = i1->rc_refcount;
3184 __entry->i2_domain = i2->rc_domain;
3185 __entry->i2_startblock = i2->rc_startblock;
3186 __entry->i2_blockcount = i2->rc_blockcount;
3187 __entry->i2_refcount = i2->rc_refcount;
3188 __entry->i3_domain = i3->rc_domain;
3189 __entry->i3_startblock = i3->rc_startblock;
3190 __entry->i3_blockcount = i3->rc_blockcount;
3191 __entry->i3_refcount = i3->rc_refcount;
3192 ),
3193 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3194 "dom %s agbno 0x%x fsbcount 0x%x refcount %u -- "
3195 "dom %s agbno 0x%x fsbcount 0x%x refcount %u",
3196 MAJOR(__entry->dev), MINOR(__entry->dev),
3197 __entry->agno,
3198 __print_symbolic(__entry->i1_domain, XFS_REFC_DOMAIN_STRINGS),
3199 __entry->i1_startblock,
3200 __entry->i1_blockcount,
3201 __entry->i1_refcount,
3202 __print_symbolic(__entry->i2_domain, XFS_REFC_DOMAIN_STRINGS),
3203 __entry->i2_startblock,
3204 __entry->i2_blockcount,
3205 __entry->i2_refcount,
3206 __print_symbolic(__entry->i3_domain, XFS_REFC_DOMAIN_STRINGS),
3207 __entry->i3_startblock,
3208 __entry->i3_blockcount,
3209 __entry->i3_refcount)
3210);
3211
3212#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3213DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3214 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3215 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3216 struct xfs_refcount_irec *i3), \
3217 TP_ARGS(mp, agno, i1, i2, i3))
3218
3219/* refcount btree tracepoints */
3220DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
3221DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
3222DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
3223DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3224DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3225DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3226DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3227DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
3228DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
3229DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
3230
3231/* refcount adjustment tracepoints */
3232DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
3233DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
3234DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
3235DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
3236DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3237DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
3238DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
3239DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3240DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3241DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3242DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3243DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3244DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
3245DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
3246DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3247DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
3248DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
3249DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3250DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3251DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3252DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3253
3254/* reflink helpers */
3255DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
3256DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
3257DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
3258#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
3259DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3260DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
3261
3262TRACE_EVENT(xfs_refcount_finish_one_leftover,
3263 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3264 int type, xfs_agblock_t agbno, xfs_extlen_t len),
3265 TP_ARGS(mp, agno, type, agbno, len),
3266 TP_STRUCT__entry(
3267 __field(dev_t, dev)
3268 __field(xfs_agnumber_t, agno)
3269 __field(int, type)
3270 __field(xfs_agblock_t, agbno)
3271 __field(xfs_extlen_t, len)
3272 ),
3273 TP_fast_assign(
3274 __entry->dev = mp->m_super->s_dev;
3275 __entry->agno = agno;
3276 __entry->type = type;
3277 __entry->agbno = agbno;
3278 __entry->len = len;
3279 ),
3280 TP_printk("dev %d:%d type %d agno 0x%x agbno 0x%x fsbcount 0x%x",
3281 MAJOR(__entry->dev), MINOR(__entry->dev),
3282 __entry->type,
3283 __entry->agno,
3284 __entry->agbno,
3285 __entry->len)
3286);
3287
3288/* simple inode-based error/%ip tracepoint class */
3289DECLARE_EVENT_CLASS(xfs_inode_error_class,
3290 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3291 TP_ARGS(ip, error, caller_ip),
3292 TP_STRUCT__entry(
3293 __field(dev_t, dev)
3294 __field(xfs_ino_t, ino)
3295 __field(int, error)
3296 __field(unsigned long, caller_ip)
3297 ),
3298 TP_fast_assign(
3299 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3300 __entry->ino = ip->i_ino;
3301 __entry->error = error;
3302 __entry->caller_ip = caller_ip;
3303 ),
3304 TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
3305 MAJOR(__entry->dev), MINOR(__entry->dev),
3306 __entry->ino,
3307 __entry->error,
3308 (char *)__entry->caller_ip)
3309);
3310
3311#define DEFINE_INODE_ERROR_EVENT(name) \
3312DEFINE_EVENT(xfs_inode_error_class, name, \
3313 TP_PROTO(struct xfs_inode *ip, int error, \
3314 unsigned long caller_ip), \
3315 TP_ARGS(ip, error, caller_ip))
3316
3317/* reflink tracepoint classes */
3318
3319/* two-file io tracepoint class */
3320DECLARE_EVENT_CLASS(xfs_double_io_class,
3321 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3322 struct xfs_inode *dest, xfs_off_t doffset),
3323 TP_ARGS(src, soffset, len, dest, doffset),
3324 TP_STRUCT__entry(
3325 __field(dev_t, dev)
3326 __field(xfs_ino_t, src_ino)
3327 __field(loff_t, src_isize)
3328 __field(loff_t, src_disize)
3329 __field(loff_t, src_offset)
3330 __field(long long, len)
3331 __field(xfs_ino_t, dest_ino)
3332 __field(loff_t, dest_isize)
3333 __field(loff_t, dest_disize)
3334 __field(loff_t, dest_offset)
3335 ),
3336 TP_fast_assign(
3337 __entry->dev = VFS_I(src)->i_sb->s_dev;
3338 __entry->src_ino = src->i_ino;
3339 __entry->src_isize = VFS_I(src)->i_size;
3340 __entry->src_disize = src->i_disk_size;
3341 __entry->src_offset = soffset;
3342 __entry->len = len;
3343 __entry->dest_ino = dest->i_ino;
3344 __entry->dest_isize = VFS_I(dest)->i_size;
3345 __entry->dest_disize = dest->i_disk_size;
3346 __entry->dest_offset = doffset;
3347 ),
3348 TP_printk("dev %d:%d bytecount 0x%llx "
3349 "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx -> "
3350 "ino 0x%llx isize 0x%llx disize 0x%llx pos 0x%llx",
3351 MAJOR(__entry->dev), MINOR(__entry->dev),
3352 __entry->len,
3353 __entry->src_ino,
3354 __entry->src_isize,
3355 __entry->src_disize,
3356 __entry->src_offset,
3357 __entry->dest_ino,
3358 __entry->dest_isize,
3359 __entry->dest_disize,
3360 __entry->dest_offset)
3361)
3362
3363#define DEFINE_DOUBLE_IO_EVENT(name) \
3364DEFINE_EVENT(xfs_double_io_class, name, \
3365 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3366 struct xfs_inode *dest, xfs_off_t doffset), \
3367 TP_ARGS(src, soffset, len, dest, doffset))
3368
3369/* inode/irec events */
3370DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3371 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3372 TP_ARGS(ip, irec),
3373 TP_STRUCT__entry(
3374 __field(dev_t, dev)
3375 __field(xfs_ino_t, ino)
3376 __field(xfs_fileoff_t, lblk)
3377 __field(xfs_extlen_t, len)
3378 __field(xfs_fsblock_t, pblk)
3379 __field(int, state)
3380 ),
3381 TP_fast_assign(
3382 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3383 __entry->ino = ip->i_ino;
3384 __entry->lblk = irec->br_startoff;
3385 __entry->len = irec->br_blockcount;
3386 __entry->pblk = irec->br_startblock;
3387 __entry->state = irec->br_state;
3388 ),
3389 TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx fsbcount 0x%x startblock 0x%llx st %d",
3390 MAJOR(__entry->dev), MINOR(__entry->dev),
3391 __entry->ino,
3392 __entry->lblk,
3393 __entry->len,
3394 __entry->pblk,
3395 __entry->state)
3396);
3397#define DEFINE_INODE_IREC_EVENT(name) \
3398DEFINE_EVENT(xfs_inode_irec_class, name, \
3399 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3400 TP_ARGS(ip, irec))
3401
3402/* inode iomap invalidation events */
3403DECLARE_EVENT_CLASS(xfs_wb_invalid_class,
3404 TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork),
3405 TP_ARGS(ip, iomap, wpcseq, whichfork),
3406 TP_STRUCT__entry(
3407 __field(dev_t, dev)
3408 __field(xfs_ino_t, ino)
3409 __field(u64, addr)
3410 __field(loff_t, pos)
3411 __field(u64, len)
3412 __field(u16, type)
3413 __field(u16, flags)
3414 __field(u32, wpcseq)
3415 __field(u32, forkseq)
3416 ),
3417 TP_fast_assign(
3418 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3419 __entry->ino = ip->i_ino;
3420 __entry->addr = iomap->addr;
3421 __entry->pos = iomap->offset;
3422 __entry->len = iomap->length;
3423 __entry->type = iomap->type;
3424 __entry->flags = iomap->flags;
3425 __entry->wpcseq = wpcseq;
3426 __entry->forkseq = READ_ONCE(xfs_ifork_ptr(ip, whichfork)->if_seq);
3427 ),
3428 TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x wpcseq 0x%x forkseq 0x%x",
3429 MAJOR(__entry->dev), MINOR(__entry->dev),
3430 __entry->ino,
3431 __entry->pos,
3432 __entry->addr,
3433 __entry->len,
3434 __entry->type,
3435 __entry->flags,
3436 __entry->wpcseq,
3437 __entry->forkseq)
3438);
3439#define DEFINE_WB_INVALID_EVENT(name) \
3440DEFINE_EVENT(xfs_wb_invalid_class, name, \
3441 TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap, unsigned int wpcseq, int whichfork), \
3442 TP_ARGS(ip, iomap, wpcseq, whichfork))
3443DEFINE_WB_INVALID_EVENT(xfs_wb_cow_iomap_invalid);
3444DEFINE_WB_INVALID_EVENT(xfs_wb_data_iomap_invalid);
3445
3446DECLARE_EVENT_CLASS(xfs_iomap_invalid_class,
3447 TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap),
3448 TP_ARGS(ip, iomap),
3449 TP_STRUCT__entry(
3450 __field(dev_t, dev)
3451 __field(xfs_ino_t, ino)
3452 __field(u64, addr)
3453 __field(loff_t, pos)
3454 __field(u64, len)
3455 __field(u64, validity_cookie)
3456 __field(u64, inodeseq)
3457 __field(u16, type)
3458 __field(u16, flags)
3459 ),
3460 TP_fast_assign(
3461 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3462 __entry->ino = ip->i_ino;
3463 __entry->addr = iomap->addr;
3464 __entry->pos = iomap->offset;
3465 __entry->len = iomap->length;
3466 __entry->validity_cookie = iomap->validity_cookie;
3467 __entry->type = iomap->type;
3468 __entry->flags = iomap->flags;
3469 __entry->inodeseq = xfs_iomap_inode_sequence(ip, iomap->flags);
3470 ),
3471 TP_printk("dev %d:%d ino 0x%llx pos 0x%llx addr 0x%llx bytecount 0x%llx type 0x%x flags 0x%x validity_cookie 0x%llx inodeseq 0x%llx",
3472 MAJOR(__entry->dev), MINOR(__entry->dev),
3473 __entry->ino,
3474 __entry->pos,
3475 __entry->addr,
3476 __entry->len,
3477 __entry->type,
3478 __entry->flags,
3479 __entry->validity_cookie,
3480 __entry->inodeseq)
3481);
3482#define DEFINE_IOMAP_INVALID_EVENT(name) \
3483DEFINE_EVENT(xfs_iomap_invalid_class, name, \
3484 TP_PROTO(struct xfs_inode *ip, const struct iomap *iomap), \
3485 TP_ARGS(ip, iomap))
3486DEFINE_IOMAP_INVALID_EVENT(xfs_iomap_invalid);
3487
3488/* refcount/reflink tracepoint definitions */
3489
3490/* reflink tracepoints */
3491DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3492DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3493DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3494TRACE_EVENT(xfs_reflink_remap_blocks,
3495 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3496 xfs_filblks_t len, struct xfs_inode *dest,
3497 xfs_fileoff_t doffset),
3498 TP_ARGS(src, soffset, len, dest, doffset),
3499 TP_STRUCT__entry(
3500 __field(dev_t, dev)
3501 __field(xfs_ino_t, src_ino)
3502 __field(xfs_fileoff_t, src_lblk)
3503 __field(xfs_filblks_t, len)
3504 __field(xfs_ino_t, dest_ino)
3505 __field(xfs_fileoff_t, dest_lblk)
3506 ),
3507 TP_fast_assign(
3508 __entry->dev = VFS_I(src)->i_sb->s_dev;
3509 __entry->src_ino = src->i_ino;
3510 __entry->src_lblk = soffset;
3511 __entry->len = len;
3512 __entry->dest_ino = dest->i_ino;
3513 __entry->dest_lblk = doffset;
3514 ),
3515 TP_printk("dev %d:%d fsbcount 0x%llx "
3516 "ino 0x%llx fileoff 0x%llx -> ino 0x%llx fileoff 0x%llx",
3517 MAJOR(__entry->dev), MINOR(__entry->dev),
3518 __entry->len,
3519 __entry->src_ino,
3520 __entry->src_lblk,
3521 __entry->dest_ino,
3522 __entry->dest_lblk)
3523);
3524DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3525DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3526DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3527DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3528DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3529DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3530DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3531DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
3532
3533/* dedupe tracepoints */
3534DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3535DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3536
3537/* ioctl tracepoints */
3538TRACE_EVENT(xfs_ioctl_clone,
3539 TP_PROTO(struct inode *src, struct inode *dest),
3540 TP_ARGS(src, dest),
3541 TP_STRUCT__entry(
3542 __field(dev_t, dev)
3543 __field(unsigned long, src_ino)
3544 __field(loff_t, src_isize)
3545 __field(unsigned long, dest_ino)
3546 __field(loff_t, dest_isize)
3547 ),
3548 TP_fast_assign(
3549 __entry->dev = src->i_sb->s_dev;
3550 __entry->src_ino = src->i_ino;
3551 __entry->src_isize = i_size_read(src);
3552 __entry->dest_ino = dest->i_ino;
3553 __entry->dest_isize = i_size_read(dest);
3554 ),
3555 TP_printk("dev %d:%d ino 0x%lx isize 0x%llx -> ino 0x%lx isize 0x%llx",
3556 MAJOR(__entry->dev), MINOR(__entry->dev),
3557 __entry->src_ino,
3558 __entry->src_isize,
3559 __entry->dest_ino,
3560 __entry->dest_isize)
3561);
3562
3563/* unshare tracepoints */
3564DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3565DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3566
3567/* copy on write */
3568DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
3569DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3570DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
3571DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
3572
3573DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3574DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3575DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_from);
3576DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_to);
3577
3578DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3579DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3580
3581
3582DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3583
3584/* rmap swapext tracepoints */
3585DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3586DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3587DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3588
3589/* fsmap traces */
3590DECLARE_EVENT_CLASS(xfs_fsmap_class,
3591 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3592 const struct xfs_rmap_irec *rmap),
3593 TP_ARGS(mp, keydev, agno, rmap),
3594 TP_STRUCT__entry(
3595 __field(dev_t, dev)
3596 __field(dev_t, keydev)
3597 __field(xfs_agnumber_t, agno)
3598 __field(xfs_fsblock_t, bno)
3599 __field(xfs_filblks_t, len)
3600 __field(uint64_t, owner)
3601 __field(uint64_t, offset)
3602 __field(unsigned int, flags)
3603 ),
3604 TP_fast_assign(
3605 __entry->dev = mp->m_super->s_dev;
3606 __entry->keydev = new_decode_dev(keydev);
3607 __entry->agno = agno;
3608 __entry->bno = rmap->rm_startblock;
3609 __entry->len = rmap->rm_blockcount;
3610 __entry->owner = rmap->rm_owner;
3611 __entry->offset = rmap->rm_offset;
3612 __entry->flags = rmap->rm_flags;
3613 ),
3614 TP_printk("dev %d:%d keydev %d:%d agno 0x%x startblock 0x%llx fsbcount 0x%llx owner 0x%llx fileoff 0x%llx flags 0x%x",
3615 MAJOR(__entry->dev), MINOR(__entry->dev),
3616 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3617 __entry->agno,
3618 __entry->bno,
3619 __entry->len,
3620 __entry->owner,
3621 __entry->offset,
3622 __entry->flags)
3623)
3624#define DEFINE_FSMAP_EVENT(name) \
3625DEFINE_EVENT(xfs_fsmap_class, name, \
3626 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3627 const struct xfs_rmap_irec *rmap), \
3628 TP_ARGS(mp, keydev, agno, rmap))
3629DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3630DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3631DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3632
3633DECLARE_EVENT_CLASS(xfs_fsmap_linear_class,
3634 TP_PROTO(struct xfs_mount *mp, u32 keydev, uint64_t bno),
3635 TP_ARGS(mp, keydev, bno),
3636 TP_STRUCT__entry(
3637 __field(dev_t, dev)
3638 __field(dev_t, keydev)
3639 __field(xfs_fsblock_t, bno)
3640 ),
3641 TP_fast_assign(
3642 __entry->dev = mp->m_super->s_dev;
3643 __entry->keydev = new_decode_dev(keydev);
3644 __entry->bno = bno;
3645 ),
3646 TP_printk("dev %d:%d keydev %d:%d bno 0x%llx",
3647 MAJOR(__entry->dev), MINOR(__entry->dev),
3648 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3649 __entry->bno)
3650)
3651#define DEFINE_FSMAP_LINEAR_EVENT(name) \
3652DEFINE_EVENT(xfs_fsmap_linear_class, name, \
3653 TP_PROTO(struct xfs_mount *mp, u32 keydev, uint64_t bno), \
3654 TP_ARGS(mp, keydev, bno))
3655DEFINE_FSMAP_LINEAR_EVENT(xfs_fsmap_low_key_linear);
3656DEFINE_FSMAP_LINEAR_EVENT(xfs_fsmap_high_key_linear);
3657
3658DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3659 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3660 TP_ARGS(mp, fsmap),
3661 TP_STRUCT__entry(
3662 __field(dev_t, dev)
3663 __field(dev_t, keydev)
3664 __field(xfs_daddr_t, block)
3665 __field(xfs_daddr_t, len)
3666 __field(uint64_t, owner)
3667 __field(uint64_t, offset)
3668 __field(uint64_t, flags)
3669 ),
3670 TP_fast_assign(
3671 __entry->dev = mp->m_super->s_dev;
3672 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3673 __entry->block = fsmap->fmr_physical;
3674 __entry->len = fsmap->fmr_length;
3675 __entry->owner = fsmap->fmr_owner;
3676 __entry->offset = fsmap->fmr_offset;
3677 __entry->flags = fsmap->fmr_flags;
3678 ),
3679 TP_printk("dev %d:%d keydev %d:%d daddr 0x%llx bbcount 0x%llx owner 0x%llx fileoff_daddr 0x%llx flags 0x%llx",
3680 MAJOR(__entry->dev), MINOR(__entry->dev),
3681 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3682 __entry->block,
3683 __entry->len,
3684 __entry->owner,
3685 __entry->offset,
3686 __entry->flags)
3687)
3688#define DEFINE_GETFSMAP_EVENT(name) \
3689DEFINE_EVENT(xfs_getfsmap_class, name, \
3690 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3691 TP_ARGS(mp, fsmap))
3692DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3693DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3694DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3695
3696DECLARE_EVENT_CLASS(xfs_trans_resv_class,
3697 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3698 struct xfs_trans_res *res),
3699 TP_ARGS(mp, type, res),
3700 TP_STRUCT__entry(
3701 __field(dev_t, dev)
3702 __field(int, type)
3703 __field(uint, logres)
3704 __field(int, logcount)
3705 __field(int, logflags)
3706 ),
3707 TP_fast_assign(
3708 __entry->dev = mp->m_super->s_dev;
3709 __entry->type = type;
3710 __entry->logres = res->tr_logres;
3711 __entry->logcount = res->tr_logcount;
3712 __entry->logflags = res->tr_logflags;
3713 ),
3714 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3715 MAJOR(__entry->dev), MINOR(__entry->dev),
3716 __entry->type,
3717 __entry->logres,
3718 __entry->logcount,
3719 __entry->logflags)
3720)
3721
3722#define DEFINE_TRANS_RESV_EVENT(name) \
3723DEFINE_EVENT(xfs_trans_resv_class, name, \
3724 TP_PROTO(struct xfs_mount *mp, unsigned int type, \
3725 struct xfs_trans_res *res), \
3726 TP_ARGS(mp, type, res))
3727DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc);
3728DEFINE_TRANS_RESV_EVENT(xfs_trans_resv_calc_minlogsize);
3729
3730TRACE_EVENT(xfs_log_get_max_trans_res,
3731 TP_PROTO(struct xfs_mount *mp, const struct xfs_trans_res *res),
3732 TP_ARGS(mp, res),
3733 TP_STRUCT__entry(
3734 __field(dev_t, dev)
3735 __field(uint, logres)
3736 __field(int, logcount)
3737 ),
3738 TP_fast_assign(
3739 __entry->dev = mp->m_super->s_dev;
3740 __entry->logres = res->tr_logres;
3741 __entry->logcount = res->tr_logcount;
3742 ),
3743 TP_printk("dev %d:%d logres %u logcount %d",
3744 MAJOR(__entry->dev), MINOR(__entry->dev),
3745 __entry->logres,
3746 __entry->logcount)
3747);
3748
3749DECLARE_EVENT_CLASS(xfs_trans_class,
3750 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3751 TP_ARGS(tp, caller_ip),
3752 TP_STRUCT__entry(
3753 __field(dev_t, dev)
3754 __field(uint32_t, tid)
3755 __field(uint32_t, flags)
3756 __field(unsigned long, caller_ip)
3757 ),
3758 TP_fast_assign(
3759 __entry->dev = tp->t_mountp->m_super->s_dev;
3760 __entry->tid = 0;
3761 if (tp->t_ticket)
3762 __entry->tid = tp->t_ticket->t_tid;
3763 __entry->flags = tp->t_flags;
3764 __entry->caller_ip = caller_ip;
3765 ),
3766 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3767 MAJOR(__entry->dev), MINOR(__entry->dev),
3768 __entry->tid,
3769 __entry->flags,
3770 (char *)__entry->caller_ip)
3771)
3772
3773#define DEFINE_TRANS_EVENT(name) \
3774DEFINE_EVENT(xfs_trans_class, name, \
3775 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3776 TP_ARGS(tp, caller_ip))
3777DEFINE_TRANS_EVENT(xfs_trans_alloc);
3778DEFINE_TRANS_EVENT(xfs_trans_cancel);
3779DEFINE_TRANS_EVENT(xfs_trans_commit);
3780DEFINE_TRANS_EVENT(xfs_trans_dup);
3781DEFINE_TRANS_EVENT(xfs_trans_free);
3782DEFINE_TRANS_EVENT(xfs_trans_roll);
3783DEFINE_TRANS_EVENT(xfs_trans_add_item);
3784DEFINE_TRANS_EVENT(xfs_trans_commit_items);
3785DEFINE_TRANS_EVENT(xfs_trans_free_items);
3786
3787TRACE_EVENT(xfs_iunlink_update_bucket,
3788 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3789 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3790 TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3791 TP_STRUCT__entry(
3792 __field(dev_t, dev)
3793 __field(xfs_agnumber_t, agno)
3794 __field(unsigned int, bucket)
3795 __field(xfs_agino_t, old_ptr)
3796 __field(xfs_agino_t, new_ptr)
3797 ),
3798 TP_fast_assign(
3799 __entry->dev = mp->m_super->s_dev;
3800 __entry->agno = agno;
3801 __entry->bucket = bucket;
3802 __entry->old_ptr = old_ptr;
3803 __entry->new_ptr = new_ptr;
3804 ),
3805 TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
3806 MAJOR(__entry->dev), MINOR(__entry->dev),
3807 __entry->agno,
3808 __entry->bucket,
3809 __entry->old_ptr,
3810 __entry->new_ptr)
3811);
3812
3813TRACE_EVENT(xfs_iunlink_update_dinode,
3814 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3815 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3816 TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3817 TP_STRUCT__entry(
3818 __field(dev_t, dev)
3819 __field(xfs_agnumber_t, agno)
3820 __field(xfs_agino_t, agino)
3821 __field(xfs_agino_t, old_ptr)
3822 __field(xfs_agino_t, new_ptr)
3823 ),
3824 TP_fast_assign(
3825 __entry->dev = mp->m_super->s_dev;
3826 __entry->agno = agno;
3827 __entry->agino = agino;
3828 __entry->old_ptr = old_ptr;
3829 __entry->new_ptr = new_ptr;
3830 ),
3831 TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
3832 MAJOR(__entry->dev), MINOR(__entry->dev),
3833 __entry->agno,
3834 __entry->agino,
3835 __entry->old_ptr,
3836 __entry->new_ptr)
3837);
3838
3839TRACE_EVENT(xfs_iunlink_reload_next,
3840 TP_PROTO(struct xfs_inode *ip),
3841 TP_ARGS(ip),
3842 TP_STRUCT__entry(
3843 __field(dev_t, dev)
3844 __field(xfs_agnumber_t, agno)
3845 __field(xfs_agino_t, agino)
3846 __field(xfs_agino_t, prev_agino)
3847 __field(xfs_agino_t, next_agino)
3848 ),
3849 TP_fast_assign(
3850 __entry->dev = ip->i_mount->m_super->s_dev;
3851 __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3852 __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3853 __entry->prev_agino = ip->i_prev_unlinked;
3854 __entry->next_agino = ip->i_next_unlinked;
3855 ),
3856 TP_printk("dev %d:%d agno 0x%x agino 0x%x prev_unlinked 0x%x next_unlinked 0x%x",
3857 MAJOR(__entry->dev), MINOR(__entry->dev),
3858 __entry->agno,
3859 __entry->agino,
3860 __entry->prev_agino,
3861 __entry->next_agino)
3862);
3863
3864TRACE_EVENT(xfs_inode_reload_unlinked_bucket,
3865 TP_PROTO(struct xfs_inode *ip),
3866 TP_ARGS(ip),
3867 TP_STRUCT__entry(
3868 __field(dev_t, dev)
3869 __field(xfs_agnumber_t, agno)
3870 __field(xfs_agino_t, agino)
3871 ),
3872 TP_fast_assign(
3873 __entry->dev = ip->i_mount->m_super->s_dev;
3874 __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3875 __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3876 ),
3877 TP_printk("dev %d:%d agno 0x%x agino 0x%x bucket %u",
3878 MAJOR(__entry->dev), MINOR(__entry->dev),
3879 __entry->agno,
3880 __entry->agino,
3881 __entry->agino % XFS_AGI_UNLINKED_BUCKETS)
3882);
3883
3884DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3885 TP_PROTO(struct xfs_inode *ip),
3886 TP_ARGS(ip),
3887 TP_STRUCT__entry(
3888 __field(dev_t, dev)
3889 __field(xfs_agnumber_t, agno)
3890 __field(xfs_agino_t, agino)
3891 ),
3892 TP_fast_assign(
3893 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3894 __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3895 __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3896 ),
3897 TP_printk("dev %d:%d agno 0x%x agino 0x%x",
3898 MAJOR(__entry->dev), MINOR(__entry->dev),
3899 __entry->agno, __entry->agino)
3900)
3901
3902#define DEFINE_AGINODE_EVENT(name) \
3903DEFINE_EVENT(xfs_ag_inode_class, name, \
3904 TP_PROTO(struct xfs_inode *ip), \
3905 TP_ARGS(ip))
3906DEFINE_AGINODE_EVENT(xfs_iunlink);
3907DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
3908
3909DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3910 TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3911 TP_ARGS(mp, flags),
3912 TP_STRUCT__entry(
3913 __field(dev_t, dev)
3914 __field(unsigned int, flags)
3915 ),
3916 TP_fast_assign(
3917 __entry->dev = mp->m_super->s_dev;
3918 __entry->flags = flags;
3919 ),
3920 TP_printk("dev %d:%d flags 0x%x",
3921 MAJOR(__entry->dev), MINOR(__entry->dev),
3922 __entry->flags)
3923);
3924#define DEFINE_FS_CORRUPT_EVENT(name) \
3925DEFINE_EVENT(xfs_fs_corrupt_class, name, \
3926 TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3927 TP_ARGS(mp, flags))
3928DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3929DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
3930DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
3931DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3932DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
3933DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
3934
3935DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3936 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3937 TP_ARGS(mp, agno, flags),
3938 TP_STRUCT__entry(
3939 __field(dev_t, dev)
3940 __field(xfs_agnumber_t, agno)
3941 __field(unsigned int, flags)
3942 ),
3943 TP_fast_assign(
3944 __entry->dev = mp->m_super->s_dev;
3945 __entry->agno = agno;
3946 __entry->flags = flags;
3947 ),
3948 TP_printk("dev %d:%d agno 0x%x flags 0x%x",
3949 MAJOR(__entry->dev), MINOR(__entry->dev),
3950 __entry->agno, __entry->flags)
3951);
3952#define DEFINE_AG_CORRUPT_EVENT(name) \
3953DEFINE_EVENT(xfs_ag_corrupt_class, name, \
3954 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3955 unsigned int flags), \
3956 TP_ARGS(mp, agno, flags))
3957DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3958DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
3959DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
3960
3961DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3962 TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3963 TP_ARGS(ip, flags),
3964 TP_STRUCT__entry(
3965 __field(dev_t, dev)
3966 __field(xfs_ino_t, ino)
3967 __field(unsigned int, flags)
3968 ),
3969 TP_fast_assign(
3970 __entry->dev = ip->i_mount->m_super->s_dev;
3971 __entry->ino = ip->i_ino;
3972 __entry->flags = flags;
3973 ),
3974 TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3975 MAJOR(__entry->dev), MINOR(__entry->dev),
3976 __entry->ino, __entry->flags)
3977);
3978#define DEFINE_INODE_CORRUPT_EVENT(name) \
3979DEFINE_EVENT(xfs_inode_corrupt_class, name, \
3980 TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3981 TP_ARGS(ip, flags))
3982DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3983DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3984
3985TRACE_EVENT(xfs_iwalk_ag,
3986 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3987 xfs_agino_t startino),
3988 TP_ARGS(mp, agno, startino),
3989 TP_STRUCT__entry(
3990 __field(dev_t, dev)
3991 __field(xfs_agnumber_t, agno)
3992 __field(xfs_agino_t, startino)
3993 ),
3994 TP_fast_assign(
3995 __entry->dev = mp->m_super->s_dev;
3996 __entry->agno = agno;
3997 __entry->startino = startino;
3998 ),
3999 TP_printk("dev %d:%d agno 0x%x startino 0x%x",
4000 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
4001 __entry->startino)
4002)
4003
4004TRACE_EVENT(xfs_iwalk_ag_rec,
4005 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
4006 struct xfs_inobt_rec_incore *irec),
4007 TP_ARGS(mp, agno, irec),
4008 TP_STRUCT__entry(
4009 __field(dev_t, dev)
4010 __field(xfs_agnumber_t, agno)
4011 __field(xfs_agino_t, startino)
4012 __field(uint64_t, freemask)
4013 ),
4014 TP_fast_assign(
4015 __entry->dev = mp->m_super->s_dev;
4016 __entry->agno = agno;
4017 __entry->startino = irec->ir_startino;
4018 __entry->freemask = irec->ir_free;
4019 ),
4020 TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
4021 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
4022 __entry->startino, __entry->freemask)
4023)
4024
4025TRACE_EVENT(xfs_pwork_init,
4026 TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
4027 TP_ARGS(mp, nr_threads, pid),
4028 TP_STRUCT__entry(
4029 __field(dev_t, dev)
4030 __field(unsigned int, nr_threads)
4031 __field(pid_t, pid)
4032 ),
4033 TP_fast_assign(
4034 __entry->dev = mp->m_super->s_dev;
4035 __entry->nr_threads = nr_threads;
4036 __entry->pid = pid;
4037 ),
4038 TP_printk("dev %d:%d nr_threads %u pid %u",
4039 MAJOR(__entry->dev), MINOR(__entry->dev),
4040 __entry->nr_threads, __entry->pid)
4041)
4042
4043DECLARE_EVENT_CLASS(xfs_kmem_class,
4044 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
4045 TP_ARGS(size, flags, caller_ip),
4046 TP_STRUCT__entry(
4047 __field(ssize_t, size)
4048 __field(int, flags)
4049 __field(unsigned long, caller_ip)
4050 ),
4051 TP_fast_assign(
4052 __entry->size = size;
4053 __entry->flags = flags;
4054 __entry->caller_ip = caller_ip;
4055 ),
4056 TP_printk("size %zd flags 0x%x caller %pS",
4057 __entry->size,
4058 __entry->flags,
4059 (char *)__entry->caller_ip)
4060)
4061
4062#define DEFINE_KMEM_EVENT(name) \
4063DEFINE_EVENT(xfs_kmem_class, name, \
4064 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
4065 TP_ARGS(size, flags, caller_ip))
4066DEFINE_KMEM_EVENT(kmem_alloc);
4067
4068TRACE_EVENT(xfs_check_new_dalign,
4069 TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
4070 TP_ARGS(mp, new_dalign, calc_rootino),
4071 TP_STRUCT__entry(
4072 __field(dev_t, dev)
4073 __field(int, new_dalign)
4074 __field(xfs_ino_t, sb_rootino)
4075 __field(xfs_ino_t, calc_rootino)
4076 ),
4077 TP_fast_assign(
4078 __entry->dev = mp->m_super->s_dev;
4079 __entry->new_dalign = new_dalign;
4080 __entry->sb_rootino = mp->m_sb.sb_rootino;
4081 __entry->calc_rootino = calc_rootino;
4082 ),
4083 TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
4084 MAJOR(__entry->dev), MINOR(__entry->dev),
4085 __entry->new_dalign, __entry->sb_rootino,
4086 __entry->calc_rootino)
4087)
4088
4089TRACE_EVENT(xfs_btree_commit_afakeroot,
4090 TP_PROTO(struct xfs_btree_cur *cur),
4091 TP_ARGS(cur),
4092 TP_STRUCT__entry(
4093 __field(dev_t, dev)
4094 __field(xfs_btnum_t, btnum)
4095 __field(xfs_agnumber_t, agno)
4096 __field(xfs_agblock_t, agbno)
4097 __field(unsigned int, levels)
4098 __field(unsigned int, blocks)
4099 ),
4100 TP_fast_assign(
4101 __entry->dev = cur->bc_mp->m_super->s_dev;
4102 __entry->btnum = cur->bc_btnum;
4103 __entry->agno = cur->bc_ag.pag->pag_agno;
4104 __entry->agbno = cur->bc_ag.afake->af_root;
4105 __entry->levels = cur->bc_ag.afake->af_levels;
4106 __entry->blocks = cur->bc_ag.afake->af_blocks;
4107 ),
4108 TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
4109 MAJOR(__entry->dev), MINOR(__entry->dev),
4110 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4111 __entry->agno,
4112 __entry->levels,
4113 __entry->blocks,
4114 __entry->agbno)
4115)
4116
4117TRACE_EVENT(xfs_btree_commit_ifakeroot,
4118 TP_PROTO(struct xfs_btree_cur *cur),
4119 TP_ARGS(cur),
4120 TP_STRUCT__entry(
4121 __field(dev_t, dev)
4122 __field(xfs_btnum_t, btnum)
4123 __field(xfs_agnumber_t, agno)
4124 __field(xfs_agino_t, agino)
4125 __field(unsigned int, levels)
4126 __field(unsigned int, blocks)
4127 __field(int, whichfork)
4128 ),
4129 TP_fast_assign(
4130 __entry->dev = cur->bc_mp->m_super->s_dev;
4131 __entry->btnum = cur->bc_btnum;
4132 __entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
4133 cur->bc_ino.ip->i_ino);
4134 __entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
4135 cur->bc_ino.ip->i_ino);
4136 __entry->levels = cur->bc_ino.ifake->if_levels;
4137 __entry->blocks = cur->bc_ino.ifake->if_blocks;
4138 __entry->whichfork = cur->bc_ino.whichfork;
4139 ),
4140 TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
4141 MAJOR(__entry->dev), MINOR(__entry->dev),
4142 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4143 __entry->agno,
4144 __entry->agino,
4145 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
4146 __entry->levels,
4147 __entry->blocks)
4148)
4149
4150TRACE_EVENT(xfs_btree_bload_level_geometry,
4151 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4152 uint64_t nr_this_level, unsigned int nr_per_block,
4153 unsigned int desired_npb, uint64_t blocks,
4154 uint64_t blocks_with_extra),
4155 TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
4156 blocks_with_extra),
4157 TP_STRUCT__entry(
4158 __field(dev_t, dev)
4159 __field(xfs_btnum_t, btnum)
4160 __field(unsigned int, level)
4161 __field(unsigned int, nlevels)
4162 __field(uint64_t, nr_this_level)
4163 __field(unsigned int, nr_per_block)
4164 __field(unsigned int, desired_npb)
4165 __field(unsigned long long, blocks)
4166 __field(unsigned long long, blocks_with_extra)
4167 ),
4168 TP_fast_assign(
4169 __entry->dev = cur->bc_mp->m_super->s_dev;
4170 __entry->btnum = cur->bc_btnum;
4171 __entry->level = level;
4172 __entry->nlevels = cur->bc_nlevels;
4173 __entry->nr_this_level = nr_this_level;
4174 __entry->nr_per_block = nr_per_block;
4175 __entry->desired_npb = desired_npb;
4176 __entry->blocks = blocks;
4177 __entry->blocks_with_extra = blocks_with_extra;
4178 ),
4179 TP_printk("dev %d:%d btree %s level %u/%u nr_this_level %llu nr_per_block %u desired_npb %u blocks %llu blocks_with_extra %llu",
4180 MAJOR(__entry->dev), MINOR(__entry->dev),
4181 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4182 __entry->level,
4183 __entry->nlevels,
4184 __entry->nr_this_level,
4185 __entry->nr_per_block,
4186 __entry->desired_npb,
4187 __entry->blocks,
4188 __entry->blocks_with_extra)
4189)
4190
4191TRACE_EVENT(xfs_btree_bload_block,
4192 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
4193 uint64_t block_idx, uint64_t nr_blocks,
4194 union xfs_btree_ptr *ptr, unsigned int nr_records),
4195 TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
4196 TP_STRUCT__entry(
4197 __field(dev_t, dev)
4198 __field(xfs_btnum_t, btnum)
4199 __field(unsigned int, level)
4200 __field(unsigned long long, block_idx)
4201 __field(unsigned long long, nr_blocks)
4202 __field(xfs_agnumber_t, agno)
4203 __field(xfs_agblock_t, agbno)
4204 __field(unsigned int, nr_records)
4205 ),
4206 TP_fast_assign(
4207 __entry->dev = cur->bc_mp->m_super->s_dev;
4208 __entry->btnum = cur->bc_btnum;
4209 __entry->level = level;
4210 __entry->block_idx = block_idx;
4211 __entry->nr_blocks = nr_blocks;
4212 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
4213 xfs_fsblock_t fsb = be64_to_cpu(ptr->l);
4214
4215 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
4216 __entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
4217 } else {
4218 __entry->agno = cur->bc_ag.pag->pag_agno;
4219 __entry->agbno = be32_to_cpu(ptr->s);
4220 }
4221 __entry->nr_records = nr_records;
4222 ),
4223 TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno 0x%x recs %u",
4224 MAJOR(__entry->dev), MINOR(__entry->dev),
4225 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
4226 __entry->level,
4227 __entry->block_idx,
4228 __entry->nr_blocks,
4229 __entry->agno,
4230 __entry->agbno,
4231 __entry->nr_records)
4232)
4233
4234DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
4235 TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
4236 TP_ARGS(mp, min, max),
4237 TP_STRUCT__entry(
4238 __field(dev_t, dev)
4239 __field(long long, min)
4240 __field(long long, max)
4241 ),
4242 TP_fast_assign(
4243 __entry->dev = mp->m_super->s_dev;
4244 __entry->min = min;
4245 __entry->max = max;
4246 ),
4247 TP_printk("dev %d:%d min %lld max %lld",
4248 MAJOR(__entry->dev), MINOR(__entry->dev),
4249 __entry->min,
4250 __entry->max)
4251)
4252
4253#define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
4254DEFINE_EVENT(xfs_timestamp_range_class, name, \
4255 TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
4256 TP_ARGS(mp, min, max))
4257DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
4258DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
4259
4260DECLARE_EVENT_CLASS(xfs_icwalk_class,
4261 TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
4262 unsigned long caller_ip),
4263 TP_ARGS(mp, icw, caller_ip),
4264 TP_STRUCT__entry(
4265 __field(dev_t, dev)
4266 __field(__u32, flags)
4267 __field(uint32_t, uid)
4268 __field(uint32_t, gid)
4269 __field(prid_t, prid)
4270 __field(__u64, min_file_size)
4271 __field(long, scan_limit)
4272 __field(unsigned long, caller_ip)
4273 ),
4274 TP_fast_assign(
4275 __entry->dev = mp->m_super->s_dev;
4276 __entry->flags = icw ? icw->icw_flags : 0;
4277 __entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
4278 icw->icw_uid) : 0;
4279 __entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
4280 icw->icw_gid) : 0;
4281 __entry->prid = icw ? icw->icw_prid : 0;
4282 __entry->min_file_size = icw ? icw->icw_min_file_size : 0;
4283 __entry->scan_limit = icw ? icw->icw_scan_limit : 0;
4284 __entry->caller_ip = caller_ip;
4285 ),
4286 TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
4287 MAJOR(__entry->dev), MINOR(__entry->dev),
4288 __entry->flags,
4289 __entry->uid,
4290 __entry->gid,
4291 __entry->prid,
4292 __entry->min_file_size,
4293 __entry->scan_limit,
4294 (char *)__entry->caller_ip)
4295);
4296#define DEFINE_ICWALK_EVENT(name) \
4297DEFINE_EVENT(xfs_icwalk_class, name, \
4298 TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
4299 unsigned long caller_ip), \
4300 TP_ARGS(mp, icw, caller_ip))
4301DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4302DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
4303
4304TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4305TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4306TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4307TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4308TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4309TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
4310
4311DECLARE_EVENT_CLASS(xlog_iclog_class,
4312 TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4313 TP_ARGS(iclog, caller_ip),
4314 TP_STRUCT__entry(
4315 __field(dev_t, dev)
4316 __field(uint32_t, state)
4317 __field(int32_t, refcount)
4318 __field(uint32_t, offset)
4319 __field(uint32_t, flags)
4320 __field(unsigned long long, lsn)
4321 __field(unsigned long, caller_ip)
4322 ),
4323 TP_fast_assign(
4324 __entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4325 __entry->state = iclog->ic_state;
4326 __entry->refcount = atomic_read(&iclog->ic_refcnt);
4327 __entry->offset = iclog->ic_offset;
4328 __entry->flags = iclog->ic_flags;
4329 __entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4330 __entry->caller_ip = caller_ip;
4331 ),
4332 TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
4333 MAJOR(__entry->dev), MINOR(__entry->dev),
4334 __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4335 __entry->refcount,
4336 __entry->offset,
4337 __entry->lsn,
4338 __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
4339 (char *)__entry->caller_ip)
4340
4341);
4342
4343#define DEFINE_ICLOG_EVENT(name) \
4344DEFINE_EVENT(xlog_iclog_class, name, \
4345 TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4346 TP_ARGS(iclog, caller_ip))
4347
4348DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4349DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4350DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4351DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4352DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4353DEFINE_ICLOG_EVENT(xlog_iclog_force);
4354DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4355DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4356DEFINE_ICLOG_EVENT(xlog_iclog_release);
4357DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4358DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4359DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4360DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4361DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4362DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4363DEFINE_ICLOG_EVENT(xlog_iclog_write);
4364
4365TRACE_DEFINE_ENUM(XFS_DAS_UNINIT);
4366TRACE_DEFINE_ENUM(XFS_DAS_SF_ADD);
4367TRACE_DEFINE_ENUM(XFS_DAS_SF_REMOVE);
4368TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ADD);
4369TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE);
4370TRACE_DEFINE_ENUM(XFS_DAS_NODE_ADD);
4371TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE);
4372TRACE_DEFINE_ENUM(XFS_DAS_LEAF_SET_RMT);
4373TRACE_DEFINE_ENUM(XFS_DAS_LEAF_ALLOC_RMT);
4374TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REPLACE);
4375TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_OLD);
4376TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_RMT);
4377TRACE_DEFINE_ENUM(XFS_DAS_LEAF_REMOVE_ATTR);
4378TRACE_DEFINE_ENUM(XFS_DAS_NODE_SET_RMT);
4379TRACE_DEFINE_ENUM(XFS_DAS_NODE_ALLOC_RMT);
4380TRACE_DEFINE_ENUM(XFS_DAS_NODE_REPLACE);
4381TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_OLD);
4382TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_RMT);
4383TRACE_DEFINE_ENUM(XFS_DAS_NODE_REMOVE_ATTR);
4384TRACE_DEFINE_ENUM(XFS_DAS_DONE);
4385
4386DECLARE_EVENT_CLASS(xfs_das_state_class,
4387 TP_PROTO(int das, struct xfs_inode *ip),
4388 TP_ARGS(das, ip),
4389 TP_STRUCT__entry(
4390 __field(int, das)
4391 __field(xfs_ino_t, ino)
4392 ),
4393 TP_fast_assign(
4394 __entry->das = das;
4395 __entry->ino = ip->i_ino;
4396 ),
4397 TP_printk("state change %s ino 0x%llx",
4398 __print_symbolic(__entry->das, XFS_DAS_STRINGS),
4399 __entry->ino)
4400)
4401
4402#define DEFINE_DAS_STATE_EVENT(name) \
4403DEFINE_EVENT(xfs_das_state_class, name, \
4404 TP_PROTO(int das, struct xfs_inode *ip), \
4405 TP_ARGS(das, ip))
4406DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4407DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4408DEFINE_DAS_STATE_EVENT(xfs_attr_leaf_addname_return);
4409DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4410DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4411DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_alloc);
4412DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
4413DEFINE_DAS_STATE_EVENT(xfs_attr_defer_add);
4414
4415
4416TRACE_EVENT(xfs_force_shutdown,
4417 TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4418 int line_num),
4419 TP_ARGS(mp, ptag, flags, fname, line_num),
4420 TP_STRUCT__entry(
4421 __field(dev_t, dev)
4422 __field(int, ptag)
4423 __field(int, flags)
4424 __string(fname, fname)
4425 __field(int, line_num)
4426 ),
4427 TP_fast_assign(
4428 __entry->dev = mp->m_super->s_dev;
4429 __entry->ptag = ptag;
4430 __entry->flags = flags;
4431 __assign_str(fname, fname);
4432 __entry->line_num = line_num;
4433 ),
4434 TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4435 MAJOR(__entry->dev), MINOR(__entry->dev),
4436 __print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4437 __print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4438 __get_str(fname),
4439 __entry->line_num)
4440);
4441
4442#ifdef CONFIG_XFS_DRAIN_INTENTS
4443DECLARE_EVENT_CLASS(xfs_perag_intents_class,
4444 TP_PROTO(struct xfs_perag *pag, void *caller_ip),
4445 TP_ARGS(pag, caller_ip),
4446 TP_STRUCT__entry(
4447 __field(dev_t, dev)
4448 __field(xfs_agnumber_t, agno)
4449 __field(long, nr_intents)
4450 __field(void *, caller_ip)
4451 ),
4452 TP_fast_assign(
4453 __entry->dev = pag->pag_mount->m_super->s_dev;
4454 __entry->agno = pag->pag_agno;
4455 __entry->nr_intents = atomic_read(&pag->pag_intents_drain.dr_count);
4456 __entry->caller_ip = caller_ip;
4457 ),
4458 TP_printk("dev %d:%d agno 0x%x intents %ld caller %pS",
4459 MAJOR(__entry->dev), MINOR(__entry->dev),
4460 __entry->agno,
4461 __entry->nr_intents,
4462 __entry->caller_ip)
4463);
4464
4465#define DEFINE_PERAG_INTENTS_EVENT(name) \
4466DEFINE_EVENT(xfs_perag_intents_class, name, \
4467 TP_PROTO(struct xfs_perag *pag, void *caller_ip), \
4468 TP_ARGS(pag, caller_ip))
4469DEFINE_PERAG_INTENTS_EVENT(xfs_perag_intent_hold);
4470DEFINE_PERAG_INTENTS_EVENT(xfs_perag_intent_rele);
4471DEFINE_PERAG_INTENTS_EVENT(xfs_perag_wait_intents);
4472
4473#endif /* CONFIG_XFS_DRAIN_INTENTS */
4474
4475#endif /* _TRACE_XFS_H */
4476
4477#undef TRACE_INCLUDE_PATH
4478#define TRACE_INCLUDE_PATH .
4479#define TRACE_INCLUDE_FILE xfs_trace
4480#include <trace/define_trace.h>