blob: 65371859c7536896adb31b1a3c023b4c27ff7af7 [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;
35
Christoph Hellwigea9a4882009-12-21 14:03:03 +000036DECLARE_EVENT_CLASS(xfs_attr_list_class,
37 TP_PROTO(struct xfs_attr_list_context *ctx),
38 TP_ARGS(ctx),
39 TP_STRUCT__entry(
40 __field(dev_t, dev)
41 __field(xfs_ino_t, ino)
42 __field(u32, hashval)
43 __field(u32, blkno)
44 __field(u32, offset)
45 __field(void *, alist)
46 __field(int, bufsize)
47 __field(int, count)
48 __field(int, firstu)
49 __field(int, dupcnt)
50 __field(int, flags)
51 ),
52 TP_fast_assign(
53 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
54 __entry->ino = ctx->dp->i_ino;
55 __entry->hashval = ctx->cursor->hashval;
56 __entry->blkno = ctx->cursor->blkno;
57 __entry->offset = ctx->cursor->offset;
58 __entry->alist = ctx->alist;
59 __entry->bufsize = ctx->bufsize;
60 __entry->count = ctx->count;
61 __entry->firstu = ctx->firstu;
62 __entry->flags = ctx->flags;
63 ),
64 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
65 "alist 0x%p size %u count %u firstu %u flags %d %s",
66 MAJOR(__entry->dev), MINOR(__entry->dev),
67 __entry->ino,
68 __entry->hashval,
69 __entry->blkno,
70 __entry->offset,
71 __entry->dupcnt,
72 __entry->alist,
73 __entry->bufsize,
74 __entry->count,
75 __entry->firstu,
76 __entry->flags,
77 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
78 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000079)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000080
Dave Chinner0fa800f2010-01-11 11:47:46 +000081#define DEFINE_PERAG_REF_EVENT(name) \
82TRACE_EVENT(name, \
83 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
84 unsigned long caller_ip), \
85 TP_ARGS(mp, agno, refcount, caller_ip), \
86 TP_STRUCT__entry( \
87 __field(dev_t, dev) \
88 __field(xfs_agnumber_t, agno) \
89 __field(int, refcount) \
90 __field(unsigned long, caller_ip) \
91 ), \
92 TP_fast_assign( \
93 __entry->dev = mp->m_super->s_dev; \
94 __entry->agno = agno; \
95 __entry->refcount = refcount; \
96 __entry->caller_ip = caller_ip; \
97 ), \
98 TP_printk("dev %d:%d agno %u refcount %d caller %pf", \
99 MAJOR(__entry->dev), MINOR(__entry->dev), \
100 __entry->agno, \
101 __entry->refcount, \
102 (char *)__entry->caller_ip) \
103);
104
105DEFINE_PERAG_REF_EVENT(xfs_perag_get)
106DEFINE_PERAG_REF_EVENT(xfs_perag_put)
107
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000108#define DEFINE_ATTR_LIST_EVENT(name) \
109DEFINE_EVENT(xfs_attr_list_class, name, \
110 TP_PROTO(struct xfs_attr_list_context *ctx), \
111 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000112DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
113DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
114DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
115DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
116DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
117DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
118DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
119DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
120
121TRACE_EVENT(xfs_attr_list_node_descend,
122 TP_PROTO(struct xfs_attr_list_context *ctx,
123 struct xfs_da_node_entry *btree),
124 TP_ARGS(ctx, btree),
125 TP_STRUCT__entry(
126 __field(dev_t, dev)
127 __field(xfs_ino_t, ino)
128 __field(u32, hashval)
129 __field(u32, blkno)
130 __field(u32, offset)
131 __field(void *, alist)
132 __field(int, bufsize)
133 __field(int, count)
134 __field(int, firstu)
135 __field(int, dupcnt)
136 __field(int, flags)
137 __field(u32, bt_hashval)
138 __field(u32, bt_before)
139 ),
140 TP_fast_assign(
141 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
142 __entry->ino = ctx->dp->i_ino;
143 __entry->hashval = ctx->cursor->hashval;
144 __entry->blkno = ctx->cursor->blkno;
145 __entry->offset = ctx->cursor->offset;
146 __entry->alist = ctx->alist;
147 __entry->bufsize = ctx->bufsize;
148 __entry->count = ctx->count;
149 __entry->firstu = ctx->firstu;
150 __entry->flags = ctx->flags;
151 __entry->bt_hashval = be32_to_cpu(btree->hashval);
152 __entry->bt_before = be32_to_cpu(btree->before);
153 ),
154 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
155 "alist 0x%p size %u count %u firstu %u flags %d %s "
156 "node hashval %u, node before %u",
157 MAJOR(__entry->dev), MINOR(__entry->dev),
158 __entry->ino,
159 __entry->hashval,
160 __entry->blkno,
161 __entry->offset,
162 __entry->dupcnt,
163 __entry->alist,
164 __entry->bufsize,
165 __entry->count,
166 __entry->firstu,
167 __entry->flags,
168 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
169 __entry->bt_hashval,
170 __entry->bt_before)
171);
172
173TRACE_EVENT(xfs_iext_insert,
174 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
175 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
176 TP_ARGS(ip, idx, r, state, caller_ip),
177 TP_STRUCT__entry(
178 __field(dev_t, dev)
179 __field(xfs_ino_t, ino)
180 __field(xfs_extnum_t, idx)
181 __field(xfs_fileoff_t, startoff)
182 __field(xfs_fsblock_t, startblock)
183 __field(xfs_filblks_t, blockcount)
184 __field(xfs_exntst_t, state)
185 __field(int, bmap_state)
186 __field(unsigned long, caller_ip)
187 ),
188 TP_fast_assign(
189 __entry->dev = VFS_I(ip)->i_sb->s_dev;
190 __entry->ino = ip->i_ino;
191 __entry->idx = idx;
192 __entry->startoff = r->br_startoff;
193 __entry->startblock = r->br_startblock;
194 __entry->blockcount = r->br_blockcount;
195 __entry->state = r->br_state;
196 __entry->bmap_state = state;
197 __entry->caller_ip = caller_ip;
198 ),
199 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000200 "offset %lld block %lld count %lld flag %d caller %pf",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000201 MAJOR(__entry->dev), MINOR(__entry->dev),
202 __entry->ino,
203 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
204 (long)__entry->idx,
205 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000206 (__int64_t)__entry->startblock,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000207 __entry->blockcount,
208 __entry->state,
209 (char *)__entry->caller_ip)
210);
211
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000212DECLARE_EVENT_CLASS(xfs_bmap_class,
213 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
214 unsigned long caller_ip),
215 TP_ARGS(ip, idx, state, caller_ip),
216 TP_STRUCT__entry(
217 __field(dev_t, dev)
218 __field(xfs_ino_t, ino)
219 __field(xfs_extnum_t, idx)
220 __field(xfs_fileoff_t, startoff)
221 __field(xfs_fsblock_t, startblock)
222 __field(xfs_filblks_t, blockcount)
223 __field(xfs_exntst_t, state)
224 __field(int, bmap_state)
225 __field(unsigned long, caller_ip)
226 ),
227 TP_fast_assign(
228 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ?
229 ip->i_afp : &ip->i_df;
230 struct xfs_bmbt_irec r;
231
232 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
233 __entry->dev = VFS_I(ip)->i_sb->s_dev;
234 __entry->ino = ip->i_ino;
235 __entry->idx = idx;
236 __entry->startoff = r.br_startoff;
237 __entry->startblock = r.br_startblock;
238 __entry->blockcount = r.br_blockcount;
239 __entry->state = r.br_state;
240 __entry->bmap_state = state;
241 __entry->caller_ip = caller_ip;
242 ),
243 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000244 "offset %lld block %lld count %lld flag %d caller %pf",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000245 MAJOR(__entry->dev), MINOR(__entry->dev),
246 __entry->ino,
247 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
248 (long)__entry->idx,
249 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000250 (__int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000251 __entry->blockcount,
252 __entry->state,
253 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000254)
255
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000256#define DEFINE_BMAP_EVENT(name) \
257DEFINE_EVENT(xfs_bmap_class, name, \
258 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
259 unsigned long caller_ip), \
260 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000261DEFINE_BMAP_EVENT(xfs_iext_remove);
262DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
263DEFINE_BMAP_EVENT(xfs_bmap_post_update);
264DEFINE_BMAP_EVENT(xfs_extlist);
265
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000266DECLARE_EVENT_CLASS(xfs_buf_class,
267 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
268 TP_ARGS(bp, caller_ip),
269 TP_STRUCT__entry(
270 __field(dev_t, dev)
271 __field(xfs_daddr_t, bno)
272 __field(size_t, buffer_length)
273 __field(int, hold)
274 __field(int, pincount)
275 __field(unsigned, lockval)
276 __field(unsigned, flags)
277 __field(unsigned long, caller_ip)
278 ),
279 TP_fast_assign(
280 __entry->dev = bp->b_target->bt_dev;
281 __entry->bno = bp->b_bn;
282 __entry->buffer_length = bp->b_buffer_length;
283 __entry->hold = atomic_read(&bp->b_hold);
284 __entry->pincount = atomic_read(&bp->b_pin_count);
285 __entry->lockval = xfs_buf_lock_value(bp);
286 __entry->flags = bp->b_flags;
287 __entry->caller_ip = caller_ip;
288 ),
289 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
290 "lock %d flags %s caller %pf",
291 MAJOR(__entry->dev), MINOR(__entry->dev),
292 (unsigned long long)__entry->bno,
293 __entry->buffer_length,
294 __entry->hold,
295 __entry->pincount,
296 __entry->lockval,
297 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
298 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000299)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000300
301#define DEFINE_BUF_EVENT(name) \
302DEFINE_EVENT(xfs_buf_class, name, \
303 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
304 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000305DEFINE_BUF_EVENT(xfs_buf_init);
306DEFINE_BUF_EVENT(xfs_buf_free);
307DEFINE_BUF_EVENT(xfs_buf_hold);
308DEFINE_BUF_EVENT(xfs_buf_rele);
309DEFINE_BUF_EVENT(xfs_buf_pin);
310DEFINE_BUF_EVENT(xfs_buf_unpin);
311DEFINE_BUF_EVENT(xfs_buf_iodone);
312DEFINE_BUF_EVENT(xfs_buf_iorequest);
313DEFINE_BUF_EVENT(xfs_buf_bawrite);
314DEFINE_BUF_EVENT(xfs_buf_bdwrite);
315DEFINE_BUF_EVENT(xfs_buf_lock);
316DEFINE_BUF_EVENT(xfs_buf_lock_done);
317DEFINE_BUF_EVENT(xfs_buf_cond_lock);
318DEFINE_BUF_EVENT(xfs_buf_unlock);
319DEFINE_BUF_EVENT(xfs_buf_ordered_retry);
320DEFINE_BUF_EVENT(xfs_buf_iowait);
321DEFINE_BUF_EVENT(xfs_buf_iowait_done);
322DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
323DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
324DEFINE_BUF_EVENT(xfs_buf_delwri_split);
325DEFINE_BUF_EVENT(xfs_buf_get_noaddr);
326DEFINE_BUF_EVENT(xfs_bdstrat_shut);
327DEFINE_BUF_EVENT(xfs_buf_item_relse);
328DEFINE_BUF_EVENT(xfs_buf_item_iodone);
329DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
330DEFINE_BUF_EVENT(xfs_buf_error_relse);
331DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
332DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
333
334/* not really buffer traces, but the buf provides useful information */
335DEFINE_BUF_EVENT(xfs_btree_corrupt);
336DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
337DEFINE_BUF_EVENT(xfs_reset_dqcounts);
338DEFINE_BUF_EVENT(xfs_inode_item_push);
339
340/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000341DECLARE_EVENT_CLASS(xfs_buf_flags_class,
342 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
343 TP_ARGS(bp, flags, caller_ip),
344 TP_STRUCT__entry(
345 __field(dev_t, dev)
346 __field(xfs_daddr_t, bno)
347 __field(size_t, buffer_length)
348 __field(int, hold)
349 __field(int, pincount)
350 __field(unsigned, lockval)
351 __field(unsigned, flags)
352 __field(unsigned long, caller_ip)
353 ),
354 TP_fast_assign(
355 __entry->dev = bp->b_target->bt_dev;
356 __entry->bno = bp->b_bn;
357 __entry->buffer_length = bp->b_buffer_length;
358 __entry->flags = flags;
359 __entry->hold = atomic_read(&bp->b_hold);
360 __entry->pincount = atomic_read(&bp->b_pin_count);
361 __entry->lockval = xfs_buf_lock_value(bp);
362 __entry->caller_ip = caller_ip;
363 ),
364 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
365 "lock %d flags %s caller %pf",
366 MAJOR(__entry->dev), MINOR(__entry->dev),
367 (unsigned long long)__entry->bno,
368 __entry->buffer_length,
369 __entry->hold,
370 __entry->pincount,
371 __entry->lockval,
372 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
373 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000374)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000375
376#define DEFINE_BUF_FLAGS_EVENT(name) \
377DEFINE_EVENT(xfs_buf_flags_class, name, \
378 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
379 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000380DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
381DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
382DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
383
384TRACE_EVENT(xfs_buf_ioerror,
385 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
386 TP_ARGS(bp, error, caller_ip),
387 TP_STRUCT__entry(
388 __field(dev_t, dev)
389 __field(xfs_daddr_t, bno)
390 __field(size_t, buffer_length)
391 __field(unsigned, flags)
392 __field(int, hold)
393 __field(int, pincount)
394 __field(unsigned, lockval)
395 __field(int, error)
396 __field(unsigned long, caller_ip)
397 ),
398 TP_fast_assign(
399 __entry->dev = bp->b_target->bt_dev;
400 __entry->bno = bp->b_bn;
401 __entry->buffer_length = bp->b_buffer_length;
402 __entry->hold = atomic_read(&bp->b_hold);
403 __entry->pincount = atomic_read(&bp->b_pin_count);
404 __entry->lockval = xfs_buf_lock_value(bp);
405 __entry->error = error;
406 __entry->flags = bp->b_flags;
407 __entry->caller_ip = caller_ip;
408 ),
409 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
410 "lock %d error %d flags %s caller %pf",
411 MAJOR(__entry->dev), MINOR(__entry->dev),
412 (unsigned long long)__entry->bno,
413 __entry->buffer_length,
414 __entry->hold,
415 __entry->pincount,
416 __entry->lockval,
417 __entry->error,
418 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
419 (void *)__entry->caller_ip)
420);
421
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000422DECLARE_EVENT_CLASS(xfs_buf_item_class,
423 TP_PROTO(struct xfs_buf_log_item *bip),
424 TP_ARGS(bip),
425 TP_STRUCT__entry(
426 __field(dev_t, dev)
427 __field(xfs_daddr_t, buf_bno)
428 __field(size_t, buf_len)
429 __field(int, buf_hold)
430 __field(int, buf_pincount)
431 __field(int, buf_lockval)
432 __field(unsigned, buf_flags)
433 __field(unsigned, bli_recur)
434 __field(int, bli_refcount)
435 __field(unsigned, bli_flags)
436 __field(void *, li_desc)
437 __field(unsigned, li_flags)
438 ),
439 TP_fast_assign(
440 __entry->dev = bip->bli_buf->b_target->bt_dev;
441 __entry->bli_flags = bip->bli_flags;
442 __entry->bli_recur = bip->bli_recur;
443 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
444 __entry->buf_bno = bip->bli_buf->b_bn;
445 __entry->buf_len = bip->bli_buf->b_buffer_length;
446 __entry->buf_flags = bip->bli_buf->b_flags;
447 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
448 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
449 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf);
450 __entry->li_desc = bip->bli_item.li_desc;
451 __entry->li_flags = bip->bli_item.li_flags;
452 ),
453 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
454 "lock %d flags %s recur %d refcount %d bliflags %s "
455 "lidesc 0x%p liflags %s",
456 MAJOR(__entry->dev), MINOR(__entry->dev),
457 (unsigned long long)__entry->buf_bno,
458 __entry->buf_len,
459 __entry->buf_hold,
460 __entry->buf_pincount,
461 __entry->buf_lockval,
462 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
463 __entry->bli_recur,
464 __entry->bli_refcount,
465 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
466 __entry->li_desc,
467 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000468)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000469
470#define DEFINE_BUF_ITEM_EVENT(name) \
471DEFINE_EVENT(xfs_buf_item_class, name, \
472 TP_PROTO(struct xfs_buf_log_item *bip), \
473 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000474DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
475DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
476DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
477DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
478DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
479DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
480DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
481DEFINE_BUF_ITEM_EVENT(xfs_buf_item_trylock);
482DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
483DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
484DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
485DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
Dave Chinnerd808f612010-02-02 10:13:42 +1100486DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pushbuf);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000487DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
488DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
489DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
490DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
491DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
492DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
493DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
494DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
495DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
496DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
497DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
498DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
499
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000500DECLARE_EVENT_CLASS(xfs_lock_class,
501 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
502 unsigned long caller_ip),
503 TP_ARGS(ip, lock_flags, caller_ip),
504 TP_STRUCT__entry(
505 __field(dev_t, dev)
506 __field(xfs_ino_t, ino)
507 __field(int, lock_flags)
508 __field(unsigned long, caller_ip)
509 ),
510 TP_fast_assign(
511 __entry->dev = VFS_I(ip)->i_sb->s_dev;
512 __entry->ino = ip->i_ino;
513 __entry->lock_flags = lock_flags;
514 __entry->caller_ip = caller_ip;
515 ),
516 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
517 MAJOR(__entry->dev), MINOR(__entry->dev),
518 __entry->ino,
519 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
520 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000521)
522
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000523#define DEFINE_LOCK_EVENT(name) \
524DEFINE_EVENT(xfs_lock_class, name, \
525 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
526 unsigned long caller_ip), \
527 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000528DEFINE_LOCK_EVENT(xfs_ilock);
529DEFINE_LOCK_EVENT(xfs_ilock_nowait);
530DEFINE_LOCK_EVENT(xfs_ilock_demote);
531DEFINE_LOCK_EVENT(xfs_iunlock);
532
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000533DECLARE_EVENT_CLASS(xfs_iget_class,
534 TP_PROTO(struct xfs_inode *ip),
535 TP_ARGS(ip),
536 TP_STRUCT__entry(
537 __field(dev_t, dev)
538 __field(xfs_ino_t, ino)
539 ),
540 TP_fast_assign(
541 __entry->dev = VFS_I(ip)->i_sb->s_dev;
542 __entry->ino = ip->i_ino;
543 ),
544 TP_printk("dev %d:%d ino 0x%llx",
545 MAJOR(__entry->dev), MINOR(__entry->dev),
546 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000547)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000548
549#define DEFINE_IGET_EVENT(name) \
550DEFINE_EVENT(xfs_iget_class, name, \
551 TP_PROTO(struct xfs_inode *ip), \
552 TP_ARGS(ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000553DEFINE_IGET_EVENT(xfs_iget_skip);
554DEFINE_IGET_EVENT(xfs_iget_reclaim);
555DEFINE_IGET_EVENT(xfs_iget_found);
556DEFINE_IGET_EVENT(xfs_iget_alloc);
557
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000558DECLARE_EVENT_CLASS(xfs_inode_class,
559 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
560 TP_ARGS(ip, caller_ip),
561 TP_STRUCT__entry(
562 __field(dev_t, dev)
563 __field(xfs_ino_t, ino)
564 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100565 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000566 __field(unsigned long, caller_ip)
567 ),
568 TP_fast_assign(
569 __entry->dev = VFS_I(ip)->i_sb->s_dev;
570 __entry->ino = ip->i_ino;
571 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100572 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000573 __entry->caller_ip = caller_ip;
574 ),
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100575 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pf",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000576 MAJOR(__entry->dev), MINOR(__entry->dev),
577 __entry->ino,
578 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100579 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000580 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000581)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000582
583#define DEFINE_INODE_EVENT(name) \
584DEFINE_EVENT(xfs_inode_class, name, \
585 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
586 TP_ARGS(ip, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000587DEFINE_INODE_EVENT(xfs_ihold);
588DEFINE_INODE_EVENT(xfs_irele);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100589DEFINE_INODE_EVENT(xfs_inode_pin);
590DEFINE_INODE_EVENT(xfs_inode_unpin);
591DEFINE_INODE_EVENT(xfs_inode_unpin_nowait);
592
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000593/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
594DEFINE_INODE_EVENT(xfs_inode);
595#define xfs_itrace_entry(ip) \
596 trace_xfs_inode(ip, _THIS_IP_)
597
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000598DECLARE_EVENT_CLASS(xfs_dquot_class,
599 TP_PROTO(struct xfs_dquot *dqp),
600 TP_ARGS(dqp),
601 TP_STRUCT__entry(
602 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000603 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000604 __field(unsigned, flags)
605 __field(unsigned, nrefs)
606 __field(unsigned long long, res_bcount)
607 __field(unsigned long long, bcount)
608 __field(unsigned long long, icount)
609 __field(unsigned long long, blk_hardlimit)
610 __field(unsigned long long, blk_softlimit)
611 __field(unsigned long long, ino_hardlimit)
612 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000613 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000614 TP_fast_assign(
615 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000616 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000617 __entry->flags = dqp->dq_flags;
618 __entry->nrefs = dqp->q_nrefs;
619 __entry->res_bcount = dqp->q_res_bcount;
620 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
621 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
622 __entry->blk_hardlimit =
623 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
624 __entry->blk_softlimit =
625 be64_to_cpu(dqp->q_core.d_blk_softlimit);
626 __entry->ino_hardlimit =
627 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
628 __entry->ino_softlimit =
629 be64_to_cpu(dqp->q_core.d_ino_softlimit);
630 ),
631 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000632 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
633 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000634 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000635 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000636 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
637 __entry->nrefs,
638 __entry->res_bcount,
639 __entry->bcount,
640 __entry->blk_hardlimit,
641 __entry->blk_softlimit,
642 __entry->icount,
643 __entry->ino_hardlimit,
644 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000645)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000646
647#define DEFINE_DQUOT_EVENT(name) \
648DEFINE_EVENT(xfs_dquot_class, name, \
649 TP_PROTO(struct xfs_dquot *dqp), \
650 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000651DEFINE_DQUOT_EVENT(xfs_dqadjust);
652DEFINE_DQUOT_EVENT(xfs_dqshake_dirty);
653DEFINE_DQUOT_EVENT(xfs_dqshake_unlink);
654DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
655DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
656DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
657DEFINE_DQUOT_EVENT(xfs_dqattach_found);
658DEFINE_DQUOT_EVENT(xfs_dqattach_get);
659DEFINE_DQUOT_EVENT(xfs_dqinit);
660DEFINE_DQUOT_EVENT(xfs_dqreuse);
661DEFINE_DQUOT_EVENT(xfs_dqalloc);
662DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
663DEFINE_DQUOT_EVENT(xfs_dqread);
664DEFINE_DQUOT_EVENT(xfs_dqread_fail);
665DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
666DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
667DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
668DEFINE_DQUOT_EVENT(xfs_dqlookup_move);
669DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
670DEFINE_DQUOT_EVENT(xfs_dqget_hit);
671DEFINE_DQUOT_EVENT(xfs_dqget_miss);
672DEFINE_DQUOT_EVENT(xfs_dqput);
673DEFINE_DQUOT_EVENT(xfs_dqput_wait);
674DEFINE_DQUOT_EVENT(xfs_dqput_free);
675DEFINE_DQUOT_EVENT(xfs_dqrele);
676DEFINE_DQUOT_EVENT(xfs_dqflush);
677DEFINE_DQUOT_EVENT(xfs_dqflush_force);
678DEFINE_DQUOT_EVENT(xfs_dqflush_done);
679/* not really iget events, but we re-use the format */
680DEFINE_IGET_EVENT(xfs_dquot_dqalloc);
681DEFINE_IGET_EVENT(xfs_dquot_dqdetach);
682
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000683DECLARE_EVENT_CLASS(xfs_loggrant_class,
684 TP_PROTO(struct log *log, struct xlog_ticket *tic),
685 TP_ARGS(log, tic),
686 TP_STRUCT__entry(
687 __field(dev_t, dev)
688 __field(unsigned, trans_type)
689 __field(char, ocnt)
690 __field(char, cnt)
691 __field(int, curr_res)
692 __field(int, unit_res)
693 __field(unsigned int, flags)
694 __field(void *, reserve_headq)
695 __field(void *, write_headq)
696 __field(int, grant_reserve_cycle)
697 __field(int, grant_reserve_bytes)
698 __field(int, grant_write_cycle)
699 __field(int, grant_write_bytes)
700 __field(int, curr_cycle)
701 __field(int, curr_block)
702 __field(xfs_lsn_t, tail_lsn)
703 ),
704 TP_fast_assign(
705 __entry->dev = log->l_mp->m_super->s_dev;
706 __entry->trans_type = tic->t_trans_type;
707 __entry->ocnt = tic->t_ocnt;
708 __entry->cnt = tic->t_cnt;
709 __entry->curr_res = tic->t_curr_res;
710 __entry->unit_res = tic->t_unit_res;
711 __entry->flags = tic->t_flags;
712 __entry->reserve_headq = log->l_reserve_headq;
713 __entry->write_headq = log->l_write_headq;
714 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle;
715 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes;
716 __entry->grant_write_cycle = log->l_grant_write_cycle;
717 __entry->grant_write_bytes = log->l_grant_write_bytes;
718 __entry->curr_cycle = log->l_curr_cycle;
719 __entry->curr_block = log->l_curr_block;
720 __entry->tail_lsn = log->l_tail_lsn;
721 ),
722 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
723 "t_unit_res %u t_flags %s reserve_headq 0x%p "
724 "write_headq 0x%p grant_reserve_cycle %d "
725 "grant_reserve_bytes %d grant_write_cycle %d "
726 "grant_write_bytes %d curr_cycle %d curr_block %d "
727 "tail_cycle %d tail_block %d",
728 MAJOR(__entry->dev), MINOR(__entry->dev),
729 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
730 __entry->ocnt,
731 __entry->cnt,
732 __entry->curr_res,
733 __entry->unit_res,
734 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
735 __entry->reserve_headq,
736 __entry->write_headq,
737 __entry->grant_reserve_cycle,
738 __entry->grant_reserve_bytes,
739 __entry->grant_write_cycle,
740 __entry->grant_write_bytes,
741 __entry->curr_cycle,
742 __entry->curr_block,
743 CYCLE_LSN(__entry->tail_lsn),
744 BLOCK_LSN(__entry->tail_lsn)
745 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000746)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000747
748#define DEFINE_LOGGRANT_EVENT(name) \
749DEFINE_EVENT(xfs_loggrant_class, name, \
750 TP_PROTO(struct log *log, struct xlog_ticket *tic), \
751 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000752DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
753DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
754DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
755DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
756DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
757DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
758DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
759DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
760DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
761DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
762DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
763DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
764DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
765DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
766DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
767DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
768DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
769DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
770DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
771DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
772DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
773DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
774DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
775DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
776
777#define DEFINE_RW_EVENT(name) \
778TRACE_EVENT(name, \
779 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
780 TP_ARGS(ip, count, offset, flags), \
781 TP_STRUCT__entry( \
782 __field(dev_t, dev) \
783 __field(xfs_ino_t, ino) \
784 __field(xfs_fsize_t, size) \
785 __field(xfs_fsize_t, new_size) \
786 __field(loff_t, offset) \
787 __field(size_t, count) \
788 __field(int, flags) \
789 ), \
790 TP_fast_assign( \
791 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
792 __entry->ino = ip->i_ino; \
793 __entry->size = ip->i_d.di_size; \
794 __entry->new_size = ip->i_new_size; \
795 __entry->offset = offset; \
796 __entry->count = count; \
797 __entry->flags = flags; \
798 ), \
799 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
800 "offset 0x%llx count 0x%zx ioflags %s", \
801 MAJOR(__entry->dev), MINOR(__entry->dev), \
802 __entry->ino, \
803 __entry->size, \
804 __entry->new_size, \
805 __entry->offset, \
806 __entry->count, \
807 __print_flags(__entry->flags, "|", XFS_IO_FLAGS)) \
808)
809DEFINE_RW_EVENT(xfs_file_read);
810DEFINE_RW_EVENT(xfs_file_buffered_write);
811DEFINE_RW_EVENT(xfs_file_direct_write);
812DEFINE_RW_EVENT(xfs_file_splice_read);
813DEFINE_RW_EVENT(xfs_file_splice_write);
814
815
816#define DEFINE_PAGE_EVENT(name) \
817TRACE_EVENT(name, \
818 TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
819 TP_ARGS(inode, page, off), \
820 TP_STRUCT__entry( \
821 __field(dev_t, dev) \
822 __field(xfs_ino_t, ino) \
823 __field(pgoff_t, pgoff) \
824 __field(loff_t, size) \
825 __field(unsigned long, offset) \
826 __field(int, delalloc) \
827 __field(int, unmapped) \
828 __field(int, unwritten) \
829 ), \
830 TP_fast_assign( \
831 int delalloc = -1, unmapped = -1, unwritten = -1; \
832 \
833 if (page_has_buffers(page)) \
834 xfs_count_page_state(page, &delalloc, \
835 &unmapped, &unwritten); \
836 __entry->dev = inode->i_sb->s_dev; \
837 __entry->ino = XFS_I(inode)->i_ino; \
838 __entry->pgoff = page_offset(page); \
839 __entry->size = i_size_read(inode); \
840 __entry->offset = off; \
841 __entry->delalloc = delalloc; \
842 __entry->unmapped = unmapped; \
843 __entry->unwritten = unwritten; \
844 ), \
845 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " \
846 "delalloc %d unmapped %d unwritten %d", \
847 MAJOR(__entry->dev), MINOR(__entry->dev), \
848 __entry->ino, \
849 __entry->pgoff, \
850 __entry->size, \
851 __entry->offset, \
852 __entry->delalloc, \
853 __entry->unmapped, \
854 __entry->unwritten) \
855)
856DEFINE_PAGE_EVENT(xfs_writepage);
857DEFINE_PAGE_EVENT(xfs_releasepage);
858DEFINE_PAGE_EVENT(xfs_invalidatepage);
859
860#define DEFINE_IOMAP_EVENT(name) \
861TRACE_EVENT(name, \
862 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
863 int flags, struct xfs_bmbt_irec *irec), \
864 TP_ARGS(ip, offset, count, flags, irec), \
865 TP_STRUCT__entry( \
866 __field(dev_t, dev) \
867 __field(xfs_ino_t, ino) \
868 __field(loff_t, size) \
869 __field(loff_t, new_size) \
870 __field(loff_t, offset) \
871 __field(size_t, count) \
872 __field(int, flags) \
873 __field(xfs_fileoff_t, startoff) \
874 __field(xfs_fsblock_t, startblock) \
875 __field(xfs_filblks_t, blockcount) \
876 ), \
877 TP_fast_assign( \
878 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
879 __entry->ino = ip->i_ino; \
880 __entry->size = ip->i_d.di_size; \
881 __entry->new_size = ip->i_new_size; \
882 __entry->offset = offset; \
883 __entry->count = count; \
884 __entry->flags = flags; \
885 __entry->startoff = irec ? irec->br_startoff : 0; \
886 __entry->startblock = irec ? irec->br_startblock : 0; \
887 __entry->blockcount = irec ? irec->br_blockcount : 0; \
888 ), \
889 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
890 "offset 0x%llx count %zd flags %s " \
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000891 "startoff 0x%llx startblock %lld blockcount 0x%llx", \
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000892 MAJOR(__entry->dev), MINOR(__entry->dev), \
893 __entry->ino, \
894 __entry->size, \
895 __entry->new_size, \
896 __entry->offset, \
897 __entry->count, \
898 __print_flags(__entry->flags, "|", BMAPI_FLAGS), \
899 __entry->startoff, \
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000900 (__int64_t)__entry->startblock, \
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000901 __entry->blockcount) \
902)
903DEFINE_IOMAP_EVENT(xfs_iomap_enter);
904DEFINE_IOMAP_EVENT(xfs_iomap_found);
905DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
906
907#define DEFINE_SIMPLE_IO_EVENT(name) \
908TRACE_EVENT(name, \
909 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
910 TP_ARGS(ip, offset, count), \
911 TP_STRUCT__entry( \
912 __field(dev_t, dev) \
913 __field(xfs_ino_t, ino) \
914 __field(loff_t, size) \
915 __field(loff_t, new_size) \
916 __field(loff_t, offset) \
917 __field(size_t, count) \
918 ), \
919 TP_fast_assign( \
920 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
921 __entry->ino = ip->i_ino; \
922 __entry->size = ip->i_d.di_size; \
923 __entry->new_size = ip->i_new_size; \
924 __entry->offset = offset; \
925 __entry->count = count; \
926 ), \
927 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
928 "offset 0x%llx count %zd", \
929 MAJOR(__entry->dev), MINOR(__entry->dev), \
930 __entry->ino, \
931 __entry->size, \
932 __entry->new_size, \
933 __entry->offset, \
934 __entry->count) \
935);
936DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
937DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
938
939
940TRACE_EVENT(xfs_itruncate_start,
941 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
942 xfs_off_t toss_start, xfs_off_t toss_finish),
943 TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
944 TP_STRUCT__entry(
945 __field(dev_t, dev)
946 __field(xfs_ino_t, ino)
947 __field(xfs_fsize_t, size)
948 __field(xfs_fsize_t, new_size)
949 __field(xfs_off_t, toss_start)
950 __field(xfs_off_t, toss_finish)
951 __field(int, flag)
952 ),
953 TP_fast_assign(
954 __entry->dev = VFS_I(ip)->i_sb->s_dev;
955 __entry->ino = ip->i_ino;
956 __entry->size = ip->i_d.di_size;
957 __entry->new_size = new_size;
958 __entry->toss_start = toss_start;
959 __entry->toss_finish = toss_finish;
960 __entry->flag = flag;
961 ),
962 TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
963 "toss start 0x%llx toss finish 0x%llx",
964 MAJOR(__entry->dev), MINOR(__entry->dev),
965 __entry->ino,
966 __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
967 __entry->size,
968 __entry->new_size,
969 __entry->toss_start,
970 __entry->toss_finish)
971);
972
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000973DECLARE_EVENT_CLASS(xfs_itrunc_class,
974 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
975 TP_ARGS(ip, new_size),
976 TP_STRUCT__entry(
977 __field(dev_t, dev)
978 __field(xfs_ino_t, ino)
979 __field(xfs_fsize_t, size)
980 __field(xfs_fsize_t, new_size)
981 ),
982 TP_fast_assign(
983 __entry->dev = VFS_I(ip)->i_sb->s_dev;
984 __entry->ino = ip->i_ino;
985 __entry->size = ip->i_d.di_size;
986 __entry->new_size = new_size;
987 ),
988 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
989 MAJOR(__entry->dev), MINOR(__entry->dev),
990 __entry->ino,
991 __entry->size,
992 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000993)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000994
995#define DEFINE_ITRUNC_EVENT(name) \
996DEFINE_EVENT(xfs_itrunc_class, name, \
997 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
998 TP_ARGS(ip, new_size))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000999DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
1000DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
1001
1002TRACE_EVENT(xfs_pagecache_inval,
1003 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1004 TP_ARGS(ip, start, finish),
1005 TP_STRUCT__entry(
1006 __field(dev_t, dev)
1007 __field(xfs_ino_t, ino)
1008 __field(xfs_fsize_t, size)
1009 __field(xfs_off_t, start)
1010 __field(xfs_off_t, finish)
1011 ),
1012 TP_fast_assign(
1013 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1014 __entry->ino = ip->i_ino;
1015 __entry->size = ip->i_d.di_size;
1016 __entry->start = start;
1017 __entry->finish = finish;
1018 ),
1019 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1020 MAJOR(__entry->dev), MINOR(__entry->dev),
1021 __entry->ino,
1022 __entry->size,
1023 __entry->start,
1024 __entry->finish)
1025);
1026
1027TRACE_EVENT(xfs_bunmap,
1028 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1029 int flags, unsigned long caller_ip),
1030 TP_ARGS(ip, bno, len, flags, caller_ip),
1031 TP_STRUCT__entry(
1032 __field(dev_t, dev)
1033 __field(xfs_ino_t, ino)
1034 __field(xfs_fsize_t, size)
1035 __field(xfs_fileoff_t, bno)
1036 __field(xfs_filblks_t, len)
1037 __field(unsigned long, caller_ip)
1038 __field(int, flags)
1039 ),
1040 TP_fast_assign(
1041 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1042 __entry->ino = ip->i_ino;
1043 __entry->size = ip->i_d.di_size;
1044 __entry->bno = bno;
1045 __entry->len = len;
1046 __entry->caller_ip = caller_ip;
1047 __entry->flags = flags;
1048 ),
1049 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1050 "flags %s caller %pf",
1051 MAJOR(__entry->dev), MINOR(__entry->dev),
1052 __entry->ino,
1053 __entry->size,
1054 __entry->bno,
1055 __entry->len,
1056 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1057 (void *)__entry->caller_ip)
1058
1059);
1060
1061TRACE_EVENT(xfs_alloc_busy,
1062 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1063 xfs_extlen_t len, int slot),
1064 TP_ARGS(mp, agno, agbno, len, slot),
1065 TP_STRUCT__entry(
1066 __field(dev_t, dev)
1067 __field(xfs_agnumber_t, agno)
1068 __field(xfs_agblock_t, agbno)
1069 __field(xfs_extlen_t, len)
1070 __field(int, slot)
1071 ),
1072 TP_fast_assign(
1073 __entry->dev = mp->m_super->s_dev;
1074 __entry->agno = agno;
1075 __entry->agbno = agbno;
1076 __entry->len = len;
1077 __entry->slot = slot;
1078 ),
1079 TP_printk("dev %d:%d agno %u agbno %u len %u slot %d",
1080 MAJOR(__entry->dev), MINOR(__entry->dev),
1081 __entry->agno,
1082 __entry->agbno,
1083 __entry->len,
1084 __entry->slot)
1085
1086);
1087
1088#define XFS_BUSY_STATES \
1089 { 0, "found" }, \
1090 { 1, "missing" }
1091
1092TRACE_EVENT(xfs_alloc_unbusy,
1093 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1094 int slot, int found),
1095 TP_ARGS(mp, agno, slot, found),
1096 TP_STRUCT__entry(
1097 __field(dev_t, dev)
1098 __field(xfs_agnumber_t, agno)
1099 __field(int, slot)
1100 __field(int, found)
1101 ),
1102 TP_fast_assign(
1103 __entry->dev = mp->m_super->s_dev;
1104 __entry->agno = agno;
1105 __entry->slot = slot;
1106 __entry->found = found;
1107 ),
1108 TP_printk("dev %d:%d agno %u slot %d %s",
1109 MAJOR(__entry->dev), MINOR(__entry->dev),
1110 __entry->agno,
1111 __entry->slot,
1112 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1113);
1114
1115TRACE_EVENT(xfs_alloc_busysearch,
1116 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001117 xfs_extlen_t len, xfs_lsn_t lsn),
1118 TP_ARGS(mp, agno, agbno, len, lsn),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001119 TP_STRUCT__entry(
1120 __field(dev_t, dev)
1121 __field(xfs_agnumber_t, agno)
1122 __field(xfs_agblock_t, agbno)
1123 __field(xfs_extlen_t, len)
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001124 __field(xfs_lsn_t, lsn)
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;
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001131 __entry->lsn = lsn;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001132 ),
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001133 TP_printk("dev %d:%d agno %u agbno %u len %u force lsn 0x%llx",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001134 MAJOR(__entry->dev), MINOR(__entry->dev),
1135 __entry->agno,
1136 __entry->agbno,
1137 __entry->len,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001138 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001139);
1140
1141TRACE_EVENT(xfs_agf,
1142 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1143 unsigned long caller_ip),
1144 TP_ARGS(mp, agf, flags, caller_ip),
1145 TP_STRUCT__entry(
1146 __field(dev_t, dev)
1147 __field(xfs_agnumber_t, agno)
1148 __field(int, flags)
1149 __field(__u32, length)
1150 __field(__u32, bno_root)
1151 __field(__u32, cnt_root)
1152 __field(__u32, bno_level)
1153 __field(__u32, cnt_level)
1154 __field(__u32, flfirst)
1155 __field(__u32, fllast)
1156 __field(__u32, flcount)
1157 __field(__u32, freeblks)
1158 __field(__u32, longest)
1159 __field(unsigned long, caller_ip)
1160 ),
1161 TP_fast_assign(
1162 __entry->dev = mp->m_super->s_dev;
1163 __entry->agno = be32_to_cpu(agf->agf_seqno),
1164 __entry->flags = flags;
1165 __entry->length = be32_to_cpu(agf->agf_length),
1166 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1167 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1168 __entry->bno_level =
1169 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1170 __entry->cnt_level =
1171 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1172 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1173 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1174 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1175 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1176 __entry->longest = be32_to_cpu(agf->agf_longest);
1177 __entry->caller_ip = caller_ip;
1178 ),
1179 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1180 "levels b %u c %u flfirst %u fllast %u flcount %u "
1181 "freeblks %u longest %u caller %pf",
1182 MAJOR(__entry->dev), MINOR(__entry->dev),
1183 __entry->agno,
1184 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1185 __entry->length,
1186 __entry->bno_root,
1187 __entry->cnt_root,
1188 __entry->bno_level,
1189 __entry->cnt_level,
1190 __entry->flfirst,
1191 __entry->fllast,
1192 __entry->flcount,
1193 __entry->freeblks,
1194 __entry->longest,
1195 (void *)__entry->caller_ip)
1196);
1197
1198TRACE_EVENT(xfs_free_extent,
1199 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1200 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1201 TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1202 TP_STRUCT__entry(
1203 __field(dev_t, dev)
1204 __field(xfs_agnumber_t, agno)
1205 __field(xfs_agblock_t, agbno)
1206 __field(xfs_extlen_t, len)
1207 __field(int, isfl)
1208 __field(int, haveleft)
1209 __field(int, haveright)
1210 ),
1211 TP_fast_assign(
1212 __entry->dev = mp->m_super->s_dev;
1213 __entry->agno = agno;
1214 __entry->agbno = agbno;
1215 __entry->len = len;
1216 __entry->isfl = isfl;
1217 __entry->haveleft = haveleft;
1218 __entry->haveright = haveright;
1219 ),
1220 TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1221 MAJOR(__entry->dev), MINOR(__entry->dev),
1222 __entry->agno,
1223 __entry->agbno,
1224 __entry->len,
1225 __entry->isfl,
1226 __entry->haveleft ?
1227 (__entry->haveright ? "both" : "left") :
1228 (__entry->haveright ? "right" : "none"))
1229
1230);
1231
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001232DECLARE_EVENT_CLASS(xfs_alloc_class,
1233 TP_PROTO(struct xfs_alloc_arg *args),
1234 TP_ARGS(args),
1235 TP_STRUCT__entry(
1236 __field(dev_t, dev)
1237 __field(xfs_agnumber_t, agno)
1238 __field(xfs_agblock_t, agbno)
1239 __field(xfs_extlen_t, minlen)
1240 __field(xfs_extlen_t, maxlen)
1241 __field(xfs_extlen_t, mod)
1242 __field(xfs_extlen_t, prod)
1243 __field(xfs_extlen_t, minleft)
1244 __field(xfs_extlen_t, total)
1245 __field(xfs_extlen_t, alignment)
1246 __field(xfs_extlen_t, minalignslop)
1247 __field(xfs_extlen_t, len)
1248 __field(short, type)
1249 __field(short, otype)
1250 __field(char, wasdel)
1251 __field(char, wasfromfl)
1252 __field(char, isfl)
1253 __field(char, userdata)
1254 __field(xfs_fsblock_t, firstblock)
1255 ),
1256 TP_fast_assign(
1257 __entry->dev = args->mp->m_super->s_dev;
1258 __entry->agno = args->agno;
1259 __entry->agbno = args->agbno;
1260 __entry->minlen = args->minlen;
1261 __entry->maxlen = args->maxlen;
1262 __entry->mod = args->mod;
1263 __entry->prod = args->prod;
1264 __entry->minleft = args->minleft;
1265 __entry->total = args->total;
1266 __entry->alignment = args->alignment;
1267 __entry->minalignslop = args->minalignslop;
1268 __entry->len = args->len;
1269 __entry->type = args->type;
1270 __entry->otype = args->otype;
1271 __entry->wasdel = args->wasdel;
1272 __entry->wasfromfl = args->wasfromfl;
1273 __entry->isfl = args->isfl;
1274 __entry->userdata = args->userdata;
1275 __entry->firstblock = args->firstblock;
1276 ),
1277 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1278 "prod %u minleft %u total %u alignment %u minalignslop %u "
1279 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1280 "userdata %d firstblock 0x%llx",
1281 MAJOR(__entry->dev), MINOR(__entry->dev),
1282 __entry->agno,
1283 __entry->agbno,
1284 __entry->minlen,
1285 __entry->maxlen,
1286 __entry->mod,
1287 __entry->prod,
1288 __entry->minleft,
1289 __entry->total,
1290 __entry->alignment,
1291 __entry->minalignslop,
1292 __entry->len,
1293 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1294 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1295 __entry->wasdel,
1296 __entry->wasfromfl,
1297 __entry->isfl,
1298 __entry->userdata,
1299 __entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001300)
1301
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001302#define DEFINE_ALLOC_EVENT(name) \
1303DEFINE_EVENT(xfs_alloc_class, name, \
1304 TP_PROTO(struct xfs_alloc_arg *args), \
1305 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001306DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1307DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1308DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1309DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1310DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1311DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1312DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1313DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1314DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1315DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1316DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1317DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1318DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1319DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1320DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1321DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1322DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1323DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1324DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1325DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1326DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1327
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001328DECLARE_EVENT_CLASS(xfs_dir2_class,
1329 TP_PROTO(struct xfs_da_args *args),
1330 TP_ARGS(args),
1331 TP_STRUCT__entry(
1332 __field(dev_t, dev)
1333 __field(xfs_ino_t, ino)
1334 __dynamic_array(char, name, args->namelen)
1335 __field(int, namelen)
1336 __field(xfs_dahash_t, hashval)
1337 __field(xfs_ino_t, inumber)
1338 __field(int, op_flags)
1339 ),
1340 TP_fast_assign(
1341 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1342 __entry->ino = args->dp->i_ino;
1343 if (args->namelen)
1344 memcpy(__get_str(name), args->name, args->namelen);
1345 __entry->namelen = args->namelen;
1346 __entry->hashval = args->hashval;
1347 __entry->inumber = args->inumber;
1348 __entry->op_flags = args->op_flags;
1349 ),
1350 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1351 "inumber 0x%llx op_flags %s",
1352 MAJOR(__entry->dev), MINOR(__entry->dev),
1353 __entry->ino,
1354 __entry->namelen,
1355 __entry->namelen ? __get_str(name) : NULL,
1356 __entry->namelen,
1357 __entry->hashval,
1358 __entry->inumber,
1359 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001360)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001361
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001362#define DEFINE_DIR2_EVENT(name) \
1363DEFINE_EVENT(xfs_dir2_class, name, \
1364 TP_PROTO(struct xfs_da_args *args), \
1365 TP_ARGS(args))
1366DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1367DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1368DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1369DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1370DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1371DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1372DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1373DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1374DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1375DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1376DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1377DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1378DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1379DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1380DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1381DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1382DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1383DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1384DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1385DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1386DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1387DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1388DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1389DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1390DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1391
1392DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1393 TP_PROTO(struct xfs_da_args *args, int idx),
1394 TP_ARGS(args, idx),
1395 TP_STRUCT__entry(
1396 __field(dev_t, dev)
1397 __field(xfs_ino_t, ino)
1398 __field(int, op_flags)
1399 __field(int, idx)
1400 ),
1401 TP_fast_assign(
1402 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1403 __entry->ino = args->dp->i_ino;
1404 __entry->op_flags = args->op_flags;
1405 __entry->idx = idx;
1406 ),
1407 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1408 MAJOR(__entry->dev), MINOR(__entry->dev),
1409 __entry->ino,
1410 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1411 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001412)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001413
1414#define DEFINE_DIR2_SPACE_EVENT(name) \
1415DEFINE_EVENT(xfs_dir2_space_class, name, \
1416 TP_PROTO(struct xfs_da_args *args, int idx), \
1417 TP_ARGS(args, idx))
1418DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1419DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1420DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1421DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001422
1423TRACE_EVENT(xfs_dir2_leafn_moveents,
1424 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1425 TP_ARGS(args, src_idx, dst_idx, count),
1426 TP_STRUCT__entry(
1427 __field(dev_t, dev)
1428 __field(xfs_ino_t, ino)
1429 __field(int, op_flags)
1430 __field(int, src_idx)
1431 __field(int, dst_idx)
1432 __field(int, count)
1433 ),
1434 TP_fast_assign(
1435 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1436 __entry->ino = args->dp->i_ino;
1437 __entry->op_flags = args->op_flags;
1438 __entry->src_idx = src_idx;
1439 __entry->dst_idx = dst_idx;
1440 __entry->count = count;
1441 ),
1442 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1443 "src_idx %d dst_idx %d count %d",
1444 MAJOR(__entry->dev), MINOR(__entry->dev),
1445 __entry->ino,
1446 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1447 __entry->src_idx,
1448 __entry->dst_idx,
1449 __entry->count)
1450);
1451
Dave Chinner3a85cd92010-01-14 01:33:55 +00001452#define XFS_SWAPEXT_INODES \
1453 { 0, "target" }, \
1454 { 1, "temp" }
1455
1456#define XFS_INODE_FORMAT_STR \
1457 { 0, "invalid" }, \
1458 { 1, "local" }, \
1459 { 2, "extent" }, \
1460 { 3, "btree" }
1461
1462DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1463 TP_PROTO(struct xfs_inode *ip, int which),
1464 TP_ARGS(ip, which),
1465 TP_STRUCT__entry(
1466 __field(dev_t, dev)
1467 __field(int, which)
1468 __field(xfs_ino_t, ino)
1469 __field(int, format)
1470 __field(int, nex)
1471 __field(int, max_nex)
1472 __field(int, broot_size)
1473 __field(int, fork_off)
1474 ),
1475 TP_fast_assign(
1476 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1477 __entry->which = which;
1478 __entry->ino = ip->i_ino;
1479 __entry->format = ip->i_d.di_format;
1480 __entry->nex = ip->i_d.di_nextents;
1481 __entry->max_nex = ip->i_df.if_ext_max;
1482 __entry->broot_size = ip->i_df.if_broot_bytes;
1483 __entry->fork_off = XFS_IFORK_BOFF(ip);
1484 ),
1485 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
1486 "Max in-fork extents %d, broot size %d, fork offset %d",
1487 MAJOR(__entry->dev), MINOR(__entry->dev),
1488 __entry->ino,
1489 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1490 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1491 __entry->nex,
1492 __entry->max_nex,
1493 __entry->broot_size,
1494 __entry->fork_off)
1495)
1496
1497#define DEFINE_SWAPEXT_EVENT(name) \
1498DEFINE_EVENT(xfs_swap_extent_class, name, \
1499 TP_PROTO(struct xfs_inode *ip, int which), \
1500 TP_ARGS(ip, which))
1501
1502DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1503DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1504
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001505#endif /* _TRACE_XFS_H */
1506
1507#undef TRACE_INCLUDE_PATH
1508#define TRACE_INCLUDE_PATH .
1509#define TRACE_INCLUDE_FILE xfs_trace
1510#include <trace/define_trace.h>