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