xfs: Improve scalability of busy extent tracking
[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 #define XFS_BUSY_SYNC \
1063         { 0,    "async" }, \
1064         { 1,    "sync" }
1065
1066 TRACE_EVENT(xfs_alloc_busy,
1067         TP_PROTO(struct xfs_trans *trans, xfs_agnumber_t agno,
1068                  xfs_agblock_t agbno, xfs_extlen_t len, int sync),
1069         TP_ARGS(trans, agno, agbno, len, sync),
1070         TP_STRUCT__entry(
1071                 __field(dev_t, dev)
1072                 __field(struct xfs_trans *, tp)
1073                 __field(int, tid)
1074                 __field(xfs_agnumber_t, agno)
1075                 __field(xfs_agblock_t, agbno)
1076                 __field(xfs_extlen_t, len)
1077                 __field(int, sync)
1078         ),
1079         TP_fast_assign(
1080                 __entry->dev = trans->t_mountp->m_super->s_dev;
1081                 __entry->tp = trans;
1082                 __entry->tid = trans->t_ticket->t_tid;
1083                 __entry->agno = agno;
1084                 __entry->agbno = agbno;
1085                 __entry->len = len;
1086                 __entry->sync = sync;
1087         ),
1088         TP_printk("dev %d:%d trans 0x%p tid 0x%x agno %u agbno %u len %u %s",
1089                   MAJOR(__entry->dev), MINOR(__entry->dev),
1090                   __entry->tp,
1091                   __entry->tid,
1092                   __entry->agno,
1093                   __entry->agbno,
1094                   __entry->len,
1095                   __print_symbolic(__entry->sync, XFS_BUSY_SYNC))
1096
1097 );
1098
1099 TRACE_EVENT(xfs_alloc_unbusy,
1100         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1101                  xfs_agblock_t agbno, xfs_extlen_t len),
1102         TP_ARGS(mp, agno, agbno, len),
1103         TP_STRUCT__entry(
1104                 __field(dev_t, dev)
1105                 __field(xfs_agnumber_t, agno)
1106                 __field(xfs_agblock_t, agbno)
1107                 __field(xfs_extlen_t, len)
1108         ),
1109         TP_fast_assign(
1110                 __entry->dev = mp->m_super->s_dev;
1111                 __entry->agno = agno;
1112                 __entry->agbno = agbno;
1113                 __entry->len = len;
1114         ),
1115         TP_printk("dev %d:%d agno %u agbno %u len %u",
1116                   MAJOR(__entry->dev), MINOR(__entry->dev),
1117                   __entry->agno,
1118                   __entry->agbno,
1119                   __entry->len)
1120 );
1121
1122 #define XFS_BUSY_STATES \
1123         { 0,    "missing" }, \
1124         { 1,    "found" }
1125
1126 TRACE_EVENT(xfs_alloc_busysearch,
1127         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1128                  xfs_agblock_t agbno, xfs_extlen_t len, int found),
1129         TP_ARGS(mp, agno, agbno, len, found),
1130         TP_STRUCT__entry(
1131                 __field(dev_t, dev)
1132                 __field(xfs_agnumber_t, agno)
1133                 __field(xfs_agblock_t, agbno)
1134                 __field(xfs_extlen_t, len)
1135                 __field(int, found)
1136         ),
1137         TP_fast_assign(
1138                 __entry->dev = mp->m_super->s_dev;
1139                 __entry->agno = agno;
1140                 __entry->agbno = agbno;
1141                 __entry->len = len;
1142                 __entry->found = found;
1143         ),
1144         TP_printk("dev %d:%d agno %u agbno %u len %u %s",
1145                   MAJOR(__entry->dev), MINOR(__entry->dev),
1146                   __entry->agno,
1147                   __entry->agbno,
1148                   __entry->len,
1149                   __print_symbolic(__entry->found, XFS_BUSY_STATES))
1150 );
1151
1152 TRACE_EVENT(xfs_trans_commit_lsn,
1153         TP_PROTO(struct xfs_trans *trans),
1154         TP_ARGS(trans),
1155         TP_STRUCT__entry(
1156                 __field(dev_t, dev)
1157                 __field(struct xfs_trans *, tp)
1158                 __field(xfs_lsn_t, lsn)
1159         ),
1160         TP_fast_assign(
1161                 __entry->dev = trans->t_mountp->m_super->s_dev;
1162                 __entry->tp = trans;
1163                 __entry->lsn = trans->t_commit_lsn;
1164         ),
1165         TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1166                   MAJOR(__entry->dev), MINOR(__entry->dev),
1167                   __entry->tp,
1168                   __entry->lsn)
1169 );
1170
1171 TRACE_EVENT(xfs_agf,
1172         TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1173                  unsigned long caller_ip),
1174         TP_ARGS(mp, agf, flags, caller_ip),
1175         TP_STRUCT__entry(
1176                 __field(dev_t, dev)
1177                 __field(xfs_agnumber_t, agno)
1178                 __field(int, flags)
1179                 __field(__u32, length)
1180                 __field(__u32, bno_root)
1181                 __field(__u32, cnt_root)
1182                 __field(__u32, bno_level)
1183                 __field(__u32, cnt_level)
1184                 __field(__u32, flfirst)
1185                 __field(__u32, fllast)
1186                 __field(__u32, flcount)
1187                 __field(__u32, freeblks)
1188                 __field(__u32, longest)
1189                 __field(unsigned long, caller_ip)
1190         ),
1191         TP_fast_assign(
1192                 __entry->dev = mp->m_super->s_dev;
1193                 __entry->agno = be32_to_cpu(agf->agf_seqno),
1194                 __entry->flags = flags;
1195                 __entry->length = be32_to_cpu(agf->agf_length),
1196                 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1197                 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1198                 __entry->bno_level =
1199                                 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1200                 __entry->cnt_level =
1201                                 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1202                 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1203                 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1204                 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1205                 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1206                 __entry->longest = be32_to_cpu(agf->agf_longest);
1207                 __entry->caller_ip = caller_ip;
1208         ),
1209         TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1210                   "levels b %u c %u flfirst %u fllast %u flcount %u "
1211                   "freeblks %u longest %u caller %pf",
1212                   MAJOR(__entry->dev), MINOR(__entry->dev),
1213                   __entry->agno,
1214                   __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1215                   __entry->length,
1216                   __entry->bno_root,
1217                   __entry->cnt_root,
1218                   __entry->bno_level,
1219                   __entry->cnt_level,
1220                   __entry->flfirst,
1221                   __entry->fllast,
1222                   __entry->flcount,
1223                   __entry->freeblks,
1224                   __entry->longest,
1225                   (void *)__entry->caller_ip)
1226 );
1227
1228 TRACE_EVENT(xfs_free_extent,
1229         TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1230                  xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1231         TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1232         TP_STRUCT__entry(
1233                 __field(dev_t, dev)
1234                 __field(xfs_agnumber_t, agno)
1235                 __field(xfs_agblock_t, agbno)
1236                 __field(xfs_extlen_t, len)
1237                 __field(int, isfl)
1238                 __field(int, haveleft)
1239                 __field(int, haveright)
1240         ),
1241         TP_fast_assign(
1242                 __entry->dev = mp->m_super->s_dev;
1243                 __entry->agno = agno;
1244                 __entry->agbno = agbno;
1245                 __entry->len = len;
1246                 __entry->isfl = isfl;
1247                 __entry->haveleft = haveleft;
1248                 __entry->haveright = haveright;
1249         ),
1250         TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1251                   MAJOR(__entry->dev), MINOR(__entry->dev),
1252                   __entry->agno,
1253                   __entry->agbno,
1254                   __entry->len,
1255                   __entry->isfl,
1256                   __entry->haveleft ?
1257                         (__entry->haveright ? "both" : "left") :
1258                         (__entry->haveright ? "right" : "none"))
1259
1260 );
1261
1262 DECLARE_EVENT_CLASS(xfs_alloc_class,
1263         TP_PROTO(struct xfs_alloc_arg *args),
1264         TP_ARGS(args),
1265         TP_STRUCT__entry(
1266                 __field(dev_t, dev)
1267                 __field(xfs_agnumber_t, agno)
1268                 __field(xfs_agblock_t, agbno)
1269                 __field(xfs_extlen_t, minlen)
1270                 __field(xfs_extlen_t, maxlen)
1271                 __field(xfs_extlen_t, mod)
1272                 __field(xfs_extlen_t, prod)
1273                 __field(xfs_extlen_t, minleft)
1274                 __field(xfs_extlen_t, total)
1275                 __field(xfs_extlen_t, alignment)
1276                 __field(xfs_extlen_t, minalignslop)
1277                 __field(xfs_extlen_t, len)
1278                 __field(short, type)
1279                 __field(short, otype)
1280                 __field(char, wasdel)
1281                 __field(char, wasfromfl)
1282                 __field(char, isfl)
1283                 __field(char, userdata)
1284                 __field(xfs_fsblock_t, firstblock)
1285         ),
1286         TP_fast_assign(
1287                 __entry->dev = args->mp->m_super->s_dev;
1288                 __entry->agno = args->agno;
1289                 __entry->agbno = args->agbno;
1290                 __entry->minlen = args->minlen;
1291                 __entry->maxlen = args->maxlen;
1292                 __entry->mod = args->mod;
1293                 __entry->prod = args->prod;
1294                 __entry->minleft = args->minleft;
1295                 __entry->total = args->total;
1296                 __entry->alignment = args->alignment;
1297                 __entry->minalignslop = args->minalignslop;
1298                 __entry->len = args->len;
1299                 __entry->type = args->type;
1300                 __entry->otype = args->otype;
1301                 __entry->wasdel = args->wasdel;
1302                 __entry->wasfromfl = args->wasfromfl;
1303                 __entry->isfl = args->isfl;
1304                 __entry->userdata = args->userdata;
1305                 __entry->firstblock = args->firstblock;
1306         ),
1307         TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1308                   "prod %u minleft %u total %u alignment %u minalignslop %u "
1309                   "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1310                   "userdata %d firstblock 0x%llx",
1311                   MAJOR(__entry->dev), MINOR(__entry->dev),
1312                   __entry->agno,
1313                   __entry->agbno,
1314                   __entry->minlen,
1315                   __entry->maxlen,
1316                   __entry->mod,
1317                   __entry->prod,
1318                   __entry->minleft,
1319                   __entry->total,
1320                   __entry->alignment,
1321                   __entry->minalignslop,
1322                   __entry->len,
1323                   __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1324                   __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1325                   __entry->wasdel,
1326                   __entry->wasfromfl,
1327                   __entry->isfl,
1328                   __entry->userdata,
1329                   __entry->firstblock)
1330 )
1331
1332 #define DEFINE_ALLOC_EVENT(name) \
1333 DEFINE_EVENT(xfs_alloc_class, name, \
1334         TP_PROTO(struct xfs_alloc_arg *args), \
1335         TP_ARGS(args))
1336 DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1337 DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1338 DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1339 DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1340 DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1341 DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1342 DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1343 DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1344 DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1345 DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1346 DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1347 DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1348 DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1349 DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1350 DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1351 DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1352 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1353 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1354 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1355 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1356 DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1357
1358 DECLARE_EVENT_CLASS(xfs_dir2_class,
1359         TP_PROTO(struct xfs_da_args *args),
1360         TP_ARGS(args),
1361         TP_STRUCT__entry(
1362                 __field(dev_t, dev)
1363                 __field(xfs_ino_t, ino)
1364                 __dynamic_array(char, name, args->namelen)
1365                 __field(int, namelen)
1366                 __field(xfs_dahash_t, hashval)
1367                 __field(xfs_ino_t, inumber)
1368                 __field(int, op_flags)
1369         ),
1370         TP_fast_assign(
1371                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1372                 __entry->ino = args->dp->i_ino;
1373                 if (args->namelen)
1374                         memcpy(__get_str(name), args->name, args->namelen);
1375                 __entry->namelen = args->namelen;
1376                 __entry->hashval = args->hashval;
1377                 __entry->inumber = args->inumber;
1378                 __entry->op_flags = args->op_flags;
1379         ),
1380         TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1381                   "inumber 0x%llx op_flags %s",
1382                   MAJOR(__entry->dev), MINOR(__entry->dev),
1383                   __entry->ino,
1384                   __entry->namelen,
1385                   __entry->namelen ? __get_str(name) : NULL,
1386                   __entry->namelen,
1387                   __entry->hashval,
1388                   __entry->inumber,
1389                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1390 )
1391
1392 #define DEFINE_DIR2_EVENT(name) \
1393 DEFINE_EVENT(xfs_dir2_class, name, \
1394         TP_PROTO(struct xfs_da_args *args), \
1395         TP_ARGS(args))
1396 DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1397 DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1398 DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1399 DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1400 DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1401 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1402 DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1403 DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1404 DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1405 DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1406 DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1407 DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1408 DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1409 DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1410 DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1411 DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1412 DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1413 DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1414 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1415 DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1416 DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1417 DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1418 DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1419 DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1420 DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1421
1422 DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1423         TP_PROTO(struct xfs_da_args *args, int idx),
1424         TP_ARGS(args, idx),
1425         TP_STRUCT__entry(
1426                 __field(dev_t, dev)
1427                 __field(xfs_ino_t, ino)
1428                 __field(int, op_flags)
1429                 __field(int, idx)
1430         ),
1431         TP_fast_assign(
1432                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1433                 __entry->ino = args->dp->i_ino;
1434                 __entry->op_flags = args->op_flags;
1435                 __entry->idx = idx;
1436         ),
1437         TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1438                   MAJOR(__entry->dev), MINOR(__entry->dev),
1439                   __entry->ino,
1440                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1441                   __entry->idx)
1442 )
1443
1444 #define DEFINE_DIR2_SPACE_EVENT(name) \
1445 DEFINE_EVENT(xfs_dir2_space_class, name, \
1446         TP_PROTO(struct xfs_da_args *args, int idx), \
1447         TP_ARGS(args, idx))
1448 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1449 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1450 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1451 DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
1452
1453 TRACE_EVENT(xfs_dir2_leafn_moveents,
1454         TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1455         TP_ARGS(args, src_idx, dst_idx, count),
1456         TP_STRUCT__entry(
1457                 __field(dev_t, dev)
1458                 __field(xfs_ino_t, ino)
1459                 __field(int, op_flags)
1460                 __field(int, src_idx)
1461                 __field(int, dst_idx)
1462                 __field(int, count)
1463         ),
1464         TP_fast_assign(
1465                 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1466                 __entry->ino = args->dp->i_ino;
1467                 __entry->op_flags = args->op_flags;
1468                 __entry->src_idx = src_idx;
1469                 __entry->dst_idx = dst_idx;
1470                 __entry->count = count;
1471         ),
1472         TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1473                   "src_idx %d dst_idx %d count %d",
1474                   MAJOR(__entry->dev), MINOR(__entry->dev),
1475                   __entry->ino,
1476                   __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1477                   __entry->src_idx,
1478                   __entry->dst_idx,
1479                   __entry->count)
1480 );
1481
1482 #define XFS_SWAPEXT_INODES \
1483         { 0,    "target" }, \
1484         { 1,    "temp" }
1485
1486 #define XFS_INODE_FORMAT_STR \
1487         { 0,    "invalid" }, \
1488         { 1,    "local" }, \
1489         { 2,    "extent" }, \
1490         { 3,    "btree" }
1491
1492 DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1493         TP_PROTO(struct xfs_inode *ip, int which),
1494         TP_ARGS(ip, which),
1495         TP_STRUCT__entry(
1496                 __field(dev_t, dev)
1497                 __field(int, which)
1498                 __field(xfs_ino_t, ino)
1499                 __field(int, format)
1500                 __field(int, nex)
1501                 __field(int, max_nex)
1502                 __field(int, broot_size)
1503                 __field(int, fork_off)
1504         ),
1505         TP_fast_assign(
1506                 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1507                 __entry->which = which;
1508                 __entry->ino = ip->i_ino;
1509                 __entry->format = ip->i_d.di_format;
1510                 __entry->nex = ip->i_d.di_nextents;
1511                 __entry->max_nex = ip->i_df.if_ext_max;
1512                 __entry->broot_size = ip->i_df.if_broot_bytes;
1513                 __entry->fork_off = XFS_IFORK_BOFF(ip);
1514         ),
1515         TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1516                   "Max in-fork extents %d, broot size %d, fork offset %d",
1517                   MAJOR(__entry->dev), MINOR(__entry->dev),
1518                   __entry->ino,
1519                   __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1520                   __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1521                   __entry->nex,
1522                   __entry->max_nex,
1523                   __entry->broot_size,
1524                   __entry->fork_off)
1525 )
1526
1527 #define DEFINE_SWAPEXT_EVENT(name) \
1528 DEFINE_EVENT(xfs_swap_extent_class, name, \
1529         TP_PROTO(struct xfs_inode *ip, int which), \
1530         TP_ARGS(ip, which))
1531
1532 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1533 DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1534
1535 DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1536         TP_PROTO(struct log *log, struct xlog_recover *trans,
1537                 struct xlog_recover_item *item, int pass),
1538         TP_ARGS(log, trans, item, pass),
1539         TP_STRUCT__entry(
1540                 __field(dev_t, dev)
1541                 __field(unsigned long, item)
1542                 __field(xlog_tid_t, tid)
1543                 __field(int, type)
1544                 __field(int, pass)
1545                 __field(int, count)
1546                 __field(int, total)
1547         ),
1548         TP_fast_assign(
1549                 __entry->dev = log->l_mp->m_super->s_dev;
1550                 __entry->item = (unsigned long)item;
1551                 __entry->tid = trans->r_log_tid;
1552                 __entry->type = ITEM_TYPE(item);
1553                 __entry->pass = pass;
1554                 __entry->count = item->ri_cnt;
1555                 __entry->total = item->ri_total;
1556         ),
1557         TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1558                   "item region count/total %d/%d",
1559                   MAJOR(__entry->dev), MINOR(__entry->dev),
1560                   __entry->tid,
1561                   __entry->pass,
1562                   (void *)__entry->item,
1563                   __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1564                   __entry->count,
1565                   __entry->total)
1566 )
1567
1568 #define DEFINE_LOG_RECOVER_ITEM(name) \
1569 DEFINE_EVENT(xfs_log_recover_item_class, name, \
1570         TP_PROTO(struct log *log, struct xlog_recover *trans, \
1571                 struct xlog_recover_item *item, int pass), \
1572         TP_ARGS(log, trans, item, pass))
1573
1574 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1575 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1576 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1577 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1578 DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1579
1580 DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1581         TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f),
1582         TP_ARGS(log, buf_f),
1583         TP_STRUCT__entry(
1584                 __field(dev_t, dev)
1585                 __field(__int64_t, blkno)
1586                 __field(unsigned short, len)
1587                 __field(unsigned short, flags)
1588                 __field(unsigned short, size)
1589                 __field(unsigned int, map_size)
1590         ),
1591         TP_fast_assign(
1592                 __entry->dev = log->l_mp->m_super->s_dev;
1593                 __entry->blkno = buf_f->blf_blkno;
1594                 __entry->len = buf_f->blf_len;
1595                 __entry->flags = buf_f->blf_flags;
1596                 __entry->size = buf_f->blf_size;
1597                 __entry->map_size = buf_f->blf_map_size;
1598         ),
1599         TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1600                         "map_size %d",
1601                   MAJOR(__entry->dev), MINOR(__entry->dev),
1602                   __entry->blkno,
1603                   __entry->len,
1604                   __entry->flags,
1605                   __entry->size,
1606                   __entry->map_size)
1607 )
1608
1609 #define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1610 DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1611         TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \
1612         TP_ARGS(log, buf_f))
1613
1614 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1615 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1616 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1617 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1618 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1619 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1620 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1621 DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1622
1623 DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1624         TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f),
1625         TP_ARGS(log, in_f),
1626         TP_STRUCT__entry(
1627                 __field(dev_t, dev)
1628                 __field(xfs_ino_t, ino)
1629                 __field(unsigned short, size)
1630                 __field(int, fields)
1631                 __field(unsigned short, asize)
1632                 __field(unsigned short, dsize)
1633                 __field(__int64_t, blkno)
1634                 __field(int, len)
1635                 __field(int, boffset)
1636         ),
1637         TP_fast_assign(
1638                 __entry->dev = log->l_mp->m_super->s_dev;
1639                 __entry->ino = in_f->ilf_ino;
1640                 __entry->size = in_f->ilf_size;
1641                 __entry->fields = in_f->ilf_fields;
1642                 __entry->asize = in_f->ilf_asize;
1643                 __entry->dsize = in_f->ilf_dsize;
1644                 __entry->blkno = in_f->ilf_blkno;
1645                 __entry->len = in_f->ilf_len;
1646                 __entry->boffset = in_f->ilf_boffset;
1647         ),
1648         TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1649                         "dsize %d, blkno 0x%llx, len %d, boffset %d",
1650                   MAJOR(__entry->dev), MINOR(__entry->dev),
1651                   __entry->ino,
1652                   __entry->size,
1653                   __entry->fields,
1654                   __entry->asize,
1655                   __entry->dsize,
1656                   __entry->blkno,
1657                   __entry->len,
1658                   __entry->boffset)
1659 )
1660 #define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1661 DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1662         TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \
1663         TP_ARGS(log, in_f))
1664
1665 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1666 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1667 DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1668
1669 #endif /* _TRACE_XFS_H */
1670
1671 #undef TRACE_INCLUDE_PATH
1672 #define TRACE_INCLUDE_PATH .
1673 #define TRACE_INCLUDE_FILE xfs_trace
1674 #include <trace/define_trace.h>