blob: 8cb42b4656fbe07d62f29539ee2f7a279db5823b [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
81#define DEFINE_ATTR_LIST_EVENT(name) \
82DEFINE_EVENT(xfs_attr_list_class, name, \
83 TP_PROTO(struct xfs_attr_list_context *ctx), \
84 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000085DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
86DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
87DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
88DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
89DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
90DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
91DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
92DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
93
94TRACE_EVENT(xfs_attr_list_node_descend,
95 TP_PROTO(struct xfs_attr_list_context *ctx,
96 struct xfs_da_node_entry *btree),
97 TP_ARGS(ctx, btree),
98 TP_STRUCT__entry(
99 __field(dev_t, dev)
100 __field(xfs_ino_t, ino)
101 __field(u32, hashval)
102 __field(u32, blkno)
103 __field(u32, offset)
104 __field(void *, alist)
105 __field(int, bufsize)
106 __field(int, count)
107 __field(int, firstu)
108 __field(int, dupcnt)
109 __field(int, flags)
110 __field(u32, bt_hashval)
111 __field(u32, bt_before)
112 ),
113 TP_fast_assign(
114 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
115 __entry->ino = ctx->dp->i_ino;
116 __entry->hashval = ctx->cursor->hashval;
117 __entry->blkno = ctx->cursor->blkno;
118 __entry->offset = ctx->cursor->offset;
119 __entry->alist = ctx->alist;
120 __entry->bufsize = ctx->bufsize;
121 __entry->count = ctx->count;
122 __entry->firstu = ctx->firstu;
123 __entry->flags = ctx->flags;
124 __entry->bt_hashval = be32_to_cpu(btree->hashval);
125 __entry->bt_before = be32_to_cpu(btree->before);
126 ),
127 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
128 "alist 0x%p size %u count %u firstu %u flags %d %s "
129 "node hashval %u, node before %u",
130 MAJOR(__entry->dev), MINOR(__entry->dev),
131 __entry->ino,
132 __entry->hashval,
133 __entry->blkno,
134 __entry->offset,
135 __entry->dupcnt,
136 __entry->alist,
137 __entry->bufsize,
138 __entry->count,
139 __entry->firstu,
140 __entry->flags,
141 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
142 __entry->bt_hashval,
143 __entry->bt_before)
144);
145
146TRACE_EVENT(xfs_iext_insert,
147 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
148 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
149 TP_ARGS(ip, idx, r, state, caller_ip),
150 TP_STRUCT__entry(
151 __field(dev_t, dev)
152 __field(xfs_ino_t, ino)
153 __field(xfs_extnum_t, idx)
154 __field(xfs_fileoff_t, startoff)
155 __field(xfs_fsblock_t, startblock)
156 __field(xfs_filblks_t, blockcount)
157 __field(xfs_exntst_t, state)
158 __field(int, bmap_state)
159 __field(unsigned long, caller_ip)
160 ),
161 TP_fast_assign(
162 __entry->dev = VFS_I(ip)->i_sb->s_dev;
163 __entry->ino = ip->i_ino;
164 __entry->idx = idx;
165 __entry->startoff = r->br_startoff;
166 __entry->startblock = r->br_startblock;
167 __entry->blockcount = r->br_blockcount;
168 __entry->state = r->br_state;
169 __entry->bmap_state = state;
170 __entry->caller_ip = caller_ip;
171 ),
172 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
173 "offset %lld block %s count %lld flag %d caller %pf",
174 MAJOR(__entry->dev), MINOR(__entry->dev),
175 __entry->ino,
176 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
177 (long)__entry->idx,
178 __entry->startoff,
179 xfs_fmtfsblock(__entry->startblock),
180 __entry->blockcount,
181 __entry->state,
182 (char *)__entry->caller_ip)
183);
184
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000185DECLARE_EVENT_CLASS(xfs_bmap_class,
186 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
187 unsigned long caller_ip),
188 TP_ARGS(ip, idx, state, caller_ip),
189 TP_STRUCT__entry(
190 __field(dev_t, dev)
191 __field(xfs_ino_t, ino)
192 __field(xfs_extnum_t, idx)
193 __field(xfs_fileoff_t, startoff)
194 __field(xfs_fsblock_t, startblock)
195 __field(xfs_filblks_t, blockcount)
196 __field(xfs_exntst_t, state)
197 __field(int, bmap_state)
198 __field(unsigned long, caller_ip)
199 ),
200 TP_fast_assign(
201 struct xfs_ifork *ifp = (state & BMAP_ATTRFORK) ?
202 ip->i_afp : &ip->i_df;
203 struct xfs_bmbt_irec r;
204
205 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
206 __entry->dev = VFS_I(ip)->i_sb->s_dev;
207 __entry->ino = ip->i_ino;
208 __entry->idx = idx;
209 __entry->startoff = r.br_startoff;
210 __entry->startblock = r.br_startblock;
211 __entry->blockcount = r.br_blockcount;
212 __entry->state = r.br_state;
213 __entry->bmap_state = state;
214 __entry->caller_ip = caller_ip;
215 ),
216 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
217 "offset %lld block %s count %lld flag %d caller %pf",
218 MAJOR(__entry->dev), MINOR(__entry->dev),
219 __entry->ino,
220 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
221 (long)__entry->idx,
222 __entry->startoff,
223 xfs_fmtfsblock(__entry->startblock),
224 __entry->blockcount,
225 __entry->state,
226 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000227)
228
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000229#define DEFINE_BMAP_EVENT(name) \
230DEFINE_EVENT(xfs_bmap_class, name, \
231 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
232 unsigned long caller_ip), \
233 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000234DEFINE_BMAP_EVENT(xfs_iext_remove);
235DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
236DEFINE_BMAP_EVENT(xfs_bmap_post_update);
237DEFINE_BMAP_EVENT(xfs_extlist);
238
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000239DECLARE_EVENT_CLASS(xfs_buf_class,
240 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
241 TP_ARGS(bp, caller_ip),
242 TP_STRUCT__entry(
243 __field(dev_t, dev)
244 __field(xfs_daddr_t, bno)
245 __field(size_t, buffer_length)
246 __field(int, hold)
247 __field(int, pincount)
248 __field(unsigned, lockval)
249 __field(unsigned, flags)
250 __field(unsigned long, caller_ip)
251 ),
252 TP_fast_assign(
253 __entry->dev = bp->b_target->bt_dev;
254 __entry->bno = bp->b_bn;
255 __entry->buffer_length = bp->b_buffer_length;
256 __entry->hold = atomic_read(&bp->b_hold);
257 __entry->pincount = atomic_read(&bp->b_pin_count);
258 __entry->lockval = xfs_buf_lock_value(bp);
259 __entry->flags = bp->b_flags;
260 __entry->caller_ip = caller_ip;
261 ),
262 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
263 "lock %d flags %s caller %pf",
264 MAJOR(__entry->dev), MINOR(__entry->dev),
265 (unsigned long long)__entry->bno,
266 __entry->buffer_length,
267 __entry->hold,
268 __entry->pincount,
269 __entry->lockval,
270 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
271 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000272)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000273
274#define DEFINE_BUF_EVENT(name) \
275DEFINE_EVENT(xfs_buf_class, name, \
276 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
277 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000278DEFINE_BUF_EVENT(xfs_buf_init);
279DEFINE_BUF_EVENT(xfs_buf_free);
280DEFINE_BUF_EVENT(xfs_buf_hold);
281DEFINE_BUF_EVENT(xfs_buf_rele);
282DEFINE_BUF_EVENT(xfs_buf_pin);
283DEFINE_BUF_EVENT(xfs_buf_unpin);
284DEFINE_BUF_EVENT(xfs_buf_iodone);
285DEFINE_BUF_EVENT(xfs_buf_iorequest);
286DEFINE_BUF_EVENT(xfs_buf_bawrite);
287DEFINE_BUF_EVENT(xfs_buf_bdwrite);
288DEFINE_BUF_EVENT(xfs_buf_lock);
289DEFINE_BUF_EVENT(xfs_buf_lock_done);
290DEFINE_BUF_EVENT(xfs_buf_cond_lock);
291DEFINE_BUF_EVENT(xfs_buf_unlock);
292DEFINE_BUF_EVENT(xfs_buf_ordered_retry);
293DEFINE_BUF_EVENT(xfs_buf_iowait);
294DEFINE_BUF_EVENT(xfs_buf_iowait_done);
295DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
296DEFINE_BUF_EVENT(xfs_buf_delwri_dequeue);
297DEFINE_BUF_EVENT(xfs_buf_delwri_split);
298DEFINE_BUF_EVENT(xfs_buf_get_noaddr);
299DEFINE_BUF_EVENT(xfs_bdstrat_shut);
300DEFINE_BUF_EVENT(xfs_buf_item_relse);
301DEFINE_BUF_EVENT(xfs_buf_item_iodone);
302DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
303DEFINE_BUF_EVENT(xfs_buf_error_relse);
304DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
305DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
306
307/* not really buffer traces, but the buf provides useful information */
308DEFINE_BUF_EVENT(xfs_btree_corrupt);
309DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
310DEFINE_BUF_EVENT(xfs_reset_dqcounts);
311DEFINE_BUF_EVENT(xfs_inode_item_push);
312
313/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000314DECLARE_EVENT_CLASS(xfs_buf_flags_class,
315 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
316 TP_ARGS(bp, flags, caller_ip),
317 TP_STRUCT__entry(
318 __field(dev_t, dev)
319 __field(xfs_daddr_t, bno)
320 __field(size_t, buffer_length)
321 __field(int, hold)
322 __field(int, pincount)
323 __field(unsigned, lockval)
324 __field(unsigned, flags)
325 __field(unsigned long, caller_ip)
326 ),
327 TP_fast_assign(
328 __entry->dev = bp->b_target->bt_dev;
329 __entry->bno = bp->b_bn;
330 __entry->buffer_length = bp->b_buffer_length;
331 __entry->flags = flags;
332 __entry->hold = atomic_read(&bp->b_hold);
333 __entry->pincount = atomic_read(&bp->b_pin_count);
334 __entry->lockval = xfs_buf_lock_value(bp);
335 __entry->caller_ip = caller_ip;
336 ),
337 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
338 "lock %d flags %s caller %pf",
339 MAJOR(__entry->dev), MINOR(__entry->dev),
340 (unsigned long long)__entry->bno,
341 __entry->buffer_length,
342 __entry->hold,
343 __entry->pincount,
344 __entry->lockval,
345 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
346 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000347)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000348
349#define DEFINE_BUF_FLAGS_EVENT(name) \
350DEFINE_EVENT(xfs_buf_flags_class, name, \
351 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
352 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000353DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
354DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
355DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
356
357TRACE_EVENT(xfs_buf_ioerror,
358 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
359 TP_ARGS(bp, error, caller_ip),
360 TP_STRUCT__entry(
361 __field(dev_t, dev)
362 __field(xfs_daddr_t, bno)
363 __field(size_t, buffer_length)
364 __field(unsigned, flags)
365 __field(int, hold)
366 __field(int, pincount)
367 __field(unsigned, lockval)
368 __field(int, error)
369 __field(unsigned long, caller_ip)
370 ),
371 TP_fast_assign(
372 __entry->dev = bp->b_target->bt_dev;
373 __entry->bno = bp->b_bn;
374 __entry->buffer_length = bp->b_buffer_length;
375 __entry->hold = atomic_read(&bp->b_hold);
376 __entry->pincount = atomic_read(&bp->b_pin_count);
377 __entry->lockval = xfs_buf_lock_value(bp);
378 __entry->error = error;
379 __entry->flags = bp->b_flags;
380 __entry->caller_ip = caller_ip;
381 ),
382 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
383 "lock %d error %d flags %s caller %pf",
384 MAJOR(__entry->dev), MINOR(__entry->dev),
385 (unsigned long long)__entry->bno,
386 __entry->buffer_length,
387 __entry->hold,
388 __entry->pincount,
389 __entry->lockval,
390 __entry->error,
391 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
392 (void *)__entry->caller_ip)
393);
394
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000395DECLARE_EVENT_CLASS(xfs_buf_item_class,
396 TP_PROTO(struct xfs_buf_log_item *bip),
397 TP_ARGS(bip),
398 TP_STRUCT__entry(
399 __field(dev_t, dev)
400 __field(xfs_daddr_t, buf_bno)
401 __field(size_t, buf_len)
402 __field(int, buf_hold)
403 __field(int, buf_pincount)
404 __field(int, buf_lockval)
405 __field(unsigned, buf_flags)
406 __field(unsigned, bli_recur)
407 __field(int, bli_refcount)
408 __field(unsigned, bli_flags)
409 __field(void *, li_desc)
410 __field(unsigned, li_flags)
411 ),
412 TP_fast_assign(
413 __entry->dev = bip->bli_buf->b_target->bt_dev;
414 __entry->bli_flags = bip->bli_flags;
415 __entry->bli_recur = bip->bli_recur;
416 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
417 __entry->buf_bno = bip->bli_buf->b_bn;
418 __entry->buf_len = bip->bli_buf->b_buffer_length;
419 __entry->buf_flags = bip->bli_buf->b_flags;
420 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
421 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
422 __entry->buf_lockval = xfs_buf_lock_value(bip->bli_buf);
423 __entry->li_desc = bip->bli_item.li_desc;
424 __entry->li_flags = bip->bli_item.li_flags;
425 ),
426 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
427 "lock %d flags %s recur %d refcount %d bliflags %s "
428 "lidesc 0x%p liflags %s",
429 MAJOR(__entry->dev), MINOR(__entry->dev),
430 (unsigned long long)__entry->buf_bno,
431 __entry->buf_len,
432 __entry->buf_hold,
433 __entry->buf_pincount,
434 __entry->buf_lockval,
435 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
436 __entry->bli_recur,
437 __entry->bli_refcount,
438 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
439 __entry->li_desc,
440 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000441)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000442
443#define DEFINE_BUF_ITEM_EVENT(name) \
444DEFINE_EVENT(xfs_buf_item_class, name, \
445 TP_PROTO(struct xfs_buf_log_item *bip), \
446 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000447DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
448DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
449DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
450DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
451DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
452DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
453DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
454DEFINE_BUF_ITEM_EVENT(xfs_buf_item_trylock);
455DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
456DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
457DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
458DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
459DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
460DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
461DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
462DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
463DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
464DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
465DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
466DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
467DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
468DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
469DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
470DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
471
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000472DECLARE_EVENT_CLASS(xfs_lock_class,
473 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
474 unsigned long caller_ip),
475 TP_ARGS(ip, lock_flags, caller_ip),
476 TP_STRUCT__entry(
477 __field(dev_t, dev)
478 __field(xfs_ino_t, ino)
479 __field(int, lock_flags)
480 __field(unsigned long, caller_ip)
481 ),
482 TP_fast_assign(
483 __entry->dev = VFS_I(ip)->i_sb->s_dev;
484 __entry->ino = ip->i_ino;
485 __entry->lock_flags = lock_flags;
486 __entry->caller_ip = caller_ip;
487 ),
488 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pf",
489 MAJOR(__entry->dev), MINOR(__entry->dev),
490 __entry->ino,
491 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
492 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000493)
494
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000495#define DEFINE_LOCK_EVENT(name) \
496DEFINE_EVENT(xfs_lock_class, name, \
497 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
498 unsigned long caller_ip), \
499 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000500DEFINE_LOCK_EVENT(xfs_ilock);
501DEFINE_LOCK_EVENT(xfs_ilock_nowait);
502DEFINE_LOCK_EVENT(xfs_ilock_demote);
503DEFINE_LOCK_EVENT(xfs_iunlock);
504
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000505DECLARE_EVENT_CLASS(xfs_iget_class,
506 TP_PROTO(struct xfs_inode *ip),
507 TP_ARGS(ip),
508 TP_STRUCT__entry(
509 __field(dev_t, dev)
510 __field(xfs_ino_t, ino)
511 ),
512 TP_fast_assign(
513 __entry->dev = VFS_I(ip)->i_sb->s_dev;
514 __entry->ino = ip->i_ino;
515 ),
516 TP_printk("dev %d:%d ino 0x%llx",
517 MAJOR(__entry->dev), MINOR(__entry->dev),
518 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000519)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000520
521#define DEFINE_IGET_EVENT(name) \
522DEFINE_EVENT(xfs_iget_class, name, \
523 TP_PROTO(struct xfs_inode *ip), \
524 TP_ARGS(ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000525DEFINE_IGET_EVENT(xfs_iget_skip);
526DEFINE_IGET_EVENT(xfs_iget_reclaim);
527DEFINE_IGET_EVENT(xfs_iget_found);
528DEFINE_IGET_EVENT(xfs_iget_alloc);
529
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000530DECLARE_EVENT_CLASS(xfs_inode_class,
531 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
532 TP_ARGS(ip, caller_ip),
533 TP_STRUCT__entry(
534 __field(dev_t, dev)
535 __field(xfs_ino_t, ino)
536 __field(int, count)
537 __field(unsigned long, caller_ip)
538 ),
539 TP_fast_assign(
540 __entry->dev = VFS_I(ip)->i_sb->s_dev;
541 __entry->ino = ip->i_ino;
542 __entry->count = atomic_read(&VFS_I(ip)->i_count);
543 __entry->caller_ip = caller_ip;
544 ),
545 TP_printk("dev %d:%d ino 0x%llx count %d caller %pf",
546 MAJOR(__entry->dev), MINOR(__entry->dev),
547 __entry->ino,
548 __entry->count,
549 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000550)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000551
552#define DEFINE_INODE_EVENT(name) \
553DEFINE_EVENT(xfs_inode_class, name, \
554 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
555 TP_ARGS(ip, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000556DEFINE_INODE_EVENT(xfs_ihold);
557DEFINE_INODE_EVENT(xfs_irele);
558/* the old xfs_itrace_entry tracer - to be replaced by s.th. in the VFS */
559DEFINE_INODE_EVENT(xfs_inode);
560#define xfs_itrace_entry(ip) \
561 trace_xfs_inode(ip, _THIS_IP_)
562
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000563DECLARE_EVENT_CLASS(xfs_dquot_class,
564 TP_PROTO(struct xfs_dquot *dqp),
565 TP_ARGS(dqp),
566 TP_STRUCT__entry(
567 __field(dev_t, dev)
568 __field(__be32, id)
569 __field(unsigned, flags)
570 __field(unsigned, nrefs)
571 __field(unsigned long long, res_bcount)
572 __field(unsigned long long, bcount)
573 __field(unsigned long long, icount)
574 __field(unsigned long long, blk_hardlimit)
575 __field(unsigned long long, blk_softlimit)
576 __field(unsigned long long, ino_hardlimit)
577 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000578 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000579 TP_fast_assign(
580 __entry->dev = dqp->q_mount->m_super->s_dev;
581 __entry->id = dqp->q_core.d_id;
582 __entry->flags = dqp->dq_flags;
583 __entry->nrefs = dqp->q_nrefs;
584 __entry->res_bcount = dqp->q_res_bcount;
585 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
586 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
587 __entry->blk_hardlimit =
588 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
589 __entry->blk_softlimit =
590 be64_to_cpu(dqp->q_core.d_blk_softlimit);
591 __entry->ino_hardlimit =
592 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
593 __entry->ino_softlimit =
594 be64_to_cpu(dqp->q_core.d_ino_softlimit);
595 ),
596 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
597 "bcnt 0x%llx [hard 0x%llx | soft 0x%llx] "
598 "icnt 0x%llx [hard 0x%llx | soft 0x%llx]",
599 MAJOR(__entry->dev), MINOR(__entry->dev),
600 be32_to_cpu(__entry->id),
601 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
602 __entry->nrefs,
603 __entry->res_bcount,
604 __entry->bcount,
605 __entry->blk_hardlimit,
606 __entry->blk_softlimit,
607 __entry->icount,
608 __entry->ino_hardlimit,
609 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000610)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000611
612#define DEFINE_DQUOT_EVENT(name) \
613DEFINE_EVENT(xfs_dquot_class, name, \
614 TP_PROTO(struct xfs_dquot *dqp), \
615 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000616DEFINE_DQUOT_EVENT(xfs_dqadjust);
617DEFINE_DQUOT_EVENT(xfs_dqshake_dirty);
618DEFINE_DQUOT_EVENT(xfs_dqshake_unlink);
619DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
620DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
621DEFINE_DQUOT_EVENT(xfs_dqreclaim_unlink);
622DEFINE_DQUOT_EVENT(xfs_dqattach_found);
623DEFINE_DQUOT_EVENT(xfs_dqattach_get);
624DEFINE_DQUOT_EVENT(xfs_dqinit);
625DEFINE_DQUOT_EVENT(xfs_dqreuse);
626DEFINE_DQUOT_EVENT(xfs_dqalloc);
627DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
628DEFINE_DQUOT_EVENT(xfs_dqread);
629DEFINE_DQUOT_EVENT(xfs_dqread_fail);
630DEFINE_DQUOT_EVENT(xfs_dqlookup_found);
631DEFINE_DQUOT_EVENT(xfs_dqlookup_want);
632DEFINE_DQUOT_EVENT(xfs_dqlookup_freelist);
633DEFINE_DQUOT_EVENT(xfs_dqlookup_move);
634DEFINE_DQUOT_EVENT(xfs_dqlookup_done);
635DEFINE_DQUOT_EVENT(xfs_dqget_hit);
636DEFINE_DQUOT_EVENT(xfs_dqget_miss);
637DEFINE_DQUOT_EVENT(xfs_dqput);
638DEFINE_DQUOT_EVENT(xfs_dqput_wait);
639DEFINE_DQUOT_EVENT(xfs_dqput_free);
640DEFINE_DQUOT_EVENT(xfs_dqrele);
641DEFINE_DQUOT_EVENT(xfs_dqflush);
642DEFINE_DQUOT_EVENT(xfs_dqflush_force);
643DEFINE_DQUOT_EVENT(xfs_dqflush_done);
644/* not really iget events, but we re-use the format */
645DEFINE_IGET_EVENT(xfs_dquot_dqalloc);
646DEFINE_IGET_EVENT(xfs_dquot_dqdetach);
647
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000648DECLARE_EVENT_CLASS(xfs_loggrant_class,
649 TP_PROTO(struct log *log, struct xlog_ticket *tic),
650 TP_ARGS(log, tic),
651 TP_STRUCT__entry(
652 __field(dev_t, dev)
653 __field(unsigned, trans_type)
654 __field(char, ocnt)
655 __field(char, cnt)
656 __field(int, curr_res)
657 __field(int, unit_res)
658 __field(unsigned int, flags)
659 __field(void *, reserve_headq)
660 __field(void *, write_headq)
661 __field(int, grant_reserve_cycle)
662 __field(int, grant_reserve_bytes)
663 __field(int, grant_write_cycle)
664 __field(int, grant_write_bytes)
665 __field(int, curr_cycle)
666 __field(int, curr_block)
667 __field(xfs_lsn_t, tail_lsn)
668 ),
669 TP_fast_assign(
670 __entry->dev = log->l_mp->m_super->s_dev;
671 __entry->trans_type = tic->t_trans_type;
672 __entry->ocnt = tic->t_ocnt;
673 __entry->cnt = tic->t_cnt;
674 __entry->curr_res = tic->t_curr_res;
675 __entry->unit_res = tic->t_unit_res;
676 __entry->flags = tic->t_flags;
677 __entry->reserve_headq = log->l_reserve_headq;
678 __entry->write_headq = log->l_write_headq;
679 __entry->grant_reserve_cycle = log->l_grant_reserve_cycle;
680 __entry->grant_reserve_bytes = log->l_grant_reserve_bytes;
681 __entry->grant_write_cycle = log->l_grant_write_cycle;
682 __entry->grant_write_bytes = log->l_grant_write_bytes;
683 __entry->curr_cycle = log->l_curr_cycle;
684 __entry->curr_block = log->l_curr_block;
685 __entry->tail_lsn = log->l_tail_lsn;
686 ),
687 TP_printk("dev %d:%d type %s t_ocnt %u t_cnt %u t_curr_res %u "
688 "t_unit_res %u t_flags %s reserve_headq 0x%p "
689 "write_headq 0x%p grant_reserve_cycle %d "
690 "grant_reserve_bytes %d grant_write_cycle %d "
691 "grant_write_bytes %d curr_cycle %d curr_block %d "
692 "tail_cycle %d tail_block %d",
693 MAJOR(__entry->dev), MINOR(__entry->dev),
694 __print_symbolic(__entry->trans_type, XFS_TRANS_TYPES),
695 __entry->ocnt,
696 __entry->cnt,
697 __entry->curr_res,
698 __entry->unit_res,
699 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
700 __entry->reserve_headq,
701 __entry->write_headq,
702 __entry->grant_reserve_cycle,
703 __entry->grant_reserve_bytes,
704 __entry->grant_write_cycle,
705 __entry->grant_write_bytes,
706 __entry->curr_cycle,
707 __entry->curr_block,
708 CYCLE_LSN(__entry->tail_lsn),
709 BLOCK_LSN(__entry->tail_lsn)
710 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000711)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000712
713#define DEFINE_LOGGRANT_EVENT(name) \
714DEFINE_EVENT(xfs_loggrant_class, name, \
715 TP_PROTO(struct log *log, struct xlog_ticket *tic), \
716 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000717DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
718DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
719DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
720DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
721DEFINE_LOGGRANT_EVENT(xfs_log_grant_enter);
722DEFINE_LOGGRANT_EVENT(xfs_log_grant_exit);
723DEFINE_LOGGRANT_EVENT(xfs_log_grant_error);
724DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep1);
725DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake1);
726DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep2);
727DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake2);
728DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_enter);
729DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_exit);
730DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_error);
731DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep1);
732DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake1);
733DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_sleep2);
734DEFINE_LOGGRANT_EVENT(xfs_log_regrant_write_wake2);
735DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
736DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
737DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
738DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
739DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
740DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
741
742#define DEFINE_RW_EVENT(name) \
743TRACE_EVENT(name, \
744 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset, int flags), \
745 TP_ARGS(ip, count, offset, flags), \
746 TP_STRUCT__entry( \
747 __field(dev_t, dev) \
748 __field(xfs_ino_t, ino) \
749 __field(xfs_fsize_t, size) \
750 __field(xfs_fsize_t, new_size) \
751 __field(loff_t, offset) \
752 __field(size_t, count) \
753 __field(int, flags) \
754 ), \
755 TP_fast_assign( \
756 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
757 __entry->ino = ip->i_ino; \
758 __entry->size = ip->i_d.di_size; \
759 __entry->new_size = ip->i_new_size; \
760 __entry->offset = offset; \
761 __entry->count = count; \
762 __entry->flags = flags; \
763 ), \
764 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
765 "offset 0x%llx count 0x%zx ioflags %s", \
766 MAJOR(__entry->dev), MINOR(__entry->dev), \
767 __entry->ino, \
768 __entry->size, \
769 __entry->new_size, \
770 __entry->offset, \
771 __entry->count, \
772 __print_flags(__entry->flags, "|", XFS_IO_FLAGS)) \
773)
774DEFINE_RW_EVENT(xfs_file_read);
775DEFINE_RW_EVENT(xfs_file_buffered_write);
776DEFINE_RW_EVENT(xfs_file_direct_write);
777DEFINE_RW_EVENT(xfs_file_splice_read);
778DEFINE_RW_EVENT(xfs_file_splice_write);
779
780
781#define DEFINE_PAGE_EVENT(name) \
782TRACE_EVENT(name, \
783 TP_PROTO(struct inode *inode, struct page *page, unsigned long off), \
784 TP_ARGS(inode, page, off), \
785 TP_STRUCT__entry( \
786 __field(dev_t, dev) \
787 __field(xfs_ino_t, ino) \
788 __field(pgoff_t, pgoff) \
789 __field(loff_t, size) \
790 __field(unsigned long, offset) \
791 __field(int, delalloc) \
792 __field(int, unmapped) \
793 __field(int, unwritten) \
794 ), \
795 TP_fast_assign( \
796 int delalloc = -1, unmapped = -1, unwritten = -1; \
797 \
798 if (page_has_buffers(page)) \
799 xfs_count_page_state(page, &delalloc, \
800 &unmapped, &unwritten); \
801 __entry->dev = inode->i_sb->s_dev; \
802 __entry->ino = XFS_I(inode)->i_ino; \
803 __entry->pgoff = page_offset(page); \
804 __entry->size = i_size_read(inode); \
805 __entry->offset = off; \
806 __entry->delalloc = delalloc; \
807 __entry->unmapped = unmapped; \
808 __entry->unwritten = unwritten; \
809 ), \
810 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx " \
811 "delalloc %d unmapped %d unwritten %d", \
812 MAJOR(__entry->dev), MINOR(__entry->dev), \
813 __entry->ino, \
814 __entry->pgoff, \
815 __entry->size, \
816 __entry->offset, \
817 __entry->delalloc, \
818 __entry->unmapped, \
819 __entry->unwritten) \
820)
821DEFINE_PAGE_EVENT(xfs_writepage);
822DEFINE_PAGE_EVENT(xfs_releasepage);
823DEFINE_PAGE_EVENT(xfs_invalidatepage);
824
825#define DEFINE_IOMAP_EVENT(name) \
826TRACE_EVENT(name, \
827 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
828 int flags, struct xfs_bmbt_irec *irec), \
829 TP_ARGS(ip, offset, count, flags, irec), \
830 TP_STRUCT__entry( \
831 __field(dev_t, dev) \
832 __field(xfs_ino_t, ino) \
833 __field(loff_t, size) \
834 __field(loff_t, new_size) \
835 __field(loff_t, offset) \
836 __field(size_t, count) \
837 __field(int, flags) \
838 __field(xfs_fileoff_t, startoff) \
839 __field(xfs_fsblock_t, startblock) \
840 __field(xfs_filblks_t, blockcount) \
841 ), \
842 TP_fast_assign( \
843 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
844 __entry->ino = ip->i_ino; \
845 __entry->size = ip->i_d.di_size; \
846 __entry->new_size = ip->i_new_size; \
847 __entry->offset = offset; \
848 __entry->count = count; \
849 __entry->flags = flags; \
850 __entry->startoff = irec ? irec->br_startoff : 0; \
851 __entry->startblock = irec ? irec->br_startblock : 0; \
852 __entry->blockcount = irec ? irec->br_blockcount : 0; \
853 ), \
854 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
855 "offset 0x%llx count %zd flags %s " \
Dave Chinnera539bd82009-12-17 00:20:07 +0000856 "startoff 0x%llx startblock %s blockcount 0x%llx", \
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000857 MAJOR(__entry->dev), MINOR(__entry->dev), \
858 __entry->ino, \
859 __entry->size, \
860 __entry->new_size, \
861 __entry->offset, \
862 __entry->count, \
863 __print_flags(__entry->flags, "|", BMAPI_FLAGS), \
864 __entry->startoff, \
Dave Chinnera539bd82009-12-17 00:20:07 +0000865 xfs_fmtfsblock(__entry->startblock), \
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000866 __entry->blockcount) \
867)
868DEFINE_IOMAP_EVENT(xfs_iomap_enter);
869DEFINE_IOMAP_EVENT(xfs_iomap_found);
870DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
871
872#define DEFINE_SIMPLE_IO_EVENT(name) \
873TRACE_EVENT(name, \
874 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
875 TP_ARGS(ip, offset, count), \
876 TP_STRUCT__entry( \
877 __field(dev_t, dev) \
878 __field(xfs_ino_t, ino) \
879 __field(loff_t, size) \
880 __field(loff_t, new_size) \
881 __field(loff_t, offset) \
882 __field(size_t, count) \
883 ), \
884 TP_fast_assign( \
885 __entry->dev = VFS_I(ip)->i_sb->s_dev; \
886 __entry->ino = ip->i_ino; \
887 __entry->size = ip->i_d.di_size; \
888 __entry->new_size = ip->i_new_size; \
889 __entry->offset = offset; \
890 __entry->count = count; \
891 ), \
892 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx " \
893 "offset 0x%llx count %zd", \
894 MAJOR(__entry->dev), MINOR(__entry->dev), \
895 __entry->ino, \
896 __entry->size, \
897 __entry->new_size, \
898 __entry->offset, \
899 __entry->count) \
900);
901DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
902DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
903
904
905TRACE_EVENT(xfs_itruncate_start,
906 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size, int flag,
907 xfs_off_t toss_start, xfs_off_t toss_finish),
908 TP_ARGS(ip, new_size, flag, toss_start, toss_finish),
909 TP_STRUCT__entry(
910 __field(dev_t, dev)
911 __field(xfs_ino_t, ino)
912 __field(xfs_fsize_t, size)
913 __field(xfs_fsize_t, new_size)
914 __field(xfs_off_t, toss_start)
915 __field(xfs_off_t, toss_finish)
916 __field(int, flag)
917 ),
918 TP_fast_assign(
919 __entry->dev = VFS_I(ip)->i_sb->s_dev;
920 __entry->ino = ip->i_ino;
921 __entry->size = ip->i_d.di_size;
922 __entry->new_size = new_size;
923 __entry->toss_start = toss_start;
924 __entry->toss_finish = toss_finish;
925 __entry->flag = flag;
926 ),
927 TP_printk("dev %d:%d ino 0x%llx %s size 0x%llx new_size 0x%llx "
928 "toss start 0x%llx toss finish 0x%llx",
929 MAJOR(__entry->dev), MINOR(__entry->dev),
930 __entry->ino,
931 __print_flags(__entry->flag, "|", XFS_ITRUNC_FLAGS),
932 __entry->size,
933 __entry->new_size,
934 __entry->toss_start,
935 __entry->toss_finish)
936);
937
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000938DECLARE_EVENT_CLASS(xfs_itrunc_class,
939 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
940 TP_ARGS(ip, new_size),
941 TP_STRUCT__entry(
942 __field(dev_t, dev)
943 __field(xfs_ino_t, ino)
944 __field(xfs_fsize_t, size)
945 __field(xfs_fsize_t, new_size)
946 ),
947 TP_fast_assign(
948 __entry->dev = VFS_I(ip)->i_sb->s_dev;
949 __entry->ino = ip->i_ino;
950 __entry->size = ip->i_d.di_size;
951 __entry->new_size = new_size;
952 ),
953 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
954 MAJOR(__entry->dev), MINOR(__entry->dev),
955 __entry->ino,
956 __entry->size,
957 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000958)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000959
960#define DEFINE_ITRUNC_EVENT(name) \
961DEFINE_EVENT(xfs_itrunc_class, name, \
962 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
963 TP_ARGS(ip, new_size))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000964DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_start);
965DEFINE_ITRUNC_EVENT(xfs_itruncate_finish_end);
966
967TRACE_EVENT(xfs_pagecache_inval,
968 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
969 TP_ARGS(ip, start, finish),
970 TP_STRUCT__entry(
971 __field(dev_t, dev)
972 __field(xfs_ino_t, ino)
973 __field(xfs_fsize_t, size)
974 __field(xfs_off_t, start)
975 __field(xfs_off_t, finish)
976 ),
977 TP_fast_assign(
978 __entry->dev = VFS_I(ip)->i_sb->s_dev;
979 __entry->ino = ip->i_ino;
980 __entry->size = ip->i_d.di_size;
981 __entry->start = start;
982 __entry->finish = finish;
983 ),
984 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
985 MAJOR(__entry->dev), MINOR(__entry->dev),
986 __entry->ino,
987 __entry->size,
988 __entry->start,
989 __entry->finish)
990);
991
992TRACE_EVENT(xfs_bunmap,
993 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
994 int flags, unsigned long caller_ip),
995 TP_ARGS(ip, bno, len, flags, caller_ip),
996 TP_STRUCT__entry(
997 __field(dev_t, dev)
998 __field(xfs_ino_t, ino)
999 __field(xfs_fsize_t, size)
1000 __field(xfs_fileoff_t, bno)
1001 __field(xfs_filblks_t, len)
1002 __field(unsigned long, caller_ip)
1003 __field(int, flags)
1004 ),
1005 TP_fast_assign(
1006 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1007 __entry->ino = ip->i_ino;
1008 __entry->size = ip->i_d.di_size;
1009 __entry->bno = bno;
1010 __entry->len = len;
1011 __entry->caller_ip = caller_ip;
1012 __entry->flags = flags;
1013 ),
1014 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
1015 "flags %s caller %pf",
1016 MAJOR(__entry->dev), MINOR(__entry->dev),
1017 __entry->ino,
1018 __entry->size,
1019 __entry->bno,
1020 __entry->len,
1021 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1022 (void *)__entry->caller_ip)
1023
1024);
1025
1026TRACE_EVENT(xfs_alloc_busy,
1027 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1028 xfs_extlen_t len, int slot),
1029 TP_ARGS(mp, agno, agbno, len, slot),
1030 TP_STRUCT__entry(
1031 __field(dev_t, dev)
1032 __field(xfs_agnumber_t, agno)
1033 __field(xfs_agblock_t, agbno)
1034 __field(xfs_extlen_t, len)
1035 __field(int, slot)
1036 ),
1037 TP_fast_assign(
1038 __entry->dev = mp->m_super->s_dev;
1039 __entry->agno = agno;
1040 __entry->agbno = agbno;
1041 __entry->len = len;
1042 __entry->slot = slot;
1043 ),
1044 TP_printk("dev %d:%d agno %u agbno %u len %u slot %d",
1045 MAJOR(__entry->dev), MINOR(__entry->dev),
1046 __entry->agno,
1047 __entry->agbno,
1048 __entry->len,
1049 __entry->slot)
1050
1051);
1052
1053#define XFS_BUSY_STATES \
1054 { 0, "found" }, \
1055 { 1, "missing" }
1056
1057TRACE_EVENT(xfs_alloc_unbusy,
1058 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1059 int slot, int found),
1060 TP_ARGS(mp, agno, slot, found),
1061 TP_STRUCT__entry(
1062 __field(dev_t, dev)
1063 __field(xfs_agnumber_t, agno)
1064 __field(int, slot)
1065 __field(int, found)
1066 ),
1067 TP_fast_assign(
1068 __entry->dev = mp->m_super->s_dev;
1069 __entry->agno = agno;
1070 __entry->slot = slot;
1071 __entry->found = found;
1072 ),
1073 TP_printk("dev %d:%d agno %u slot %d %s",
1074 MAJOR(__entry->dev), MINOR(__entry->dev),
1075 __entry->agno,
1076 __entry->slot,
1077 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1078);
1079
1080TRACE_EVENT(xfs_alloc_busysearch,
1081 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1082 xfs_extlen_t len, int found),
1083 TP_ARGS(mp, agno, agbno, len, found),
1084 TP_STRUCT__entry(
1085 __field(dev_t, dev)
1086 __field(xfs_agnumber_t, agno)
1087 __field(xfs_agblock_t, agbno)
1088 __field(xfs_extlen_t, len)
1089 __field(int, found)
1090 ),
1091 TP_fast_assign(
1092 __entry->dev = mp->m_super->s_dev;
1093 __entry->agno = agno;
1094 __entry->agbno = agbno;
1095 __entry->len = len;
1096 __entry->found = found;
1097 ),
1098 TP_printk("dev %d:%d agno %u agbno %u len %u %s",
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 __entry->agno,
1101 __entry->agbno,
1102 __entry->len,
1103 __print_symbolic(__entry->found, XFS_BUSY_STATES))
1104);
1105
1106TRACE_EVENT(xfs_agf,
1107 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1108 unsigned long caller_ip),
1109 TP_ARGS(mp, agf, flags, caller_ip),
1110 TP_STRUCT__entry(
1111 __field(dev_t, dev)
1112 __field(xfs_agnumber_t, agno)
1113 __field(int, flags)
1114 __field(__u32, length)
1115 __field(__u32, bno_root)
1116 __field(__u32, cnt_root)
1117 __field(__u32, bno_level)
1118 __field(__u32, cnt_level)
1119 __field(__u32, flfirst)
1120 __field(__u32, fllast)
1121 __field(__u32, flcount)
1122 __field(__u32, freeblks)
1123 __field(__u32, longest)
1124 __field(unsigned long, caller_ip)
1125 ),
1126 TP_fast_assign(
1127 __entry->dev = mp->m_super->s_dev;
1128 __entry->agno = be32_to_cpu(agf->agf_seqno),
1129 __entry->flags = flags;
1130 __entry->length = be32_to_cpu(agf->agf_length),
1131 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1132 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1133 __entry->bno_level =
1134 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1135 __entry->cnt_level =
1136 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1137 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1138 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1139 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1140 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1141 __entry->longest = be32_to_cpu(agf->agf_longest);
1142 __entry->caller_ip = caller_ip;
1143 ),
1144 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1145 "levels b %u c %u flfirst %u fllast %u flcount %u "
1146 "freeblks %u longest %u caller %pf",
1147 MAJOR(__entry->dev), MINOR(__entry->dev),
1148 __entry->agno,
1149 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1150 __entry->length,
1151 __entry->bno_root,
1152 __entry->cnt_root,
1153 __entry->bno_level,
1154 __entry->cnt_level,
1155 __entry->flfirst,
1156 __entry->fllast,
1157 __entry->flcount,
1158 __entry->freeblks,
1159 __entry->longest,
1160 (void *)__entry->caller_ip)
1161);
1162
1163TRACE_EVENT(xfs_free_extent,
1164 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1165 xfs_extlen_t len, bool isfl, int haveleft, int haveright),
1166 TP_ARGS(mp, agno, agbno, len, isfl, haveleft, haveright),
1167 TP_STRUCT__entry(
1168 __field(dev_t, dev)
1169 __field(xfs_agnumber_t, agno)
1170 __field(xfs_agblock_t, agbno)
1171 __field(xfs_extlen_t, len)
1172 __field(int, isfl)
1173 __field(int, haveleft)
1174 __field(int, haveright)
1175 ),
1176 TP_fast_assign(
1177 __entry->dev = mp->m_super->s_dev;
1178 __entry->agno = agno;
1179 __entry->agbno = agbno;
1180 __entry->len = len;
1181 __entry->isfl = isfl;
1182 __entry->haveleft = haveleft;
1183 __entry->haveright = haveright;
1184 ),
1185 TP_printk("dev %d:%d agno %u agbno %u len %u isfl %d %s",
1186 MAJOR(__entry->dev), MINOR(__entry->dev),
1187 __entry->agno,
1188 __entry->agbno,
1189 __entry->len,
1190 __entry->isfl,
1191 __entry->haveleft ?
1192 (__entry->haveright ? "both" : "left") :
1193 (__entry->haveright ? "right" : "none"))
1194
1195);
1196
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001197DECLARE_EVENT_CLASS(xfs_alloc_class,
1198 TP_PROTO(struct xfs_alloc_arg *args),
1199 TP_ARGS(args),
1200 TP_STRUCT__entry(
1201 __field(dev_t, dev)
1202 __field(xfs_agnumber_t, agno)
1203 __field(xfs_agblock_t, agbno)
1204 __field(xfs_extlen_t, minlen)
1205 __field(xfs_extlen_t, maxlen)
1206 __field(xfs_extlen_t, mod)
1207 __field(xfs_extlen_t, prod)
1208 __field(xfs_extlen_t, minleft)
1209 __field(xfs_extlen_t, total)
1210 __field(xfs_extlen_t, alignment)
1211 __field(xfs_extlen_t, minalignslop)
1212 __field(xfs_extlen_t, len)
1213 __field(short, type)
1214 __field(short, otype)
1215 __field(char, wasdel)
1216 __field(char, wasfromfl)
1217 __field(char, isfl)
1218 __field(char, userdata)
1219 __field(xfs_fsblock_t, firstblock)
1220 ),
1221 TP_fast_assign(
1222 __entry->dev = args->mp->m_super->s_dev;
1223 __entry->agno = args->agno;
1224 __entry->agbno = args->agbno;
1225 __entry->minlen = args->minlen;
1226 __entry->maxlen = args->maxlen;
1227 __entry->mod = args->mod;
1228 __entry->prod = args->prod;
1229 __entry->minleft = args->minleft;
1230 __entry->total = args->total;
1231 __entry->alignment = args->alignment;
1232 __entry->minalignslop = args->minalignslop;
1233 __entry->len = args->len;
1234 __entry->type = args->type;
1235 __entry->otype = args->otype;
1236 __entry->wasdel = args->wasdel;
1237 __entry->wasfromfl = args->wasfromfl;
1238 __entry->isfl = args->isfl;
1239 __entry->userdata = args->userdata;
1240 __entry->firstblock = args->firstblock;
1241 ),
1242 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1243 "prod %u minleft %u total %u alignment %u minalignslop %u "
1244 "len %u type %s otype %s wasdel %d wasfromfl %d isfl %d "
1245 "userdata %d firstblock 0x%llx",
1246 MAJOR(__entry->dev), MINOR(__entry->dev),
1247 __entry->agno,
1248 __entry->agbno,
1249 __entry->minlen,
1250 __entry->maxlen,
1251 __entry->mod,
1252 __entry->prod,
1253 __entry->minleft,
1254 __entry->total,
1255 __entry->alignment,
1256 __entry->minalignslop,
1257 __entry->len,
1258 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1259 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1260 __entry->wasdel,
1261 __entry->wasfromfl,
1262 __entry->isfl,
1263 __entry->userdata,
1264 __entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001265)
1266
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001267#define DEFINE_ALLOC_EVENT(name) \
1268DEFINE_EVENT(xfs_alloc_class, name, \
1269 TP_PROTO(struct xfs_alloc_arg *args), \
1270 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001271DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
1272DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1273DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1274DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1275DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1276DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1277DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
1278DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1279DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1280DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1281DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1282DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
1283DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1284DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1285DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1286DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1287DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1288DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1289DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1290DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1291DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1292
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001293DECLARE_EVENT_CLASS(xfs_dir2_class,
1294 TP_PROTO(struct xfs_da_args *args),
1295 TP_ARGS(args),
1296 TP_STRUCT__entry(
1297 __field(dev_t, dev)
1298 __field(xfs_ino_t, ino)
1299 __dynamic_array(char, name, args->namelen)
1300 __field(int, namelen)
1301 __field(xfs_dahash_t, hashval)
1302 __field(xfs_ino_t, inumber)
1303 __field(int, op_flags)
1304 ),
1305 TP_fast_assign(
1306 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1307 __entry->ino = args->dp->i_ino;
1308 if (args->namelen)
1309 memcpy(__get_str(name), args->name, args->namelen);
1310 __entry->namelen = args->namelen;
1311 __entry->hashval = args->hashval;
1312 __entry->inumber = args->inumber;
1313 __entry->op_flags = args->op_flags;
1314 ),
1315 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1316 "inumber 0x%llx op_flags %s",
1317 MAJOR(__entry->dev), MINOR(__entry->dev),
1318 __entry->ino,
1319 __entry->namelen,
1320 __entry->namelen ? __get_str(name) : NULL,
1321 __entry->namelen,
1322 __entry->hashval,
1323 __entry->inumber,
1324 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001325)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001326
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001327#define DEFINE_DIR2_EVENT(name) \
1328DEFINE_EVENT(xfs_dir2_class, name, \
1329 TP_PROTO(struct xfs_da_args *args), \
1330 TP_ARGS(args))
1331DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1332DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1333DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1334DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1335DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1336DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1337DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1338DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1339DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1340DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1341DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1342DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1343DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1344DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1345DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1346DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1347DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1348DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1349DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1350DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1351DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1352DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1353DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1354DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1355DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1356
1357DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1358 TP_PROTO(struct xfs_da_args *args, int idx),
1359 TP_ARGS(args, idx),
1360 TP_STRUCT__entry(
1361 __field(dev_t, dev)
1362 __field(xfs_ino_t, ino)
1363 __field(int, op_flags)
1364 __field(int, idx)
1365 ),
1366 TP_fast_assign(
1367 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1368 __entry->ino = args->dp->i_ino;
1369 __entry->op_flags = args->op_flags;
1370 __entry->idx = idx;
1371 ),
1372 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1373 MAJOR(__entry->dev), MINOR(__entry->dev),
1374 __entry->ino,
1375 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1376 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001377)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001378
1379#define DEFINE_DIR2_SPACE_EVENT(name) \
1380DEFINE_EVENT(xfs_dir2_space_class, name, \
1381 TP_PROTO(struct xfs_da_args *args, int idx), \
1382 TP_ARGS(args, idx))
1383DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1384DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1385DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1386DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001387
1388TRACE_EVENT(xfs_dir2_leafn_moveents,
1389 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1390 TP_ARGS(args, src_idx, dst_idx, count),
1391 TP_STRUCT__entry(
1392 __field(dev_t, dev)
1393 __field(xfs_ino_t, ino)
1394 __field(int, op_flags)
1395 __field(int, src_idx)
1396 __field(int, dst_idx)
1397 __field(int, count)
1398 ),
1399 TP_fast_assign(
1400 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1401 __entry->ino = args->dp->i_ino;
1402 __entry->op_flags = args->op_flags;
1403 __entry->src_idx = src_idx;
1404 __entry->dst_idx = dst_idx;
1405 __entry->count = count;
1406 ),
1407 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1408 "src_idx %d dst_idx %d count %d",
1409 MAJOR(__entry->dev), MINOR(__entry->dev),
1410 __entry->ino,
1411 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1412 __entry->src_idx,
1413 __entry->dst_idx,
1414 __entry->count)
1415);
1416
1417#endif /* _TRACE_XFS_H */
1418
1419#undef TRACE_INCLUDE_PATH
1420#define TRACE_INCLUDE_PATH .
1421#define TRACE_INCLUDE_FILE xfs_trace
1422#include <trace/define_trace.h>