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