blob: be5dffd282a10095e146e95206d24f10e6baffdf [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 Hellwigcca28fb2010-06-24 11:57:09 +1000542DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000543 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
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000558#define DEFINE_INODE_EVENT(name) \
559DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000560 TP_PROTO(struct xfs_inode *ip), \
561 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000562DEFINE_INODE_EVENT(xfs_iget_skip);
563DEFINE_INODE_EVENT(xfs_iget_reclaim);
564DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
565DEFINE_INODE_EVENT(xfs_iget_hit);
566DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000567
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000568DEFINE_INODE_EVENT(xfs_getattr);
569DEFINE_INODE_EVENT(xfs_setattr);
570DEFINE_INODE_EVENT(xfs_readlink);
571DEFINE_INODE_EVENT(xfs_alloc_file_space);
572DEFINE_INODE_EVENT(xfs_free_file_space);
573DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000574#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000575DEFINE_INODE_EVENT(xfs_check_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000576#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000577DEFINE_INODE_EVENT(xfs_vm_bmap);
578DEFINE_INODE_EVENT(xfs_file_ioctl);
579DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
580DEFINE_INODE_EVENT(xfs_ioctl_setattr);
581DEFINE_INODE_EVENT(xfs_file_fsync);
582DEFINE_INODE_EVENT(xfs_destroy_inode);
583DEFINE_INODE_EVENT(xfs_write_inode);
Al Virob57922d2010-06-07 14:34:48 -0400584DEFINE_INODE_EVENT(xfs_evict_inode);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000585
586DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
587DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
588
589DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000590 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
591 TP_ARGS(ip, caller_ip),
592 TP_STRUCT__entry(
593 __field(dev_t, dev)
594 __field(xfs_ino_t, ino)
595 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100596 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000597 __field(unsigned long, caller_ip)
598 ),
599 TP_fast_assign(
600 __entry->dev = VFS_I(ip)->i_sb->s_dev;
601 __entry->ino = ip->i_ino;
602 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100603 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000604 __entry->caller_ip = caller_ip;
605 ),
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100606 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000607 MAJOR(__entry->dev), MINOR(__entry->dev),
608 __entry->ino,
609 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100610 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000611 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000612)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000613
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000614#define DEFINE_IREF_EVENT(name) \
615DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000616 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
617 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000618DEFINE_IREF_EVENT(xfs_ihold);
619DEFINE_IREF_EVENT(xfs_irele);
620DEFINE_IREF_EVENT(xfs_inode_pin);
621DEFINE_IREF_EVENT(xfs_inode_unpin);
622DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100623
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000624DECLARE_EVENT_CLASS(xfs_namespace_class,
625 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
626 TP_ARGS(dp, name),
627 TP_STRUCT__entry(
628 __field(dev_t, dev)
629 __field(xfs_ino_t, dp_ino)
630 __dynamic_array(char, name, name->len)
631 ),
632 TP_fast_assign(
633 __entry->dev = VFS_I(dp)->i_sb->s_dev;
634 __entry->dp_ino = dp->i_ino;
635 memcpy(__get_str(name), name->name, name->len);
636 ),
637 TP_printk("dev %d:%d dp ino 0x%llx name %s",
638 MAJOR(__entry->dev), MINOR(__entry->dev),
639 __entry->dp_ino,
640 __get_str(name))
641)
642
643#define DEFINE_NAMESPACE_EVENT(name) \
644DEFINE_EVENT(xfs_namespace_class, name, \
645 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
646 TP_ARGS(dp, name))
647DEFINE_NAMESPACE_EVENT(xfs_remove);
648DEFINE_NAMESPACE_EVENT(xfs_link);
649DEFINE_NAMESPACE_EVENT(xfs_lookup);
650DEFINE_NAMESPACE_EVENT(xfs_create);
651DEFINE_NAMESPACE_EVENT(xfs_symlink);
652
653TRACE_EVENT(xfs_rename,
654 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
655 struct xfs_name *src_name, struct xfs_name *target_name),
656 TP_ARGS(src_dp, target_dp, src_name, target_name),
657 TP_STRUCT__entry(
658 __field(dev_t, dev)
659 __field(xfs_ino_t, src_dp_ino)
660 __field(xfs_ino_t, target_dp_ino)
661 __dynamic_array(char, src_name, src_name->len)
662 __dynamic_array(char, target_name, target_name->len)
663 ),
664 TP_fast_assign(
665 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
666 __entry->src_dp_ino = src_dp->i_ino;
667 __entry->target_dp_ino = target_dp->i_ino;
668 memcpy(__get_str(src_name), src_name->name, src_name->len);
669 memcpy(__get_str(target_name), target_name->name, target_name->len);
670 ),
671 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
672 " src name %s target name %s",
673 MAJOR(__entry->dev), MINOR(__entry->dev),
674 __entry->src_dp_ino,
675 __entry->target_dp_ino,
676 __get_str(src_name),
677 __get_str(target_name))
678)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000679
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000680DECLARE_EVENT_CLASS(xfs_dquot_class,
681 TP_PROTO(struct xfs_dquot *dqp),
682 TP_ARGS(dqp),
683 TP_STRUCT__entry(
684 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000685 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000686 __field(unsigned, flags)
687 __field(unsigned, nrefs)
688 __field(unsigned long long, res_bcount)
689 __field(unsigned long long, bcount)
690 __field(unsigned long long, icount)
691 __field(unsigned long long, blk_hardlimit)
692 __field(unsigned long long, blk_softlimit)
693 __field(unsigned long long, ino_hardlimit)
694 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000695 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000696 TP_fast_assign(
697 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000698 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000699 __entry->flags = dqp->dq_flags;
700 __entry->nrefs = dqp->q_nrefs;
701 __entry->res_bcount = dqp->q_res_bcount;
702 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
703 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
704 __entry->blk_hardlimit =
705 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
706 __entry->blk_softlimit =
707 be64_to_cpu(dqp->q_core.d_blk_softlimit);
708 __entry->ino_hardlimit =
709 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
710 __entry->ino_softlimit =
711 be64_to_cpu(dqp->q_core.d_ino_softlimit);
712 ),
713 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000714 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
715 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000716 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000717 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000718 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
719 __entry->nrefs,
720 __entry->res_bcount,
721 __entry->bcount,
722 __entry->blk_hardlimit,
723 __entry->blk_softlimit,
724 __entry->icount,
725 __entry->ino_hardlimit,
726 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000727)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000728
729#define DEFINE_DQUOT_EVENT(name) \
730DEFINE_EVENT(xfs_dquot_class, name, \
731 TP_PROTO(struct xfs_dquot *dqp), \
732 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000733DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000734DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
735DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
736DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
737DEFINE_DQUOT_EVENT(xfs_dqattach_found);
738DEFINE_DQUOT_EVENT(xfs_dqattach_get);
739DEFINE_DQUOT_EVENT(xfs_dqinit);
740DEFINE_DQUOT_EVENT(xfs_dqreuse);
741DEFINE_DQUOT_EVENT(xfs_dqalloc);
742DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
743DEFINE_DQUOT_EVENT(xfs_dqread);
744DEFINE_DQUOT_EVENT(xfs_dqread_fail);
745DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
746DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
747DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000748DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
749DEFINE_DQUOT_EVENT(xfs_dqget_hit);
750DEFINE_DQUOT_EVENT(xfs_dqget_miss);
751DEFINE_DQUOT_EVENT(xfs_dqput);
752DEFINE_DQUOT_EVENT(xfs_dqput_wait);
753DEFINE_DQUOT_EVENT(xfs_dqput_free);
754DEFINE_DQUOT_EVENT(xfs_dqrele);
755DEFINE_DQUOT_EVENT(xfs_dqflush);
756DEFINE_DQUOT_EVENT(xfs_dqflush_force);
757DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000758
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000759DECLARE_EVENT_CLASS(xfs_loggrant_class,
760 TP_PROTO(struct log *log, struct xlog_ticket *tic),
761 TP_ARGS(log, tic),
762 TP_STRUCT__entry(
763 __field(dev_t, dev)
764 __field(unsigned, trans_type)
765 __field(char, ocnt)
766 __field(char, cnt)
767 __field(int, curr_res)
768 __field(int, unit_res)
769 __field(unsigned int, flags)
770 __field(void *, reserve_headq)
771 __field(void *, write_headq)
772 __field(int, grant_reserve_cycle)
773 __field(int, grant_reserve_bytes)
774 __field(int, grant_write_cycle)
775 __field(int, grant_write_bytes)
776 __field(int, curr_cycle)
777 __field(int, curr_block)
778 __field(xfs_lsn_t, tail_lsn)
779 ),
780 TP_fast_assign(
781 __entry->dev = log->l_mp->m_super->s_dev;
782 __entry->trans_type = tic->t_trans_type;
783 __entry->ocnt = tic->t_ocnt;
784 __entry->cnt = tic->t_cnt;
785 __entry->curr_res = tic->t_curr_res;
786 __entry->unit_res = tic->t_unit_res;
787 __entry->flags = tic->t_flags;
788 __entry->reserve_headq = log->l_reserve_headq;
789 __entry->write_headq = log->l_write_headq;
790 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle;
791 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes;
792 __entry->grant_write_cycle = log->l_grant_write_cycle;
793 __entry->grant_write_bytes = log->l_grant_write_bytes;
794 __entry->curr_cycle = log->l_curr_cycle;
795 __entry->curr_block = log->l_curr_block;
796 __entry->tail_lsn = log->l_tail_lsn;
797 ),
798 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
799 "t_unit_res %u t_flags %s reserve_headq 0x%p "
800 "write_headq 0x%p grant_reserve_cycle %d "
801 "grant_reserve_bytes %d grant_write_cycle %d "
802 "grant_write_bytes %d curr_cycle %d curr_block %d "
803 "tail_cycle %d tail_block %d",
804 MAJOR(__entry->dev), MINOR(__entry->dev),
805 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
806 __entry->ocnt,
807 __entry->cnt,
808 __entry->curr_res,
809 __entry->unit_res,
810 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
811 __entry->reserve_headq,
812 __entry->write_headq,
813 __entry->grant_reserve_cycle,
814 __entry->grant_reserve_bytes,
815 __entry->grant_write_cycle,
816 __entry->grant_write_bytes,
817 __entry->curr_cycle,
818 __entry->curr_block,
819 CYCLE_LSN(__entry->tail_lsn),
820 BLOCK_LSN(__entry->tail_lsn)
821 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000822)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000823
824#define DEFINE_LOGGRANT_EVENT(name) \
825DEFINE_EVENT(xfs_loggrant_class, name, \
826 TP_PROTO(struct log *log, struct xlog_ticket *tic), \
827 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000828DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
829DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
830DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
831DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
832DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
833DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
834DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
835DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
836DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
837DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
838DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
839DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
840DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
841DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
842DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
843DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
844DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
845DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
846DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
847DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
848DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
849DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
850DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
851DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
852
Li Zefanf8adb4d2010-05-24 08:25:57 +0000853DECLARE_EVENT_CLASS(xfs_file_class,
854 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags),
855 TP_ARGS(ip, count, offset, flags),
856 TP_STRUCT__entry(
857 __field(dev_t, dev)
858 __field(xfs_ino_t, ino)
859 __field(xfs_fsize_t, size)
860 __field(xfs_fsize_t, new_size)
861 __field(loff_t, offset)
862 __field(size_t, count)
863 __field(int, flags)
864 ),
865 TP_fast_assign(
866 __entry->dev = VFS_I(ip)->i_sb->s_dev;
867 __entry->ino = ip->i_ino;
868 __entry->size = ip->i_d.di_size;
869 __entry->new_size = ip->i_new_size;
870 __entry->offset = offset;
871 __entry->count = count;
872 __entry->flags = flags;
873 ),
874 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
875 "offset 0x%llx count 0x%zx ioflags %s",
876 MAJOR(__entry->dev), MINOR(__entry->dev),
877 __entry->ino,
878 __entry->size,
879 __entry->new_size,
880 __entry->offset,
881 __entry->count,
882 __print_flags(__entry->flags, "|", XFS_IO_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000883)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000884
885#define DEFINE_RW_EVENT(name) \
886DEFINE_EVENT(xfs_file_class, name, \
887 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
888 TP_ARGS(ip, count, offset, flags))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000889DEFINE_RW_EVENT(xfs_file_read);
890DEFINE_RW_EVENT(xfs_file_buffered_write);
891DEFINE_RW_EVENT(xfs_file_direct_write);
892DEFINE_RW_EVENT(xfs_file_splice_read);
893DEFINE_RW_EVENT(xfs_file_splice_write);
894
Li Zefanf8adb4d2010-05-24 08:25:57 +0000895DECLARE_EVENT_CLASS(xfs_page_class,
896 TP_PROTO(struct inode *inode, struct page *page, unsigned long off),
897 TP_ARGS(inode, page, off),
898 TP_STRUCT__entry(
899 __field(dev_t, dev)
900 __field(xfs_ino_t, ino)
901 __field(pgoff_t, pgoff)
902 __field(loff_t, size)
903 __field(unsigned long, offset)
904 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000905 __field(int, unwritten)
906 ),
907 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000908 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000909
Li Zefanf8adb4d2010-05-24 08:25:57 +0000910 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000911 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000912 __entry->dev = inode->i_sb->s_dev;
913 __entry->ino = XFS_I(inode)->i_ino;
914 __entry->pgoff = page_offset(page);
915 __entry->size = i_size_read(inode);
916 __entry->offset = off;
917 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +0000918 __entry->unwritten = unwritten;
919 ),
920 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig20cb52e2010-06-24 09:46:01 +1000921 "delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000922 MAJOR(__entry->dev), MINOR(__entry->dev),
923 __entry->ino,
924 __entry->pgoff,
925 __entry->size,
926 __entry->offset,
927 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +0000928 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000929)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000930
931#define DEFINE_PAGE_EVENT(name) \
932DEFINE_EVENT(xfs_page_class, name, \
933 TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
934 TP_ARGS(inode, page, off))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000935DEFINE_PAGE_EVENT(xfs_writepage);
936DEFINE_PAGE_EVENT(xfs_releasepage);
937DEFINE_PAGE_EVENT(xfs_invalidatepage);
938
Li Zefanf8adb4d2010-05-24 08:25:57 +0000939DECLARE_EVENT_CLASS(xfs_iomap_class,
940 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
941 int flags, struct xfs_bmbt_irec *irec),
942 TP_ARGS(ip, offset, count, flags, irec),
943 TP_STRUCT__entry(
944 __field(dev_t, dev)
945 __field(xfs_ino_t, ino)
946 __field(loff_t, size)
947 __field(loff_t, new_size)
948 __field(loff_t, offset)
949 __field(size_t, count)
950 __field(int, flags)
951 __field(xfs_fileoff_t, startoff)
952 __field(xfs_fsblock_t, startblock)
953 __field(xfs_filblks_t, blockcount)
954 ),
955 TP_fast_assign(
956 __entry->dev = VFS_I(ip)->i_sb->s_dev;
957 __entry->ino = ip->i_ino;
958 __entry->size = ip->i_d.di_size;
959 __entry->new_size = ip->i_new_size;
960 __entry->offset = offset;
961 __entry->count = count;
962 __entry->flags = flags;
963 __entry->startoff = irec ? irec->br_startoff : 0;
964 __entry->startblock = irec ? irec->br_startblock : 0;
965 __entry->blockcount = irec ? irec->br_blockcount : 0;
966 ),
967 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
968 "offset 0x%llx count %zd flags %s "
969 "startoff 0x%llx startblock %lld blockcount 0x%llx",
970 MAJOR(__entry->dev), MINOR(__entry->dev),
971 __entry->ino,
972 __entry->size,
973 __entry->new_size,
974 __entry->offset,
975 __entry->count,
976 __print_flags(__entry->flags, "|", BMAPI_FLAGS),
977 __entry->startoff,
978 (__int64_t)__entry->startblock,
979 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000980)
Li Zefanf8adb4d2010-05-24 08:25:57 +0000981
982#define DEFINE_IOMAP_EVENT(name) \
983DEFINE_EVENT(xfs_iomap_class, name, \
984 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
985 int flags, struct xfs_bmbt_irec *irec), \
986 TP_ARGS(ip, offset, count, flags, irec))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000987DEFINE_IOMAP_EVENT(xfs_iomap_enter);
988DEFINE_IOMAP_EVENT(xfs_iomap_found);
989DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
990
Li Zefanf8adb4d2010-05-24 08:25:57 +0000991DECLARE_EVENT_CLASS(xfs_simple_io_class,
992 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
993 TP_ARGS(ip, offset, count),
994 TP_STRUCT__entry(
995 __field(dev_t, dev)
996 __field(xfs_ino_t, ino)
997 __field(loff_t, size)
998 __field(loff_t, new_size)
999 __field(loff_t, offset)
1000 __field(size_t, count)
1001 ),
1002 TP_fast_assign(
1003 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1004 __entry->ino = ip->i_ino;
1005 __entry->size = ip->i_d.di_size;
1006 __entry->new_size = ip->i_new_size;
1007 __entry->offset = offset;
1008 __entry->count = count;
1009 ),
1010 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx "
1011 "offset 0x%llx count %zd",
1012 MAJOR(__entry->dev), MINOR(__entry->dev),
1013 __entry->ino,
1014 __entry->size,
1015 __entry->new_size,
1016 __entry->offset,
1017 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001018);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001019
1020#define DEFINE_SIMPLE_IO_EVENT(name) \
1021DEFINE_EVENT(xfs_simple_io_class, name, \
1022 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1023 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001024DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1025DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
1026
1027
1028TRACE_EVENT(xfs_itruncate_start,
1029 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
1030 xfs_off_t toss_start, xfs_off_t toss_finish),
1031 TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
1032 TP_STRUCT__entry(
1033 __field(dev_t, dev)
1034 __field(xfs_ino_t, ino)
1035 __field(xfs_fsize_t, size)
1036 __field(xfs_fsize_t, new_size)
1037 __field(xfs_off_t, toss_start)
1038 __field(xfs_off_t, toss_finish)
1039 __field(int, flag)
1040 ),
1041 TP_fast_assign(
1042 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1043 __entry->ino = ip->i_ino;
1044 __entry->size = ip->i_d.di_size;
1045 __entry->new_size = new_size;
1046 __entry->toss_start = toss_start;
1047 __entry->toss_finish = toss_finish;
1048 __entry->flag = flag;
1049 ),
1050 TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
1051 "toss start 0x%llx toss finish 0x%llx",
1052 MAJOR(__entry->dev), MINOR(__entry->dev),
1053 __entry->ino,
1054 __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
1055 __entry->size,
1056 __entry->new_size,
1057 __entry->toss_start,
1058 __entry->toss_finish)
1059);
1060
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001061DECLARE_EVENT_CLASS(xfs_itrunc_class,
1062 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1063 TP_ARGS(ip, new_size),
1064 TP_STRUCT__entry(
1065 __field(dev_t, dev)
1066 __field(xfs_ino_t, ino)
1067 __field(xfs_fsize_t, size)
1068 __field(xfs_fsize_t, new_size)
1069 ),
1070 TP_fast_assign(
1071 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1072 __entry->ino = ip->i_ino;
1073 __entry->size = ip->i_d.di_size;
1074 __entry->new_size = new_size;
1075 ),
1076 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1077 MAJOR(__entry->dev), MINOR(__entry->dev),
1078 __entry->ino,
1079 __entry->size,
1080 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001081)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001082
1083#define DEFINE_ITRUNC_EVENT(name) \
1084DEFINE_EVENT(xfs_itrunc_class, name, \
1085 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1086 TP_ARGS(ip, new_size))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001087DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
1088DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
1089
1090TRACE_EVENT(xfs_pagecache_inval,
1091 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1092 TP_ARGS(ip, start, finish),
1093 TP_STRUCT__entry(
1094 __field(dev_t, dev)
1095 __field(xfs_ino_t, ino)
1096 __field(xfs_fsize_t, size)
1097 __field(xfs_off_t, start)
1098 __field(xfs_off_t, finish)
1099 ),
1100 TP_fast_assign(
1101 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1102 __entry->ino = ip->i_ino;
1103 __entry->size = ip->i_d.di_size;
1104 __entry->start = start;
1105 __entry->finish = finish;
1106 ),
1107 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1108 MAJOR(__entry->dev), MINOR(__entry->dev),
1109 __entry->ino,
1110 __entry->size,
1111 __entry->start,
1112 __entry->finish)
1113);
1114
1115TRACE_EVENT(xfs_bunmap,
1116 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1117 int flags, unsigned long caller_ip),
1118 TP_ARGS(ip, bno, len, flags, caller_ip),
1119 TP_STRUCT__entry(
1120 __field(dev_t, dev)
1121 __field(xfs_ino_t, ino)
1122 __field(xfs_fsize_t, size)
1123 __field(xfs_fileoff_t, bno)
1124 __field(xfs_filblks_t, len)
1125 __field(unsigned long, caller_ip)
1126 __field(int, flags)
1127 ),
1128 TP_fast_assign(
1129 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1130 __entry->ino = ip->i_ino;
1131 __entry->size = ip->i_d.di_size;
1132 __entry->bno = bno;
1133 __entry->len = len;
1134 __entry->caller_ip = caller_ip;
1135 __entry->flags = flags;
1136 ),
1137 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1138 "flags %s caller %pf",
1139 MAJOR(__entry->dev), MINOR(__entry->dev),
1140 __entry->ino,
1141 __entry->size,
1142 __entry->bno,
1143 __entry->len,
1144 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1145 (void *)__entry->caller_ip)
1146
1147);
1148
Dave Chinnered3b4d62010-05-21 12:07:08 +10001149#define XFS_BUSY_SYNC \
1150 { 0, "async" }, \
1151 { 1, "sync" }
1152
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001153TRACE_EVENT(xfs_alloc_busy,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001154 TP_PROTO(struct xfs_trans *trans, xfs_agnumber_t agno,
1155 xfs_agblock_t agbno, xfs_extlen_t len, int sync),
1156 TP_ARGS(trans, agno, agbno, len, sync),
1157 TP_STRUCT__entry(
1158 __field(dev_t, dev)
1159 __field(struct xfs_trans *, tp)
1160 __field(int, tid)
1161 __field(xfs_agnumber_t, agno)
1162 __field(xfs_agblock_t, agbno)
1163 __field(xfs_extlen_t, len)
1164 __field(int, sync)
1165 ),
1166 TP_fast_assign(
1167 __entry->dev = trans->t_mountp->m_super->s_dev;
1168 __entry->tp = trans;
1169 __entry->tid = trans->t_ticket->t_tid;
1170 __entry->agno = agno;
1171 __entry->agbno = agbno;
1172 __entry->len = len;
1173 __entry->sync = sync;
1174 ),
1175 TP_printk("dev %d:%d trans 0x%p tid 0x%x agno %u agbno %u len %u %s",
1176 MAJOR(__entry->dev), MINOR(__entry->dev),
1177 __entry->tp,
1178 __entry->tid,
1179 __entry->agno,
1180 __entry->agbno,
1181 __entry->len,
1182 __print_symbolic(__entry->sync, XFS_BUSY_SYNC))
1183
1184);
1185
1186TRACE_EVENT(xfs_alloc_unbusy,
1187 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1188 xfs_agblock_t agbno, xfs_extlen_t len),
1189 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001190 TP_STRUCT__entry(
1191 __field(dev_t, dev)
1192 __field(xfs_agnumber_t, agno)
1193 __field(xfs_agblock_t, agbno)
1194 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001195 ),
1196 TP_fast_assign(
1197 __entry->dev = mp->m_super->s_dev;
1198 __entry->agno = agno;
1199 __entry->agbno = agbno;
1200 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001201 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001202 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001203 MAJOR(__entry->dev), MINOR(__entry->dev),
1204 __entry->agno,
1205 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001206 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001207);
1208
1209#define XFS_BUSY_STATES \
Dave Chinnered3b4d62010-05-21 12:07:08 +10001210 { 0, "missing" }, \
1211 { 1, "found" }
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001212
Dave Chinnered3b4d62010-05-21 12:07:08 +10001213TRACE_EVENT(xfs_alloc_busysearch,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001214 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001215 xfs_agblock_t agbno, xfs_extlen_t len, int found),
1216 TP_ARGS(mp, agno, agbno, len, found),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001217 TP_STRUCT__entry(
1218 __field(dev_t, dev)
1219 __field(xfs_agnumber_t, agno)
Dave Chinnered3b4d62010-05-21 12:07:08 +10001220 __field(xfs_agblock_t, agbno)
1221 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001222 __field(int, found)
1223 ),
1224 TP_fast_assign(
1225 __entry->dev = mp->m_super->s_dev;
1226 __entry->agno = agno;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001227 __entry->agbno = agbno;
1228 __entry->len = len;
Dave Chinnered3b4d62010-05-21 12:07:08 +10001229 __entry->found = found;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001230 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001231 TP_printk("dev %d:%d agno %u agbno %u len %u %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001232 MAJOR(__entry->dev), MINOR(__entry->dev),
1233 __entry->agno,
1234 __entry->agbno,
1235 __entry->len,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001236 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1237);
1238
1239TRACE_EVENT(xfs_trans_commit_lsn,
1240 TP_PROTO(struct xfs_trans *trans),
1241 TP_ARGS(trans),
1242 TP_STRUCT__entry(
1243 __field(dev_t, dev)
1244 __field(struct xfs_trans *, tp)
1245 __field(xfs_lsn_t, lsn)
1246 ),
1247 TP_fast_assign(
1248 __entry->dev = trans->t_mountp->m_super->s_dev;
1249 __entry->tp = trans;
1250 __entry->lsn = trans->t_commit_lsn;
1251 ),
1252 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1253 MAJOR(__entry->dev), MINOR(__entry->dev),
1254 __entry->tp,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001255 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001256);
1257
1258TRACE_EVENT(xfs_agf,
1259 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1260 unsigned long caller_ip),
1261 TP_ARGS(mp, agf, flags, caller_ip),
1262 TP_STRUCT__entry(
1263 __field(dev_t, dev)
1264 __field(xfs_agnumber_t, agno)
1265 __field(int, flags)
1266 __field(__u32, length)
1267 __field(__u32, bno_root)
1268 __field(__u32, cnt_root)
1269 __field(__u32, bno_level)
1270 __field(__u32, cnt_level)
1271 __field(__u32, flfirst)
1272 __field(__u32, fllast)
1273 __field(__u32, flcount)
1274 __field(__u32, freeblks)
1275 __field(__u32, longest)
1276 __field(unsigned long, caller_ip)
1277 ),
1278 TP_fast_assign(
1279 __entry->dev = mp->m_super->s_dev;
1280 __entry->agno = be32_to_cpu(agf->agf_seqno),
1281 __entry->flags = flags;
1282 __entry->length = be32_to_cpu(agf->agf_length),
1283 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1284 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1285 __entry->bno_level =
1286 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1287 __entry->cnt_level =
1288 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1289 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1290 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1291 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1292 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1293 __entry->longest = be32_to_cpu(agf->agf_longest);
1294 __entry->caller_ip = caller_ip;
1295 ),
1296 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1297 "levels b %u c %u flfirst %u fllast %u flcount %u "
1298 "freeblks %u longest %u caller %pf",
1299 MAJOR(__entry->dev), MINOR(__entry->dev),
1300 __entry->agno,
1301 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1302 __entry->length,
1303 __entry->bno_root,
1304 __entry->cnt_root,
1305 __entry->bno_level,
1306 __entry->cnt_level,
1307 __entry->flfirst,
1308 __entry->fllast,
1309 __entry->flcount,
1310 __entry->freeblks,
1311 __entry->longest,
1312 (void *)__entry->caller_ip)
1313);
1314
1315TRACE_EVENT(xfs_free_extent,
1316 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1317 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1318 TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1319 TP_STRUCT__entry(
1320 __field(dev_t, dev)
1321 __field(xfs_agnumber_t, agno)
1322 __field(xfs_agblock_t, agbno)
1323 __field(xfs_extlen_t, len)
1324 __field(int, isfl)
1325 __field(int, haveleft)
1326 __field(int, haveright)
1327 ),
1328 TP_fast_assign(
1329 __entry->dev = mp->m_super->s_dev;
1330 __entry->agno = agno;
1331 __entry->agbno = agbno;
1332 __entry->len = len;
1333 __entry->isfl = isfl;
1334 __entry->haveleft = haveleft;
1335 __entry->haveright = haveright;
1336 ),
1337 TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1338 MAJOR(__entry->dev), MINOR(__entry->dev),
1339 __entry->agno,
1340 __entry->agbno,
1341 __entry->len,
1342 __entry->isfl,
1343 __entry->haveleft ?
1344 (__entry->haveright ? "both" : "left") :
1345 (__entry->haveright ? "right" : "none"))
1346
1347);
1348
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001349DECLARE_EVENT_CLASS(xfs_alloc_class,
1350 TP_PROTO(struct xfs_alloc_arg *args),
1351 TP_ARGS(args),
1352 TP_STRUCT__entry(
1353 __field(dev_t, dev)
1354 __field(xfs_agnumber_t, agno)
1355 __field(xfs_agblock_t, agbno)
1356 __field(xfs_extlen_t, minlen)
1357 __field(xfs_extlen_t, maxlen)
1358 __field(xfs_extlen_t, mod)
1359 __field(xfs_extlen_t, prod)
1360 __field(xfs_extlen_t, minleft)
1361 __field(xfs_extlen_t, total)
1362 __field(xfs_extlen_t, alignment)
1363 __field(xfs_extlen_t, minalignslop)
1364 __field(xfs_extlen_t, len)
1365 __field(short, type)
1366 __field(short, otype)
1367 __field(char, wasdel)
1368 __field(char, wasfromfl)
1369 __field(char, isfl)
1370 __field(char, userdata)
1371 __field(xfs_fsblock_t, firstblock)
1372 ),
1373 TP_fast_assign(
1374 __entry->dev = args->mp->m_super->s_dev;
1375 __entry->agno = args->agno;
1376 __entry->agbno = args->agbno;
1377 __entry->minlen = args->minlen;
1378 __entry->maxlen = args->maxlen;
1379 __entry->mod = args->mod;
1380 __entry->prod = args->prod;
1381 __entry->minleft = args->minleft;
1382 __entry->total = args->total;
1383 __entry->alignment = args->alignment;
1384 __entry->minalignslop = args->minalignslop;
1385 __entry->len = args->len;
1386 __entry->type = args->type;
1387 __entry->otype = args->otype;
1388 __entry->wasdel = args->wasdel;
1389 __entry->wasfromfl = args->wasfromfl;
1390 __entry->isfl = args->isfl;
1391 __entry->userdata = args->userdata;
1392 __entry->firstblock = args->firstblock;
1393 ),
1394 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1395 "prod %u minleft %u total %u alignment %u minalignslop %u "
1396 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1397 "userdata %d firstblock 0x%llx",
1398 MAJOR(__entry->dev), MINOR(__entry->dev),
1399 __entry->agno,
1400 __entry->agbno,
1401 __entry->minlen,
1402 __entry->maxlen,
1403 __entry->mod,
1404 __entry->prod,
1405 __entry->minleft,
1406 __entry->total,
1407 __entry->alignment,
1408 __entry->minalignslop,
1409 __entry->len,
1410 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1411 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1412 __entry->wasdel,
1413 __entry->wasfromfl,
1414 __entry->isfl,
1415 __entry->userdata,
1416 __entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001417)
1418
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001419#define DEFINE_ALLOC_EVENT(name) \
1420DEFINE_EVENT(xfs_alloc_class, name, \
1421 TP_PROTO(struct xfs_alloc_arg *args), \
1422 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001423DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1424DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1425DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1426DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1427DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1428DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1429DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1430DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1431DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1432DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1433DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1434DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1435DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1436DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1437DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1438DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1439DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1440DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1441DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1442DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1443DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1444
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001445DECLARE_EVENT_CLASS(xfs_dir2_class,
1446 TP_PROTO(struct xfs_da_args *args),
1447 TP_ARGS(args),
1448 TP_STRUCT__entry(
1449 __field(dev_t, dev)
1450 __field(xfs_ino_t, ino)
1451 __dynamic_array(char, name, args->namelen)
1452 __field(int, namelen)
1453 __field(xfs_dahash_t, hashval)
1454 __field(xfs_ino_t, inumber)
1455 __field(int, op_flags)
1456 ),
1457 TP_fast_assign(
1458 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1459 __entry->ino = args->dp->i_ino;
1460 if (args->namelen)
1461 memcpy(__get_str(name), args->name, args->namelen);
1462 __entry->namelen = args->namelen;
1463 __entry->hashval = args->hashval;
1464 __entry->inumber = args->inumber;
1465 __entry->op_flags = args->op_flags;
1466 ),
1467 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1468 "inumber 0x%llx op_flags %s",
1469 MAJOR(__entry->dev), MINOR(__entry->dev),
1470 __entry->ino,
1471 __entry->namelen,
1472 __entry->namelen ? __get_str(name) : NULL,
1473 __entry->namelen,
1474 __entry->hashval,
1475 __entry->inumber,
1476 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001477)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001478
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001479#define DEFINE_DIR2_EVENT(name) \
1480DEFINE_EVENT(xfs_dir2_class, name, \
1481 TP_PROTO(struct xfs_da_args *args), \
1482 TP_ARGS(args))
1483DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1484DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1485DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1486DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1487DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1488DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1489DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1490DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1491DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1492DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1493DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1494DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1495DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1496DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1497DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1498DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1499DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1500DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1501DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1502DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1503DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1504DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1505DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1506DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1507DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1508
1509DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1510 TP_PROTO(struct xfs_da_args *args, int idx),
1511 TP_ARGS(args, idx),
1512 TP_STRUCT__entry(
1513 __field(dev_t, dev)
1514 __field(xfs_ino_t, ino)
1515 __field(int, op_flags)
1516 __field(int, idx)
1517 ),
1518 TP_fast_assign(
1519 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1520 __entry->ino = args->dp->i_ino;
1521 __entry->op_flags = args->op_flags;
1522 __entry->idx = idx;
1523 ),
1524 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1525 MAJOR(__entry->dev), MINOR(__entry->dev),
1526 __entry->ino,
1527 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1528 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001529)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001530
1531#define DEFINE_DIR2_SPACE_EVENT(name) \
1532DEFINE_EVENT(xfs_dir2_space_class, name, \
1533 TP_PROTO(struct xfs_da_args *args, int idx), \
1534 TP_ARGS(args, idx))
1535DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1536DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1537DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1538DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001539
1540TRACE_EVENT(xfs_dir2_leafn_moveents,
1541 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1542 TP_ARGS(args, src_idx, dst_idx, count),
1543 TP_STRUCT__entry(
1544 __field(dev_t, dev)
1545 __field(xfs_ino_t, ino)
1546 __field(int, op_flags)
1547 __field(int, src_idx)
1548 __field(int, dst_idx)
1549 __field(int, count)
1550 ),
1551 TP_fast_assign(
1552 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1553 __entry->ino = args->dp->i_ino;
1554 __entry->op_flags = args->op_flags;
1555 __entry->src_idx = src_idx;
1556 __entry->dst_idx = dst_idx;
1557 __entry->count = count;
1558 ),
1559 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1560 "src_idx %d dst_idx %d count %d",
1561 MAJOR(__entry->dev), MINOR(__entry->dev),
1562 __entry->ino,
1563 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1564 __entry->src_idx,
1565 __entry->dst_idx,
1566 __entry->count)
1567);
1568
Dave Chinner3a85cd92010-01-14 01:33:55 +00001569#define XFS_SWAPEXT_INODES \
1570 { 0, "target" }, \
1571 { 1, "temp" }
1572
1573#define XFS_INODE_FORMAT_STR \
1574 { 0, "invalid" }, \
1575 { 1, "local" }, \
1576 { 2, "extent" }, \
1577 { 3, "btree" }
1578
1579DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1580 TP_PROTO(struct xfs_inode *ip, int which),
1581 TP_ARGS(ip, which),
1582 TP_STRUCT__entry(
1583 __field(dev_t, dev)
1584 __field(int, which)
1585 __field(xfs_ino_t, ino)
1586 __field(int, format)
1587 __field(int, nex)
1588 __field(int, max_nex)
1589 __field(int, broot_size)
1590 __field(int, fork_off)
1591 ),
1592 TP_fast_assign(
1593 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1594 __entry->which = which;
1595 __entry->ino = ip->i_ino;
1596 __entry->format = ip->i_d.di_format;
1597 __entry->nex = ip->i_d.di_nextents;
1598 __entry->max_nex = ip->i_df.if_ext_max;
1599 __entry->broot_size = ip->i_df.if_broot_bytes;
1600 __entry->fork_off = XFS_IFORK_BOFF(ip);
1601 ),
1602 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1603 "Max in-fork extents %d, broot size %d, fork offset %d",
1604 MAJOR(__entry->dev), MINOR(__entry->dev),
1605 __entry->ino,
1606 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1607 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1608 __entry->nex,
1609 __entry->max_nex,
1610 __entry->broot_size,
1611 __entry->fork_off)
1612)
1613
1614#define DEFINE_SWAPEXT_EVENT(name) \
1615DEFINE_EVENT(xfs_swap_extent_class, name, \
1616 TP_PROTO(struct xfs_inode *ip, int which), \
1617 TP_ARGS(ip, which))
1618
1619DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1620DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1621
Dave Chinner9abbc532010-04-13 15:06:46 +10001622DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
1623 TP_PROTO(struct log *log, struct xlog_recover *trans,
1624 struct xlog_recover_item *item, int pass),
1625 TP_ARGS(log, trans, item, pass),
1626 TP_STRUCT__entry(
1627 __field(dev_t, dev)
1628 __field(unsigned long, item)
1629 __field(xlog_tid_t, tid)
1630 __field(int, type)
1631 __field(int, pass)
1632 __field(int, count)
1633 __field(int, total)
1634 ),
1635 TP_fast_assign(
1636 __entry->dev = log->l_mp->m_super->s_dev;
1637 __entry->item = (unsigned long)item;
1638 __entry->tid = trans->r_log_tid;
1639 __entry->type = ITEM_TYPE(item);
1640 __entry->pass = pass;
1641 __entry->count = item->ri_cnt;
1642 __entry->total = item->ri_total;
1643 ),
1644 TP_printk("dev %d:%d trans 0x%x, pass %d, item 0x%p, item type %s "
1645 "item region count/total %d/%d",
1646 MAJOR(__entry->dev), MINOR(__entry->dev),
1647 __entry->tid,
1648 __entry->pass,
1649 (void *)__entry->item,
1650 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1651 __entry->count,
1652 __entry->total)
1653)
1654
1655#define DEFINE_LOG_RECOVER_ITEM(name) \
1656DEFINE_EVENT(xfs_log_recover_item_class, name, \
1657 TP_PROTO(struct log *log, struct xlog_recover *trans, \
1658 struct xlog_recover_item *item, int pass), \
1659 TP_ARGS(log, trans, item, pass))
1660
1661DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
1662DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
1663DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
1664DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
1665DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
1666
1667DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
1668 TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f),
1669 TP_ARGS(log, buf_f),
1670 TP_STRUCT__entry(
1671 __field(dev_t, dev)
1672 __field(__int64_t, blkno)
1673 __field(unsigned short, len)
1674 __field(unsigned short, flags)
1675 __field(unsigned short, size)
1676 __field(unsigned int, map_size)
1677 ),
1678 TP_fast_assign(
1679 __entry->dev = log->l_mp->m_super->s_dev;
1680 __entry->blkno = buf_f->blf_blkno;
1681 __entry->len = buf_f->blf_len;
1682 __entry->flags = buf_f->blf_flags;
1683 __entry->size = buf_f->blf_size;
1684 __entry->map_size = buf_f->blf_map_size;
1685 ),
1686 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
1687 "map_size %d",
1688 MAJOR(__entry->dev), MINOR(__entry->dev),
1689 __entry->blkno,
1690 __entry->len,
1691 __entry->flags,
1692 __entry->size,
1693 __entry->map_size)
1694)
1695
1696#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
1697DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
1698 TP_PROTO(struct log *log, struct xfs_buf_log_format *buf_f), \
1699 TP_ARGS(log, buf_f))
1700
1701DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
1702DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
1703DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
1704DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
1705DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
1706DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
1707DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
1708DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
1709
1710DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
1711 TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f),
1712 TP_ARGS(log, in_f),
1713 TP_STRUCT__entry(
1714 __field(dev_t, dev)
1715 __field(xfs_ino_t, ino)
1716 __field(unsigned short, size)
1717 __field(int, fields)
1718 __field(unsigned short, asize)
1719 __field(unsigned short, dsize)
1720 __field(__int64_t, blkno)
1721 __field(int, len)
1722 __field(int, boffset)
1723 ),
1724 TP_fast_assign(
1725 __entry->dev = log->l_mp->m_super->s_dev;
1726 __entry->ino = in_f->ilf_ino;
1727 __entry->size = in_f->ilf_size;
1728 __entry->fields = in_f->ilf_fields;
1729 __entry->asize = in_f->ilf_asize;
1730 __entry->dsize = in_f->ilf_dsize;
1731 __entry->blkno = in_f->ilf_blkno;
1732 __entry->len = in_f->ilf_len;
1733 __entry->boffset = in_f->ilf_boffset;
1734 ),
1735 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
1736 "dsize %d, blkno 0x%llx, len %d, boffset %d",
1737 MAJOR(__entry->dev), MINOR(__entry->dev),
1738 __entry->ino,
1739 __entry->size,
1740 __entry->fields,
1741 __entry->asize,
1742 __entry->dsize,
1743 __entry->blkno,
1744 __entry->len,
1745 __entry->boffset)
1746)
1747#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
1748DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
1749 TP_PROTO(struct log *log, struct xfs_inode_log_format *in_f), \
1750 TP_ARGS(log, in_f))
1751
1752DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
1753DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
1754DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
1755
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001756#endif /* _TRACE_XFS_H */
1757
1758#undef TRACE_INCLUDE_PATH
1759#define TRACE_INCLUDE_PATH .
1760#define TRACE_INCLUDE_FILE xfs_trace
1761#include <trace/define_trace.h>