xfs: track AGs with reclaimable inodes in per-ag radix tree
[linux-2.6.git] / fs / xfs / linux-2.6 / xfs_trace.h
1 /*
2  * Copyright (c) 2009, Christoph Hellwig
3  * All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write the Free Software Foundation,
16  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17  */
18 #undef TRACE_SYSTEM
19 #define TRACE_SYSTEM xfs
20
21 #if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22 #define _TRACE_XFS_H
23
24 #include <linux/tracepoint.h>
25
26 struct xfs_agf;
27 struct xfs_alloc_arg;
28 struct xfs_attr_list_context;
29 struct xfs_buf_log_item;
30 struct xfs_da_args;
31 struct xfs_da_node_entry;
32 struct xfs_dquot;
33 struct xlog_ticket;
34 struct log;
35 struct xlog_recover;
36 struct xlog_recover_item;
37 struct xfs_buf_log_format;
38 struct xfs_inode_log_format;
39
40 DECLARE_EVENT_CLASS(xfs_attr_list_class,
41         TP_PROTO(struct xfs_attr_list_context *ctx),
42         TP_ARGS(ctx),
43         TP_STRUCT__entry(
44                 __field(dev_t, dev)
45                 __field(xfs_ino_t, ino)
46                 __field(u32, hashval)
47                 __field(u32, blkno)
48                 __field(u32, offset)
49                 __field(void *, alist)
50                 __field(int, bufsize)
51                 __field(int, count)
52                 __field(int, firstu)
53                 __field(int, dupcnt)
54                 __field(int, flags)
55         ),
56         TP_fast_assign(
57                 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
58                 __entry->ino = ctx->dp->i_ino;
59                 __entry->hashval = ctx->cursor->hashval;
60                 __entry->blkno = ctx->cursor->blkno;
61                 __entry->offset = ctx->cursor->offset;
62                 __entry->alist = ctx->alist;
63                 __entry->bufsize = ctx->bufsize;
64                 __entry->count = ctx->count;
65                 __entry->firstu = ctx->firstu;
66                 __entry->flags = ctx->flags;
67         ),
68         TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
69                   "alist 0x%p size %u count %u firstu %u flags %d %s",
70                   MAJOR(__entry->dev), MINOR(__entry->dev),
71                    __entry->ino,
72                    __entry->hashval,
73                    __entry->blkno,
74                    __entry->offset,
75                    __entry->dupcnt,
76                    __entry->alist,
77                    __entry->bufsize,
78                    __entry->count,
79                    __entry->firstu,
80                    __entry->flags,
81                    __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
82         )
83 )
84
85 #define DEFINE_ATTR_LIST_EVENT(name) \
86 DEFINE_EVENT(xfs_attr_list_class, name, \
87         TP_PROTO(struct xfs_attr_list_context *ctx), \
88         TP_ARGS(ctx))
89 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
90 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
91 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
92 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
93 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
94 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
95 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
96 DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
97
98 DECLARE_EVENT_CLASS(xfs_perag_class,
99         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
100                  unsigned long caller_ip),
101         TP_ARGS(mp, agno, refcount, caller_ip),
102         TP_STRUCT__entry(
103                 __field(dev_t, dev)
104                 __field(xfs_agnumber_t, agno)
105                 __field(int, refcount)
106                 __field(unsigned long, caller_ip)
107         ),
108         TP_fast_assign(
109                 __entry->dev = mp->m_super->s_dev;
110                 __entry->agno = agno;
111                 __entry->refcount = refcount;
112                 __entry->caller_ip = caller_ip;
113         ),
114         TP_printk("dev %d:%d agno %u refcount %d caller %pf",
115                   MAJOR(__entry->dev), MINOR(__entry->dev),
116                   __entry->agno,
117                   __entry->refcount,
118                   (char *)__entry->caller_ip)
119 );
120
121 #define DEFINE_PERAG_REF_EVENT(name)    \
122 DEFINE_EVENT(xfs_perag_class, name,     \
123         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,       \
124                  unsigned long caller_ip),                                      \
125         TP_ARGS(mp, agno, refcount, caller_ip))
126 DEFINE_PERAG_REF_EVENT(xfs_perag_get);
127 DEFINE_PERAG_REF_EVENT(xfs_perag_get_reclaim);
128 DEFINE_PERAG_REF_EVENT(xfs_perag_put);
129 DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
130 DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
131
132 TRACE_EVENT(xfs_attr_list_node_descend,
133         TP_PROTO(struct xfs_attr_list_context *ctx,
134                  struct xfs_da_node_entry *btree),
135         TP_ARGS(ctx, btree),
136         TP_STRUCT__entry(
137                 __field(dev_t, dev)
138                 __field(xfs_ino_t, ino)
139                 __field(u32, hashval)
140                 __field(u32, blkno)
141                 __field(u32, offset)
142                 __field(void *, alist)
143                 __field(int, bufsize)
144                 __field(int, count)
145                 __field(int, firstu)
146                 __field(int, dupcnt)
147                 __field(int, flags)
148                 __field(u32, bt_hashval)
149                 __field(u32, bt_before)
150         ),
151         TP_fast_assign(
152                 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
153                 __entry->ino = ctx->dp->i_ino;
154                 __entry->hashval = ctx->cursor->hashval;
155                 __entry->blkno = ctx->cursor->blkno;
156                 __entry->offset = ctx->cursor->offset;
157                 __entry->alist = ctx->alist;
158                 __entry->bufsize = ctx->bufsize;
159                 __entry->count = ctx->count;
160                 __entry->firstu = ctx->firstu;
161                 __entry->flags = ctx->flags;
162                 __entry->bt_hashval = be32_to_cpu(btree->hashval);
163                 __entry->bt_before = be32_to_cpu(btree->before);
164         ),
165         TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
166                   "alist 0x%p size %u count %u firstu %u flags %d %s "
167                   "node hashval %u, node before %u",
168                   MAJOR(__entry->dev), MINOR(__entry->dev),
169                    __entry->ino,
170                    __entry->hashval,
171                    __entry->blkno,
172                    __entry->offset,
173                    __entry->dupcnt,
174                    __entry->alist,
175                    __entry->bufsize,
176                    __entry->count,
177                    __entry->firstu,
178                    __entry->flags,
179                    __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
180                    __entry->bt_hashval,
181                    __entry->bt_before)
182 );
183
184 TRACE_EVENT(xfs_iext_insert,
185         TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
186                  struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
187         TP_ARGS(ip, idx, r, state, caller_ip),
188         TP_STRUCT__entry(
189                 __field(dev_t, dev)
190                 __field(xfs_ino_t, ino)
191                 __field(xfs_extnum_t, idx)
192                 __field(xfs_fileoff_t, startoff)
193                 __field(xfs_fsblock_t, startblock)
194                 __field(xfs_filblks_t, blockcount)
195                 __field(xfs_exntst_t, state)
196                 __field(int, bmap_state)
197                 __field(unsigned long, caller_ip)
198         ),
199         TP_fast_assign(
200                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
201                 __entry->ino = ip->i_ino;
202                 __entry->idx = idx;
203                 __entry->startoff = r->br_startoff;
204                 __entry->startblock = r->br_startblock;
205                 __entry->blockcount = r->br_blockcount;
206                 __entry->state = r->br_state;
207                 __entry->bmap_state = state;
208                 __entry->caller_ip = caller_ip;
209         ),
210         TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
211                   "offset %lld block %lld count %lld flag %d caller %pf",
212                   MAJOR(__entry->dev), MINOR(__entry->dev),
213                   __entry->ino,
214                   __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
215                   (long)__entry->idx,
216                   __entry->startoff,
217                   (__int64_t)__entry->startblock,
218                   __entry->blockcount,
219                   __entry->state,
220                   (char *)__entry->caller_ip)
221 );
222
223 DECLARE_EVENT_CLASS(xfs_bmap_class,
224         TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
225                  unsigned long caller_ip),
226         TP_ARGS(ip, idx, state, caller_ip),
227         TP_STRUCT__entry(
228                 __field(dev_t, dev)
229                 __field(xfs_ino_t, ino)
230                 __field(xfs_extnum_t, idx)
231                 __field(xfs_fileoff_t, startoff)
232                 __field(xfs_fsblock_t, startblock)
233                 __field(xfs_filblks_t, blockcount)
234                 __field(xfs_exntst_t, state)
235                 __field(int, bmap_state)
236                 __field(unsigned long, caller_ip)
237         ),
238         TP_fast_assign(
239                 struct xfs_ifork        *ifp = (state & BMAP_ATTRFORK) ?
240                                                 ip->i_afp : &ip->i_df;
241                 struct xfs_bmbt_irec    r;
242
243                 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
244                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
245                 __entry->ino = ip->i_ino;
246                 __entry->idx = idx;
247                 __entry->startoff = r.br_startoff;
248                 __entry->startblock = r.br_startblock;
249                 __entry->blockcount = r.br_blockcount;
250                 __entry->state = r.br_state;
251                 __entry->bmap_state = state;
252                 __entry->caller_ip = caller_ip;
253         ),
254         TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
255                   "offset %lld block %lld count %lld flag %d caller %pf",
256                   MAJOR(__entry->dev), MINOR(__entry->dev),
257                   __entry->ino,
258                   __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
259                   (long)__entry->idx,
260                   __entry->startoff,
261                   (__int64_t)__entry->startblock,
262                   __entry->blockcount,
263                   __entry->state,
264                   (char *)__entry->caller_ip)
265 )
266
267 #define DEFINE_BMAP_EVENT(name) \
268 DEFINE_EVENT(xfs_bmap_class, name, \
269         TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
270                  unsigned long caller_ip), \
271         TP_ARGS(ip, idx, state, caller_ip))
272 DEFINE_BMAP_EVENT(xfs_iext_remove);
273 DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
274 DEFINE_BMAP_EVENT(xfs_bmap_post_update);
275 DEFINE_BMAP_EVENT(xfs_extlist);
276
277 DECLARE_EVENT_CLASS(xfs_buf_class,
278         TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
279         TP_ARGS(bp, caller_ip),
280         TP_STRUCT__entry(
281                 __field(dev_t, dev)
282                 __field(xfs_daddr_t, bno)
283                 __field(size_t, buffer_length)
284                 __field(int, hold)
285                 __field(int, pincount)
286                 __field(unsigned, lockval)
287                 __field(unsigned, flags)
288                 __field(unsigned long, caller_ip)
289         ),
290         TP_fast_assign(
291                 __entry->dev = bp->b_target->bt_dev;
292                 __entry->bno = bp->b_bn;
293                 __entry->buffer_length = bp->b_buffer_length;
294                 __entry->hold = atomic_read(&bp->b_hold);
295                 __entry->pincount = atomic_read(&bp->b_pin_count);
296                 __entry->lockval = xfs_buf_lock_value(bp);
297                 __entry->flags = bp->b_flags;
298                 __entry->caller_ip = caller_ip;
299         ),
300         TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
301                   "lock %d flags %s caller %pf",
302                   MAJOR(__entry->dev), MINOR(__entry->dev),
303                   (unsigned long long)__entry->bno,
304                   __entry->buffer_length,
305                   __entry->hold,
306                   __entry->pincount,
307                   __entry->lockval,
308                   __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
309                   (void *)__entry->caller_ip)
310 )
311
312 #define DEFINE_BUF_EVENT(name) \
313 DEFINE_EVENT(xfs_buf_class, name, \
314         TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
315         TP_ARGS(bp, caller_ip))
316 DEFINE_BUF_EVENT(xfs_buf_init);
317 DEFINE_BUF_EVENT(xfs_buf_free);
318 DEFINE_BUF_EVENT(xfs_buf_hold);
319 DEFINE_BUF_EVENT(xfs_buf_rele);
320 DEFINE_BUF_EVENT(xfs_buf_pin);
321 DEFINE_BUF_EVENT(xfs_buf_unpin);
322 DEFINE_BUF_EVENT(xfs_buf_iodone);
323 DEFINE_BUF_EVENT(xfs_buf_iorequest);
324 DEFINE_BUF_EVENT(xfs_buf_bawrite);
325 DEFINE_BUF_EVENT(xfs_buf_bdwrite);
326 DEFINE_BUF_EVENT(xfs_buf_lock);
327 DEFINE_BUF_EVENT(xfs_buf_lock_done);
328 DEFINE_BUF_EVENT(xfs_buf_cond_lock);
329 DEFINE_BUF_EVENT(xfs_buf_unlock);
330 DEFINE_BUF_EVENT(xfs_buf_ordered_retry);
331 DEFINE_BUF_EVENT(xfs_buf_iowait);
332 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
333 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
334 DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
335 DEFINE_BUF_EVENT(xfs_buf_delwri_split);
336 DEFINE_BUF_EVENT(xfs_buf_get_noaddr);
337 DEFINE_BUF_EVENT(xfs_bdstrat_shut);
338 DEFINE_BUF_EVENT(xfs_buf_item_relse);
339 DEFINE_BUF_EVENT(xfs_buf_item_iodone);
340 DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
341 DEFINE_BUF_EVENT(xfs_buf_error_relse);
342 DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
343 DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
344
345 /* not really buffer traces, but the buf provides useful information */
346 DEFINE_BUF_EVENT(xfs_btree_corrupt);
347 DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
348 DEFINE_BUF_EVENT(xfs_reset_dqcounts);
349 DEFINE_BUF_EVENT(xfs_inode_item_push);
350
351 /* pass flags explicitly */
352 DECLARE_EVENT_CLASS(xfs_buf_flags_class,
353         TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
354         TP_ARGS(bp, flags, caller_ip),
355         TP_STRUCT__entry(
356                 __field(dev_t, dev)
357                 __field(xfs_daddr_t, bno)
358                 __field(size_t, buffer_length)
359                 __field(int, hold)
360                 __field(int, pincount)
361                 __field(unsigned, lockval)
362                 __field(unsigned, flags)
363                 __field(unsigned long, caller_ip)
364         ),
365         TP_fast_assign(
366                 __entry->dev = bp->b_target->bt_dev;
367                 __entry->bno = bp->b_bn;
368                 __entry->buffer_length = bp->b_buffer_length;
369                 __entry->flags = flags;
370                 __entry->hold = atomic_read(&bp->b_hold);
371                 __entry->pincount = atomic_read(&bp->b_pin_count);
372                 __entry->lockval = xfs_buf_lock_value(bp);
373                 __entry->caller_ip = caller_ip;
374         ),
375         TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
376                   "lock %d flags %s caller %pf",
377                   MAJOR(__entry->dev), MINOR(__entry->dev),
378                   (unsigned long long)__entry->bno,
379                   __entry->buffer_length,
380                   __entry->hold,
381                   __entry->pincount,
382                   __entry->lockval,
383                   __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
384                   (void *)__entry->caller_ip)
385 )
386
387 #define DEFINE_BUF_FLAGS_EVENT(name) \
388 DEFINE_EVENT(xfs_buf_flags_class, name, \
389         TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
390         TP_ARGS(bp, flags, caller_ip))
391 DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
392 DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
393 DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
394
395 TRACE_EVENT(xfs_buf_ioerror,
396         TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
397         TP_ARGS(bp, error, caller_ip),
398         TP_STRUCT__entry(
399                 __field(dev_t, dev)
400                 __field(xfs_daddr_t, bno)
401                 __field(size_t, buffer_length)
402                 __field(unsigned, flags)
403                 __field(int, hold)
404                 __field(int, pincount)
405                 __field(unsigned, lockval)
406                 __field(int, error)
407                 __field(unsigned long, caller_ip)
408         ),
409         TP_fast_assign(
410                 __entry->dev = bp->b_target->bt_dev;
411                 __entry->bno = bp->b_bn;
412                 __entry->buffer_length = bp->b_buffer_length;
413                 __entry->hold = atomic_read(&bp->b_hold);
414                 __entry->pincount = atomic_read(&bp->b_pin_count);
415                 __entry->lockval = xfs_buf_lock_value(bp);
416                 __entry->error = error;
417                 __entry->flags = bp->b_flags;
418                 __entry->caller_ip = caller_ip;
419         ),
420         TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
421                   "lock %d error %d flags %s caller %pf",
422                   MAJOR(__entry->dev), MINOR(__entry->dev),
423                   (unsigned long long)__entry->bno,
424                   __entry->buffer_length,
425                   __entry->hold,
426                   __entry->pincount,
427                   __entry->lockval,
428                   __entry->error,
429                   __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
430                   (void *)__entry->caller_ip)
431 );
432
433 DECLARE_EVENT_CLASS(xfs_buf_item_class,
434         TP_PROTO(struct xfs_buf_log_item *bip),
435         TP_ARGS(bip),
436         TP_STRUCT__entry(
437                 __field(dev_t, dev)
438                 __field(xfs_daddr_t, buf_bno)
439                 __field(size_t, buf_len)
440                 __field(int, buf_hold)
441                 __field(int, buf_pincount)
442                 __field(int, buf_lockval)
443                 __field(unsigned, buf_flags)
444                 __field(unsigned, bli_recur)
445                 __field(int, bli_refcount)
446                 __field(unsigned, bli_flags)
447                 __field(void *, li_desc)
448                 __field(unsigned, li_flags)
449         ),
450         TP_fast_assign(
451                 __entry->dev = bip->bli_buf->b_target->bt_dev;
452                 __entry->bli_flags = bip->bli_flags;
453                 __entry->bli_recur = bip->bli_recur;
454                 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
455                 __entry->buf_bno = bip->bli_buf->b_bn;
456                 __entry->buf_len = bip->bli_buf->b_buffer_length;
457                 __entry->buf_flags = bip->bli_buf->b_flags;
458                 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
459                 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
460                 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf);
461                 __entry->li_desc = bip->bli_item.li_desc;
462                 __entry->li_flags = bip->bli_item.li_flags;
463         ),
464         TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
465                   "lock %d flags %s recur %d refcount %d bliflags %s "
466                   "lidesc 0x%p liflags %s",
467                   MAJOR(__entry->dev), MINOR(__entry->dev),
468                   (unsigned long long)__entry->buf_bno,
469                   __entry->buf_len,
470                   __entry->buf_hold,
471                   __entry->buf_pincount,
472                   __entry->buf_lockval,
473                   __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
474                   __entry->bli_recur,
475                   __entry->bli_refcount,
476                   __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
477                   __entry->li_desc,
478                   __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
479 )
480
481 #define DEFINE_BUF_ITEM_EVENT(name) \
482 DEFINE_EVENT(xfs_buf_item_class, name, \
483         TP_PROTO(struct xfs_buf_log_item *bip), \
484         TP_ARGS(bip))
485 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
486 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
487 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
488 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
489 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
490 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
491 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
492 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_trylock);
493 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
494 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
495 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
496 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
497 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pushbuf);
498 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
499 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
500 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
501 DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
502 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
503 DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
504 DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
505 DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
506 DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
507 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
508 DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
509 DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
510
511 DECLARE_EVENT_CLASS(xfs_lock_class,
512         TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
513                  unsigned long caller_ip),
514         TP_ARGS(ip,  lock_flags, caller_ip),
515         TP_STRUCT__entry(
516                 __field(dev_t, dev)
517                 __field(xfs_ino_t, ino)
518                 __field(int, lock_flags)
519                 __field(unsigned long, caller_ip)
520         ),
521         TP_fast_assign(
522                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
523                 __entry->ino = ip->i_ino;
524                 __entry->lock_flags = lock_flags;
525                 __entry->caller_ip = caller_ip;
526         ),
527         TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
528                   MAJOR(__entry->dev), MINOR(__entry->dev),
529                   __entry->ino,
530                   __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
531                   (void *)__entry->caller_ip)
532 )
533
534 #define DEFINE_LOCK_EVENT(name) \
535 DEFINE_EVENT(xfs_lock_class, name, \
536         TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
537                  unsigned long caller_ip), \
538         TP_ARGS(ip,  lock_flags, caller_ip))
539 DEFINE_LOCK_EVENT(xfs_ilock);
540 DEFINE_LOCK_EVENT(xfs_ilock_nowait);
541 DEFINE_LOCK_EVENT(xfs_ilock_demote);
542 DEFINE_LOCK_EVENT(xfs_iunlock);
543
544 DECLARE_EVENT_CLASS(xfs_iget_class,
545         TP_PROTO(struct xfs_inode *ip),
546         TP_ARGS(ip),
547         TP_STRUCT__entry(
548                 __field(dev_t, dev)
549                 __field(xfs_ino_t, ino)
550         ),
551         TP_fast_assign(
552                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
553                 __entry->ino = ip->i_ino;
554         ),
555         TP_printk("dev %d:%d ino 0x%llx",
556                   MAJOR(__entry->dev), MINOR(__entry->dev),
557                   __entry->ino)
558 )
559
560 #define DEFINE_IGET_EVENT(name) \
561 DEFINE_EVENT(xfs_iget_class, name, \
562         TP_PROTO(struct xfs_inode *ip), \
563         TP_ARGS(ip))
564 DEFINE_IGET_EVENT(xfs_iget_skip);
565 DEFINE_IGET_EVENT(xfs_iget_reclaim);
566 DEFINE_IGET_EVENT(xfs_iget_found);
567 DEFINE_IGET_EVENT(xfs_iget_alloc);
568
569 DECLARE_EVENT_CLASS(xfs_inode_class,
570         TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
571         TP_ARGS(ip, caller_ip),
572         TP_STRUCT__entry(
573                 __field(dev_t, dev)
574                 __field(xfs_ino_t, ino)
575                 __field(int, count)
576                 __field(int, pincount)
577                 __field(unsigned long, caller_ip)
578         ),
579         TP_fast_assign(
580                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
581                 __entry->ino = ip->i_ino;
582                 __entry->count = atomic_read(&VFS_I(ip)->i_count);
583                 __entry->pincount = atomic_read(&ip->i_pincount);
584                 __entry->caller_ip = caller_ip;
585         ),
586         TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
587                   MAJOR(__entry->dev), MINOR(__entry->dev),
588                   __entry->ino,
589                   __entry->count,
590                   __entry->pincount,
591                   (char *)__entry->caller_ip)
592 )
593
594 #define DEFINE_INODE_EVENT(name) \
595 DEFINE_EVENT(xfs_inode_class, name, \
596         TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
597         TP_ARGS(ip, caller_ip))
598 DEFINE_INODE_EVENT(xfs_ihold);
599 DEFINE_INODE_EVENT(xfs_irele);
600 DEFINE_INODE_EVENT(xfs_inode_pin);
601 DEFINE_INODE_EVENT(xfs_inode_unpin);
602 DEFINE_INODE_EVENT(xfs_inode_unpin_nowait);
603
604 /* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
605 DEFINE_INODE_EVENT(xfs_inode);
606 #define xfs_itrace_entry(ip)    \
607         trace_xfs_inode(ip, _THIS_IP_)
608
609 DECLARE_EVENT_CLASS(xfs_dquot_class,
610         TP_PROTO(struct xfs_dquot *dqp),
611         TP_ARGS(dqp),
612         TP_STRUCT__entry(
613                 __field(dev_t, dev)
614                 __field(u32, id)
615                 __field(unsigned, flags)
616                 __field(unsigned, nrefs)
617                 __field(unsigned long long, res_bcount)
618                 __field(unsigned long long, bcount)
619                 __field(unsigned long long, icount)
620                 __field(unsigned long long, blk_hardlimit)
621                 __field(unsigned long long, blk_softlimit)
622                 __field(unsigned long long, ino_hardlimit)
623                 __field(unsigned long long, ino_softlimit)
624         ), \
625         TP_fast_assign(
626                 __entry->dev = dqp->q_mount->m_super->s_dev;
627                 __entry->id = be32_to_cpu(dqp->q_core.d_id);
628                 __entry->flags = dqp->dq_flags;
629                 __entry->nrefs = dqp->q_nrefs;
630                 __entry->res_bcount = dqp->q_res_bcount;
631                 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
632                 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
633                 __entry->blk_hardlimit =
634                         be64_to_cpu(dqp->q_core.d_blk_hardlimit);
635                 __entry->blk_softlimit =
636                         be64_to_cpu(dqp->q_core.d_blk_softlimit);
637                 __entry->ino_hardlimit =
638                         be64_to_cpu(dqp->q_core.d_ino_hardlimit);
639                 __entry->ino_softlimit =
640                         be64_to_cpu(dqp->q_core.d_ino_softlimit);
641         ),
642         TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
643                   "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
644                   "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
645                   MAJOR(__entry->dev), MINOR(__entry->dev),
646                   __entry->id,
647                   __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
648                   __entry->nrefs,
649                   __entry->res_bcount,
650                   __entry->bcount,
651                   __entry->blk_hardlimit,
652                   __entry->blk_softlimit,
653                   __entry->icount,
654                   __entry->ino_hardlimit,
655                   __entry->ino_softlimit)
656 )
657
658 #define DEFINE_DQUOT_EVENT(name) \
659 DEFINE_EVENT(xfs_dquot_class, name, \
660         TP_PROTO(struct xfs_dquot *dqp), \
661         TP_ARGS(dqp))
662 DEFINE_DQUOT_EVENT(xfs_dqadjust);
663 DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
664 DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
665 DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
666 DEFINE_DQUOT_EVENT(xfs_dqattach_found);
667 DEFINE_DQUOT_EVENT(xfs_dqattach_get);
668 DEFINE_DQUOT_EVENT(xfs_dqinit);
669 DEFINE_DQUOT_EVENT(xfs_dqreuse);
670 DEFINE_DQUOT_EVENT(xfs_dqalloc);
671 DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
672 DEFINE_DQUOT_EVENT(xfs_dqread);
673 DEFINE_DQUOT_EVENT(xfs_dqread_fail);
674 DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
675 DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
676 DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
677 DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
678 DEFINE_DQUOT_EVENT(xfs_dqget_hit);
679 DEFINE_DQUOT_EVENT(xfs_dqget_miss);
680 DEFINE_DQUOT_EVENT(xfs_dqput);
681 DEFINE_DQUOT_EVENT(xfs_dqput_wait);
682 DEFINE_DQUOT_EVENT(xfs_dqput_free);
683 DEFINE_DQUOT_EVENT(xfs_dqrele);
684 DEFINE_DQUOT_EVENT(xfs_dqflush);
685 DEFINE_DQUOT_EVENT(xfs_dqflush_force);
686 DEFINE_DQUOT_EVENT(xfs_dqflush_done);
687 /* not really iget events, but we re-use the format */
688 DEFINE_IGET_EVENT(xfs_dquot_dqalloc);
689 DEFINE_IGET_EVENT(xfs_dquot_dqdetach);
690
691 DECLARE_EVENT_CLASS(xfs_loggrant_class,
692         TP_PROTO(struct log *log, struct xlog_ticket *tic),
693         TP_ARGS(log, tic),
694         TP_STRUCT__entry(
695                 __field(dev_t, dev)
696                 __field(unsigned, trans_type)
697                 __field(char, ocnt)
698                 __field(char, cnt)
699                 __field(int, curr_res)
700                 __field(int, unit_res)
701                 __field(unsigned int, flags)
702                 __field(void *, reserve_headq)
703                 __field(void *, write_headq)
704                 __field(int, grant_reserve_cycle)
705                 __field(int, grant_reserve_bytes)
706                 __field(int, grant_write_cycle)
707                 __field(int, grant_write_bytes)
708                 __field(int, curr_cycle)
709                 __field(int, curr_block)
710                 __field(xfs_lsn_t, tail_lsn)
711         ),
712         TP_fast_assign(
713                 __entry->dev = log->l_mp->m_super->s_dev;
714                 __entry->trans_type = tic->t_trans_type;
715                 __entry->ocnt = tic->t_ocnt;
716                 __entry->cnt = tic->t_cnt;
717                 __entry->curr_res = tic->t_curr_res;
718                 __entry->unit_res = tic->t_unit_res;
719                 __entry->flags = tic->t_flags;
720                 __entry->reserve_headq = log->l_reserve_headq;
721                 __entry->write_headq = log->l_write_headq;
722                 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle;
723                 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes;
724                 __entry->grant_write_cycle = log->l_grant_write_cycle;
725                 __entry->grant_write_bytes = log->l_grant_write_bytes;
726                 __entry->curr_cycle = log->l_curr_cycle;
727                 __entry->curr_block = log->l_curr_block;
728                 __entry->tail_lsn = log->l_tail_lsn;
729         ),
730         TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
731                   "t_unit_res %u t_flags %s reserve_headq 0x%p "
732                   "write_headq 0x%p grant_reserve_cycle %d "
733                   "grant_reserve_bytes %d grant_write_cycle %d "
734                   "grant_write_bytes %d curr_cycle %d curr_block %d "
735                   "tail_cycle %d tail_block %d",
736                   MAJOR(__entry->dev), MINOR(__entry->dev),
737                   __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
738                   __entry->ocnt,
739                   __entry->cnt,
740                   __entry->curr_res,
741                   __entry->unit_res,
742                   __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
743                   __entry->reserve_headq,
744                   __entry->write_headq,
745                   __entry->grant_reserve_cycle,
746                   __entry->grant_reserve_bytes,
747                   __entry->grant_write_cycle,
748                   __entry->grant_write_bytes,
749                   __entry->curr_cycle,
750                   __entry->curr_block,
751                   CYCLE_LSN(__entry->tail_lsn),
752                   BLOCK_LSN(__entry->tail_lsn)
753         )
754 )
755
756 #define DEFINE_LOGGRANT_EVENT(name) \
757 DEFINE_EVENT(xfs_loggrant_class, name, \
758         TP_PROTO(struct log *log, struct xlog_ticket *tic), \
759         TP_ARGS(log, tic))
760 DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
761 DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
762 DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
763 DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
764 DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
765 DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
766 DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
767 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
768 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
769 DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
770 DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
771 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
772 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
773 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
774 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
775 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
776 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
777 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
778 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
779 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
780 DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
781 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
782 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
783 DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
784
785 DECLARE_EVENT_CLASS(xfs_file_class,
786         TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
787         TP_ARGS(ip, count, offset, flags),
788         TP_STRUCT__entry(
789                 __field(dev_t, dev)
790                 __field(xfs_ino_t, ino)
791                 __field(xfs_fsize_t, size)
792                 __field(xfs_fsize_t, new_size)
793                 __field(loff_t, offset)
794                 __field(size_t, count)
795                 __field(int, flags)
796         ),
797         TP_fast_assign(
798                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
799                 __entry->ino = ip->i_ino;
800                 __entry->size = ip->i_d.di_size;
801                 __entry->new_size = ip->i_new_size;
802                 __entry->offset = offset;
803                 __entry->count = count;
804                 __entry->flags = flags;
805         ),
806         TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
807                   "offset 0x%llx count 0x%zx ioflags %s",
808                   MAJOR(__entry->dev), MINOR(__entry->dev),
809                   __entry->ino,
810                   __entry->size,
811                   __entry->new_size,
812                   __entry->offset,
813                   __entry->count,
814                   __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
815 )
816
817 #define DEFINE_RW_EVENT(name)           \
818 DEFINE_EVENT(xfs_file_class, name,      \
819         TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
820         TP_ARGS(ip, count, offset, flags))
821 DEFINE_RW_EVENT(xfs_file_read);
822 DEFINE_RW_EVENT(xfs_file_buffered_write);
823 DEFINE_RW_EVENT(xfs_file_direct_write);
824 DEFINE_RW_EVENT(xfs_file_splice_read);
825 DEFINE_RW_EVENT(xfs_file_splice_write);
826
827 DECLARE_EVENT_CLASS(xfs_page_class,
828         TP_PROTO(struct inode *inode, struct page *page, unsigned long off),
829         TP_ARGS(inode, page, off),
830         TP_STRUCT__entry(
831                 __field(dev_t, dev)
832                 __field(xfs_ino_t, ino)
833                 __field(pgoff_t, pgoff)
834                 __field(loff_t, size)
835                 __field(unsigned long, offset)
836                 __field(int, delalloc)
837                 __field(int, unmapped)
838                 __field(int, unwritten)
839         ),
840         TP_fast_assign(
841                 int delalloc = -1, unmapped = -1, unwritten = -1;
842
843                 if (page_has_buffers(page))
844                         xfs_count_page_state(page, &delalloc,
845                                              &unmapped, &unwritten);
846                 __entry->dev = inode->i_sb->s_dev;
847                 __entry->ino = XFS_I(inode)->i_ino;
848                 __entry->pgoff = page_offset(page);
849                 __entry->size = i_size_read(inode);
850                 __entry->offset = off;
851                 __entry->delalloc = delalloc;
852                 __entry->unmapped = unmapped;
853                 __entry->unwritten = unwritten;
854         ),
855         TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
856                   "delalloc %d unmapped %d unwritten %d",
857                   MAJOR(__entry->dev), MINOR(__entry->dev),
858                   __entry->ino,
859                   __entry->pgoff,
860                   __entry->size,
861                   __entry->offset,
862                   __entry->delalloc,
863                   __entry->unmapped,
864                   __entry->unwritten)
865 )
866
867 #define DEFINE_PAGE_EVENT(name)         \
868 DEFINE_EVENT(xfs_page_class, name,      \
869         TP_PROTO(struct inode *inode, struct page *page, unsigned long off),    \
870         TP_ARGS(inode, page, off))
871 DEFINE_PAGE_EVENT(xfs_writepage);
872 DEFINE_PAGE_EVENT(xfs_releasepage);
873 DEFINE_PAGE_EVENT(xfs_invalidatepage);
874
875 DECLARE_EVENT_CLASS(xfs_iomap_class,
876         TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
877                  int flags, struct xfs_bmbt_irec *irec),
878         TP_ARGS(ip, offset, count, flags, irec),
879         TP_STRUCT__entry(
880                 __field(dev_t, dev)
881                 __field(xfs_ino_t, ino)
882                 __field(loff_t, size)
883                 __field(loff_t, new_size)
884                 __field(loff_t, offset)
885                 __field(size_t, count)
886                 __field(int, flags)
887                 __field(xfs_fileoff_t, startoff)
888                 __field(xfs_fsblock_t, startblock)
889                 __field(xfs_filblks_t, blockcount)
890         ),
891         TP_fast_assign(
892                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
893                 __entry->ino = ip->i_ino;
894                 __entry->size = ip->i_d.di_size;
895                 __entry->new_size = ip->i_new_size;
896                 __entry->offset = offset;
897                 __entry->count = count;
898                 __entry->flags = flags;
899                 __entry->startoff = irec ? irec->br_startoff : 0;
900                 __entry->startblock = irec ? irec->br_startblock : 0;
901                 __entry->blockcount = irec ? irec->br_blockcount : 0;
902         ),
903         TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
904                   "offset 0x%llx count %zd flags %s "
905                   "startoff 0x%llx startblock %lld blockcount 0x%llx",
906                   MAJOR(__entry->dev), MINOR(__entry->dev),
907                   __entry->ino,
908                   __entry->size,
909                   __entry->new_size,
910                   __entry->offset,
911                   __entry->count,
912                   __print_flags(__entry->flags, "|", BMAPI_FLAGS),
913                   __entry->startoff,
914                   (__int64_t)__entry->startblock,
915                   __entry->blockcount)
916 )
917
918 #define DEFINE_IOMAP_EVENT(name)        \
919 DEFINE_EVENT(xfs_iomap_class, name,     \
920         TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
921                  int flags, struct xfs_bmbt_irec *irec),                \
922         TP_ARGS(ip, offset, count, flags, irec))
923 DEFINE_IOMAP_EVENT(xfs_iomap_enter);
924 DEFINE_IOMAP_EVENT(xfs_iomap_found);
925 DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
926
927 DECLARE_EVENT_CLASS(xfs_simple_io_class,
928         TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
929         TP_ARGS(ip, offset, count),
930         TP_STRUCT__entry(
931                 __field(dev_t, dev)
932                 __field(xfs_ino_t, ino)
933                 __field(loff_t, size)
934                 __field(loff_t, new_size)
935                 __field(loff_t, offset)
936                 __field(size_t, count)
937         ),
938         TP_fast_assign(
939                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
940                 __entry->ino = ip->i_ino;
941                 __entry->size = ip->i_d.di_size;
942                 __entry->new_size = ip->i_new_size;
943                 __entry->offset = offset;
944                 __entry->count = count;
945         ),
946         TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
947                   "offset 0x%llx count %zd",
948                   MAJOR(__entry->dev), MINOR(__entry->dev),
949                   __entry->ino,
950                   __entry->size,
951                   __entry->new_size,
952                   __entry->offset,
953                   __entry->count)
954 );
955
956 #define DEFINE_SIMPLE_IO_EVENT(name)    \
957 DEFINE_EVENT(xfs_simple_io_class, name, \
958         TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),        \
959         TP_ARGS(ip, offset, count))
960 DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
961 DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
962
963
964 TRACE_EVENT(xfs_itruncate_start,
965         TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
966                  xfs_off_t toss_start, xfs_off_t toss_finish),
967         TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
968         TP_STRUCT__entry(
969                 __field(dev_t, dev)
970                 __field(xfs_ino_t, ino)
971                 __field(xfs_fsize_t, size)
972                 __field(xfs_fsize_t, new_size)
973                 __field(xfs_off_t, toss_start)
974                 __field(xfs_off_t, toss_finish)
975                 __field(int, flag)
976         ),
977         TP_fast_assign(
978                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
979                 __entry->ino = ip->i_ino;
980                 __entry->size = ip->i_d.di_size;
981                 __entry->new_size = new_size;
982                 __entry->toss_start = toss_start;
983                 __entry->toss_finish = toss_finish;
984                 __entry->flag = flag;
985         ),
986         TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
987                   "toss start 0x%llx toss finish 0x%llx",
988                   MAJOR(__entry->dev), MINOR(__entry->dev),
989                   __entry->ino,
990                   __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
991                   __entry->size,
992                   __entry->new_size,
993                   __entry->toss_start,
994                   __entry->toss_finish)
995 );
996
997 DECLARE_EVENT_CLASS(xfs_itrunc_class,
998         TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
999         TP_ARGS(ip, new_size),
1000         TP_STRUCT__entry(
1001                 __field(dev_t, dev)
1002                 __field(xfs_ino_t, ino)
1003                 __field(xfs_fsize_t, size)
1004                 __field(xfs_fsize_t, new_size)
1005         ),
1006         TP_fast_assign(
1007                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1008                 __entry->ino = ip->i_ino;
1009                 __entry->size = ip->i_d.di_size;
1010                 __entry->new_size = new_size;
1011         ),
1012         TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1013                   MAJOR(__entry->dev), MINOR(__entry->dev),
1014                   __entry->ino,
1015                   __entry->size,
1016                   __entry->new_size)
1017 )
1018
1019 #define DEFINE_ITRUNC_EVENT(name) \
1020 DEFINE_EVENT(xfs_itrunc_class, name, \
1021         TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1022         TP_ARGS(ip, new_size))
1023 DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
1024 DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
1025
1026 TRACE_EVENT(xfs_pagecache_inval,
1027         TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1028         TP_ARGS(ip, start, finish),
1029         TP_STRUCT__entry(
1030                 __field(dev_t, dev)
1031                 __field(xfs_ino_t, ino)
1032                 __field(xfs_fsize_t, size)
1033                 __field(xfs_off_t, start)
1034                 __field(xfs_off_t, finish)
1035         ),
1036         TP_fast_assign(
1037                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1038                 __entry->ino = ip->i_ino;
1039                 __entry->size = ip->i_d.di_size;
1040                 __entry->start = start;
1041                 __entry->finish = finish;
1042         ),
1043         TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1044                   MAJOR(__entry->dev), MINOR(__entry->dev),
1045                   __entry->ino,
1046                   __entry->size,
1047                   __entry->start,
1048                   __entry->finish)
1049 );
1050
1051 TRACE_EVENT(xfs_bunmap,
1052         TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1053                  int flags, unsigned long caller_ip),
1054         TP_ARGS(ip, bno, len, flags, caller_ip),
1055         TP_STRUCT__entry(
1056                 __field(dev_t, dev)
1057                 __field(xfs_ino_t, ino)
1058                 __field(xfs_fsize_t, size)
1059                 __field(xfs_fileoff_t, bno)
1060                 __field(xfs_filblks_t, len)
1061                 __field(unsigned long, caller_ip)
1062                 __field(int, flags)
1063         ),
1064         TP_fast_assign(
1065                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1066                 __entry->ino = ip->i_ino;
1067                 __entry->size = ip->i_d.di_size;
1068                 __entry->bno = bno;
1069                 __entry->len = len;
1070                 __entry->caller_ip = caller_ip;
1071                 __entry->flags = flags;
1072         ),
1073         TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1074                   "flags %s caller %pf",
1075                   MAJOR(__entry->dev), MINOR(__entry->dev),
1076                   __entry->ino,
1077                   __entry->size,
1078                   __entry->bno,
1079                   __entry->len,
1080                   __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1081                   (void *)__entry->caller_ip)
1082
1083 );
1084
1085 #define XFS_BUSY_SYNC \
1086         { 0,    "async" }, \
1087         { 1,    "sync" }
1088
1089 TRACE_EVENT(xfs_alloc_busy,
1090         TP_PROTO(struct xfs_trans *trans, xfs_agnumber_t agno,
1091                  xfs_agblock_t agbno, xfs_extlen_t len, int sync),
1092         TP_ARGS(trans, agno, agbno, len, sync),
1093         TP_STRUCT__entry(
1094                 __field(dev_t, dev)
1095                 __field(struct xfs_trans *, tp)
1096                 __field(int, tid)
1097                 __field(xfs_agnumber_t, agno)
1098                 __field(xfs_agblock_t, agbno)
1099                 __field(xfs_extlen_t, len)
1100                 __field(int, sync)
1101         ),
1102         TP_fast_assign(
1103                 __entry->dev = trans->t_mountp->m_super->s_dev;
1104                 __entry->tp = trans;
1105                 __entry->tid = trans->t_ticket->t_tid;
1106                 __entry->agno = agno;
1107                 __entry->agbno = agbno;
1108                 __entry->len = len;
1109                 __entry->sync = sync;
1110         ),
1111         TP_printk("dev %d:%d trans 0x%p tid 0x%x agno %u agbno %u len %u %s",
1112                   MAJOR(__entry->dev), MINOR(__entry->dev),
1113                   __entry->tp,
1114                   __entry->tid,
1115                   __entry->agno,
1116                   __entry->agbno,
1117                   __entry->len,
1118                   __print_symbolic(__entry->sync, XFS_BUSY_SYNC))
1119
1120 );
1121
1122 TRACE_EVENT(xfs_alloc_unbusy,
1123         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1124                  xfs_agblock_t agbno, xfs_extlen_t len),
1125         TP_ARGS(mp, agno, agbno, len),
1126         TP_STRUCT__entry(
1127                 __field(dev_t, dev)
1128                 __field(xfs_agnumber_t, agno)
1129                 __field(xfs_agblock_t, agbno)
1130                 __field(xfs_extlen_t, len)
1131         ),
1132         TP_fast_assign(
1133                 __entry->dev = mp->m_super->s_dev;
1134                 __entry->agno = agno;
1135                 __entry->agbno = agbno;
1136                 __entry->len = len;
1137         ),
1138         TP_printk("dev %d:%d agno %u agbno %u len %u",
1139                   MAJOR(__entry->dev), MINOR(__entry->dev),
1140                   __entry->agno,
1141                   __entry->agbno,
1142                   __entry->len)
1143 );
1144
1145 #define XFS_BUSY_STATES \
1146         { 0,    "missing" }, \
1147         { 1,    "found" }
1148
1149 TRACE_EVENT(xfs_alloc_busysearch,
1150         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1151                  xfs_agblock_t agbno, xfs_extlen_t len, int found),
1152         TP_ARGS(mp, agno, agbno, len, found),
1153         TP_STRUCT__entry(
1154                 __field(dev_t, dev)
1155                 __field(xfs_agnumber_t, agno)
1156                 __field(xfs_agblock_t, agbno)
1157                 __field(xfs_extlen_t, len)
1158                 __field(int, found)
1159         ),
1160         TP_fast_assign(
1161                 __entry->dev = mp->m_super->s_dev;
1162                 __entry->agno = agno;
1163                 __entry->agbno = agbno;
1164                 __entry->len = len;
1165                 __entry->found = found;
1166         ),
1167         TP_printk("dev %d:%d agno %u agbno %u len %u %s",
1168                   MAJOR(__entry->dev), MINOR(__entry->dev),
1169                   __entry->agno,
1170                   __entry->agbno,
1171                   __entry->len,
1172                   __print_symbolic(__entry->found, XFS_BUSY_STATES))
1173 );
1174
1175 TRACE_EVENT(xfs_trans_commit_lsn,
1176         TP_PROTO(struct xfs_trans *trans),
1177         TP_ARGS(trans),
1178         TP_STRUCT__entry(
1179                 __field(dev_t, dev)
1180                 __field(struct xfs_trans *, tp)
1181                 __field(xfs_lsn_t, lsn)
1182         ),
1183         TP_fast_assign(
1184                 __entry->dev = trans->t_mountp->m_super->s_dev;
1185                 __entry->tp = trans;
1186                 __entry->lsn = trans->t_commit_lsn;
1187         ),
1188         TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1189                   MAJOR(__entry->dev), MINOR(__entry->dev),
1190                   __entry->tp,
1191                   __entry->lsn)
1192 );
1193
1194 TRACE_EVENT(xfs_agf,
1195         TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1196                  unsigned long caller_ip),
1197         TP_ARGS(mp, agf, flags, caller_ip),
1198         TP_STRUCT__entry(
1199                 __field(dev_t, dev)
1200                 __field(xfs_agnumber_t, agno)
1201                 __field(int, flags)
1202                 __field(__u32, length)
1203                 __field(__u32, bno_root)
1204                 __field(__u32, cnt_root)
1205                 __field(__u32, bno_level)
1206                 __field(__u32, cnt_level)
1207                 __field(__u32, flfirst)
1208                 __field(__u32, fllast)
1209                 __field(__u32, flcount)
1210                 __field(__u32, freeblks)
1211                 __field(__u32, longest)
1212                 __field(unsigned long, caller_ip)
1213         ),
1214         TP_fast_assign(
1215                 __entry->dev = mp->m_super->s_dev;
1216                 __entry->agno = be32_to_cpu(agf->agf_seqno),
1217                 __entry->flags = flags;
1218                 __entry->length = be32_to_cpu(agf->agf_length),
1219                 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1220                 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1221                 __entry->bno_level =
1222                                 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1223                 __entry->cnt_level =
1224                                 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1225                 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1226                 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1227                 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1228                 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1229                 __entry->longest = be32_to_cpu(agf->agf_longest);
1230                 __entry->caller_ip = caller_ip;
1231         ),
1232         TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1233                   "levels b %u c %u flfirst %u fllast %u flcount %u "
1234                   "freeblks %u longest %u caller %pf",
1235                   MAJOR(__entry->dev), MINOR(__entry->dev),
1236                   __entry->agno,
1237                   __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1238                   __entry->length,
1239                   __entry->bno_root,
1240                   __entry->cnt_root,
1241                   __entry->bno_level,
1242                   __entry->cnt_level,
1243                   __entry->flfirst,
1244                   __entry->fllast,
1245                   __entry->flcount,
1246                   __entry->freeblks,
1247                   __entry->longest,
1248                   (void *)__entry->caller_ip)
1249 );
1250
1251 TRACE_EVENT(xfs_free_extent,
1252         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1253                  xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1254         TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1255         TP_STRUCT__entry(
1256                 __field(dev_t, dev)
1257                 __field(xfs_agnumber_t, agno)
1258                 __field(xfs_agblock_t, agbno)
1259                 __field(xfs_extlen_t, len)
1260                 __field(int, isfl)
1261                 __field(int, haveleft)
1262                 __field(int, haveright)
1263         ),
1264         TP_fast_assign(
1265                 __entry->dev = mp->m_super->s_dev;
1266                 __entry->agno = agno;
1267                 __entry->agbno = agbno;
1268                 __entry->len = len;
1269                 __entry->isfl = isfl;
1270                 __entry->haveleft = haveleft;
1271                 __entry->haveright = haveright;
1272         ),
1273         TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1274                   MAJOR(__entry->dev), MINOR(__entry->dev),
1275                   __entry->agno,
1276                   __entry->agbno,
1277                   __entry->len,
1278                   __entry->isfl,
1279                   __entry->haveleft ?
1280                         (__entry->haveright ? "both" : "left") :
1281                         (__entry->haveright ? "right" : "none"))
1282
1283 );
1284
1285 DECLARE_EVENT_CLASS(xfs_alloc_class,
1286         TP_PROTO(struct xfs_alloc_arg *args),
1287         TP_ARGS(args),
1288         TP_STRUCT__entry(
1289                 __field(dev_t, dev)
1290                 __field(xfs_agnumber_t, agno)
1291                 __field(xfs_agblock_t, agbno)
1292                 __field(xfs_extlen_t, minlen)
1293                 __field(xfs_extlen_t, maxlen)
1294                 __field(xfs_extlen_t, mod)
1295                 __field(xfs_extlen_t, prod)
1296                 __field(xfs_extlen_t, minleft)
1297                 __field(xfs_extlen_t, total)
1298                 __field(xfs_extlen_t, alignment)
1299                 __field(xfs_extlen_t, minalignslop)
1300                 __field(xfs_extlen_t, len)
1301                 __field(short, type)
1302                 __field(short, otype)
1303                 __field(char, wasdel)
1304                 __field(char, wasfromfl)
1305                 __field(char, isfl)
1306                 __field(char, userdata)
1307                 __field(xfs_fsblock_t, firstblock)
1308         ),
1309         TP_fast_assign(
1310                 __entry->dev = args->mp->m_super->s_dev;
1311                 __entry->agno = args->agno;
1312                 __entry->agbno = args->agbno;
1313                 __entry->minlen = args->minlen;
1314                 __entry->maxlen = args->maxlen;
1315                 __entry->mod = args->mod;
1316                 __entry->prod = args->prod;
1317                 __entry->minleft = args->minleft;
1318                 __entry->total = args->total;
1319                 __entry->alignment = args->alignment;
1320                 __entry->minalignslop = args->minalignslop;
1321                 __entry->len = args->len;
1322                 __entry->type = args->type;
1323                 __entry->otype = args->otype;
1324                 __entry->wasdel = args->wasdel;
1325                 __entry->wasfromfl = args->wasfromfl;
1326                 __entry->isfl = args->isfl;
1327                 __entry->userdata = args->userdata;
1328                 __entry->firstblock = args->firstblock;
1329         ),
1330         TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1331                   "prod %u minleft %u total %u alignment %u minalignslop %u "
1332                   "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1333                   "userdata %d firstblock 0x%llx",
1334                   MAJOR(__entry->dev), MINOR(__entry->dev),
1335                   __entry->agno,
1336                   __entry->agbno,
1337                   __entry->minlen,
1338                   __entry->maxlen,
1339                   __entry->mod,
1340                   __entry->prod,
1341                   __entry->minleft,
1342                   __entry->total,
1343                   __entry->alignment,
1344                   __entry->minalignslop,
1345                   __entry->len,
1346                   __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1347                   __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1348                   __entry->wasdel,
1349                   __entry->wasfromfl,
1350                   __entry->isfl,
1351                   __entry->userdata,
1352                   __entry->firstblock)
1353 )
1354
1355 #define DEFINE_ALLOC_EVENT(name) \
1356 DEFINE_EVENT(xfs_alloc_class, name, \
1357         TP_PROTO(struct xfs_alloc_arg *args), \
1358         TP_ARGS(args))
1359 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1360 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1361 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1362 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1363 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1364 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1365 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1366 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1367 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1368 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1369 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1370 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1371 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1372 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1373 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1374 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1375 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1376 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1377 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1378 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1379 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1380
1381 DECLARE_EVENT_CLASS(xfs_dir2_class,
1382         TP_PROTO(struct xfs_da_args *args),
1383         TP_ARGS(args),
1384         TP_STRUCT__entry(
1385                 __field(dev_t, dev)
1386                 __field(xfs_ino_t, ino)
1387                 __dynamic_array(char, name, args->namelen)
1388                 __field(int, namelen)
1389                 __field(xfs_dahash_t, hashval)
1390                 __field(xfs_ino_t, inumber)
1391                 __field(int, op_flags)
1392         ),
1393         TP_fast_assign(
1394                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1395                 __entry->ino = args->dp->i_ino;
1396                 if (args->namelen)
1397                         memcpy(__get_str(name), args->name, args->namelen);
1398                 __entry->namelen = args->namelen;
1399                 __entry->hashval = args->hashval;
1400                 __entry->inumber = args->inumber;
1401                 __entry->op_flags = args->op_flags;
1402         ),
1403         TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1404                   "inumber 0x%llx op_flags %s",
1405                   MAJOR(__entry->dev), MINOR(__entry->dev),
1406                   __entry->ino,
1407                   __entry->namelen,
1408                   __entry->namelen ? __get_str(name) : NULL,
1409                   __entry->namelen,
1410                   __entry->hashval,
1411                   __entry->inumber,
1412                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1413 )
1414
1415 #define DEFINE_DIR2_EVENT(name) \
1416 DEFINE_EVENT(xfs_dir2_class, name, \
1417         TP_PROTO(struct xfs_da_args *args), \
1418         TP_ARGS(args))
1419 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1420 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1421 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1422 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1423 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1424 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1425 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1426 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1427 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1428 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1429 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1430 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1431 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1432 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1433 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1434 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1435 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1436 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1437 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1438 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1439 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1440 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1441 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1442 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1443 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1444
1445 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1446         TP_PROTO(struct xfs_da_args *args, int idx),
1447         TP_ARGS(args, idx),
1448         TP_STRUCT__entry(
1449                 __field(dev_t, dev)
1450                 __field(xfs_ino_t, ino)
1451                 __field(int, op_flags)
1452                 __field(int, idx)
1453         ),
1454         TP_fast_assign(
1455                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1456                 __entry->ino = args->dp->i_ino;
1457                 __entry->op_flags = args->op_flags;
1458                 __entry->idx = idx;
1459         ),
1460         TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1461                   MAJOR(__entry->dev), MINOR(__entry->dev),
1462                   __entry->ino,
1463                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1464                   __entry->idx)
1465 )
1466
1467 #define DEFINE_DIR2_SPACE_EVENT(name) \
1468 DEFINE_EVENT(xfs_dir2_space_class, name, \
1469         TP_PROTO(struct xfs_da_args *args, int idx), \
1470         TP_ARGS(args, idx))
1471 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1472 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1473 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1474 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1475
1476 TRACE_EVENT(xfs_dir2_leafn_moveents,
1477         TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1478         TP_ARGS(args, src_idx, dst_idx, count),
1479         TP_STRUCT__entry(
1480                 __field(dev_t, dev)
1481                 __field(xfs_ino_t, ino)
1482                 __field(int, op_flags)
1483                 __field(int, src_idx)
1484                 __field(int, dst_idx)
1485                 __field(int, count)
1486         ),
1487         TP_fast_assign(
1488                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1489                 __entry->ino = args->dp->i_ino;
1490                 __entry->op_flags = args->op_flags;
1491                 __entry->src_idx = src_idx;
1492                 __entry->dst_idx = dst_idx;
1493                 __entry->count = count;
1494         ),
1495         TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1496                   "src_idx %d dst_idx %d count %d",
1497                   MAJOR(__entry->dev), MINOR(__entry->dev),
1498                   __entry->ino,
1499                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1500                   __entry->src_idx,
1501                   __entry->dst_idx,
1502                   __entry->count)
1503 );
1504
1505 #define XFS_SWAPEXT_INODES \
1506         { 0,    "target" }, \
1507         { 1,    "temp" }
1508
1509 #define XFS_INODE_FORMAT_STR \
1510         { 0,    "invalid" }, \
1511         { 1,    "local" }, \
1512         { 2,    "extent" }, \
1513         { 3,    "btree" }
1514
1515 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1516         TP_PROTO(struct xfs_inode *ip, int which),
1517         TP_ARGS(ip, which),
1518         TP_STRUCT__entry(
1519                 __field(dev_t, dev)
1520                 __field(int, which)
1521                 __field(xfs_ino_t, ino)
1522                 __field(int, format)
1523                 __field(int, nex)
1524                 __field(int, max_nex)
1525                 __field(int, broot_size)
1526                 __field(int, fork_off)
1527         ),
1528         TP_fast_assign(
1529                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1530                 __entry->which = which;
1531                 __entry->ino = ip->i_ino;
1532                 __entry->format = ip->i_d.di_format;
1533                 __entry->nex = ip->i_d.di_nextents;
1534                 __entry->max_nex = ip->i_df.if_ext_max;
1535                 __entry->broot_size = ip->i_df.if_broot_bytes;
1536                 __entry->fork_off = XFS_IFORK_BOFF(ip);
1537         ),
1538         TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1539                   "Max in-fork extents %d, broot size %d, fork offset %d",
1540                   MAJOR(__entry->dev), MINOR(__entry->dev),
1541                   __entry->ino,
1542                   __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1543                   __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1544                   __entry->nex,
1545                   __entry->max_nex,
1546                   __entry->broot_size,
1547                   __entry->fork_off)
1548 )
1549
1550 #define DEFINE_SWAPEXT_EVENT(name) \
1551 DEFINE_EVENT(xfs_swap_extent_class, name, \
1552         TP_PROTO(struct xfs_inode *ip, int which), \
1553         TP_ARGS(ip, which))
1554
1555 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1556 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1557
1558 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1559         TP_PROTO(struct log *log, struct xlog_recover *trans,
1560                 struct xlog_recover_item *item, int pass),
1561         TP_ARGS(log, trans, item, pass),
1562         TP_STRUCT__entry(
1563                 __field(dev_t, dev)
1564                 __field(unsigned long, item)
1565                 __field(xlog_tid_t, tid)
1566                 __field(int, type)
1567                 __field(int, pass)
1568                 __field(int, count)
1569                 __field(int, total)
1570         ),
1571         TP_fast_assign(
1572                 __entry->dev = log->l_mp->m_super->s_dev;
1573                 __entry->item = (unsigned long)item;
1574                 __entry->tid = trans->r_log_tid;
1575                 __entry->type = ITEM_TYPE(item);
1576                 __entry->pass = pass;
1577                 __entry->count = item->ri_cnt;
1578                 __entry->total = item->ri_total;
1579         ),
1580         TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1581                   "item region count/total %d/%d",
1582                   MAJOR(__entry->dev), MINOR(__entry->dev),
1583                   __entry->tid,
1584                   __entry->pass,
1585                   (void *)__entry->item,
1586                   __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1587                   __entry->count,
1588                   __entry->total)
1589 )
1590
1591 #define DEFINE_LOG_RECOVER_ITEM(name) \
1592 DEFINE_EVENT(xfs_log_recover_item_class, name, \
1593         TP_PROTO(struct log *log, struct xlog_recover *trans, \
1594                 struct xlog_recover_item *item, int pass), \
1595         TP_ARGS(log, trans, item, pass))
1596
1597 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1598 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1599 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1600 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1601 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1602
1603 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1604         TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f),
1605         TP_ARGS(log, buf_f),
1606         TP_STRUCT__entry(
1607                 __field(dev_t, dev)
1608                 __field(__int64_t, blkno)
1609                 __field(unsigned short, len)
1610                 __field(unsigned short, flags)
1611                 __field(unsigned short, size)
1612                 __field(unsigned int, map_size)
1613         ),
1614         TP_fast_assign(
1615                 __entry->dev = log->l_mp->m_super->s_dev;
1616                 __entry->blkno = buf_f->blf_blkno;
1617                 __entry->len = buf_f->blf_len;
1618                 __entry->flags = buf_f->blf_flags;
1619                 __entry->size = buf_f->blf_size;
1620                 __entry->map_size = buf_f->blf_map_size;
1621         ),
1622         TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1623                         "map_size %d",
1624                   MAJOR(__entry->dev), MINOR(__entry->dev),
1625                   __entry->blkno,
1626                   __entry->len,
1627                   __entry->flags,
1628                   __entry->size,
1629                   __entry->map_size)
1630 )
1631
1632 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1633 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1634         TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \
1635         TP_ARGS(log, buf_f))
1636
1637 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1638 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1639 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1640 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1641 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1642 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1643 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1644 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1645
1646 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1647         TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f),
1648         TP_ARGS(log, in_f),
1649         TP_STRUCT__entry(
1650                 __field(dev_t, dev)
1651                 __field(xfs_ino_t, ino)
1652                 __field(unsigned short, size)
1653                 __field(int, fields)
1654                 __field(unsigned short, asize)
1655                 __field(unsigned short, dsize)
1656                 __field(__int64_t, blkno)
1657                 __field(int, len)
1658                 __field(int, boffset)
1659         ),
1660         TP_fast_assign(
1661                 __entry->dev = log->l_mp->m_super->s_dev;
1662                 __entry->ino = in_f->ilf_ino;
1663                 __entry->size = in_f->ilf_size;
1664                 __entry->fields = in_f->ilf_fields;
1665                 __entry->asize = in_f->ilf_asize;
1666                 __entry->dsize = in_f->ilf_dsize;
1667                 __entry->blkno = in_f->ilf_blkno;
1668                 __entry->len = in_f->ilf_len;
1669                 __entry->boffset = in_f->ilf_boffset;
1670         ),
1671         TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1672                         "dsize %d, blkno 0x%llx, len %d, boffset %d",
1673                   MAJOR(__entry->dev), MINOR(__entry->dev),
1674                   __entry->ino,
1675                   __entry->size,
1676                   __entry->fields,
1677                   __entry->asize,
1678                   __entry->dsize,
1679                   __entry->blkno,
1680                   __entry->len,
1681                   __entry->boffset)
1682 )
1683 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1684 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1685         TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \
1686         TP_ARGS(log, in_f))
1687
1688 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1689 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1690 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1691
1692 #endif /* _TRACE_XFS_H */
1693
1694 #undef TRACE_INCLUDE_PATH
1695 #define TRACE_INCLUDE_PATH .
1696 #define TRACE_INCLUDE_FILE xfs_trace
1697 #include <trace/define_trace.h>