blob: 2e137d4a85ae66bc3a9172a4d93f734ba7aabb99 [file] [log] [blame]
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM xfs
20
21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22#define _TRACE_XFS_H
23
24#include <linux/tracepoint.h>
25
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000033struct xfs_log_item;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000034struct xlog_ticket;
Mark Tinguelyad223e62012-06-14 09:22:15 -050035struct xlog;
Dave Chinner9abbc532010-04-13 15:06:46 +100036struct xlog_recover;
37struct xlog_recover_item;
38struct xfs_buf_log_format;
39struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050040struct xfs_bmbt_irec;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000041
Christoph Hellwigea9a4882009-12-21 14:03:03 +000042DECLARE_EVENT_CLASS(xfs_attr_list_class,
43 TP_PROTO(struct xfs_attr_list_context *ctx),
44 TP_ARGS(ctx),
45 TP_STRUCT__entry(
46 __field(dev_t, dev)
47 __field(xfs_ino_t, ino)
48 __field(u32, hashval)
49 __field(u32, blkno)
50 __field(u32, offset)
51 __field(void *, alist)
52 __field(int, bufsize)
53 __field(int, count)
54 __field(int, firstu)
55 __field(int, dupcnt)
56 __field(int, flags)
57 ),
58 TP_fast_assign(
59 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
60 __entry->ino = ctx->dp->i_ino;
61 __entry->hashval = ctx->cursor->hashval;
62 __entry->blkno = ctx->cursor->blkno;
63 __entry->offset = ctx->cursor->offset;
64 __entry->alist = ctx->alist;
65 __entry->bufsize = ctx->bufsize;
66 __entry->count = ctx->count;
67 __entry->firstu = ctx->firstu;
68 __entry->flags = ctx->flags;
69 ),
70 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
71 "alist 0x%p size %u count %u firstu %u flags %d %s",
72 MAJOR(__entry->dev), MINOR(__entry->dev),
73 __entry->ino,
74 __entry->hashval,
75 __entry->blkno,
76 __entry->offset,
77 __entry->dupcnt,
78 __entry->alist,
79 __entry->bufsize,
80 __entry->count,
81 __entry->firstu,
82 __entry->flags,
83 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
84 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000085)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000086
87#define DEFINE_ATTR_LIST_EVENT(name) \
88DEFINE_EVENT(xfs_attr_list_class, name, \
89 TP_PROTO(struct xfs_attr_list_context *ctx), \
90 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000091DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
92DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
93DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
94DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +110099DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000101
Li Zefanf8adb4d2010-05-24 08:25:57 +0000102DECLARE_EVENT_CLASS(xfs_perag_class,
103 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
104 unsigned long caller_ip),
105 TP_ARGS(mp, agno, refcount, caller_ip),
106 TP_STRUCT__entry(
107 __field(dev_t, dev)
108 __field(xfs_agnumber_t, agno)
109 __field(int, refcount)
110 __field(unsigned long, caller_ip)
111 ),
112 TP_fast_assign(
113 __entry->dev = mp->m_super->s_dev;
114 __entry->agno = agno;
115 __entry->refcount = refcount;
116 __entry->caller_ip = caller_ip;
117 ),
118 TP_printk("dev %d:%d agno %u refcount %d caller %pf",
119 MAJOR(__entry->dev), MINOR(__entry->dev),
120 __entry->agno,
121 __entry->refcount,
122 (char *)__entry->caller_ip)
123);
124
125#define DEFINE_PERAG_REF_EVENT(name) \
126DEFINE_EVENT(xfs_perag_class, name, \
127 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
128 unsigned long caller_ip), \
129 TP_ARGS(mp, agno, refcount, caller_ip))
130DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000131DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000132DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000133DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
134DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500135DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
136DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000137
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000138TRACE_EVENT(xfs_attr_list_node_descend,
139 TP_PROTO(struct xfs_attr_list_context *ctx,
140 struct xfs_da_node_entry *btree),
141 TP_ARGS(ctx, btree),
142 TP_STRUCT__entry(
143 __field(dev_t, dev)
144 __field(xfs_ino_t, ino)
145 __field(u32, hashval)
146 __field(u32, blkno)
147 __field(u32, offset)
148 __field(void *, alist)
149 __field(int, bufsize)
150 __field(int, count)
151 __field(int, firstu)
152 __field(int, dupcnt)
153 __field(int, flags)
154 __field(u32, bt_hashval)
155 __field(u32, bt_before)
156 ),
157 TP_fast_assign(
158 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
159 __entry->ino = ctx->dp->i_ino;
160 __entry->hashval = ctx->cursor->hashval;
161 __entry->blkno = ctx->cursor->blkno;
162 __entry->offset = ctx->cursor->offset;
163 __entry->alist = ctx->alist;
164 __entry->bufsize = ctx->bufsize;
165 __entry->count = ctx->count;
166 __entry->firstu = ctx->firstu;
167 __entry->flags = ctx->flags;
168 __entry->bt_hashval = be32_to_cpu(btree->hashval);
169 __entry->bt_before = be32_to_cpu(btree->before);
170 ),
171 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
172 "alist 0x%p size %u count %u firstu %u flags %d %s "
173 "node hashval %u, node before %u",
174 MAJOR(__entry->dev), MINOR(__entry->dev),
175 __entry->ino,
176 __entry->hashval,
177 __entry->blkno,
178 __entry->offset,
179 __entry->dupcnt,
180 __entry->alist,
181 __entry->bufsize,
182 __entry->count,
183 __entry->firstu,
184 __entry->flags,
185 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
186 __entry->bt_hashval,
187 __entry->bt_before)
188);
189
190TRACE_EVENT(xfs_iext_insert,
191 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
192 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
193 TP_ARGS(ip, idx, r, state, caller_ip),
194 TP_STRUCT__entry(
195 __field(dev_t, dev)
196 __field(xfs_ino_t, ino)
197 __field(xfs_extnum_t, idx)
198 __field(xfs_fileoff_t, startoff)
199 __field(xfs_fsblock_t, startblock)
200 __field(xfs_filblks_t, blockcount)
201 __field(xfs_exntst_t, state)
202 __field(int, bmap_state)
203 __field(unsigned long, caller_ip)
204 ),
205 TP_fast_assign(
206 __entry->dev = VFS_I(ip)->i_sb->s_dev;
207 __entry->ino = ip->i_ino;
208 __entry->idx = idx;
209 __entry->startoff = r->br_startoff;
210 __entry->startblock = r->br_startblock;
211 __entry->blockcount = r->br_blockcount;
212 __entry->state = r->br_state;
213 __entry->bmap_state = state;
214 __entry->caller_ip = caller_ip;
215 ),
216 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000217 "offset %lld block %lld count %lld flag %d caller %pf",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000218 MAJOR(__entry->dev), MINOR(__entry->dev),
219 __entry->ino,
220 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
221 (long)__entry->idx,
222 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000223 (__int64_t)__entry->startblock,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000224 __entry->blockcount,
225 __entry->state,
226 (char *)__entry->caller_ip)
227);
228
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000229DECLARE_EVENT_CLASS(xfs_bmap_class,
230 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
231 unsigned long caller_ip),
232 TP_ARGS(ip, idx, state, caller_ip),
233 TP_STRUCT__entry(
234 __field(dev_t, dev)
235 __field(xfs_ino_t, ino)
236 __field(xfs_extnum_t, idx)
237 __field(xfs_fileoff_t, startoff)
238 __field(xfs_fsblock_t, startblock)
239 __field(xfs_filblks_t, blockcount)
240 __field(xfs_exntst_t, state)
241 __field(int, bmap_state)
242 __field(unsigned long, caller_ip)
243 ),
244 TP_fast_assign(
245 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ?
246 ip->i_afp : &ip->i_df;
247 struct xfs_bmbt_irec r;
248
249 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
250 __entry->dev = VFS_I(ip)->i_sb->s_dev;
251 __entry->ino = ip->i_ino;
252 __entry->idx = idx;
253 __entry->startoff = r.br_startoff;
254 __entry->startblock = r.br_startblock;
255 __entry->blockcount = r.br_blockcount;
256 __entry->state = r.br_state;
257 __entry->bmap_state = state;
258 __entry->caller_ip = caller_ip;
259 ),
260 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000261 "offset %lld block %lld count %lld flag %d caller %pf",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000262 MAJOR(__entry->dev), MINOR(__entry->dev),
263 __entry->ino,
264 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
265 (long)__entry->idx,
266 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000267 (__int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000268 __entry->blockcount,
269 __entry->state,
270 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000271)
272
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000273#define DEFINE_BMAP_EVENT(name) \
274DEFINE_EVENT(xfs_bmap_class, name, \
275 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
276 unsigned long caller_ip), \
277 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000278DEFINE_BMAP_EVENT(xfs_iext_remove);
279DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
280DEFINE_BMAP_EVENT(xfs_bmap_post_update);
281DEFINE_BMAP_EVENT(xfs_extlist);
282
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000283DECLARE_EVENT_CLASS(xfs_buf_class,
284 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
285 TP_ARGS(bp, caller_ip),
286 TP_STRUCT__entry(
287 __field(dev_t, dev)
288 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000289 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000290 __field(int, hold)
291 __field(int, pincount)
292 __field(unsigned, lockval)
293 __field(unsigned, flags)
294 __field(unsigned long, caller_ip)
295 ),
296 TP_fast_assign(
297 __entry->dev = bp->b_target->bt_dev;
298 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000299 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000300 __entry->hold = atomic_read(&bp->b_hold);
301 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200302 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000303 __entry->flags = bp->b_flags;
304 __entry->caller_ip = caller_ip;
305 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000306 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000307 "lock %d flags %s caller %pf",
308 MAJOR(__entry->dev), MINOR(__entry->dev),
309 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000310 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000311 __entry->hold,
312 __entry->pincount,
313 __entry->lockval,
314 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
315 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000316)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000317
318#define DEFINE_BUF_EVENT(name) \
319DEFINE_EVENT(xfs_buf_class, name, \
320 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
321 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000322DEFINE_BUF_EVENT(xfs_buf_init);
323DEFINE_BUF_EVENT(xfs_buf_free);
324DEFINE_BUF_EVENT(xfs_buf_hold);
325DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000326DEFINE_BUF_EVENT(xfs_buf_iodone);
327DEFINE_BUF_EVENT(xfs_buf_iorequest);
328DEFINE_BUF_EVENT(xfs_buf_bawrite);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000329DEFINE_BUF_EVENT(xfs_buf_lock);
330DEFINE_BUF_EVENT(xfs_buf_lock_done);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200331DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000332DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000333DEFINE_BUF_EVENT(xfs_buf_iowait);
334DEFINE_BUF_EVENT(xfs_buf_iowait_done);
335DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000336DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000337DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Dave Chinner686865f2010-09-24 20:07:47 +1000338DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000339DEFINE_BUF_EVENT(xfs_bdstrat_shut);
340DEFINE_BUF_EVENT(xfs_buf_item_relse);
341DEFINE_BUF_EVENT(xfs_buf_item_iodone);
342DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
343DEFINE_BUF_EVENT(xfs_buf_error_relse);
344DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
345DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
346
347/* not really buffer traces, but the buf provides useful information */
348DEFINE_BUF_EVENT(xfs_btree_corrupt);
349DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
350DEFINE_BUF_EVENT(xfs_reset_dqcounts);
351DEFINE_BUF_EVENT(xfs_inode_item_push);
352
353/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000354DECLARE_EVENT_CLASS(xfs_buf_flags_class,
355 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
356 TP_ARGS(bp, flags, caller_ip),
357 TP_STRUCT__entry(
358 __field(dev_t, dev)
359 __field(xfs_daddr_t, bno)
360 __field(size_t, buffer_length)
361 __field(int, hold)
362 __field(int, pincount)
363 __field(unsigned, lockval)
364 __field(unsigned, flags)
365 __field(unsigned long, caller_ip)
366 ),
367 TP_fast_assign(
368 __entry->dev = bp->b_target->bt_dev;
369 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000370 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000371 __entry->flags = flags;
372 __entry->hold = atomic_read(&bp->b_hold);
373 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200374 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000375 __entry->caller_ip = caller_ip;
376 ),
377 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
378 "lock %d flags %s caller %pf",
379 MAJOR(__entry->dev), MINOR(__entry->dev),
380 (unsigned long long)__entry->bno,
381 __entry->buffer_length,
382 __entry->hold,
383 __entry->pincount,
384 __entry->lockval,
385 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
386 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000387)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000388
389#define DEFINE_BUF_FLAGS_EVENT(name) \
390DEFINE_EVENT(xfs_buf_flags_class, name, \
391 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
392 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000393DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
394DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
395DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
396
397TRACE_EVENT(xfs_buf_ioerror,
398 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
399 TP_ARGS(bp, error, caller_ip),
400 TP_STRUCT__entry(
401 __field(dev_t, dev)
402 __field(xfs_daddr_t, bno)
403 __field(size_t, buffer_length)
404 __field(unsigned, flags)
405 __field(int, hold)
406 __field(int, pincount)
407 __field(unsigned, lockval)
408 __field(int, error)
409 __field(unsigned long, caller_ip)
410 ),
411 TP_fast_assign(
412 __entry->dev = bp->b_target->bt_dev;
413 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000414 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000415 __entry->hold = atomic_read(&bp->b_hold);
416 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200417 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000418 __entry->error = error;
419 __entry->flags = bp->b_flags;
420 __entry->caller_ip = caller_ip;
421 ),
422 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
423 "lock %d error %d flags %s caller %pf",
424 MAJOR(__entry->dev), MINOR(__entry->dev),
425 (unsigned long long)__entry->bno,
426 __entry->buffer_length,
427 __entry->hold,
428 __entry->pincount,
429 __entry->lockval,
430 __entry->error,
431 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
432 (void *)__entry->caller_ip)
433);
434
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000435DECLARE_EVENT_CLASS(xfs_buf_item_class,
436 TP_PROTO(struct xfs_buf_log_item *bip),
437 TP_ARGS(bip),
438 TP_STRUCT__entry(
439 __field(dev_t, dev)
440 __field(xfs_daddr_t, buf_bno)
441 __field(size_t, buf_len)
442 __field(int, buf_hold)
443 __field(int, buf_pincount)
444 __field(int, buf_lockval)
445 __field(unsigned, buf_flags)
446 __field(unsigned, bli_recur)
447 __field(int, bli_refcount)
448 __field(unsigned, bli_flags)
449 __field(void *, li_desc)
450 __field(unsigned, li_flags)
451 ),
452 TP_fast_assign(
453 __entry->dev = bip->bli_buf->b_target->bt_dev;
454 __entry->bli_flags = bip->bli_flags;
455 __entry->bli_recur = bip->bli_recur;
456 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
457 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000458 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000459 __entry->buf_flags = bip->bli_buf->b_flags;
460 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
461 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200462 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000463 __entry->li_desc = bip->bli_item.li_desc;
464 __entry->li_flags = bip->bli_item.li_flags;
465 ),
466 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
467 "lock %d flags %s recur %d refcount %d bliflags %s "
468 "lidesc 0x%p liflags %s",
469 MAJOR(__entry->dev), MINOR(__entry->dev),
470 (unsigned long long)__entry->buf_bno,
471 __entry->buf_len,
472 __entry->buf_hold,
473 __entry->buf_pincount,
474 __entry->buf_lockval,
475 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
476 __entry->bli_recur,
477 __entry->bli_refcount,
478 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
479 __entry->li_desc,
480 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000481)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000482
483#define DEFINE_BUF_ITEM_EVENT(name) \
484DEFINE_EVENT(xfs_buf_item_class, name, \
485 TP_PROTO(struct xfs_buf_log_item *bip), \
486 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000487DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
488DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
489DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
490DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
491DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
492DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
493DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000494DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
495DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
496DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
497DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
498DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
499DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
500DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
501DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
502DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
503DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
504DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
505DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
506DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
507DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
508DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
509DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
510
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000511DECLARE_EVENT_CLASS(xfs_lock_class,
512 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
513 unsigned long caller_ip),
514 TP_ARGS(ip, lock_flags, caller_ip),
515 TP_STRUCT__entry(
516 __field(dev_t, dev)
517 __field(xfs_ino_t, ino)
518 __field(int, lock_flags)
519 __field(unsigned long, caller_ip)
520 ),
521 TP_fast_assign(
522 __entry->dev = VFS_I(ip)->i_sb->s_dev;
523 __entry->ino = ip->i_ino;
524 __entry->lock_flags = lock_flags;
525 __entry->caller_ip = caller_ip;
526 ),
527 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
528 MAJOR(__entry->dev), MINOR(__entry->dev),
529 __entry->ino,
530 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
531 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000532)
533
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000534#define DEFINE_LOCK_EVENT(name) \
535DEFINE_EVENT(xfs_lock_class, name, \
536 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
537 unsigned long caller_ip), \
538 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000539DEFINE_LOCK_EVENT(xfs_ilock);
540DEFINE_LOCK_EVENT(xfs_ilock_nowait);
541DEFINE_LOCK_EVENT(xfs_ilock_demote);
542DEFINE_LOCK_EVENT(xfs_iunlock);
543
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000544DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000545 TP_PROTO(struct xfs_inode *ip),
546 TP_ARGS(ip),
547 TP_STRUCT__entry(
548 __field(dev_t, dev)
549 __field(xfs_ino_t, ino)
550 ),
551 TP_fast_assign(
552 __entry->dev = VFS_I(ip)->i_sb->s_dev;
553 __entry->ino = ip->i_ino;
554 ),
555 TP_printk("dev %d:%d ino 0x%llx",
556 MAJOR(__entry->dev), MINOR(__entry->dev),
557 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000558)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000559
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000560#define DEFINE_INODE_EVENT(name) \
561DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000562 TP_PROTO(struct xfs_inode *ip), \
563 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000564DEFINE_INODE_EVENT(xfs_iget_skip);
565DEFINE_INODE_EVENT(xfs_iget_reclaim);
566DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
567DEFINE_INODE_EVENT(xfs_iget_hit);
568DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000569
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000570DEFINE_INODE_EVENT(xfs_getattr);
571DEFINE_INODE_EVENT(xfs_setattr);
572DEFINE_INODE_EVENT(xfs_readlink);
573DEFINE_INODE_EVENT(xfs_alloc_file_space);
574DEFINE_INODE_EVENT(xfs_free_file_space);
575DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000576#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200577DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000578#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000579DEFINE_INODE_EVENT(xfs_vm_bmap);
580DEFINE_INODE_EVENT(xfs_file_ioctl);
581DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
582DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000583DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000584DEFINE_INODE_EVENT(xfs_file_fsync);
585DEFINE_INODE_EVENT(xfs_destroy_inode);
Al Virob57922d2010-06-07 14:34:48 -0400586DEFINE_INODE_EVENT(xfs_evict_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400587DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000588
589DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
590DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
591
Brian Foster27b52862012-11-06 09:50:38 -0500592DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
593DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500594DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500595
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000596DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000597 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
598 TP_ARGS(ip, caller_ip),
599 TP_STRUCT__entry(
600 __field(dev_t, dev)
601 __field(xfs_ino_t, ino)
602 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100603 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000604 __field(unsigned long, caller_ip)
605 ),
606 TP_fast_assign(
607 __entry->dev = VFS_I(ip)->i_sb->s_dev;
608 __entry->ino = ip->i_ino;
609 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100610 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000611 __entry->caller_ip = caller_ip;
612 ),
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100613 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000614 MAJOR(__entry->dev), MINOR(__entry->dev),
615 __entry->ino,
616 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100617 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000618 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000619)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000620
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000621#define DEFINE_IREF_EVENT(name) \
622DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000623 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
624 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000625DEFINE_IREF_EVENT(xfs_ihold);
626DEFINE_IREF_EVENT(xfs_irele);
627DEFINE_IREF_EVENT(xfs_inode_pin);
628DEFINE_IREF_EVENT(xfs_inode_unpin);
629DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100630
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000631DECLARE_EVENT_CLASS(xfs_namespace_class,
632 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
633 TP_ARGS(dp, name),
634 TP_STRUCT__entry(
635 __field(dev_t, dev)
636 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000637 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000638 __dynamic_array(char, name, name->len)
639 ),
640 TP_fast_assign(
641 __entry->dev = VFS_I(dp)->i_sb->s_dev;
642 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000643 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000644 memcpy(__get_str(name), name->name, name->len);
645 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000646 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000647 MAJOR(__entry->dev), MINOR(__entry->dev),
648 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000649 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000650 __get_str(name))
651)
652
653#define DEFINE_NAMESPACE_EVENT(name) \
654DEFINE_EVENT(xfs_namespace_class, name, \
655 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
656 TP_ARGS(dp, name))
657DEFINE_NAMESPACE_EVENT(xfs_remove);
658DEFINE_NAMESPACE_EVENT(xfs_link);
659DEFINE_NAMESPACE_EVENT(xfs_lookup);
660DEFINE_NAMESPACE_EVENT(xfs_create);
661DEFINE_NAMESPACE_EVENT(xfs_symlink);
662
663TRACE_EVENT(xfs_rename,
664 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
665 struct xfs_name *src_name, struct xfs_name *target_name),
666 TP_ARGS(src_dp, target_dp, src_name, target_name),
667 TP_STRUCT__entry(
668 __field(dev_t, dev)
669 __field(xfs_ino_t, src_dp_ino)
670 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000671 __field(int, src_namelen)
672 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000673 __dynamic_array(char, src_name, src_name->len)
674 __dynamic_array(char, target_name, target_name->len)
675 ),
676 TP_fast_assign(
677 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
678 __entry->src_dp_ino = src_dp->i_ino;
679 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000680 __entry->src_namelen = src_name->len;
681 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000682 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000683 memcpy(__get_str(target_name), target_name->name,
684 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000685 ),
686 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000687 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000688 MAJOR(__entry->dev), MINOR(__entry->dev),
689 __entry->src_dp_ino,
690 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000691 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000692 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000693 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000694 __get_str(target_name))
695)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000696
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000697DECLARE_EVENT_CLASS(xfs_dquot_class,
698 TP_PROTO(struct xfs_dquot *dqp),
699 TP_ARGS(dqp),
700 TP_STRUCT__entry(
701 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000702 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000703 __field(unsigned, flags)
704 __field(unsigned, nrefs)
705 __field(unsigned long long, res_bcount)
706 __field(unsigned long long, bcount)
707 __field(unsigned long long, icount)
708 __field(unsigned long long, blk_hardlimit)
709 __field(unsigned long long, blk_softlimit)
710 __field(unsigned long long, ino_hardlimit)
711 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000712 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000713 TP_fast_assign(
714 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000715 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000716 __entry->flags = dqp->dq_flags;
717 __entry->nrefs = dqp->q_nrefs;
718 __entry->res_bcount = dqp->q_res_bcount;
719 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
720 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
721 __entry->blk_hardlimit =
722 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
723 __entry->blk_softlimit =
724 be64_to_cpu(dqp->q_core.d_blk_softlimit);
725 __entry->ino_hardlimit =
726 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
727 __entry->ino_softlimit =
728 be64_to_cpu(dqp->q_core.d_ino_softlimit);
729 ),
730 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000731 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
732 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000733 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000734 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000735 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
736 __entry->nrefs,
737 __entry->res_bcount,
738 __entry->bcount,
739 __entry->blk_hardlimit,
740 __entry->blk_softlimit,
741 __entry->icount,
742 __entry->ino_hardlimit,
743 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000744)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000745
746#define DEFINE_DQUOT_EVENT(name) \
747DEFINE_EVENT(xfs_dquot_class, name, \
748 TP_PROTO(struct xfs_dquot *dqp), \
749 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000750DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000751DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
752DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000753DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
754DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000755DEFINE_DQUOT_EVENT(xfs_dqattach_found);
756DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000757DEFINE_DQUOT_EVENT(xfs_dqalloc);
758DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
759DEFINE_DQUOT_EVENT(xfs_dqread);
760DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000761DEFINE_DQUOT_EVENT(xfs_dqget_hit);
762DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000763DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
764DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000765DEFINE_DQUOT_EVENT(xfs_dqput);
766DEFINE_DQUOT_EVENT(xfs_dqput_wait);
767DEFINE_DQUOT_EVENT(xfs_dqput_free);
768DEFINE_DQUOT_EVENT(xfs_dqrele);
769DEFINE_DQUOT_EVENT(xfs_dqflush);
770DEFINE_DQUOT_EVENT(xfs_dqflush_force);
771DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000772
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000773DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500774 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000775 TP_ARGS(log, tic),
776 TP_STRUCT__entry(
777 __field(dev_t, dev)
778 __field(unsigned, trans_type)
779 __field(char, ocnt)
780 __field(char, cnt)
781 __field(int, curr_res)
782 __field(int, unit_res)
783 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100784 __field(int, reserveq)
785 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000786 __field(int, grant_reserve_cycle)
787 __field(int, grant_reserve_bytes)
788 __field(int, grant_write_cycle)
789 __field(int, grant_write_bytes)
790 __field(int, curr_cycle)
791 __field(int, curr_block)
792 __field(xfs_lsn_t, tail_lsn)
793 ),
794 TP_fast_assign(
795 __entry->dev = log->l_mp->m_super->s_dev;
796 __entry->trans_type = tic->t_trans_type;
797 __entry->ocnt = tic->t_ocnt;
798 __entry->cnt = tic->t_cnt;
799 __entry->curr_res = tic->t_curr_res;
800 __entry->unit_res = tic->t_unit_res;
801 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000802 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
803 __entry->writeq = list_empty(&log->l_write_head.waiters);
804 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100805 &__entry->grant_reserve_cycle,
806 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000807 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100808 &__entry->grant_write_cycle,
809 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000810 __entry->curr_cycle = log->l_curr_cycle;
811 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100812 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000813 ),
814 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100815 "t_unit_res %u t_flags %s reserveq %s "
816 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000817 "grant_reserve_bytes %d grant_write_cycle %d "
818 "grant_write_bytes %d curr_cycle %d curr_block %d "
819 "tail_cycle %d tail_block %d",
820 MAJOR(__entry->dev), MINOR(__entry->dev),
821 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
822 __entry->ocnt,
823 __entry->cnt,
824 __entry->curr_res,
825 __entry->unit_res,
826 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100827 __entry->reserveq ? "empty" : "active",
828 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000829 __entry->grant_reserve_cycle,
830 __entry->grant_reserve_bytes,
831 __entry->grant_write_cycle,
832 __entry->grant_write_bytes,
833 __entry->curr_cycle,
834 __entry->curr_block,
835 CYCLE_LSN(__entry->tail_lsn),
836 BLOCK_LSN(__entry->tail_lsn)
837 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000838)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000839
840#define DEFINE_LOGGRANT_EVENT(name) \
841DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500842 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000843 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000844DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
845DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000846DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +0000847DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
848DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +1100849DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +0000850DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
851DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
852DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
853DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000854DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
855DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
856DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
857DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
858DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
859DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
860
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000861DECLARE_EVENT_CLASS(xfs_log_item_class,
862 TP_PROTO(struct xfs_log_item *lip),
863 TP_ARGS(lip),
864 TP_STRUCT__entry(
865 __field(dev_t, dev)
866 __field(void *, lip)
867 __field(uint, type)
868 __field(uint, flags)
869 __field(xfs_lsn_t, lsn)
870 ),
871 TP_fast_assign(
872 __entry->dev = lip->li_mountp->m_super->s_dev;
873 __entry->lip = lip;
874 __entry->type = lip->li_type;
875 __entry->flags = lip->li_flags;
876 __entry->lsn = lip->li_lsn;
877 ),
878 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
879 MAJOR(__entry->dev), MINOR(__entry->dev),
880 __entry->lip,
881 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
882 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
883 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
884)
885
Dave Chinner14c26c62012-04-24 16:33:31 +1000886TRACE_EVENT(xfs_log_force,
887 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn),
888 TP_ARGS(mp, lsn),
889 TP_STRUCT__entry(
890 __field(dev_t, dev)
891 __field(xfs_lsn_t, lsn)
892 ),
893 TP_fast_assign(
894 __entry->dev = mp->m_super->s_dev;
895 __entry->lsn = lsn;
896 ),
897 TP_printk("dev %d:%d lsn 0x%llx",
898 MAJOR(__entry->dev), MINOR(__entry->dev),
899 __entry->lsn)
900)
901
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000902#define DEFINE_LOG_ITEM_EVENT(name) \
903DEFINE_EVENT(xfs_log_item_class, name, \
904 TP_PROTO(struct xfs_log_item *lip), \
905 TP_ARGS(lip))
906DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000907DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
908DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000909DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000910
911
Li Zefanf8adb4d2010-05-24 08:25:57 +0000912DECLARE_EVENT_CLASS(xfs_file_class,
913 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
914 TP_ARGS(ip, count, offset, flags),
915 TP_STRUCT__entry(
916 __field(dev_t, dev)
917 __field(xfs_ino_t, ino)
918 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000919 __field(loff_t, offset)
920 __field(size_t, count)
921 __field(int, flags)
922 ),
923 TP_fast_assign(
924 __entry->dev = VFS_I(ip)->i_sb->s_dev;
925 __entry->ino = ip->i_ino;
926 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +0000927 __entry->offset = offset;
928 __entry->count = count;
929 __entry->flags = flags;
930 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +0000931 TP_printk("dev %d:%d ino 0x%llx size 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +0000932 "offset 0x%llx count 0x%zx ioflags %s",
933 MAJOR(__entry->dev), MINOR(__entry->dev),
934 __entry->ino,
935 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +0000936 __entry->offset,
937 __entry->count,
938 __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000939)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000940
941#define DEFINE_RW_EVENT(name) \
942DEFINE_EVENT(xfs_file_class, name, \
943 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
944 TP_ARGS(ip, count, offset, flags))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000945DEFINE_RW_EVENT(xfs_file_read);
946DEFINE_RW_EVENT(xfs_file_buffered_write);
947DEFINE_RW_EVENT(xfs_file_direct_write);
948DEFINE_RW_EVENT(xfs_file_splice_read);
949DEFINE_RW_EVENT(xfs_file_splice_write);
950
Li Zefanf8adb4d2010-05-24 08:25:57 +0000951DECLARE_EVENT_CLASS(xfs_page_class,
952 TP_PROTO(struct inode *inode, struct page *page, unsigned long off),
953 TP_ARGS(inode, page, off),
954 TP_STRUCT__entry(
955 __field(dev_t, dev)
956 __field(xfs_ino_t, ino)
957 __field(pgoff_t, pgoff)
958 __field(loff_t, size)
959 __field(unsigned long, offset)
960 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000961 __field(int, unwritten)
962 ),
963 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000964 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000965
Li Zefanf8adb4d2010-05-24 08:25:57 +0000966 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000967 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000968 __entry->dev = inode->i_sb->s_dev;
969 __entry->ino = XFS_I(inode)->i_ino;
970 __entry->pgoff = page_offset(page);
971 __entry->size = i_size_read(inode);
972 __entry->offset = off;
973 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +0000974 __entry->unwritten = unwritten;
975 ),
976 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000977 "delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000978 MAJOR(__entry->dev), MINOR(__entry->dev),
979 __entry->ino,
980 __entry->pgoff,
981 __entry->size,
982 __entry->offset,
983 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +0000984 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000985)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000986
987#define DEFINE_PAGE_EVENT(name) \
988DEFINE_EVENT(xfs_page_class, name, \
989 TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
990 TP_ARGS(inode, page, off))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000991DEFINE_PAGE_EVENT(xfs_writepage);
992DEFINE_PAGE_EVENT(xfs_releasepage);
993DEFINE_PAGE_EVENT(xfs_invalidatepage);
994
Christoph Hellwiga206c812010-12-10 08:42:20 +0000995DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +0000996 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +0000997 int type, struct xfs_bmbt_irec *irec),
998 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +0000999 TP_STRUCT__entry(
1000 __field(dev_t, dev)
1001 __field(xfs_ino_t, ino)
1002 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001003 __field(loff_t, offset)
1004 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001005 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001006 __field(xfs_fileoff_t, startoff)
1007 __field(xfs_fsblock_t, startblock)
1008 __field(xfs_filblks_t, blockcount)
1009 ),
1010 TP_fast_assign(
1011 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1012 __entry->ino = ip->i_ino;
1013 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001014 __entry->offset = offset;
1015 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001016 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001017 __entry->startoff = irec ? irec->br_startoff : 0;
1018 __entry->startblock = irec ? irec->br_startblock : 0;
1019 __entry->blockcount = irec ? irec->br_blockcount : 0;
1020 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001021 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1022 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001023 MAJOR(__entry->dev), MINOR(__entry->dev),
1024 __entry->ino,
1025 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001026 __entry->offset,
1027 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001028 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001029 __entry->startoff,
1030 (__int64_t)__entry->startblock,
1031 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001032)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001033
1034#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001035DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001036 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001037 int type, struct xfs_bmbt_irec *irec), \
1038 TP_ARGS(ip, offset, count, type, irec))
1039DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1040DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1041DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1042DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001043
Li Zefanf8adb4d2010-05-24 08:25:57 +00001044DECLARE_EVENT_CLASS(xfs_simple_io_class,
1045 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1046 TP_ARGS(ip, offset, count),
1047 TP_STRUCT__entry(
1048 __field(dev_t, dev)
1049 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001050 __field(loff_t, isize)
1051 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001052 __field(loff_t, offset)
1053 __field(size_t, count)
1054 ),
1055 TP_fast_assign(
1056 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1057 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001058 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001059 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001060 __entry->offset = offset;
1061 __entry->count = count;
1062 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001063 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001064 "offset 0x%llx count %zd",
1065 MAJOR(__entry->dev), MINOR(__entry->dev),
1066 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001067 __entry->isize,
1068 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001069 __entry->offset,
1070 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001071);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001072
1073#define DEFINE_SIMPLE_IO_EVENT(name) \
1074DEFINE_EVENT(xfs_simple_io_class, name, \
1075 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1076 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001077DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1078DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001079DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001080DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001081
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001082DECLARE_EVENT_CLASS(xfs_itrunc_class,
1083 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1084 TP_ARGS(ip, new_size),
1085 TP_STRUCT__entry(
1086 __field(dev_t, dev)
1087 __field(xfs_ino_t, ino)
1088 __field(xfs_fsize_t, size)
1089 __field(xfs_fsize_t, new_size)
1090 ),
1091 TP_fast_assign(
1092 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1093 __entry->ino = ip->i_ino;
1094 __entry->size = ip->i_d.di_size;
1095 __entry->new_size = new_size;
1096 ),
1097 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1098 MAJOR(__entry->dev), MINOR(__entry->dev),
1099 __entry->ino,
1100 __entry->size,
1101 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001102)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001103
1104#define DEFINE_ITRUNC_EVENT(name) \
1105DEFINE_EVENT(xfs_itrunc_class, name, \
1106 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1107 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001108DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1109DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001110
1111TRACE_EVENT(xfs_pagecache_inval,
1112 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1113 TP_ARGS(ip, start, finish),
1114 TP_STRUCT__entry(
1115 __field(dev_t, dev)
1116 __field(xfs_ino_t, ino)
1117 __field(xfs_fsize_t, size)
1118 __field(xfs_off_t, start)
1119 __field(xfs_off_t, finish)
1120 ),
1121 TP_fast_assign(
1122 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1123 __entry->ino = ip->i_ino;
1124 __entry->size = ip->i_d.di_size;
1125 __entry->start = start;
1126 __entry->finish = finish;
1127 ),
1128 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1129 MAJOR(__entry->dev), MINOR(__entry->dev),
1130 __entry->ino,
1131 __entry->size,
1132 __entry->start,
1133 __entry->finish)
1134);
1135
1136TRACE_EVENT(xfs_bunmap,
1137 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1138 int flags, unsigned long caller_ip),
1139 TP_ARGS(ip, bno, len, flags, caller_ip),
1140 TP_STRUCT__entry(
1141 __field(dev_t, dev)
1142 __field(xfs_ino_t, ino)
1143 __field(xfs_fsize_t, size)
1144 __field(xfs_fileoff_t, bno)
1145 __field(xfs_filblks_t, len)
1146 __field(unsigned long, caller_ip)
1147 __field(int, flags)
1148 ),
1149 TP_fast_assign(
1150 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1151 __entry->ino = ip->i_ino;
1152 __entry->size = ip->i_d.di_size;
1153 __entry->bno = bno;
1154 __entry->len = len;
1155 __entry->caller_ip = caller_ip;
1156 __entry->flags = flags;
1157 ),
1158 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1159 "flags %s caller %pf",
1160 MAJOR(__entry->dev), MINOR(__entry->dev),
1161 __entry->ino,
1162 __entry->size,
1163 __entry->bno,
1164 __entry->len,
1165 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1166 (void *)__entry->caller_ip)
1167
1168);
1169
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001170DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001171 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1172 xfs_agblock_t agbno, xfs_extlen_t len),
1173 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001174 TP_STRUCT__entry(
1175 __field(dev_t, dev)
1176 __field(xfs_agnumber_t, agno)
1177 __field(xfs_agblock_t, agbno)
1178 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001179 ),
1180 TP_fast_assign(
1181 __entry->dev = mp->m_super->s_dev;
1182 __entry->agno = agno;
1183 __entry->agbno = agbno;
1184 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001185 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001186 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001187 MAJOR(__entry->dev), MINOR(__entry->dev),
1188 __entry->agno,
1189 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001190 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001191);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001192#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001193DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001194 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1195 xfs_agblock_t agbno, xfs_extlen_t len), \
1196 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001197DEFINE_BUSY_EVENT(xfs_extent_busy);
1198DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1199DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1200DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1201DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001202
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001203TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001204 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1205 xfs_agblock_t agbno, xfs_extlen_t len,
1206 xfs_agblock_t tbno, xfs_extlen_t tlen),
1207 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1208 TP_STRUCT__entry(
1209 __field(dev_t, dev)
1210 __field(xfs_agnumber_t, agno)
1211 __field(xfs_agblock_t, agbno)
1212 __field(xfs_extlen_t, len)
1213 __field(xfs_agblock_t, tbno)
1214 __field(xfs_extlen_t, tlen)
1215 ),
1216 TP_fast_assign(
1217 __entry->dev = mp->m_super->s_dev;
1218 __entry->agno = agno;
1219 __entry->agbno = agbno;
1220 __entry->len = len;
1221 __entry->tbno = tbno;
1222 __entry->tlen = tlen;
1223 ),
1224 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1225 MAJOR(__entry->dev), MINOR(__entry->dev),
1226 __entry->agno,
1227 __entry->agbno,
1228 __entry->len,
1229 __entry->tbno,
1230 __entry->tlen)
1231);
1232
Dave Chinnered3b4d62010-05-21 12:07:08 +10001233TRACE_EVENT(xfs_trans_commit_lsn,
1234 TP_PROTO(struct xfs_trans *trans),
1235 TP_ARGS(trans),
1236 TP_STRUCT__entry(
1237 __field(dev_t, dev)
1238 __field(struct xfs_trans *, tp)
1239 __field(xfs_lsn_t, lsn)
1240 ),
1241 TP_fast_assign(
1242 __entry->dev = trans->t_mountp->m_super->s_dev;
1243 __entry->tp = trans;
1244 __entry->lsn = trans->t_commit_lsn;
1245 ),
1246 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1247 MAJOR(__entry->dev), MINOR(__entry->dev),
1248 __entry->tp,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001249 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001250);
1251
1252TRACE_EVENT(xfs_agf,
1253 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1254 unsigned long caller_ip),
1255 TP_ARGS(mp, agf, flags, caller_ip),
1256 TP_STRUCT__entry(
1257 __field(dev_t, dev)
1258 __field(xfs_agnumber_t, agno)
1259 __field(int, flags)
1260 __field(__u32, length)
1261 __field(__u32, bno_root)
1262 __field(__u32, cnt_root)
1263 __field(__u32, bno_level)
1264 __field(__u32, cnt_level)
1265 __field(__u32, flfirst)
1266 __field(__u32, fllast)
1267 __field(__u32, flcount)
1268 __field(__u32, freeblks)
1269 __field(__u32, longest)
1270 __field(unsigned long, caller_ip)
1271 ),
1272 TP_fast_assign(
1273 __entry->dev = mp->m_super->s_dev;
1274 __entry->agno = be32_to_cpu(agf->agf_seqno),
1275 __entry->flags = flags;
1276 __entry->length = be32_to_cpu(agf->agf_length),
1277 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1278 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1279 __entry->bno_level =
1280 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1281 __entry->cnt_level =
1282 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1283 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1284 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1285 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1286 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1287 __entry->longest = be32_to_cpu(agf->agf_longest);
1288 __entry->caller_ip = caller_ip;
1289 ),
1290 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1291 "levels b %u c %u flfirst %u fllast %u flcount %u "
1292 "freeblks %u longest %u caller %pf",
1293 MAJOR(__entry->dev), MINOR(__entry->dev),
1294 __entry->agno,
1295 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1296 __entry->length,
1297 __entry->bno_root,
1298 __entry->cnt_root,
1299 __entry->bno_level,
1300 __entry->cnt_level,
1301 __entry->flfirst,
1302 __entry->fllast,
1303 __entry->flcount,
1304 __entry->freeblks,
1305 __entry->longest,
1306 (void *)__entry->caller_ip)
1307);
1308
1309TRACE_EVENT(xfs_free_extent,
1310 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1311 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1312 TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1313 TP_STRUCT__entry(
1314 __field(dev_t, dev)
1315 __field(xfs_agnumber_t, agno)
1316 __field(xfs_agblock_t, agbno)
1317 __field(xfs_extlen_t, len)
1318 __field(int, isfl)
1319 __field(int, haveleft)
1320 __field(int, haveright)
1321 ),
1322 TP_fast_assign(
1323 __entry->dev = mp->m_super->s_dev;
1324 __entry->agno = agno;
1325 __entry->agbno = agbno;
1326 __entry->len = len;
1327 __entry->isfl = isfl;
1328 __entry->haveleft = haveleft;
1329 __entry->haveright = haveright;
1330 ),
1331 TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1332 MAJOR(__entry->dev), MINOR(__entry->dev),
1333 __entry->agno,
1334 __entry->agbno,
1335 __entry->len,
1336 __entry->isfl,
1337 __entry->haveleft ?
1338 (__entry->haveright ? "both" : "left") :
1339 (__entry->haveright ? "right" : "none"))
1340
1341);
1342
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001343DECLARE_EVENT_CLASS(xfs_alloc_class,
1344 TP_PROTO(struct xfs_alloc_arg *args),
1345 TP_ARGS(args),
1346 TP_STRUCT__entry(
1347 __field(dev_t, dev)
1348 __field(xfs_agnumber_t, agno)
1349 __field(xfs_agblock_t, agbno)
1350 __field(xfs_extlen_t, minlen)
1351 __field(xfs_extlen_t, maxlen)
1352 __field(xfs_extlen_t, mod)
1353 __field(xfs_extlen_t, prod)
1354 __field(xfs_extlen_t, minleft)
1355 __field(xfs_extlen_t, total)
1356 __field(xfs_extlen_t, alignment)
1357 __field(xfs_extlen_t, minalignslop)
1358 __field(xfs_extlen_t, len)
1359 __field(short, type)
1360 __field(short, otype)
1361 __field(char, wasdel)
1362 __field(char, wasfromfl)
1363 __field(char, isfl)
1364 __field(char, userdata)
1365 __field(xfs_fsblock_t, firstblock)
1366 ),
1367 TP_fast_assign(
1368 __entry->dev = args->mp->m_super->s_dev;
1369 __entry->agno = args->agno;
1370 __entry->agbno = args->agbno;
1371 __entry->minlen = args->minlen;
1372 __entry->maxlen = args->maxlen;
1373 __entry->mod = args->mod;
1374 __entry->prod = args->prod;
1375 __entry->minleft = args->minleft;
1376 __entry->total = args->total;
1377 __entry->alignment = args->alignment;
1378 __entry->minalignslop = args->minalignslop;
1379 __entry->len = args->len;
1380 __entry->type = args->type;
1381 __entry->otype = args->otype;
1382 __entry->wasdel = args->wasdel;
1383 __entry->wasfromfl = args->wasfromfl;
1384 __entry->isfl = args->isfl;
1385 __entry->userdata = args->userdata;
1386 __entry->firstblock = args->firstblock;
1387 ),
1388 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1389 "prod %u minleft %u total %u alignment %u minalignslop %u "
1390 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1391 "userdata %d firstblock 0x%llx",
1392 MAJOR(__entry->dev), MINOR(__entry->dev),
1393 __entry->agno,
1394 __entry->agbno,
1395 __entry->minlen,
1396 __entry->maxlen,
1397 __entry->mod,
1398 __entry->prod,
1399 __entry->minleft,
1400 __entry->total,
1401 __entry->alignment,
1402 __entry->minalignslop,
1403 __entry->len,
1404 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1405 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1406 __entry->wasdel,
1407 __entry->wasfromfl,
1408 __entry->isfl,
1409 __entry->userdata,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001410 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001411)
1412
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001413#define DEFINE_ALLOC_EVENT(name) \
1414DEFINE_EVENT(xfs_alloc_class, name, \
1415 TP_PROTO(struct xfs_alloc_arg *args), \
1416 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001417DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001418DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001419DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1420DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1421DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1422DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1423DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1424DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001425DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1426DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001427DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1428DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1429DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1430DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1431DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001432DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001433DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1434DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1435DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1436DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1437DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1438DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1439DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1440DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1441DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1442
Dave Chinner5a5881c2012-03-22 05:15:13 +00001443DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001444 TP_PROTO(struct xfs_da_args *args),
1445 TP_ARGS(args),
1446 TP_STRUCT__entry(
1447 __field(dev_t, dev)
1448 __field(xfs_ino_t, ino)
1449 __dynamic_array(char, name, args->namelen)
1450 __field(int, namelen)
1451 __field(xfs_dahash_t, hashval)
1452 __field(xfs_ino_t, inumber)
1453 __field(int, op_flags)
1454 ),
1455 TP_fast_assign(
1456 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1457 __entry->ino = args->dp->i_ino;
1458 if (args->namelen)
1459 memcpy(__get_str(name), args->name, args->namelen);
1460 __entry->namelen = args->namelen;
1461 __entry->hashval = args->hashval;
1462 __entry->inumber = args->inumber;
1463 __entry->op_flags = args->op_flags;
1464 ),
1465 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1466 "inumber 0x%llx op_flags %s",
1467 MAJOR(__entry->dev), MINOR(__entry->dev),
1468 __entry->ino,
1469 __entry->namelen,
1470 __entry->namelen ? __get_str(name) : NULL,
1471 __entry->namelen,
1472 __entry->hashval,
1473 __entry->inumber,
1474 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001475)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001476
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001477#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001478DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001479 TP_PROTO(struct xfs_da_args *args), \
1480 TP_ARGS(args))
1481DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1482DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1483DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1484DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1485DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1486DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1487DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1488DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1489DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1490DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1491DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1492DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1493DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1494DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1495DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1496DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1497DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1498DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1499DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1500DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1501DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1502DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1503DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1504DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1505DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1506
Dave Chinneree732592012-11-12 22:53:53 +11001507DECLARE_EVENT_CLASS(xfs_attr_class,
1508 TP_PROTO(struct xfs_da_args *args),
1509 TP_ARGS(args),
1510 TP_STRUCT__entry(
1511 __field(dev_t, dev)
1512 __field(xfs_ino_t, ino)
1513 __dynamic_array(char, name, args->namelen)
1514 __field(int, namelen)
1515 __field(int, valuelen)
1516 __field(xfs_dahash_t, hashval)
1517 __field(int, op_flags)
1518 ),
1519 TP_fast_assign(
1520 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1521 __entry->ino = args->dp->i_ino;
1522 if (args->namelen)
1523 memcpy(__get_str(name), args->name, args->namelen);
1524 __entry->namelen = args->namelen;
1525 __entry->valuelen = args->valuelen;
1526 __entry->hashval = args->hashval;
1527 __entry->op_flags = args->op_flags;
1528 ),
1529 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1530 "hashval 0x%x op_flags %s",
1531 MAJOR(__entry->dev), MINOR(__entry->dev),
1532 __entry->ino,
1533 __entry->namelen,
1534 __entry->namelen ? __get_str(name) : NULL,
1535 __entry->namelen,
1536 __entry->valuelen,
1537 __entry->hashval,
1538 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1539)
1540
Dave Chinner5a5881c2012-03-22 05:15:13 +00001541#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001542DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001543 TP_PROTO(struct xfs_da_args *args), \
1544 TP_ARGS(args))
1545DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1546DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1547DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1548DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1549DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1550DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1551DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1552
1553DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1554DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1555DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001556DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001557DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1558DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001559DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1560DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001561DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1562DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001563DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001564DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1565DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1566DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1567DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1568DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1569DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1570DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1571DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1572DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1573DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1574DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001575DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001576
1577DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001578DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001579DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1580DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1581DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1582
Dave Chinneree732592012-11-12 22:53:53 +11001583DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1584DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1585
1586DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1587DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1588DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1589
Dave Chinner5a5881c2012-03-22 05:15:13 +00001590#define DEFINE_DA_EVENT(name) \
1591DEFINE_EVENT(xfs_da_class, name, \
1592 TP_PROTO(struct xfs_da_args *args), \
1593 TP_ARGS(args))
1594DEFINE_DA_EVENT(xfs_da_split);
1595DEFINE_DA_EVENT(xfs_da_join);
1596DEFINE_DA_EVENT(xfs_da_link_before);
1597DEFINE_DA_EVENT(xfs_da_link_after);
1598DEFINE_DA_EVENT(xfs_da_unlink_back);
1599DEFINE_DA_EVENT(xfs_da_unlink_forward);
1600DEFINE_DA_EVENT(xfs_da_root_split);
1601DEFINE_DA_EVENT(xfs_da_root_join);
1602DEFINE_DA_EVENT(xfs_da_node_add);
1603DEFINE_DA_EVENT(xfs_da_node_create);
1604DEFINE_DA_EVENT(xfs_da_node_split);
1605DEFINE_DA_EVENT(xfs_da_node_remove);
1606DEFINE_DA_EVENT(xfs_da_node_rebalance);
1607DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001608DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001609DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1610DEFINE_DA_EVENT(xfs_da_grow_inode);
1611DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001612DEFINE_DA_EVENT(xfs_da_fixhashpath);
1613DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001614
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001615DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1616 TP_PROTO(struct xfs_da_args *args, int idx),
1617 TP_ARGS(args, idx),
1618 TP_STRUCT__entry(
1619 __field(dev_t, dev)
1620 __field(xfs_ino_t, ino)
1621 __field(int, op_flags)
1622 __field(int, idx)
1623 ),
1624 TP_fast_assign(
1625 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1626 __entry->ino = args->dp->i_ino;
1627 __entry->op_flags = args->op_flags;
1628 __entry->idx = idx;
1629 ),
1630 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1631 MAJOR(__entry->dev), MINOR(__entry->dev),
1632 __entry->ino,
1633 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1634 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001635)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001636
1637#define DEFINE_DIR2_SPACE_EVENT(name) \
1638DEFINE_EVENT(xfs_dir2_space_class, name, \
1639 TP_PROTO(struct xfs_da_args *args, int idx), \
1640 TP_ARGS(args, idx))
1641DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1642DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1643DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1644DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001645
1646TRACE_EVENT(xfs_dir2_leafn_moveents,
1647 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1648 TP_ARGS(args, src_idx, dst_idx, count),
1649 TP_STRUCT__entry(
1650 __field(dev_t, dev)
1651 __field(xfs_ino_t, ino)
1652 __field(int, op_flags)
1653 __field(int, src_idx)
1654 __field(int, dst_idx)
1655 __field(int, count)
1656 ),
1657 TP_fast_assign(
1658 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1659 __entry->ino = args->dp->i_ino;
1660 __entry->op_flags = args->op_flags;
1661 __entry->src_idx = src_idx;
1662 __entry->dst_idx = dst_idx;
1663 __entry->count = count;
1664 ),
1665 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1666 "src_idx %d dst_idx %d count %d",
1667 MAJOR(__entry->dev), MINOR(__entry->dev),
1668 __entry->ino,
1669 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1670 __entry->src_idx,
1671 __entry->dst_idx,
1672 __entry->count)
1673);
1674
Dave Chinner3a85cd92010-01-14 01:33:55 +00001675#define XFS_SWAPEXT_INODES \
1676 { 0, "target" }, \
1677 { 1, "temp" }
1678
1679#define XFS_INODE_FORMAT_STR \
1680 { 0, "invalid" }, \
1681 { 1, "local" }, \
1682 { 2, "extent" }, \
1683 { 3, "btree" }
1684
1685DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1686 TP_PROTO(struct xfs_inode *ip, int which),
1687 TP_ARGS(ip, which),
1688 TP_STRUCT__entry(
1689 __field(dev_t, dev)
1690 __field(int, which)
1691 __field(xfs_ino_t, ino)
1692 __field(int, format)
1693 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001694 __field(int, broot_size)
1695 __field(int, fork_off)
1696 ),
1697 TP_fast_assign(
1698 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1699 __entry->which = which;
1700 __entry->ino = ip->i_ino;
1701 __entry->format = ip->i_d.di_format;
1702 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001703 __entry->broot_size = ip->i_df.if_broot_bytes;
1704 __entry->fork_off = XFS_IFORK_BOFF(ip);
1705 ),
1706 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001707 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001708 MAJOR(__entry->dev), MINOR(__entry->dev),
1709 __entry->ino,
1710 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1711 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1712 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001713 __entry->broot_size,
1714 __entry->fork_off)
1715)
1716
1717#define DEFINE_SWAPEXT_EVENT(name) \
1718DEFINE_EVENT(xfs_swap_extent_class, name, \
1719 TP_PROTO(struct xfs_inode *ip, int which), \
1720 TP_ARGS(ip, which))
1721
1722DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1723DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1724
Dave Chinner9abbc532010-04-13 15:06:46 +10001725DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001726 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001727 struct xlog_recover_item *item, int pass),
1728 TP_ARGS(log, trans, item, pass),
1729 TP_STRUCT__entry(
1730 __field(dev_t, dev)
1731 __field(unsigned long, item)
1732 __field(xlog_tid_t, tid)
1733 __field(int, type)
1734 __field(int, pass)
1735 __field(int, count)
1736 __field(int, total)
1737 ),
1738 TP_fast_assign(
1739 __entry->dev = log->l_mp->m_super->s_dev;
1740 __entry->item = (unsigned long)item;
1741 __entry->tid = trans->r_log_tid;
1742 __entry->type = ITEM_TYPE(item);
1743 __entry->pass = pass;
1744 __entry->count = item->ri_cnt;
1745 __entry->total = item->ri_total;
1746 ),
1747 TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1748 "item region count/total %d/%d",
1749 MAJOR(__entry->dev), MINOR(__entry->dev),
1750 __entry->tid,
1751 __entry->pass,
1752 (void *)__entry->item,
1753 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1754 __entry->count,
1755 __entry->total)
1756)
1757
1758#define DEFINE_LOG_RECOVER_ITEM(name) \
1759DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001760 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10001761 struct xlog_recover_item *item, int pass), \
1762 TP_ARGS(log, trans, item, pass))
1763
1764DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1765DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1766DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1767DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1768DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1769
1770DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001771 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10001772 TP_ARGS(log, buf_f),
1773 TP_STRUCT__entry(
1774 __field(dev_t, dev)
1775 __field(__int64_t, blkno)
1776 __field(unsigned short, len)
1777 __field(unsigned short, flags)
1778 __field(unsigned short, size)
1779 __field(unsigned int, map_size)
1780 ),
1781 TP_fast_assign(
1782 __entry->dev = log->l_mp->m_super->s_dev;
1783 __entry->blkno = buf_f->blf_blkno;
1784 __entry->len = buf_f->blf_len;
1785 __entry->flags = buf_f->blf_flags;
1786 __entry->size = buf_f->blf_size;
1787 __entry->map_size = buf_f->blf_map_size;
1788 ),
1789 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1790 "map_size %d",
1791 MAJOR(__entry->dev), MINOR(__entry->dev),
1792 __entry->blkno,
1793 __entry->len,
1794 __entry->flags,
1795 __entry->size,
1796 __entry->map_size)
1797)
1798
1799#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1800DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001801 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10001802 TP_ARGS(log, buf_f))
1803
1804DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1805DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1806DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1807DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1808DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1809DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1810DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1811DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1812
1813DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001814 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10001815 TP_ARGS(log, in_f),
1816 TP_STRUCT__entry(
1817 __field(dev_t, dev)
1818 __field(xfs_ino_t, ino)
1819 __field(unsigned short, size)
1820 __field(int, fields)
1821 __field(unsigned short, asize)
1822 __field(unsigned short, dsize)
1823 __field(__int64_t, blkno)
1824 __field(int, len)
1825 __field(int, boffset)
1826 ),
1827 TP_fast_assign(
1828 __entry->dev = log->l_mp->m_super->s_dev;
1829 __entry->ino = in_f->ilf_ino;
1830 __entry->size = in_f->ilf_size;
1831 __entry->fields = in_f->ilf_fields;
1832 __entry->asize = in_f->ilf_asize;
1833 __entry->dsize = in_f->ilf_dsize;
1834 __entry->blkno = in_f->ilf_blkno;
1835 __entry->len = in_f->ilf_len;
1836 __entry->boffset = in_f->ilf_boffset;
1837 ),
1838 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1839 "dsize %d, blkno 0x%llx, len %d, boffset %d",
1840 MAJOR(__entry->dev), MINOR(__entry->dev),
1841 __entry->ino,
1842 __entry->size,
1843 __entry->fields,
1844 __entry->asize,
1845 __entry->dsize,
1846 __entry->blkno,
1847 __entry->len,
1848 __entry->boffset)
1849)
1850#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1851DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001852 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10001853 TP_ARGS(log, in_f))
1854
1855DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1856DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1857DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1858
Christoph Hellwiga46db602011-01-07 13:02:04 +00001859DECLARE_EVENT_CLASS(xfs_discard_class,
1860 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1861 xfs_agblock_t agbno, xfs_extlen_t len),
1862 TP_ARGS(mp, agno, agbno, len),
1863 TP_STRUCT__entry(
1864 __field(dev_t, dev)
1865 __field(xfs_agnumber_t, agno)
1866 __field(xfs_agblock_t, agbno)
1867 __field(xfs_extlen_t, len)
1868 ),
1869 TP_fast_assign(
1870 __entry->dev = mp->m_super->s_dev;
1871 __entry->agno = agno;
1872 __entry->agbno = agbno;
1873 __entry->len = len;
1874 ),
1875 TP_printk("dev %d:%d agno %u agbno %u len %u\n",
1876 MAJOR(__entry->dev), MINOR(__entry->dev),
1877 __entry->agno,
1878 __entry->agbno,
1879 __entry->len)
1880)
1881
1882#define DEFINE_DISCARD_EVENT(name) \
1883DEFINE_EVENT(xfs_discard_class, name, \
1884 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1885 xfs_agblock_t agbno, xfs_extlen_t len), \
1886 TP_ARGS(mp, agno, agbno, len))
1887DEFINE_DISCARD_EVENT(xfs_discard_extent);
1888DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
1889DEFINE_DISCARD_EVENT(xfs_discard_exclude);
1890DEFINE_DISCARD_EVENT(xfs_discard_busy);
1891
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001892#endif /* _TRACE_XFS_H */
1893
1894#undef TRACE_INCLUDE_PATH
1895#define TRACE_INCLUDE_PATH .
1896#define TRACE_INCLUDE_FILE xfs_trace
1897#include <trace/define_trace.h>