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