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