blob: 6fcc893dfc91358e7da174e4bf4126112cb2a1e2 [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00002/*
3 * Copyright (c) 2009, Christoph Hellwig
4 * All Rights Reserved.
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00005 */
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM xfs
8
9#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
10#define _TRACE_XFS_H
11
12#include <linux/tracepoint.h>
13
14struct xfs_agf;
15struct xfs_alloc_arg;
16struct xfs_attr_list_context;
17struct xfs_buf_log_item;
18struct xfs_da_args;
19struct xfs_da_node_entry;
20struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000021struct xfs_log_item;
Mark Tinguelyad223e62012-06-14 09:22:15 -050022struct xlog;
Dave Chinner750b9c92013-11-01 15:27:18 +110023struct xlog_ticket;
Dave Chinner9abbc532010-04-13 15:06:46 +100024struct xlog_recover;
25struct xlog_recover_item;
26struct xfs_buf_log_format;
27struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050028struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100029struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070030struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070031struct xfs_fsmap;
32struct xfs_rmap_irec;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000033
Christoph Hellwigea9a4882009-12-21 14:03:03 +000034DECLARE_EVENT_CLASS(xfs_attr_list_class,
35 TP_PROTO(struct xfs_attr_list_context *ctx),
36 TP_ARGS(ctx),
37 TP_STRUCT__entry(
38 __field(dev_t, dev)
39 __field(xfs_ino_t, ino)
40 __field(u32, hashval)
41 __field(u32, blkno)
42 __field(u32, offset)
43 __field(void *, alist)
44 __field(int, bufsize)
45 __field(int, count)
46 __field(int, firstu)
47 __field(int, dupcnt)
48 __field(int, flags)
49 ),
50 TP_fast_assign(
51 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
52 __entry->ino = ctx->dp->i_ino;
53 __entry->hashval = ctx->cursor->hashval;
54 __entry->blkno = ctx->cursor->blkno;
55 __entry->offset = ctx->cursor->offset;
56 __entry->alist = ctx->alist;
57 __entry->bufsize = ctx->bufsize;
58 __entry->count = ctx->count;
59 __entry->firstu = ctx->firstu;
60 __entry->flags = ctx->flags;
61 ),
62 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -080063 "alist %p size %u count %u firstu %u flags %d %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +000064 MAJOR(__entry->dev), MINOR(__entry->dev),
65 __entry->ino,
66 __entry->hashval,
67 __entry->blkno,
68 __entry->offset,
69 __entry->dupcnt,
70 __entry->alist,
71 __entry->bufsize,
72 __entry->count,
73 __entry->firstu,
74 __entry->flags,
75 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
76 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000077)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000078
79#define DEFINE_ATTR_LIST_EVENT(name) \
80DEFINE_EVENT(xfs_attr_list_class, name, \
81 TP_PROTO(struct xfs_attr_list_context *ctx), \
82 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000083DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
84DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
85DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
86DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
87DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
88DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
89DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
90DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +110091DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
92DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000093
Li Zefanf8adb4d2010-05-24 08:25:57 +000094DECLARE_EVENT_CLASS(xfs_perag_class,
95 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
96 unsigned long caller_ip),
97 TP_ARGS(mp, agno, refcount, caller_ip),
98 TP_STRUCT__entry(
99 __field(dev_t, dev)
100 __field(xfs_agnumber_t, agno)
101 __field(int, refcount)
102 __field(unsigned long, caller_ip)
103 ),
104 TP_fast_assign(
105 __entry->dev = mp->m_super->s_dev;
106 __entry->agno = agno;
107 __entry->refcount = refcount;
108 __entry->caller_ip = caller_ip;
109 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800110 TP_printk("dev %d:%d agno %u refcount %d caller %pS",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000111 MAJOR(__entry->dev), MINOR(__entry->dev),
112 __entry->agno,
113 __entry->refcount,
114 (char *)__entry->caller_ip)
115);
116
117#define DEFINE_PERAG_REF_EVENT(name) \
118DEFINE_EVENT(xfs_perag_class, name, \
119 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
120 unsigned long caller_ip), \
121 TP_ARGS(mp, agno, refcount, caller_ip))
122DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000123DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000124DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000125DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
126DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500127DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
128DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700129DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
130DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000131
Dave Chinnerd1230312013-11-01 15:27:19 +1100132DECLARE_EVENT_CLASS(xfs_ag_class,
133 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
134 TP_ARGS(mp, agno),
135 TP_STRUCT__entry(
136 __field(dev_t, dev)
137 __field(xfs_agnumber_t, agno)
138 ),
139 TP_fast_assign(
140 __entry->dev = mp->m_super->s_dev;
141 __entry->agno = agno;
142 ),
143 TP_printk("dev %d:%d agno %u",
144 MAJOR(__entry->dev), MINOR(__entry->dev),
145 __entry->agno)
146);
147#define DEFINE_AG_EVENT(name) \
148DEFINE_EVENT(xfs_ag_class, name, \
149 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
150 TP_ARGS(mp, agno))
151
152DEFINE_AG_EVENT(xfs_read_agf);
153DEFINE_AG_EVENT(xfs_alloc_read_agf);
154DEFINE_AG_EVENT(xfs_read_agi);
155DEFINE_AG_EVENT(xfs_ialloc_read_agi);
156
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000157TRACE_EVENT(xfs_attr_list_node_descend,
158 TP_PROTO(struct xfs_attr_list_context *ctx,
159 struct xfs_da_node_entry *btree),
160 TP_ARGS(ctx, btree),
161 TP_STRUCT__entry(
162 __field(dev_t, dev)
163 __field(xfs_ino_t, ino)
164 __field(u32, hashval)
165 __field(u32, blkno)
166 __field(u32, offset)
167 __field(void *, alist)
168 __field(int, bufsize)
169 __field(int, count)
170 __field(int, firstu)
171 __field(int, dupcnt)
172 __field(int, flags)
173 __field(u32, bt_hashval)
174 __field(u32, bt_before)
175 ),
176 TP_fast_assign(
177 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
178 __entry->ino = ctx->dp->i_ino;
179 __entry->hashval = ctx->cursor->hashval;
180 __entry->blkno = ctx->cursor->blkno;
181 __entry->offset = ctx->cursor->offset;
182 __entry->alist = ctx->alist;
183 __entry->bufsize = ctx->bufsize;
184 __entry->count = ctx->count;
185 __entry->firstu = ctx->firstu;
186 __entry->flags = ctx->flags;
187 __entry->bt_hashval = be32_to_cpu(btree->hashval);
188 __entry->bt_before = be32_to_cpu(btree->before);
189 ),
190 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800191 "alist %p size %u count %u firstu %u flags %d %s "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000192 "node hashval %u, node before %u",
193 MAJOR(__entry->dev), MINOR(__entry->dev),
194 __entry->ino,
195 __entry->hashval,
196 __entry->blkno,
197 __entry->offset,
198 __entry->dupcnt,
199 __entry->alist,
200 __entry->bufsize,
201 __entry->count,
202 __entry->firstu,
203 __entry->flags,
204 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
205 __entry->bt_hashval,
206 __entry->bt_before)
207);
208
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000209DECLARE_EVENT_CLASS(xfs_bmap_class,
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700210 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000211 unsigned long caller_ip),
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700212 TP_ARGS(ip, cur, state, caller_ip),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000213 TP_STRUCT__entry(
214 __field(dev_t, dev)
215 __field(xfs_ino_t, ino)
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700216 __field(void *, leaf);
217 __field(int, pos);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000218 __field(xfs_fileoff_t, startoff)
219 __field(xfs_fsblock_t, startblock)
220 __field(xfs_filblks_t, blockcount)
221 __field(xfs_exntst_t, state)
222 __field(int, bmap_state)
223 __field(unsigned long, caller_ip)
224 ),
225 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700226 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000227 struct xfs_bmbt_irec r;
228
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700229 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700230 xfs_iext_get_extent(ifp, cur, &r);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000231 __entry->dev = VFS_I(ip)->i_sb->s_dev;
232 __entry->ino = ip->i_ino;
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700233 __entry->leaf = cur->leaf;
234 __entry->pos = cur->pos;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000235 __entry->startoff = r.br_startoff;
236 __entry->startblock = r.br_startblock;
237 __entry->blockcount = r.br_blockcount;
238 __entry->state = r.br_state;
239 __entry->bmap_state = state;
240 __entry->caller_ip = caller_ip;
241 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800242 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800243 "offset %lld block %lld count %lld flag %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000244 MAJOR(__entry->dev), MINOR(__entry->dev),
245 __entry->ino,
246 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700247 __entry->leaf,
248 __entry->pos,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000249 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700250 (int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000251 __entry->blockcount,
252 __entry->state,
253 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000254)
255
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000256#define DEFINE_BMAP_EVENT(name) \
257DEFINE_EVENT(xfs_bmap_class, name, \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700258 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000259 unsigned long caller_ip), \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700260 TP_ARGS(ip, cur, state, caller_ip))
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700261DEFINE_BMAP_EVENT(xfs_iext_insert);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000262DEFINE_BMAP_EVENT(xfs_iext_remove);
263DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
264DEFINE_BMAP_EVENT(xfs_bmap_post_update);
Christoph Hellwige8e0e172017-10-19 11:06:29 -0700265DEFINE_BMAP_EVENT(xfs_read_extent);
266DEFINE_BMAP_EVENT(xfs_write_extent);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000267
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000268DECLARE_EVENT_CLASS(xfs_buf_class,
269 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
270 TP_ARGS(bp, caller_ip),
271 TP_STRUCT__entry(
272 __field(dev_t, dev)
273 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000274 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000275 __field(int, hold)
276 __field(int, pincount)
277 __field(unsigned, lockval)
278 __field(unsigned, flags)
279 __field(unsigned long, caller_ip)
280 ),
281 TP_fast_assign(
282 __entry->dev = bp->b_target->bt_dev;
Dave Chinnerd61fa8c2018-11-19 13:31:07 -0800283 if (bp->b_bn == XFS_BUF_DADDR_NULL)
284 __entry->bno = bp->b_maps[0].bm_bn;
285 else
286 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000287 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000288 __entry->hold = atomic_read(&bp->b_hold);
289 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200290 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000291 __entry->flags = bp->b_flags;
292 __entry->caller_ip = caller_ip;
293 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000294 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800295 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000296 MAJOR(__entry->dev), MINOR(__entry->dev),
297 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000298 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000299 __entry->hold,
300 __entry->pincount,
301 __entry->lockval,
302 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
303 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000304)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000305
306#define DEFINE_BUF_EVENT(name) \
307DEFINE_EVENT(xfs_buf_class, name, \
308 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
309 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000310DEFINE_BUF_EVENT(xfs_buf_init);
311DEFINE_BUF_EVENT(xfs_buf_free);
312DEFINE_BUF_EVENT(xfs_buf_hold);
313DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000314DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000315DEFINE_BUF_EVENT(xfs_buf_submit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000316DEFINE_BUF_EVENT(xfs_buf_lock);
317DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000318DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200319DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000320DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000321DEFINE_BUF_EVENT(xfs_buf_iowait);
322DEFINE_BUF_EVENT(xfs_buf_iowait_done);
323DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000324DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000325DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700326DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000327DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000328DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000329DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
330DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100331DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000332DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
333
334/* not really buffer traces, but the buf provides useful information */
335DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000336DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000337
338/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000339DECLARE_EVENT_CLASS(xfs_buf_flags_class,
340 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
341 TP_ARGS(bp, flags, caller_ip),
342 TP_STRUCT__entry(
343 __field(dev_t, dev)
344 __field(xfs_daddr_t, bno)
345 __field(size_t, buffer_length)
346 __field(int, hold)
347 __field(int, pincount)
348 __field(unsigned, lockval)
349 __field(unsigned, flags)
350 __field(unsigned long, caller_ip)
351 ),
352 TP_fast_assign(
353 __entry->dev = bp->b_target->bt_dev;
354 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000355 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000356 __entry->flags = flags;
357 __entry->hold = atomic_read(&bp->b_hold);
358 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200359 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000360 __entry->caller_ip = caller_ip;
361 ),
362 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800363 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000364 MAJOR(__entry->dev), MINOR(__entry->dev),
365 (unsigned long long)__entry->bno,
366 __entry->buffer_length,
367 __entry->hold,
368 __entry->pincount,
369 __entry->lockval,
370 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
371 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000372)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000373
374#define DEFINE_BUF_FLAGS_EVENT(name) \
375DEFINE_EVENT(xfs_buf_flags_class, name, \
376 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
377 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000378DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
379DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
380DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
381
382TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800383 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000384 TP_ARGS(bp, error, caller_ip),
385 TP_STRUCT__entry(
386 __field(dev_t, dev)
387 __field(xfs_daddr_t, bno)
388 __field(size_t, buffer_length)
389 __field(unsigned, flags)
390 __field(int, hold)
391 __field(int, pincount)
392 __field(unsigned, lockval)
393 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800394 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000395 ),
396 TP_fast_assign(
397 __entry->dev = bp->b_target->bt_dev;
398 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000399 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000400 __entry->hold = atomic_read(&bp->b_hold);
401 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200402 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000403 __entry->error = error;
404 __entry->flags = bp->b_flags;
405 __entry->caller_ip = caller_ip;
406 ),
407 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800408 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000409 MAJOR(__entry->dev), MINOR(__entry->dev),
410 (unsigned long long)__entry->bno,
411 __entry->buffer_length,
412 __entry->hold,
413 __entry->pincount,
414 __entry->lockval,
415 __entry->error,
416 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
417 (void *)__entry->caller_ip)
418);
419
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000420DECLARE_EVENT_CLASS(xfs_buf_item_class,
421 TP_PROTO(struct xfs_buf_log_item *bip),
422 TP_ARGS(bip),
423 TP_STRUCT__entry(
424 __field(dev_t, dev)
425 __field(xfs_daddr_t, buf_bno)
426 __field(size_t, buf_len)
427 __field(int, buf_hold)
428 __field(int, buf_pincount)
429 __field(int, buf_lockval)
430 __field(unsigned, buf_flags)
431 __field(unsigned, bli_recur)
432 __field(int, bli_refcount)
433 __field(unsigned, bli_flags)
Dave Chinner22525c12018-05-09 07:47:34 -0700434 __field(unsigned long, li_flags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000435 ),
436 TP_fast_assign(
437 __entry->dev = bip->bli_buf->b_target->bt_dev;
438 __entry->bli_flags = bip->bli_flags;
439 __entry->bli_recur = bip->bli_recur;
440 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
441 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000442 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000443 __entry->buf_flags = bip->bli_buf->b_flags;
444 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
445 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200446 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000447 __entry->li_flags = bip->bli_item.li_flags;
448 ),
449 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
450 "lock %d flags %s recur %d refcount %d bliflags %s "
Dave Chinnere6631f82018-05-09 07:49:37 -0700451 "liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000452 MAJOR(__entry->dev), MINOR(__entry->dev),
453 (unsigned long long)__entry->buf_bno,
454 __entry->buf_len,
455 __entry->buf_hold,
456 __entry->buf_pincount,
457 __entry->buf_lockval,
458 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
459 __entry->bli_recur,
460 __entry->bli_refcount,
461 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000462 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000463)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000464
465#define DEFINE_BUF_ITEM_EVENT(name) \
466DEFINE_EVENT(xfs_buf_item_class, name, \
467 TP_PROTO(struct xfs_buf_log_item *bip), \
468 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000469DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000470DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000471DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
472DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
473DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000474DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000475DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
476DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
477DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000478DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000479DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
480DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
481DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
482DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
483DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
484DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
485DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
486DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
487DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
488DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
489DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
490DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
491DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
492DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
493
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000494DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700495 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
496 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000497 TP_STRUCT__entry(
498 __field(dev_t, dev)
499 __field(xfs_ino_t, ino)
500 __field(xfs_agnumber_t, agno)
501 __field(int, streams)
502 ),
503 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700504 __entry->dev = mp->m_super->s_dev;
505 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000506 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700507 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000508 ),
509 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
510 MAJOR(__entry->dev), MINOR(__entry->dev),
511 __entry->ino,
512 __entry->agno,
513 __entry->streams)
514)
515#define DEFINE_FILESTREAM_EVENT(name) \
516DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700517 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
518 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000519DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
520DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
521DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
522
523TRACE_EVENT(xfs_filestream_pick,
524 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
525 xfs_extlen_t free, int nscan),
526 TP_ARGS(ip, agno, free, nscan),
527 TP_STRUCT__entry(
528 __field(dev_t, dev)
529 __field(xfs_ino_t, ino)
530 __field(xfs_agnumber_t, agno)
531 __field(int, streams)
532 __field(xfs_extlen_t, free)
533 __field(int, nscan)
534 ),
535 TP_fast_assign(
536 __entry->dev = VFS_I(ip)->i_sb->s_dev;
537 __entry->ino = ip->i_ino;
538 __entry->agno = agno;
539 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
540 __entry->free = free;
541 __entry->nscan = nscan;
542 ),
543 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
544 MAJOR(__entry->dev), MINOR(__entry->dev),
545 __entry->ino,
546 __entry->agno,
547 __entry->streams,
548 __entry->free,
549 __entry->nscan)
550);
551
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000552DECLARE_EVENT_CLASS(xfs_lock_class,
553 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
554 unsigned long caller_ip),
555 TP_ARGS(ip, lock_flags, caller_ip),
556 TP_STRUCT__entry(
557 __field(dev_t, dev)
558 __field(xfs_ino_t, ino)
559 __field(int, lock_flags)
560 __field(unsigned long, caller_ip)
561 ),
562 TP_fast_assign(
563 __entry->dev = VFS_I(ip)->i_sb->s_dev;
564 __entry->ino = ip->i_ino;
565 __entry->lock_flags = lock_flags;
566 __entry->caller_ip = caller_ip;
567 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800568 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000569 MAJOR(__entry->dev), MINOR(__entry->dev),
570 __entry->ino,
571 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
572 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000573)
574
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000575#define DEFINE_LOCK_EVENT(name) \
576DEFINE_EVENT(xfs_lock_class, name, \
577 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
578 unsigned long caller_ip), \
579 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000580DEFINE_LOCK_EVENT(xfs_ilock);
581DEFINE_LOCK_EVENT(xfs_ilock_nowait);
582DEFINE_LOCK_EVENT(xfs_ilock_demote);
583DEFINE_LOCK_EVENT(xfs_iunlock);
584
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000585DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000586 TP_PROTO(struct xfs_inode *ip),
587 TP_ARGS(ip),
588 TP_STRUCT__entry(
589 __field(dev_t, dev)
590 __field(xfs_ino_t, ino)
591 ),
592 TP_fast_assign(
593 __entry->dev = VFS_I(ip)->i_sb->s_dev;
594 __entry->ino = ip->i_ino;
595 ),
596 TP_printk("dev %d:%d ino 0x%llx",
597 MAJOR(__entry->dev), MINOR(__entry->dev),
598 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000599)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000600
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000601#define DEFINE_INODE_EVENT(name) \
602DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000603 TP_PROTO(struct xfs_inode *ip), \
604 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000605DEFINE_INODE_EVENT(xfs_iget_skip);
606DEFINE_INODE_EVENT(xfs_iget_reclaim);
607DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
608DEFINE_INODE_EVENT(xfs_iget_hit);
609DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000610
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000611DEFINE_INODE_EVENT(xfs_getattr);
612DEFINE_INODE_EVENT(xfs_setattr);
613DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500614DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000615DEFINE_INODE_EVENT(xfs_alloc_file_space);
616DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000617DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100618DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100619DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000620DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000621#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200622DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000623#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000624DEFINE_INODE_EVENT(xfs_vm_bmap);
625DEFINE_INODE_EVENT(xfs_file_ioctl);
626DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
627DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000628DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000629DEFINE_INODE_EVENT(xfs_file_fsync);
630DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400631DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000632
633DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
634DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
635
Brian Foster27b52862012-11-06 09:50:38 -0500636DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
637DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500638DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700639DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
640DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
641DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500642
Darrick J. Wong85f8dff2018-12-18 14:32:29 -0800643/*
644 * ftrace's __print_symbolic requires that all enum values be wrapped in the
645 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
646 * ring buffer. Somehow this was only worth mentioning in the ftrace sample
647 * code.
648 */
649TRACE_DEFINE_ENUM(PE_SIZE_PTE);
650TRACE_DEFINE_ENUM(PE_SIZE_PMD);
651TRACE_DEFINE_ENUM(PE_SIZE_PUD);
652
Christoph Hellwigd522d562017-08-29 10:08:41 -0700653TRACE_EVENT(xfs_filemap_fault,
654 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
655 bool write_fault),
656 TP_ARGS(ip, pe_size, write_fault),
657 TP_STRUCT__entry(
658 __field(dev_t, dev)
659 __field(xfs_ino_t, ino)
660 __field(enum page_entry_size, pe_size)
661 __field(bool, write_fault)
662 ),
663 TP_fast_assign(
664 __entry->dev = VFS_I(ip)->i_sb->s_dev;
665 __entry->ino = ip->i_ino;
666 __entry->pe_size = pe_size;
667 __entry->write_fault = write_fault;
668 ),
669 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
670 MAJOR(__entry->dev), MINOR(__entry->dev),
671 __entry->ino,
672 __print_symbolic(__entry->pe_size,
673 { PE_SIZE_PTE, "PTE" },
674 { PE_SIZE_PMD, "PMD" },
675 { PE_SIZE_PUD, "PUD" }),
676 __entry->write_fault)
677)
678
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000679DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000680 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
681 TP_ARGS(ip, caller_ip),
682 TP_STRUCT__entry(
683 __field(dev_t, dev)
684 __field(xfs_ino_t, ino)
685 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100686 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000687 __field(unsigned long, caller_ip)
688 ),
689 TP_fast_assign(
690 __entry->dev = VFS_I(ip)->i_sb->s_dev;
691 __entry->ino = ip->i_ino;
692 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100693 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000694 __entry->caller_ip = caller_ip;
695 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800696 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000697 MAJOR(__entry->dev), MINOR(__entry->dev),
698 __entry->ino,
699 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100700 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000701 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000702)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000703
Brian Foster19cb7e32013-03-18 10:51:48 -0400704TRACE_EVENT(xfs_iomap_prealloc_size,
705 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
706 unsigned int writeio_blocks),
707 TP_ARGS(ip, blocks, shift, writeio_blocks),
708 TP_STRUCT__entry(
709 __field(dev_t, dev)
710 __field(xfs_ino_t, ino)
711 __field(xfs_fsblock_t, blocks)
712 __field(int, shift)
713 __field(unsigned int, writeio_blocks)
714 ),
715 TP_fast_assign(
716 __entry->dev = VFS_I(ip)->i_sb->s_dev;
717 __entry->ino = ip->i_ino;
718 __entry->blocks = blocks;
719 __entry->shift = shift;
720 __entry->writeio_blocks = writeio_blocks;
721 ),
722 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
723 "m_writeio_blocks %u",
724 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
725 __entry->blocks, __entry->shift, __entry->writeio_blocks)
726)
727
Brian Foster56d11152015-05-29 09:18:32 +1000728TRACE_EVENT(xfs_irec_merge_pre,
729 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
730 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
731 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
732 TP_STRUCT__entry(
733 __field(dev_t, dev)
734 __field(xfs_agnumber_t, agno)
735 __field(xfs_agino_t, agino)
736 __field(uint16_t, holemask)
737 __field(xfs_agino_t, nagino)
738 __field(uint16_t, nholemask)
739 ),
740 TP_fast_assign(
741 __entry->dev = mp->m_super->s_dev;
742 __entry->agno = agno;
743 __entry->agino = agino;
744 __entry->holemask = holemask;
745 __entry->nagino = nagino;
746 __entry->nholemask = holemask;
747 ),
748 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
749 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
750 __entry->agino, __entry->holemask, __entry->nagino,
751 __entry->nholemask)
752)
753
754TRACE_EVENT(xfs_irec_merge_post,
755 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
756 uint16_t holemask),
757 TP_ARGS(mp, agno, agino, holemask),
758 TP_STRUCT__entry(
759 __field(dev_t, dev)
760 __field(xfs_agnumber_t, agno)
761 __field(xfs_agino_t, agino)
762 __field(uint16_t, holemask)
763 ),
764 TP_fast_assign(
765 __entry->dev = mp->m_super->s_dev;
766 __entry->agno = agno;
767 __entry->agino = agino;
768 __entry->holemask = holemask;
769 ),
770 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
771 MINOR(__entry->dev), __entry->agno, __entry->agino,
772 __entry->holemask)
773)
774
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000775#define DEFINE_IREF_EVENT(name) \
776DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000777 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
778 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000779DEFINE_IREF_EVENT(xfs_irele);
780DEFINE_IREF_EVENT(xfs_inode_pin);
781DEFINE_IREF_EVENT(xfs_inode_unpin);
782DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100783
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000784DECLARE_EVENT_CLASS(xfs_namespace_class,
785 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
786 TP_ARGS(dp, name),
787 TP_STRUCT__entry(
788 __field(dev_t, dev)
789 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000790 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000791 __dynamic_array(char, name, name->len)
792 ),
793 TP_fast_assign(
794 __entry->dev = VFS_I(dp)->i_sb->s_dev;
795 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000796 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000797 memcpy(__get_str(name), name->name, name->len);
798 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000799 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000800 MAJOR(__entry->dev), MINOR(__entry->dev),
801 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000802 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000803 __get_str(name))
804)
805
806#define DEFINE_NAMESPACE_EVENT(name) \
807DEFINE_EVENT(xfs_namespace_class, name, \
808 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
809 TP_ARGS(dp, name))
810DEFINE_NAMESPACE_EVENT(xfs_remove);
811DEFINE_NAMESPACE_EVENT(xfs_link);
812DEFINE_NAMESPACE_EVENT(xfs_lookup);
813DEFINE_NAMESPACE_EVENT(xfs_create);
814DEFINE_NAMESPACE_EVENT(xfs_symlink);
815
816TRACE_EVENT(xfs_rename,
817 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
818 struct xfs_name *src_name, struct xfs_name *target_name),
819 TP_ARGS(src_dp, target_dp, src_name, target_name),
820 TP_STRUCT__entry(
821 __field(dev_t, dev)
822 __field(xfs_ino_t, src_dp_ino)
823 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000824 __field(int, src_namelen)
825 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000826 __dynamic_array(char, src_name, src_name->len)
827 __dynamic_array(char, target_name, target_name->len)
828 ),
829 TP_fast_assign(
830 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
831 __entry->src_dp_ino = src_dp->i_ino;
832 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000833 __entry->src_namelen = src_name->len;
834 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000835 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000836 memcpy(__get_str(target_name), target_name->name,
837 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000838 ),
839 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000840 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000841 MAJOR(__entry->dev), MINOR(__entry->dev),
842 __entry->src_dp_ino,
843 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000844 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000845 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000846 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000847 __get_str(target_name))
848)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000849
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000850DECLARE_EVENT_CLASS(xfs_dquot_class,
851 TP_PROTO(struct xfs_dquot *dqp),
852 TP_ARGS(dqp),
853 TP_STRUCT__entry(
854 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000855 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000856 __field(unsigned, flags)
857 __field(unsigned, nrefs)
858 __field(unsigned long long, res_bcount)
859 __field(unsigned long long, bcount)
860 __field(unsigned long long, icount)
861 __field(unsigned long long, blk_hardlimit)
862 __field(unsigned long long, blk_softlimit)
863 __field(unsigned long long, ino_hardlimit)
864 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000865 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000866 TP_fast_assign(
867 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000868 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000869 __entry->flags = dqp->dq_flags;
870 __entry->nrefs = dqp->q_nrefs;
871 __entry->res_bcount = dqp->q_res_bcount;
872 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
873 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
874 __entry->blk_hardlimit =
875 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
876 __entry->blk_softlimit =
877 be64_to_cpu(dqp->q_core.d_blk_softlimit);
878 __entry->ino_hardlimit =
879 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
880 __entry->ino_softlimit =
881 be64_to_cpu(dqp->q_core.d_ino_softlimit);
882 ),
883 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000884 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
885 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000886 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000887 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000888 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
889 __entry->nrefs,
890 __entry->res_bcount,
891 __entry->bcount,
892 __entry->blk_hardlimit,
893 __entry->blk_softlimit,
894 __entry->icount,
895 __entry->ino_hardlimit,
896 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000897)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000898
899#define DEFINE_DQUOT_EVENT(name) \
900DEFINE_EVENT(xfs_dquot_class, name, \
901 TP_PROTO(struct xfs_dquot *dqp), \
902 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000903DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000904DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
905DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000906DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
907DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000908DEFINE_DQUOT_EVENT(xfs_dqattach_found);
909DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000910DEFINE_DQUOT_EVENT(xfs_dqalloc);
911DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
912DEFINE_DQUOT_EVENT(xfs_dqread);
913DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000914DEFINE_DQUOT_EVENT(xfs_dqget_hit);
915DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000916DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
917DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000918DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000919DEFINE_DQUOT_EVENT(xfs_dqput_free);
920DEFINE_DQUOT_EVENT(xfs_dqrele);
921DEFINE_DQUOT_EVENT(xfs_dqflush);
922DEFINE_DQUOT_EVENT(xfs_dqflush_force);
923DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000924
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000925DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500926 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000927 TP_ARGS(log, tic),
928 TP_STRUCT__entry(
929 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000930 __field(char, ocnt)
931 __field(char, cnt)
932 __field(int, curr_res)
933 __field(int, unit_res)
934 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100935 __field(int, reserveq)
936 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000937 __field(int, grant_reserve_cycle)
938 __field(int, grant_reserve_bytes)
939 __field(int, grant_write_cycle)
940 __field(int, grant_write_bytes)
941 __field(int, curr_cycle)
942 __field(int, curr_block)
943 __field(xfs_lsn_t, tail_lsn)
944 ),
945 TP_fast_assign(
946 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000947 __entry->ocnt = tic->t_ocnt;
948 __entry->cnt = tic->t_cnt;
949 __entry->curr_res = tic->t_curr_res;
950 __entry->unit_res = tic->t_unit_res;
951 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000952 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
953 __entry->writeq = list_empty(&log->l_write_head.waiters);
954 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100955 &__entry->grant_reserve_cycle,
956 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000957 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100958 &__entry->grant_write_cycle,
959 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000960 __entry->curr_cycle = log->l_curr_cycle;
961 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100962 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000963 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000964 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100965 "t_unit_res %u t_flags %s reserveq %s "
966 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000967 "grant_reserve_bytes %d grant_write_cycle %d "
968 "grant_write_bytes %d curr_cycle %d curr_block %d "
969 "tail_cycle %d tail_block %d",
970 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000971 __entry->ocnt,
972 __entry->cnt,
973 __entry->curr_res,
974 __entry->unit_res,
975 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100976 __entry->reserveq ? "empty" : "active",
977 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000978 __entry->grant_reserve_cycle,
979 __entry->grant_reserve_bytes,
980 __entry->grant_write_cycle,
981 __entry->grant_write_bytes,
982 __entry->curr_cycle,
983 __entry->curr_block,
984 CYCLE_LSN(__entry->tail_lsn),
985 BLOCK_LSN(__entry->tail_lsn)
986 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000987)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000988
989#define DEFINE_LOGGRANT_EVENT(name) \
990DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500991 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000992 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000993DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
994DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000995DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +0000996DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
997DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +1100998DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +0000999DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1000DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1001DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1002DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001003DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1004DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1005DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1006DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1007DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1008DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1009
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001010DECLARE_EVENT_CLASS(xfs_log_item_class,
1011 TP_PROTO(struct xfs_log_item *lip),
1012 TP_ARGS(lip),
1013 TP_STRUCT__entry(
1014 __field(dev_t, dev)
1015 __field(void *, lip)
1016 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001017 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001018 __field(xfs_lsn_t, lsn)
1019 ),
1020 TP_fast_assign(
1021 __entry->dev = lip->li_mountp->m_super->s_dev;
1022 __entry->lip = lip;
1023 __entry->type = lip->li_type;
1024 __entry->flags = lip->li_flags;
1025 __entry->lsn = lip->li_lsn;
1026 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001027 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001028 MAJOR(__entry->dev), MINOR(__entry->dev),
1029 __entry->lip,
1030 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1031 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1032 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1033)
1034
Dave Chinner14c26c62012-04-24 16:33:31 +10001035TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001036 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1037 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001038 TP_STRUCT__entry(
1039 __field(dev_t, dev)
1040 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001041 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001042 ),
1043 TP_fast_assign(
1044 __entry->dev = mp->m_super->s_dev;
1045 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001046 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001047 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001048 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001049 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001050 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001051)
1052
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001053#define DEFINE_LOG_ITEM_EVENT(name) \
1054DEFINE_EVENT(xfs_log_item_class, name, \
1055 TP_PROTO(struct xfs_log_item *lip), \
1056 TP_ARGS(lip))
1057DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001058DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1059DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001060DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001061
Dave Chinner750b9c92013-11-01 15:27:18 +11001062DECLARE_EVENT_CLASS(xfs_ail_class,
1063 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1064 TP_ARGS(lip, old_lsn, new_lsn),
1065 TP_STRUCT__entry(
1066 __field(dev_t, dev)
1067 __field(void *, lip)
1068 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001069 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001070 __field(xfs_lsn_t, old_lsn)
1071 __field(xfs_lsn_t, new_lsn)
1072 ),
1073 TP_fast_assign(
1074 __entry->dev = lip->li_mountp->m_super->s_dev;
1075 __entry->lip = lip;
1076 __entry->type = lip->li_type;
1077 __entry->flags = lip->li_flags;
1078 __entry->old_lsn = old_lsn;
1079 __entry->new_lsn = new_lsn;
1080 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001081 TP_printk("dev %d:%d lip %p old lsn %d/%d new lsn %d/%d type %s flags %s",
Dave Chinner750b9c92013-11-01 15:27:18 +11001082 MAJOR(__entry->dev), MINOR(__entry->dev),
1083 __entry->lip,
1084 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1085 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1086 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1087 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1088)
1089
1090#define DEFINE_AIL_EVENT(name) \
1091DEFINE_EVENT(xfs_ail_class, name, \
1092 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1093 TP_ARGS(lip, old_lsn, new_lsn))
1094DEFINE_AIL_EVENT(xfs_ail_insert);
1095DEFINE_AIL_EVENT(xfs_ail_move);
1096DEFINE_AIL_EVENT(xfs_ail_delete);
1097
1098TRACE_EVENT(xfs_log_assign_tail_lsn,
1099 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1100 TP_ARGS(log, new_lsn),
1101 TP_STRUCT__entry(
1102 __field(dev_t, dev)
1103 __field(xfs_lsn_t, new_lsn)
1104 __field(xfs_lsn_t, old_lsn)
1105 __field(xfs_lsn_t, last_sync_lsn)
1106 ),
1107 TP_fast_assign(
1108 __entry->dev = log->l_mp->m_super->s_dev;
1109 __entry->new_lsn = new_lsn;
1110 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1111 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1112 ),
1113 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1114 MAJOR(__entry->dev), MINOR(__entry->dev),
1115 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1116 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1117 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1118)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001119
Li Zefanf8adb4d2010-05-24 08:25:57 +00001120DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001121 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1122 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001123 TP_STRUCT__entry(
1124 __field(dev_t, dev)
1125 __field(xfs_ino_t, ino)
1126 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001127 __field(loff_t, offset)
1128 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001129 ),
1130 TP_fast_assign(
1131 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1132 __entry->ino = ip->i_ino;
1133 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001134 __entry->offset = offset;
1135 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001136 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001137 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001138 MAJOR(__entry->dev), MINOR(__entry->dev),
1139 __entry->ino,
1140 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001141 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001142 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001143)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001144
1145#define DEFINE_RW_EVENT(name) \
1146DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001147 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1148 TP_ARGS(ip, count, offset))
1149DEFINE_RW_EVENT(xfs_file_buffered_read);
1150DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001151DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001152DEFINE_RW_EVENT(xfs_file_buffered_write);
1153DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001154DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001155
Li Zefanf8adb4d2010-05-24 08:25:57 +00001156DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001157 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1158 unsigned int len),
1159 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001160 TP_STRUCT__entry(
1161 __field(dev_t, dev)
1162 __field(xfs_ino_t, ino)
1163 __field(pgoff_t, pgoff)
1164 __field(loff_t, size)
1165 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001166 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001167 ),
1168 TP_fast_assign(
Li Zefanf8adb4d2010-05-24 08:25:57 +00001169 __entry->dev = inode->i_sb->s_dev;
1170 __entry->ino = XFS_I(inode)->i_ino;
1171 __entry->pgoff = page_offset(page);
1172 __entry->size = i_size_read(inode);
1173 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001174 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001175 ),
1176 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001177 "length %x",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001178 MAJOR(__entry->dev), MINOR(__entry->dev),
1179 __entry->ino,
1180 __entry->pgoff,
1181 __entry->size,
1182 __entry->offset,
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001183 __entry->length)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001184)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001185
1186#define DEFINE_PAGE_EVENT(name) \
1187DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001188 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1189 unsigned int len), \
1190 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001191DEFINE_PAGE_EVENT(xfs_writepage);
1192DEFINE_PAGE_EVENT(xfs_releasepage);
1193DEFINE_PAGE_EVENT(xfs_invalidatepage);
1194
Dave Chinner121e2132016-01-08 11:28:35 +11001195DECLARE_EVENT_CLASS(xfs_readpage_class,
1196 TP_PROTO(struct inode *inode, int nr_pages),
1197 TP_ARGS(inode, nr_pages),
1198 TP_STRUCT__entry(
1199 __field(dev_t, dev)
1200 __field(xfs_ino_t, ino)
1201 __field(int, nr_pages)
1202 ),
1203 TP_fast_assign(
1204 __entry->dev = inode->i_sb->s_dev;
1205 __entry->ino = inode->i_ino;
1206 __entry->nr_pages = nr_pages;
1207 ),
1208 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1209 MAJOR(__entry->dev), MINOR(__entry->dev),
1210 __entry->ino,
1211 __entry->nr_pages)
1212)
1213
1214#define DEFINE_READPAGE_EVENT(name) \
1215DEFINE_EVENT(xfs_readpage_class, name, \
1216 TP_PROTO(struct inode *inode, int nr_pages), \
1217 TP_ARGS(inode, nr_pages))
1218DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1219DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1220
Darrick J. Wong85f8dff2018-12-18 14:32:29 -08001221TRACE_DEFINE_ENUM(XFS_IO_HOLE);
1222TRACE_DEFINE_ENUM(XFS_IO_DELALLOC);
1223TRACE_DEFINE_ENUM(XFS_IO_UNWRITTEN);
1224TRACE_DEFINE_ENUM(XFS_IO_OVERWRITE);
1225TRACE_DEFINE_ENUM(XFS_IO_COW);
1226
Christoph Hellwiga206c812010-12-10 08:42:20 +00001227DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001228 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001229 int type, struct xfs_bmbt_irec *irec),
1230 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001231 TP_STRUCT__entry(
1232 __field(dev_t, dev)
1233 __field(xfs_ino_t, ino)
1234 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001235 __field(loff_t, offset)
1236 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001237 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001238 __field(xfs_fileoff_t, startoff)
1239 __field(xfs_fsblock_t, startblock)
1240 __field(xfs_filblks_t, blockcount)
1241 ),
1242 TP_fast_assign(
1243 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1244 __entry->ino = ip->i_ino;
1245 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001246 __entry->offset = offset;
1247 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001248 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001249 __entry->startoff = irec ? irec->br_startoff : 0;
1250 __entry->startblock = irec ? irec->br_startblock : 0;
1251 __entry->blockcount = irec ? irec->br_blockcount : 0;
1252 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001253 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1254 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001255 MAJOR(__entry->dev), MINOR(__entry->dev),
1256 __entry->ino,
1257 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001258 __entry->offset,
1259 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001260 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001261 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001262 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001263 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001264)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001265
1266#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001267DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001268 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001269 int type, struct xfs_bmbt_irec *irec), \
1270 TP_ARGS(ip, offset, count, type, irec))
1271DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1272DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001273DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1274DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001275
Li Zefanf8adb4d2010-05-24 08:25:57 +00001276DECLARE_EVENT_CLASS(xfs_simple_io_class,
1277 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1278 TP_ARGS(ip, offset, count),
1279 TP_STRUCT__entry(
1280 __field(dev_t, dev)
1281 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001282 __field(loff_t, isize)
1283 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001284 __field(loff_t, offset)
1285 __field(size_t, count)
1286 ),
1287 TP_fast_assign(
1288 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1289 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001290 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001291 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001292 __entry->offset = offset;
1293 __entry->count = count;
1294 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001295 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001296 "offset 0x%llx count %zd",
1297 MAJOR(__entry->dev), MINOR(__entry->dev),
1298 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001299 __entry->isize,
1300 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001301 __entry->offset,
1302 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001303);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001304
1305#define DEFINE_SIMPLE_IO_EVENT(name) \
1306DEFINE_EVENT(xfs_simple_io_class, name, \
1307 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1308 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001309DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1310DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001311DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001312DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001313DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1314DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1315DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001316
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001317DECLARE_EVENT_CLASS(xfs_itrunc_class,
1318 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1319 TP_ARGS(ip, new_size),
1320 TP_STRUCT__entry(
1321 __field(dev_t, dev)
1322 __field(xfs_ino_t, ino)
1323 __field(xfs_fsize_t, size)
1324 __field(xfs_fsize_t, new_size)
1325 ),
1326 TP_fast_assign(
1327 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1328 __entry->ino = ip->i_ino;
1329 __entry->size = ip->i_d.di_size;
1330 __entry->new_size = new_size;
1331 ),
1332 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1333 MAJOR(__entry->dev), MINOR(__entry->dev),
1334 __entry->ino,
1335 __entry->size,
1336 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001337)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001338
1339#define DEFINE_ITRUNC_EVENT(name) \
1340DEFINE_EVENT(xfs_itrunc_class, name, \
1341 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1342 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001343DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1344DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001345
1346TRACE_EVENT(xfs_pagecache_inval,
1347 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1348 TP_ARGS(ip, start, finish),
1349 TP_STRUCT__entry(
1350 __field(dev_t, dev)
1351 __field(xfs_ino_t, ino)
1352 __field(xfs_fsize_t, size)
1353 __field(xfs_off_t, start)
1354 __field(xfs_off_t, finish)
1355 ),
1356 TP_fast_assign(
1357 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1358 __entry->ino = ip->i_ino;
1359 __entry->size = ip->i_d.di_size;
1360 __entry->start = start;
1361 __entry->finish = finish;
1362 ),
1363 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1364 MAJOR(__entry->dev), MINOR(__entry->dev),
1365 __entry->ino,
1366 __entry->size,
1367 __entry->start,
1368 __entry->finish)
1369);
1370
1371TRACE_EVENT(xfs_bunmap,
1372 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1373 int flags, unsigned long caller_ip),
1374 TP_ARGS(ip, bno, len, flags, caller_ip),
1375 TP_STRUCT__entry(
1376 __field(dev_t, dev)
1377 __field(xfs_ino_t, ino)
1378 __field(xfs_fsize_t, size)
1379 __field(xfs_fileoff_t, bno)
1380 __field(xfs_filblks_t, len)
1381 __field(unsigned long, caller_ip)
1382 __field(int, flags)
1383 ),
1384 TP_fast_assign(
1385 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1386 __entry->ino = ip->i_ino;
1387 __entry->size = ip->i_d.di_size;
1388 __entry->bno = bno;
1389 __entry->len = len;
1390 __entry->caller_ip = caller_ip;
1391 __entry->flags = flags;
1392 ),
1393 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001394 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001395 MAJOR(__entry->dev), MINOR(__entry->dev),
1396 __entry->ino,
1397 __entry->size,
1398 __entry->bno,
1399 __entry->len,
1400 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1401 (void *)__entry->caller_ip)
1402
1403);
1404
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001405DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001406 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1407 xfs_agblock_t agbno, xfs_extlen_t len),
1408 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001409 TP_STRUCT__entry(
1410 __field(dev_t, dev)
1411 __field(xfs_agnumber_t, agno)
1412 __field(xfs_agblock_t, agbno)
1413 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001414 ),
1415 TP_fast_assign(
1416 __entry->dev = mp->m_super->s_dev;
1417 __entry->agno = agno;
1418 __entry->agbno = agbno;
1419 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001420 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001421 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001422 MAJOR(__entry->dev), MINOR(__entry->dev),
1423 __entry->agno,
1424 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001425 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001426);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001427#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001428DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001429 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1430 xfs_agblock_t agbno, xfs_extlen_t len), \
1431 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001432DEFINE_BUSY_EVENT(xfs_extent_busy);
1433DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1434DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1435DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1436DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001437
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001438TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001439 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1440 xfs_agblock_t agbno, xfs_extlen_t len,
1441 xfs_agblock_t tbno, xfs_extlen_t tlen),
1442 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1443 TP_STRUCT__entry(
1444 __field(dev_t, dev)
1445 __field(xfs_agnumber_t, agno)
1446 __field(xfs_agblock_t, agbno)
1447 __field(xfs_extlen_t, len)
1448 __field(xfs_agblock_t, tbno)
1449 __field(xfs_extlen_t, tlen)
1450 ),
1451 TP_fast_assign(
1452 __entry->dev = mp->m_super->s_dev;
1453 __entry->agno = agno;
1454 __entry->agbno = agbno;
1455 __entry->len = len;
1456 __entry->tbno = tbno;
1457 __entry->tlen = tlen;
1458 ),
1459 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1460 MAJOR(__entry->dev), MINOR(__entry->dev),
1461 __entry->agno,
1462 __entry->agbno,
1463 __entry->len,
1464 __entry->tbno,
1465 __entry->tlen)
1466);
1467
Brian Fostera27ba262018-03-15 10:51:58 -07001468DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001469 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1470 unsigned long caller_ip),
1471 TP_ARGS(mp, agf, flags, caller_ip),
1472 TP_STRUCT__entry(
1473 __field(dev_t, dev)
1474 __field(xfs_agnumber_t, agno)
1475 __field(int, flags)
1476 __field(__u32, length)
1477 __field(__u32, bno_root)
1478 __field(__u32, cnt_root)
1479 __field(__u32, bno_level)
1480 __field(__u32, cnt_level)
1481 __field(__u32, flfirst)
1482 __field(__u32, fllast)
1483 __field(__u32, flcount)
1484 __field(__u32, freeblks)
1485 __field(__u32, longest)
1486 __field(unsigned long, caller_ip)
1487 ),
1488 TP_fast_assign(
1489 __entry->dev = mp->m_super->s_dev;
1490 __entry->agno = be32_to_cpu(agf->agf_seqno),
1491 __entry->flags = flags;
1492 __entry->length = be32_to_cpu(agf->agf_length),
1493 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1494 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1495 __entry->bno_level =
1496 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1497 __entry->cnt_level =
1498 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1499 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1500 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1501 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1502 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1503 __entry->longest = be32_to_cpu(agf->agf_longest);
1504 __entry->caller_ip = caller_ip;
1505 ),
1506 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1507 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001508 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001509 MAJOR(__entry->dev), MINOR(__entry->dev),
1510 __entry->agno,
1511 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1512 __entry->length,
1513 __entry->bno_root,
1514 __entry->cnt_root,
1515 __entry->bno_level,
1516 __entry->cnt_level,
1517 __entry->flfirst,
1518 __entry->fllast,
1519 __entry->flcount,
1520 __entry->freeblks,
1521 __entry->longest,
1522 (void *)__entry->caller_ip)
1523);
Brian Fostera27ba262018-03-15 10:51:58 -07001524#define DEFINE_AGF_EVENT(name) \
1525DEFINE_EVENT(xfs_agf_class, name, \
1526 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1527 unsigned long caller_ip), \
1528 TP_ARGS(mp, agf, flags, caller_ip))
1529DEFINE_AGF_EVENT(xfs_agf);
1530DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001531
1532TRACE_EVENT(xfs_free_extent,
1533 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001534 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1535 int haveright),
1536 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001537 TP_STRUCT__entry(
1538 __field(dev_t, dev)
1539 __field(xfs_agnumber_t, agno)
1540 __field(xfs_agblock_t, agbno)
1541 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001542 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001543 __field(int, haveleft)
1544 __field(int, haveright)
1545 ),
1546 TP_fast_assign(
1547 __entry->dev = mp->m_super->s_dev;
1548 __entry->agno = agno;
1549 __entry->agbno = agbno;
1550 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001551 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001552 __entry->haveleft = haveleft;
1553 __entry->haveright = haveright;
1554 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001555 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001556 MAJOR(__entry->dev), MINOR(__entry->dev),
1557 __entry->agno,
1558 __entry->agbno,
1559 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001560 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001561 __entry->haveleft ?
1562 (__entry->haveright ? "both" : "left") :
1563 (__entry->haveright ? "right" : "none"))
1564
1565);
1566
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001567DECLARE_EVENT_CLASS(xfs_alloc_class,
1568 TP_PROTO(struct xfs_alloc_arg *args),
1569 TP_ARGS(args),
1570 TP_STRUCT__entry(
1571 __field(dev_t, dev)
1572 __field(xfs_agnumber_t, agno)
1573 __field(xfs_agblock_t, agbno)
1574 __field(xfs_extlen_t, minlen)
1575 __field(xfs_extlen_t, maxlen)
1576 __field(xfs_extlen_t, mod)
1577 __field(xfs_extlen_t, prod)
1578 __field(xfs_extlen_t, minleft)
1579 __field(xfs_extlen_t, total)
1580 __field(xfs_extlen_t, alignment)
1581 __field(xfs_extlen_t, minalignslop)
1582 __field(xfs_extlen_t, len)
1583 __field(short, type)
1584 __field(short, otype)
1585 __field(char, wasdel)
1586 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001587 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001588 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001589 __field(xfs_fsblock_t, firstblock)
1590 ),
1591 TP_fast_assign(
1592 __entry->dev = args->mp->m_super->s_dev;
1593 __entry->agno = args->agno;
1594 __entry->agbno = args->agbno;
1595 __entry->minlen = args->minlen;
1596 __entry->maxlen = args->maxlen;
1597 __entry->mod = args->mod;
1598 __entry->prod = args->prod;
1599 __entry->minleft = args->minleft;
1600 __entry->total = args->total;
1601 __entry->alignment = args->alignment;
1602 __entry->minalignslop = args->minalignslop;
1603 __entry->len = args->len;
1604 __entry->type = args->type;
1605 __entry->otype = args->otype;
1606 __entry->wasdel = args->wasdel;
1607 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001608 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001609 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001610 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001611 ),
1612 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1613 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001614 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001615 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001616 MAJOR(__entry->dev), MINOR(__entry->dev),
1617 __entry->agno,
1618 __entry->agbno,
1619 __entry->minlen,
1620 __entry->maxlen,
1621 __entry->mod,
1622 __entry->prod,
1623 __entry->minleft,
1624 __entry->total,
1625 __entry->alignment,
1626 __entry->minalignslop,
1627 __entry->len,
1628 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1629 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1630 __entry->wasdel,
1631 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001632 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001633 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001634 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001635)
1636
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001637#define DEFINE_ALLOC_EVENT(name) \
1638DEFINE_EVENT(xfs_alloc_class, name, \
1639 TP_PROTO(struct xfs_alloc_arg *args), \
1640 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001641DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001642DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001643DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1644DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1645DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1646DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1647DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1648DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001649DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1650DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001651DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1652DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1653DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1654DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1655DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001656DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001657DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1658DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1659DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1660DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1661DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1662DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1663DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1664DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1665DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1666
Dave Chinner5a5881c2012-03-22 05:15:13 +00001667DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001668 TP_PROTO(struct xfs_da_args *args),
1669 TP_ARGS(args),
1670 TP_STRUCT__entry(
1671 __field(dev_t, dev)
1672 __field(xfs_ino_t, ino)
1673 __dynamic_array(char, name, args->namelen)
1674 __field(int, namelen)
1675 __field(xfs_dahash_t, hashval)
1676 __field(xfs_ino_t, inumber)
1677 __field(int, op_flags)
1678 ),
1679 TP_fast_assign(
1680 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1681 __entry->ino = args->dp->i_ino;
1682 if (args->namelen)
1683 memcpy(__get_str(name), args->name, args->namelen);
1684 __entry->namelen = args->namelen;
1685 __entry->hashval = args->hashval;
1686 __entry->inumber = args->inumber;
1687 __entry->op_flags = args->op_flags;
1688 ),
1689 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1690 "inumber 0x%llx op_flags %s",
1691 MAJOR(__entry->dev), MINOR(__entry->dev),
1692 __entry->ino,
1693 __entry->namelen,
1694 __entry->namelen ? __get_str(name) : NULL,
1695 __entry->namelen,
1696 __entry->hashval,
1697 __entry->inumber,
1698 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001699)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001700
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001701#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001702DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001703 TP_PROTO(struct xfs_da_args *args), \
1704 TP_ARGS(args))
1705DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1706DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1707DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1708DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1709DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1710DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1711DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1712DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1713DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1714DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1715DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1716DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1717DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1718DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1719DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1720DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1721DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1722DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1723DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1724DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1725DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1726DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1727DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1728DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1729DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1730
Dave Chinneree732592012-11-12 22:53:53 +11001731DECLARE_EVENT_CLASS(xfs_attr_class,
1732 TP_PROTO(struct xfs_da_args *args),
1733 TP_ARGS(args),
1734 TP_STRUCT__entry(
1735 __field(dev_t, dev)
1736 __field(xfs_ino_t, ino)
1737 __dynamic_array(char, name, args->namelen)
1738 __field(int, namelen)
1739 __field(int, valuelen)
1740 __field(xfs_dahash_t, hashval)
Eric Sandeene4435232018-04-17 17:17:35 -07001741 __field(int, flags)
Dave Chinneree732592012-11-12 22:53:53 +11001742 __field(int, op_flags)
1743 ),
1744 TP_fast_assign(
1745 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1746 __entry->ino = args->dp->i_ino;
1747 if (args->namelen)
1748 memcpy(__get_str(name), args->name, args->namelen);
1749 __entry->namelen = args->namelen;
1750 __entry->valuelen = args->valuelen;
1751 __entry->hashval = args->hashval;
Eric Sandeene4435232018-04-17 17:17:35 -07001752 __entry->flags = args->flags;
Dave Chinneree732592012-11-12 22:53:53 +11001753 __entry->op_flags = args->op_flags;
1754 ),
1755 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Eric Sandeene4435232018-04-17 17:17:35 -07001756 "hashval 0x%x flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001757 MAJOR(__entry->dev), MINOR(__entry->dev),
1758 __entry->ino,
1759 __entry->namelen,
1760 __entry->namelen ? __get_str(name) : NULL,
1761 __entry->namelen,
1762 __entry->valuelen,
1763 __entry->hashval,
Eric Sandeene4435232018-04-17 17:17:35 -07001764 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
Dave Chinneree732592012-11-12 22:53:53 +11001765 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1766)
1767
Dave Chinner5a5881c2012-03-22 05:15:13 +00001768#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001769DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001770 TP_PROTO(struct xfs_da_args *args), \
1771 TP_ARGS(args))
1772DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1773DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1774DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1775DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1776DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001777DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1778
1779DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1780DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001782DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001783DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1784DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001785DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1786DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001787DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1788DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001789DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001790DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1791DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1792DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1793DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1794DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1795DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1796DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1797DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1798DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1799DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1800DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001801DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001802
1803DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001804DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001805DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1806DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1807
Dave Chinneree732592012-11-12 22:53:53 +11001808DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1809DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1810
1811DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1812DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1813DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1814
Dave Chinner5a5881c2012-03-22 05:15:13 +00001815#define DEFINE_DA_EVENT(name) \
1816DEFINE_EVENT(xfs_da_class, name, \
1817 TP_PROTO(struct xfs_da_args *args), \
1818 TP_ARGS(args))
1819DEFINE_DA_EVENT(xfs_da_split);
1820DEFINE_DA_EVENT(xfs_da_join);
1821DEFINE_DA_EVENT(xfs_da_link_before);
1822DEFINE_DA_EVENT(xfs_da_link_after);
1823DEFINE_DA_EVENT(xfs_da_unlink_back);
1824DEFINE_DA_EVENT(xfs_da_unlink_forward);
1825DEFINE_DA_EVENT(xfs_da_root_split);
1826DEFINE_DA_EVENT(xfs_da_root_join);
1827DEFINE_DA_EVENT(xfs_da_node_add);
1828DEFINE_DA_EVENT(xfs_da_node_create);
1829DEFINE_DA_EVENT(xfs_da_node_split);
1830DEFINE_DA_EVENT(xfs_da_node_remove);
1831DEFINE_DA_EVENT(xfs_da_node_rebalance);
1832DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001833DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001834DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1835DEFINE_DA_EVENT(xfs_da_grow_inode);
1836DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001837DEFINE_DA_EVENT(xfs_da_fixhashpath);
1838DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001839
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001840DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1841 TP_PROTO(struct xfs_da_args *args, int idx),
1842 TP_ARGS(args, idx),
1843 TP_STRUCT__entry(
1844 __field(dev_t, dev)
1845 __field(xfs_ino_t, ino)
1846 __field(int, op_flags)
1847 __field(int, idx)
1848 ),
1849 TP_fast_assign(
1850 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1851 __entry->ino = args->dp->i_ino;
1852 __entry->op_flags = args->op_flags;
1853 __entry->idx = idx;
1854 ),
1855 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1856 MAJOR(__entry->dev), MINOR(__entry->dev),
1857 __entry->ino,
1858 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1859 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001860)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001861
1862#define DEFINE_DIR2_SPACE_EVENT(name) \
1863DEFINE_EVENT(xfs_dir2_space_class, name, \
1864 TP_PROTO(struct xfs_da_args *args, int idx), \
1865 TP_ARGS(args, idx))
1866DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1867DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1868DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1869DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001870
1871TRACE_EVENT(xfs_dir2_leafn_moveents,
1872 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1873 TP_ARGS(args, src_idx, dst_idx, count),
1874 TP_STRUCT__entry(
1875 __field(dev_t, dev)
1876 __field(xfs_ino_t, ino)
1877 __field(int, op_flags)
1878 __field(int, src_idx)
1879 __field(int, dst_idx)
1880 __field(int, count)
1881 ),
1882 TP_fast_assign(
1883 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1884 __entry->ino = args->dp->i_ino;
1885 __entry->op_flags = args->op_flags;
1886 __entry->src_idx = src_idx;
1887 __entry->dst_idx = dst_idx;
1888 __entry->count = count;
1889 ),
1890 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1891 "src_idx %d dst_idx %d count %d",
1892 MAJOR(__entry->dev), MINOR(__entry->dev),
1893 __entry->ino,
1894 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1895 __entry->src_idx,
1896 __entry->dst_idx,
1897 __entry->count)
1898);
1899
Dave Chinner3a85cd92010-01-14 01:33:55 +00001900#define XFS_SWAPEXT_INODES \
1901 { 0, "target" }, \
1902 { 1, "temp" }
1903
Darrick J. Wong0357d212018-12-18 14:32:30 -08001904TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
1905TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
1906TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
1907TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
1908TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
Dave Chinner3a85cd92010-01-14 01:33:55 +00001909
1910DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1911 TP_PROTO(struct xfs_inode *ip, int which),
1912 TP_ARGS(ip, which),
1913 TP_STRUCT__entry(
1914 __field(dev_t, dev)
1915 __field(int, which)
1916 __field(xfs_ino_t, ino)
1917 __field(int, format)
1918 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001919 __field(int, broot_size)
1920 __field(int, fork_off)
1921 ),
1922 TP_fast_assign(
1923 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1924 __entry->which = which;
1925 __entry->ino = ip->i_ino;
1926 __entry->format = ip->i_d.di_format;
1927 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001928 __entry->broot_size = ip->i_df.if_broot_bytes;
1929 __entry->fork_off = XFS_IFORK_BOFF(ip);
1930 ),
1931 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001932 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001933 MAJOR(__entry->dev), MINOR(__entry->dev),
1934 __entry->ino,
1935 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1936 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1937 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001938 __entry->broot_size,
1939 __entry->fork_off)
1940)
1941
1942#define DEFINE_SWAPEXT_EVENT(name) \
1943DEFINE_EVENT(xfs_swap_extent_class, name, \
1944 TP_PROTO(struct xfs_inode *ip, int which), \
1945 TP_ARGS(ip, which))
1946
1947DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1948DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1949
Brian Fostere67d3d42017-08-08 18:21:53 -07001950TRACE_EVENT(xfs_log_recover,
1951 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1952 TP_ARGS(log, headblk, tailblk),
1953 TP_STRUCT__entry(
1954 __field(dev_t, dev)
1955 __field(xfs_daddr_t, headblk)
1956 __field(xfs_daddr_t, tailblk)
1957 ),
1958 TP_fast_assign(
1959 __entry->dev = log->l_mp->m_super->s_dev;
1960 __entry->headblk = headblk;
1961 __entry->tailblk = tailblk;
1962 ),
1963 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1964 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1965 __entry->tailblk)
1966)
1967
Brian Foster5cd9cee2016-09-26 08:34:52 +10001968TRACE_EVENT(xfs_log_recover_record,
1969 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1970 TP_ARGS(log, rhead, pass),
1971 TP_STRUCT__entry(
1972 __field(dev_t, dev)
1973 __field(xfs_lsn_t, lsn)
1974 __field(int, len)
1975 __field(int, num_logops)
1976 __field(int, pass)
1977 ),
1978 TP_fast_assign(
1979 __entry->dev = log->l_mp->m_super->s_dev;
1980 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1981 __entry->len = be32_to_cpu(rhead->h_len);
1982 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1983 __entry->pass = pass;
1984 ),
1985 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1986 MAJOR(__entry->dev), MINOR(__entry->dev),
1987 __entry->lsn, __entry->len, __entry->num_logops,
1988 __entry->pass)
1989)
1990
Dave Chinner9abbc532010-04-13 15:06:46 +10001991DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001992 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001993 struct xlog_recover_item *item, int pass),
1994 TP_ARGS(log, trans, item, pass),
1995 TP_STRUCT__entry(
1996 __field(dev_t, dev)
1997 __field(unsigned long, item)
1998 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001999 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002000 __field(int, type)
2001 __field(int, pass)
2002 __field(int, count)
2003 __field(int, total)
2004 ),
2005 TP_fast_assign(
2006 __entry->dev = log->l_mp->m_super->s_dev;
2007 __entry->item = (unsigned long)item;
2008 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002009 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002010 __entry->type = ITEM_TYPE(item);
2011 __entry->pass = pass;
2012 __entry->count = item->ri_cnt;
2013 __entry->total = item->ri_total;
2014 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08002015 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10002016 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002017 MAJOR(__entry->dev), MINOR(__entry->dev),
2018 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002019 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002020 __entry->pass,
2021 (void *)__entry->item,
2022 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2023 __entry->count,
2024 __entry->total)
2025)
2026
2027#define DEFINE_LOG_RECOVER_ITEM(name) \
2028DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002029 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002030 struct xlog_recover_item *item, int pass), \
2031 TP_ARGS(log, trans, item, pass))
2032
2033DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2034DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2035DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2036DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2037DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2038
2039DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002040 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002041 TP_ARGS(log, buf_f),
2042 TP_STRUCT__entry(
2043 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002044 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002045 __field(unsigned short, len)
2046 __field(unsigned short, flags)
2047 __field(unsigned short, size)
2048 __field(unsigned int, map_size)
2049 ),
2050 TP_fast_assign(
2051 __entry->dev = log->l_mp->m_super->s_dev;
2052 __entry->blkno = buf_f->blf_blkno;
2053 __entry->len = buf_f->blf_len;
2054 __entry->flags = buf_f->blf_flags;
2055 __entry->size = buf_f->blf_size;
2056 __entry->map_size = buf_f->blf_map_size;
2057 ),
2058 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2059 "map_size %d",
2060 MAJOR(__entry->dev), MINOR(__entry->dev),
2061 __entry->blkno,
2062 __entry->len,
2063 __entry->flags,
2064 __entry->size,
2065 __entry->map_size)
2066)
2067
2068#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2069DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002070 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002071 TP_ARGS(log, buf_f))
2072
2073DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2074DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2075DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2076DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2077DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002078DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002079DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2080DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2081DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2082
2083DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002084 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002085 TP_ARGS(log, in_f),
2086 TP_STRUCT__entry(
2087 __field(dev_t, dev)
2088 __field(xfs_ino_t, ino)
2089 __field(unsigned short, size)
2090 __field(int, fields)
2091 __field(unsigned short, asize)
2092 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002093 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002094 __field(int, len)
2095 __field(int, boffset)
2096 ),
2097 TP_fast_assign(
2098 __entry->dev = log->l_mp->m_super->s_dev;
2099 __entry->ino = in_f->ilf_ino;
2100 __entry->size = in_f->ilf_size;
2101 __entry->fields = in_f->ilf_fields;
2102 __entry->asize = in_f->ilf_asize;
2103 __entry->dsize = in_f->ilf_dsize;
2104 __entry->blkno = in_f->ilf_blkno;
2105 __entry->len = in_f->ilf_len;
2106 __entry->boffset = in_f->ilf_boffset;
2107 ),
2108 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2109 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2110 MAJOR(__entry->dev), MINOR(__entry->dev),
2111 __entry->ino,
2112 __entry->size,
2113 __entry->fields,
2114 __entry->asize,
2115 __entry->dsize,
2116 __entry->blkno,
2117 __entry->len,
2118 __entry->boffset)
2119)
2120#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2121DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002122 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002123 TP_ARGS(log, in_f))
2124
2125DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2126DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2127DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2128
Brian Foster78d57e42015-08-19 09:58:48 +10002129DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2130 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2131 TP_ARGS(log, in_f),
2132 TP_STRUCT__entry(
2133 __field(dev_t, dev)
2134 __field(xfs_agnumber_t, agno)
2135 __field(xfs_agblock_t, agbno)
2136 __field(unsigned int, count)
2137 __field(unsigned int, isize)
2138 __field(xfs_agblock_t, length)
2139 __field(unsigned int, gen)
2140 ),
2141 TP_fast_assign(
2142 __entry->dev = log->l_mp->m_super->s_dev;
2143 __entry->agno = be32_to_cpu(in_f->icl_ag);
2144 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2145 __entry->count = be32_to_cpu(in_f->icl_count);
2146 __entry->isize = be32_to_cpu(in_f->icl_isize);
2147 __entry->length = be32_to_cpu(in_f->icl_length);
2148 __entry->gen = be32_to_cpu(in_f->icl_gen);
2149 ),
2150 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2151 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2152 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2153 __entry->length, __entry->gen)
2154)
2155#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2156DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2157 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2158 TP_ARGS(log, in_f))
2159
2160DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2161DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2162
Christoph Hellwiga46db602011-01-07 13:02:04 +00002163DECLARE_EVENT_CLASS(xfs_discard_class,
2164 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2165 xfs_agblock_t agbno, xfs_extlen_t len),
2166 TP_ARGS(mp, agno, agbno, len),
2167 TP_STRUCT__entry(
2168 __field(dev_t, dev)
2169 __field(xfs_agnumber_t, agno)
2170 __field(xfs_agblock_t, agbno)
2171 __field(xfs_extlen_t, len)
2172 ),
2173 TP_fast_assign(
2174 __entry->dev = mp->m_super->s_dev;
2175 __entry->agno = agno;
2176 __entry->agbno = agbno;
2177 __entry->len = len;
2178 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002179 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002180 MAJOR(__entry->dev), MINOR(__entry->dev),
2181 __entry->agno,
2182 __entry->agbno,
2183 __entry->len)
2184)
2185
2186#define DEFINE_DISCARD_EVENT(name) \
2187DEFINE_EVENT(xfs_discard_class, name, \
2188 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2189 xfs_agblock_t agbno, xfs_extlen_t len), \
2190 TP_ARGS(mp, agno, agbno, len))
2191DEFINE_DISCARD_EVENT(xfs_discard_extent);
2192DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2193DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2194DEFINE_DISCARD_EVENT(xfs_discard_busy);
2195
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002196/* btree cursor events */
Darrick J. Wongc4942132018-12-18 14:32:31 -08002197TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2198TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2199TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2200TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2201TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2202TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2203TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2204
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002205DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2206 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2207 TP_ARGS(cur, level, bp),
2208 TP_STRUCT__entry(
2209 __field(dev_t, dev)
2210 __field(xfs_btnum_t, btnum)
2211 __field(int, level)
2212 __field(int, nlevels)
2213 __field(int, ptr)
2214 __field(xfs_daddr_t, daddr)
2215 ),
2216 TP_fast_assign(
2217 __entry->dev = cur->bc_mp->m_super->s_dev;
2218 __entry->btnum = cur->bc_btnum;
2219 __entry->level = level;
2220 __entry->nlevels = cur->bc_nlevels;
2221 __entry->ptr = cur->bc_ptrs[level];
2222 __entry->daddr = bp ? bp->b_bn : -1;
2223 ),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002224 TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002225 MAJOR(__entry->dev), MINOR(__entry->dev),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002226 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002227 __entry->level,
2228 __entry->nlevels,
2229 __entry->ptr,
2230 (unsigned long long)__entry->daddr)
2231)
2232
2233#define DEFINE_BTREE_CUR_EVENT(name) \
2234DEFINE_EVENT(xfs_btree_cur_class, name, \
2235 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2236 TP_ARGS(cur, level, bp))
2237DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002238DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002239
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002240/* deferred ops */
2241struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002242
2243DECLARE_EVENT_CLASS(xfs_defer_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002244 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2245 TP_ARGS(tp, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002246 TP_STRUCT__entry(
2247 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002248 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002249 __field(char, committed)
Dave Chinnere632a562018-05-09 07:48:52 -07002250 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002251 ),
2252 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002253 __entry->dev = tp->t_mountp->m_super->s_dev;
2254 __entry->tp = tp;
Dave Chinnere632a562018-05-09 07:48:52 -07002255 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002256 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002257 TP_printk("dev %d:%d tp %p caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002258 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002259 __entry->tp,
Dave Chinnere632a562018-05-09 07:48:52 -07002260 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002261)
2262#define DEFINE_DEFER_EVENT(name) \
2263DEFINE_EVENT(xfs_defer_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002264 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2265 TP_ARGS(tp, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002266
2267DECLARE_EVENT_CLASS(xfs_defer_error_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002268 TP_PROTO(struct xfs_trans *tp, int error),
2269 TP_ARGS(tp, error),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002270 TP_STRUCT__entry(
2271 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002272 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002273 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002274 __field(int, error)
2275 ),
2276 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002277 __entry->dev = tp->t_mountp->m_super->s_dev;
2278 __entry->tp = tp;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002279 __entry->error = error;
2280 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002281 TP_printk("dev %d:%d tp %p err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002282 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002283 __entry->tp,
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002284 __entry->error)
2285)
2286#define DEFINE_DEFER_ERROR_EVENT(name) \
2287DEFINE_EVENT(xfs_defer_error_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002288 TP_PROTO(struct xfs_trans *tp, int error), \
2289 TP_ARGS(tp, error))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002290
2291DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2292 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2293 TP_ARGS(mp, dfp),
2294 TP_STRUCT__entry(
2295 __field(dev_t, dev)
2296 __field(int, type)
2297 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002298 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002299 __field(int, nr)
2300 ),
2301 TP_fast_assign(
2302 __entry->dev = mp ? mp->m_super->s_dev : 0;
Darrick J. Wong02b100f2018-12-12 08:46:22 -08002303 __entry->type = dfp->dfp_type;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002304 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002305 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002306 __entry->nr = dfp->dfp_count;
2307 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002308 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002309 MAJOR(__entry->dev), MINOR(__entry->dev),
2310 __entry->type,
2311 __entry->intent,
2312 __entry->committed,
2313 __entry->nr)
2314)
2315#define DEFINE_DEFER_PENDING_EVENT(name) \
2316DEFINE_EVENT(xfs_defer_pending_class, name, \
2317 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2318 TP_ARGS(mp, dfp))
2319
2320DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2321 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2322 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2323 TP_ARGS(mp, agno, type, agbno, len),
2324 TP_STRUCT__entry(
2325 __field(dev_t, dev)
2326 __field(xfs_agnumber_t, agno)
2327 __field(int, type)
2328 __field(xfs_agblock_t, agbno)
2329 __field(xfs_extlen_t, len)
2330 ),
2331 TP_fast_assign(
2332 __entry->dev = mp->m_super->s_dev;
2333 __entry->agno = agno;
2334 __entry->type = type;
2335 __entry->agbno = agbno;
2336 __entry->len = len;
2337 ),
2338 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2339 MAJOR(__entry->dev), MINOR(__entry->dev),
2340 __entry->type,
2341 __entry->agno,
2342 __entry->agbno,
2343 __entry->len)
2344);
2345#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2346DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2347 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2348 int type, \
2349 xfs_agblock_t bno, \
2350 xfs_extlen_t len), \
2351 TP_ARGS(mp, agno, type, bno, len))
2352
2353DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2354 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2355 int op,
2356 xfs_agblock_t agbno,
2357 xfs_ino_t ino,
2358 int whichfork,
2359 xfs_fileoff_t offset,
2360 xfs_filblks_t len,
2361 xfs_exntst_t state),
2362 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2363 TP_STRUCT__entry(
2364 __field(dev_t, dev)
2365 __field(xfs_agnumber_t, agno)
2366 __field(xfs_ino_t, ino)
2367 __field(xfs_agblock_t, agbno)
2368 __field(int, whichfork)
2369 __field(xfs_fileoff_t, l_loff)
2370 __field(xfs_filblks_t, l_len)
2371 __field(xfs_exntst_t, l_state)
2372 __field(int, op)
2373 ),
2374 TP_fast_assign(
2375 __entry->dev = mp->m_super->s_dev;
2376 __entry->agno = agno;
2377 __entry->ino = ino;
2378 __entry->agbno = agbno;
2379 __entry->whichfork = whichfork;
2380 __entry->l_loff = offset;
2381 __entry->l_len = len;
2382 __entry->l_state = state;
2383 __entry->op = op;
2384 ),
2385 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2386 MAJOR(__entry->dev), MINOR(__entry->dev),
2387 __entry->op,
2388 __entry->agno,
2389 __entry->agbno,
2390 __entry->ino,
2391 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2392 __entry->l_loff,
2393 __entry->l_len,
2394 __entry->l_state)
2395);
2396#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2397DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2398 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2399 int op, \
2400 xfs_agblock_t agbno, \
2401 xfs_ino_t ino, \
2402 int whichfork, \
2403 xfs_fileoff_t offset, \
2404 xfs_filblks_t len, \
2405 xfs_exntst_t state), \
2406 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2407
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002408DEFINE_DEFER_EVENT(xfs_defer_cancel);
2409DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2410DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2411DEFINE_DEFER_EVENT(xfs_defer_finish);
2412DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2413
2414DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2415DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002416
Brian Foster1ae093cb2018-08-01 07:20:34 -07002417DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2418DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002419DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2420DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2421
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002422#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2423DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2424DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002425DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2426DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002427
Darrick J. Wong673930c2016-08-03 11:33:43 +10002428/* rmap tracepoints */
2429DECLARE_EVENT_CLASS(xfs_rmap_class,
2430 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2431 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
Darrick J. Wong66e32372018-12-12 08:46:23 -08002432 const struct xfs_owner_info *oinfo),
Darrick J. Wong673930c2016-08-03 11:33:43 +10002433 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2434 TP_STRUCT__entry(
2435 __field(dev_t, dev)
2436 __field(xfs_agnumber_t, agno)
2437 __field(xfs_agblock_t, agbno)
2438 __field(xfs_extlen_t, len)
2439 __field(uint64_t, owner)
2440 __field(uint64_t, offset)
2441 __field(unsigned long, flags)
2442 ),
2443 TP_fast_assign(
2444 __entry->dev = mp->m_super->s_dev;
2445 __entry->agno = agno;
2446 __entry->agbno = agbno;
2447 __entry->len = len;
2448 __entry->owner = oinfo->oi_owner;
2449 __entry->offset = oinfo->oi_offset;
2450 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002451 if (unwritten)
2452 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002453 ),
2454 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2455 MAJOR(__entry->dev), MINOR(__entry->dev),
2456 __entry->agno,
2457 __entry->agbno,
2458 __entry->len,
2459 __entry->owner,
2460 __entry->offset,
2461 __entry->flags)
2462);
2463#define DEFINE_RMAP_EVENT(name) \
2464DEFINE_EVENT(xfs_rmap_class, name, \
2465 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2466 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
Darrick J. Wong66e32372018-12-12 08:46:23 -08002467 const struct xfs_owner_info *oinfo), \
Darrick J. Wong673930c2016-08-03 11:33:43 +10002468 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2469
2470/* simple AG-based error/%ip tracepoint class */
2471DECLARE_EVENT_CLASS(xfs_ag_error_class,
2472 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2473 unsigned long caller_ip),
2474 TP_ARGS(mp, agno, error, caller_ip),
2475 TP_STRUCT__entry(
2476 __field(dev_t, dev)
2477 __field(xfs_agnumber_t, agno)
2478 __field(int, error)
2479 __field(unsigned long, caller_ip)
2480 ),
2481 TP_fast_assign(
2482 __entry->dev = mp->m_super->s_dev;
2483 __entry->agno = agno;
2484 __entry->error = error;
2485 __entry->caller_ip = caller_ip;
2486 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002487 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002488 MAJOR(__entry->dev), MINOR(__entry->dev),
2489 __entry->agno,
2490 __entry->error,
2491 (char *)__entry->caller_ip)
2492);
2493
2494#define DEFINE_AG_ERROR_EVENT(name) \
2495DEFINE_EVENT(xfs_ag_error_class, name, \
2496 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2497 unsigned long caller_ip), \
2498 TP_ARGS(mp, agno, error, caller_ip))
2499
2500DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2501DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2502DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2503DEFINE_RMAP_EVENT(xfs_rmap_map);
2504DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2505DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002506DEFINE_RMAP_EVENT(xfs_rmap_convert);
2507DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2508DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2509DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002510
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002511DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2512 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2513 xfs_agblock_t agbno, xfs_extlen_t len,
2514 uint64_t owner, uint64_t offset, unsigned int flags),
2515 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2516 TP_STRUCT__entry(
2517 __field(dev_t, dev)
2518 __field(xfs_agnumber_t, agno)
2519 __field(xfs_agblock_t, agbno)
2520 __field(xfs_extlen_t, len)
2521 __field(uint64_t, owner)
2522 __field(uint64_t, offset)
2523 __field(unsigned int, flags)
2524 ),
2525 TP_fast_assign(
2526 __entry->dev = mp->m_super->s_dev;
2527 __entry->agno = agno;
2528 __entry->agbno = agbno;
2529 __entry->len = len;
2530 __entry->owner = owner;
2531 __entry->offset = offset;
2532 __entry->flags = flags;
2533 ),
2534 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2535 MAJOR(__entry->dev), MINOR(__entry->dev),
2536 __entry->agno,
2537 __entry->agbno,
2538 __entry->len,
2539 __entry->owner,
2540 __entry->offset,
2541 __entry->flags)
2542);
2543#define DEFINE_RMAPBT_EVENT(name) \
2544DEFINE_EVENT(xfs_rmapbt_class, name, \
2545 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2546 xfs_agblock_t agbno, xfs_extlen_t len, \
2547 uint64_t owner, uint64_t offset, unsigned int flags), \
2548 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2549
2550#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2551DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2552DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2553
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002554DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2555DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002556DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2557DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2558DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2559DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2560DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2561DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002562
2563DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2564DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2565DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2566DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002567DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2568DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002569DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002570
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002571/* deferred bmbt updates */
2572#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2573DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2574DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2575
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002576/* per-AG reservation */
2577DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2578 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2579 xfs_extlen_t len),
2580 TP_ARGS(pag, resv, len),
2581 TP_STRUCT__entry(
2582 __field(dev_t, dev)
2583 __field(xfs_agnumber_t, agno)
2584 __field(int, resv)
2585 __field(xfs_extlen_t, freeblks)
2586 __field(xfs_extlen_t, flcount)
2587 __field(xfs_extlen_t, reserved)
2588 __field(xfs_extlen_t, asked)
2589 __field(xfs_extlen_t, len)
2590 ),
2591 TP_fast_assign(
2592 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2593
2594 __entry->dev = pag->pag_mount->m_super->s_dev;
2595 __entry->agno = pag->pag_agno;
2596 __entry->resv = resv;
2597 __entry->freeblks = pag->pagf_freeblks;
2598 __entry->flcount = pag->pagf_flcount;
2599 __entry->reserved = r ? r->ar_reserved : 0;
2600 __entry->asked = r ? r->ar_asked : 0;
2601 __entry->len = len;
2602 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002603 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2604 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002605 MAJOR(__entry->dev), MINOR(__entry->dev),
2606 __entry->agno,
2607 __entry->resv,
2608 __entry->freeblks,
2609 __entry->flcount,
2610 __entry->reserved,
2611 __entry->asked,
2612 __entry->len)
2613)
2614#define DEFINE_AG_RESV_EVENT(name) \
2615DEFINE_EVENT(xfs_ag_resv_class, name, \
2616 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2617 xfs_extlen_t len), \
2618 TP_ARGS(pag, type, len))
2619
2620/* per-AG reservation tracepoints */
2621DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2622DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2623DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2624DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2625DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2626DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2627
2628DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2629DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2630
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002631/* refcount tracepoint classes */
2632
2633/* reuse the discard trace class for agbno/aglen-based traces */
2634#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2635
2636/* ag btree lookup tracepoint class */
Darrick J. Wong85f8dff2018-12-18 14:32:29 -08002637TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2638TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2639TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002640DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2641 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2642 xfs_agblock_t agbno, xfs_lookup_t dir),
2643 TP_ARGS(mp, agno, agbno, dir),
2644 TP_STRUCT__entry(
2645 __field(dev_t, dev)
2646 __field(xfs_agnumber_t, agno)
2647 __field(xfs_agblock_t, agbno)
2648 __field(xfs_lookup_t, dir)
2649 ),
2650 TP_fast_assign(
2651 __entry->dev = mp->m_super->s_dev;
2652 __entry->agno = agno;
2653 __entry->agbno = agbno;
2654 __entry->dir = dir;
2655 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002656 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002657 MAJOR(__entry->dev), MINOR(__entry->dev),
2658 __entry->agno,
2659 __entry->agbno,
2660 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2661 __entry->dir)
2662)
2663
2664#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2665DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2666 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2667 xfs_agblock_t agbno, xfs_lookup_t dir), \
2668 TP_ARGS(mp, agno, agbno, dir))
2669
2670/* single-rcext tracepoint class */
2671DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2672 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2673 struct xfs_refcount_irec *irec),
2674 TP_ARGS(mp, agno, irec),
2675 TP_STRUCT__entry(
2676 __field(dev_t, dev)
2677 __field(xfs_agnumber_t, agno)
2678 __field(xfs_agblock_t, startblock)
2679 __field(xfs_extlen_t, blockcount)
2680 __field(xfs_nlink_t, refcount)
2681 ),
2682 TP_fast_assign(
2683 __entry->dev = mp->m_super->s_dev;
2684 __entry->agno = agno;
2685 __entry->startblock = irec->rc_startblock;
2686 __entry->blockcount = irec->rc_blockcount;
2687 __entry->refcount = irec->rc_refcount;
2688 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002689 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002690 MAJOR(__entry->dev), MINOR(__entry->dev),
2691 __entry->agno,
2692 __entry->startblock,
2693 __entry->blockcount,
2694 __entry->refcount)
2695)
2696
2697#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2698DEFINE_EVENT(xfs_refcount_extent_class, name, \
2699 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2700 struct xfs_refcount_irec *irec), \
2701 TP_ARGS(mp, agno, irec))
2702
2703/* single-rcext and an agbno tracepoint class */
2704DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2705 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2706 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2707 TP_ARGS(mp, agno, irec, agbno),
2708 TP_STRUCT__entry(
2709 __field(dev_t, dev)
2710 __field(xfs_agnumber_t, agno)
2711 __field(xfs_agblock_t, startblock)
2712 __field(xfs_extlen_t, blockcount)
2713 __field(xfs_nlink_t, refcount)
2714 __field(xfs_agblock_t, agbno)
2715 ),
2716 TP_fast_assign(
2717 __entry->dev = mp->m_super->s_dev;
2718 __entry->agno = agno;
2719 __entry->startblock = irec->rc_startblock;
2720 __entry->blockcount = irec->rc_blockcount;
2721 __entry->refcount = irec->rc_refcount;
2722 __entry->agbno = agbno;
2723 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002724 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002725 MAJOR(__entry->dev), MINOR(__entry->dev),
2726 __entry->agno,
2727 __entry->startblock,
2728 __entry->blockcount,
2729 __entry->refcount,
2730 __entry->agbno)
2731)
2732
2733#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2734DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2735 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2736 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2737 TP_ARGS(mp, agno, irec, agbno))
2738
2739/* double-rcext tracepoint class */
2740DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2741 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2742 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2743 TP_ARGS(mp, agno, i1, i2),
2744 TP_STRUCT__entry(
2745 __field(dev_t, dev)
2746 __field(xfs_agnumber_t, agno)
2747 __field(xfs_agblock_t, i1_startblock)
2748 __field(xfs_extlen_t, i1_blockcount)
2749 __field(xfs_nlink_t, i1_refcount)
2750 __field(xfs_agblock_t, i2_startblock)
2751 __field(xfs_extlen_t, i2_blockcount)
2752 __field(xfs_nlink_t, i2_refcount)
2753 ),
2754 TP_fast_assign(
2755 __entry->dev = mp->m_super->s_dev;
2756 __entry->agno = agno;
2757 __entry->i1_startblock = i1->rc_startblock;
2758 __entry->i1_blockcount = i1->rc_blockcount;
2759 __entry->i1_refcount = i1->rc_refcount;
2760 __entry->i2_startblock = i2->rc_startblock;
2761 __entry->i2_blockcount = i2->rc_blockcount;
2762 __entry->i2_refcount = i2->rc_refcount;
2763 ),
2764 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002765 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002766 MAJOR(__entry->dev), MINOR(__entry->dev),
2767 __entry->agno,
2768 __entry->i1_startblock,
2769 __entry->i1_blockcount,
2770 __entry->i1_refcount,
2771 __entry->i2_startblock,
2772 __entry->i2_blockcount,
2773 __entry->i2_refcount)
2774)
2775
2776#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2777DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2778 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2779 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2780 TP_ARGS(mp, agno, i1, i2))
2781
2782/* double-rcext and an agbno tracepoint class */
2783DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2784 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2785 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2786 xfs_agblock_t agbno),
2787 TP_ARGS(mp, agno, i1, i2, agbno),
2788 TP_STRUCT__entry(
2789 __field(dev_t, dev)
2790 __field(xfs_agnumber_t, agno)
2791 __field(xfs_agblock_t, i1_startblock)
2792 __field(xfs_extlen_t, i1_blockcount)
2793 __field(xfs_nlink_t, i1_refcount)
2794 __field(xfs_agblock_t, i2_startblock)
2795 __field(xfs_extlen_t, i2_blockcount)
2796 __field(xfs_nlink_t, i2_refcount)
2797 __field(xfs_agblock_t, agbno)
2798 ),
2799 TP_fast_assign(
2800 __entry->dev = mp->m_super->s_dev;
2801 __entry->agno = agno;
2802 __entry->i1_startblock = i1->rc_startblock;
2803 __entry->i1_blockcount = i1->rc_blockcount;
2804 __entry->i1_refcount = i1->rc_refcount;
2805 __entry->i2_startblock = i2->rc_startblock;
2806 __entry->i2_blockcount = i2->rc_blockcount;
2807 __entry->i2_refcount = i2->rc_refcount;
2808 __entry->agbno = agbno;
2809 ),
2810 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002811 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002812 MAJOR(__entry->dev), MINOR(__entry->dev),
2813 __entry->agno,
2814 __entry->i1_startblock,
2815 __entry->i1_blockcount,
2816 __entry->i1_refcount,
2817 __entry->i2_startblock,
2818 __entry->i2_blockcount,
2819 __entry->i2_refcount,
2820 __entry->agbno)
2821)
2822
2823#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2824DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2825 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2826 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2827 xfs_agblock_t agbno), \
2828 TP_ARGS(mp, agno, i1, i2, agbno))
2829
2830/* triple-rcext tracepoint class */
2831DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2832 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2833 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2834 struct xfs_refcount_irec *i3),
2835 TP_ARGS(mp, agno, i1, i2, i3),
2836 TP_STRUCT__entry(
2837 __field(dev_t, dev)
2838 __field(xfs_agnumber_t, agno)
2839 __field(xfs_agblock_t, i1_startblock)
2840 __field(xfs_extlen_t, i1_blockcount)
2841 __field(xfs_nlink_t, i1_refcount)
2842 __field(xfs_agblock_t, i2_startblock)
2843 __field(xfs_extlen_t, i2_blockcount)
2844 __field(xfs_nlink_t, i2_refcount)
2845 __field(xfs_agblock_t, i3_startblock)
2846 __field(xfs_extlen_t, i3_blockcount)
2847 __field(xfs_nlink_t, i3_refcount)
2848 ),
2849 TP_fast_assign(
2850 __entry->dev = mp->m_super->s_dev;
2851 __entry->agno = agno;
2852 __entry->i1_startblock = i1->rc_startblock;
2853 __entry->i1_blockcount = i1->rc_blockcount;
2854 __entry->i1_refcount = i1->rc_refcount;
2855 __entry->i2_startblock = i2->rc_startblock;
2856 __entry->i2_blockcount = i2->rc_blockcount;
2857 __entry->i2_refcount = i2->rc_refcount;
2858 __entry->i3_startblock = i3->rc_startblock;
2859 __entry->i3_blockcount = i3->rc_blockcount;
2860 __entry->i3_refcount = i3->rc_refcount;
2861 ),
2862 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2863 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002864 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002865 MAJOR(__entry->dev), MINOR(__entry->dev),
2866 __entry->agno,
2867 __entry->i1_startblock,
2868 __entry->i1_blockcount,
2869 __entry->i1_refcount,
2870 __entry->i2_startblock,
2871 __entry->i2_blockcount,
2872 __entry->i2_refcount,
2873 __entry->i3_startblock,
2874 __entry->i3_blockcount,
2875 __entry->i3_refcount)
2876);
2877
2878#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2879DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2880 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2881 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2882 struct xfs_refcount_irec *i3), \
2883 TP_ARGS(mp, agno, i1, i2, i3))
2884
2885/* refcount btree tracepoints */
2886DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2887DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2888DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2889DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2890DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2891DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2892DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2893DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2894DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2895DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2896
2897/* refcount adjustment tracepoints */
2898DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2899DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002900DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2901DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002902DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2903DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002904DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002905DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2906DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2907DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2908DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2909DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2910DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002911DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002912DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2913DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2914DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2915DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2916DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2917DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2918DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2919
2920/* reflink helpers */
2921DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2922DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2923DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002924#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2925DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2926DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002927
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002928TRACE_EVENT(xfs_refcount_finish_one_leftover,
2929 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2930 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2931 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2932 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2933 TP_STRUCT__entry(
2934 __field(dev_t, dev)
2935 __field(xfs_agnumber_t, agno)
2936 __field(int, type)
2937 __field(xfs_agblock_t, agbno)
2938 __field(xfs_extlen_t, len)
2939 __field(xfs_agblock_t, new_agbno)
2940 __field(xfs_extlen_t, new_len)
2941 ),
2942 TP_fast_assign(
2943 __entry->dev = mp->m_super->s_dev;
2944 __entry->agno = agno;
2945 __entry->type = type;
2946 __entry->agbno = agbno;
2947 __entry->len = len;
2948 __entry->new_agbno = new_agbno;
2949 __entry->new_len = new_len;
2950 ),
2951 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2952 MAJOR(__entry->dev), MINOR(__entry->dev),
2953 __entry->type,
2954 __entry->agno,
2955 __entry->agbno,
2956 __entry->len,
2957 __entry->new_agbno,
2958 __entry->new_len)
2959);
2960
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002961/* simple inode-based error/%ip tracepoint class */
2962DECLARE_EVENT_CLASS(xfs_inode_error_class,
2963 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2964 TP_ARGS(ip, error, caller_ip),
2965 TP_STRUCT__entry(
2966 __field(dev_t, dev)
2967 __field(xfs_ino_t, ino)
2968 __field(int, error)
2969 __field(unsigned long, caller_ip)
2970 ),
2971 TP_fast_assign(
2972 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2973 __entry->ino = ip->i_ino;
2974 __entry->error = error;
2975 __entry->caller_ip = caller_ip;
2976 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002977 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002978 MAJOR(__entry->dev), MINOR(__entry->dev),
2979 __entry->ino,
2980 __entry->error,
2981 (char *)__entry->caller_ip)
2982);
2983
2984#define DEFINE_INODE_ERROR_EVENT(name) \
2985DEFINE_EVENT(xfs_inode_error_class, name, \
2986 TP_PROTO(struct xfs_inode *ip, int error, \
2987 unsigned long caller_ip), \
2988 TP_ARGS(ip, error, caller_ip))
2989
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002990/* reflink tracepoint classes */
2991
2992/* two-file io tracepoint class */
2993DECLARE_EVENT_CLASS(xfs_double_io_class,
2994 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2995 struct xfs_inode *dest, xfs_off_t doffset),
2996 TP_ARGS(src, soffset, len, dest, doffset),
2997 TP_STRUCT__entry(
2998 __field(dev_t, dev)
2999 __field(xfs_ino_t, src_ino)
3000 __field(loff_t, src_isize)
3001 __field(loff_t, src_disize)
3002 __field(loff_t, src_offset)
3003 __field(size_t, len)
3004 __field(xfs_ino_t, dest_ino)
3005 __field(loff_t, dest_isize)
3006 __field(loff_t, dest_disize)
3007 __field(loff_t, dest_offset)
3008 ),
3009 TP_fast_assign(
3010 __entry->dev = VFS_I(src)->i_sb->s_dev;
3011 __entry->src_ino = src->i_ino;
3012 __entry->src_isize = VFS_I(src)->i_size;
3013 __entry->src_disize = src->i_d.di_size;
3014 __entry->src_offset = soffset;
3015 __entry->len = len;
3016 __entry->dest_ino = dest->i_ino;
3017 __entry->dest_isize = VFS_I(dest)->i_size;
3018 __entry->dest_disize = dest->i_d.di_size;
3019 __entry->dest_offset = doffset;
3020 ),
3021 TP_printk("dev %d:%d count %zd "
3022 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3023 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3024 MAJOR(__entry->dev), MINOR(__entry->dev),
3025 __entry->len,
3026 __entry->src_ino,
3027 __entry->src_isize,
3028 __entry->src_disize,
3029 __entry->src_offset,
3030 __entry->dest_ino,
3031 __entry->dest_isize,
3032 __entry->dest_disize,
3033 __entry->dest_offset)
3034)
3035
3036#define DEFINE_DOUBLE_IO_EVENT(name) \
3037DEFINE_EVENT(xfs_double_io_class, name, \
3038 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3039 struct xfs_inode *dest, xfs_off_t doffset), \
3040 TP_ARGS(src, soffset, len, dest, doffset))
3041
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003042/* inode/irec events */
3043DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3044 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3045 TP_ARGS(ip, irec),
3046 TP_STRUCT__entry(
3047 __field(dev_t, dev)
3048 __field(xfs_ino_t, ino)
3049 __field(xfs_fileoff_t, lblk)
3050 __field(xfs_extlen_t, len)
3051 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003052 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003053 ),
3054 TP_fast_assign(
3055 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3056 __entry->ino = ip->i_ino;
3057 __entry->lblk = irec->br_startoff;
3058 __entry->len = irec->br_blockcount;
3059 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003060 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003061 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003062 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu st %d",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003063 MAJOR(__entry->dev), MINOR(__entry->dev),
3064 __entry->ino,
3065 __entry->lblk,
3066 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003067 __entry->pblk,
3068 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003069);
3070#define DEFINE_INODE_IREC_EVENT(name) \
3071DEFINE_EVENT(xfs_inode_irec_class, name, \
3072 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3073 TP_ARGS(ip, irec))
3074
3075/* refcount/reflink tracepoint definitions */
3076
3077/* reflink tracepoints */
3078DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3079DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3080DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3081DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3082TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3083 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3084 xfs_filblks_t len, struct xfs_inode *dest,
3085 xfs_fileoff_t doffset),
3086 TP_ARGS(src, soffset, len, dest, doffset),
3087 TP_STRUCT__entry(
3088 __field(dev_t, dev)
3089 __field(xfs_ino_t, src_ino)
3090 __field(xfs_fileoff_t, src_lblk)
3091 __field(xfs_filblks_t, len)
3092 __field(xfs_ino_t, dest_ino)
3093 __field(xfs_fileoff_t, dest_lblk)
3094 ),
3095 TP_fast_assign(
3096 __entry->dev = VFS_I(src)->i_sb->s_dev;
3097 __entry->src_ino = src->i_ino;
3098 __entry->src_lblk = soffset;
3099 __entry->len = len;
3100 __entry->dest_ino = dest->i_ino;
3101 __entry->dest_lblk = doffset;
3102 ),
3103 TP_printk("dev %d:%d len 0x%llx "
3104 "ino 0x%llx offset 0x%llx blocks -> "
3105 "ino 0x%llx offset 0x%llx blocks",
3106 MAJOR(__entry->dev), MINOR(__entry->dev),
3107 __entry->len,
3108 __entry->src_ino,
3109 __entry->src_lblk,
3110 __entry->dest_ino,
3111 __entry->dest_lblk)
3112);
3113TRACE_EVENT(xfs_reflink_punch_range,
3114 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3115 xfs_extlen_t len),
3116 TP_ARGS(ip, lblk, len),
3117 TP_STRUCT__entry(
3118 __field(dev_t, dev)
3119 __field(xfs_ino_t, ino)
3120 __field(xfs_fileoff_t, lblk)
3121 __field(xfs_extlen_t, len)
3122 ),
3123 TP_fast_assign(
3124 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3125 __entry->ino = ip->i_ino;
3126 __entry->lblk = lblk;
3127 __entry->len = len;
3128 ),
3129 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3130 MAJOR(__entry->dev), MINOR(__entry->dev),
3131 __entry->ino,
3132 __entry->lblk,
3133 __entry->len)
3134);
3135TRACE_EVENT(xfs_reflink_remap,
3136 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3137 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3138 TP_ARGS(ip, lblk, len, new_pblk),
3139 TP_STRUCT__entry(
3140 __field(dev_t, dev)
3141 __field(xfs_ino_t, ino)
3142 __field(xfs_fileoff_t, lblk)
3143 __field(xfs_extlen_t, len)
3144 __field(xfs_fsblock_t, new_pblk)
3145 ),
3146 TP_fast_assign(
3147 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3148 __entry->ino = ip->i_ino;
3149 __entry->lblk = lblk;
3150 __entry->len = len;
3151 __entry->new_pblk = new_pblk;
3152 ),
3153 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3154 MAJOR(__entry->dev), MINOR(__entry->dev),
3155 __entry->ino,
3156 __entry->lblk,
3157 __entry->len,
3158 __entry->new_pblk)
3159);
3160DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3161DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3162DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3163DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003164DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3165DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3166
3167/* dedupe tracepoints */
3168DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3169DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3170
3171/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003172TRACE_EVENT(xfs_ioctl_clone,
3173 TP_PROTO(struct inode *src, struct inode *dest),
3174 TP_ARGS(src, dest),
3175 TP_STRUCT__entry(
3176 __field(dev_t, dev)
3177 __field(unsigned long, src_ino)
3178 __field(loff_t, src_isize)
3179 __field(unsigned long, dest_ino)
3180 __field(loff_t, dest_isize)
3181 ),
3182 TP_fast_assign(
3183 __entry->dev = src->i_sb->s_dev;
3184 __entry->src_ino = src->i_ino;
3185 __entry->src_isize = i_size_read(src);
3186 __entry->dest_ino = dest->i_ino;
3187 __entry->dest_isize = i_size_read(dest);
3188 ),
3189 TP_printk("dev %d:%d "
3190 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003191 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003192 MAJOR(__entry->dev), MINOR(__entry->dev),
3193 __entry->src_ino,
3194 __entry->src_isize,
3195 __entry->dest_ino,
3196 __entry->dest_isize)
3197);
3198
3199/* unshare tracepoints */
3200DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003201DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003202
3203/* copy on write */
3204DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003205DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3206DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3207DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003208DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003209
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003210DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003211
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003212DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003213
3214DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3215DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3216DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003217
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003218DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3219DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3220
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003221
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003222DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003223
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003224/* rmap swapext tracepoints */
3225DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3226DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3227DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3228
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003229/* fsmap traces */
3230DECLARE_EVENT_CLASS(xfs_fsmap_class,
3231 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3232 struct xfs_rmap_irec *rmap),
3233 TP_ARGS(mp, keydev, agno, rmap),
3234 TP_STRUCT__entry(
3235 __field(dev_t, dev)
3236 __field(dev_t, keydev)
3237 __field(xfs_agnumber_t, agno)
3238 __field(xfs_fsblock_t, bno)
3239 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003240 __field(uint64_t, owner)
3241 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003242 __field(unsigned int, flags)
3243 ),
3244 TP_fast_assign(
3245 __entry->dev = mp->m_super->s_dev;
3246 __entry->keydev = new_decode_dev(keydev);
3247 __entry->agno = agno;
3248 __entry->bno = rmap->rm_startblock;
3249 __entry->len = rmap->rm_blockcount;
3250 __entry->owner = rmap->rm_owner;
3251 __entry->offset = rmap->rm_offset;
3252 __entry->flags = rmap->rm_flags;
3253 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003254 TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld offset %llu flags 0x%x",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003255 MAJOR(__entry->dev), MINOR(__entry->dev),
3256 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3257 __entry->agno,
3258 __entry->bno,
3259 __entry->len,
3260 __entry->owner,
3261 __entry->offset,
3262 __entry->flags)
3263)
3264#define DEFINE_FSMAP_EVENT(name) \
3265DEFINE_EVENT(xfs_fsmap_class, name, \
3266 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3267 struct xfs_rmap_irec *rmap), \
3268 TP_ARGS(mp, keydev, agno, rmap))
3269DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3270DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3271DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3272
3273DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3274 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3275 TP_ARGS(mp, fsmap),
3276 TP_STRUCT__entry(
3277 __field(dev_t, dev)
3278 __field(dev_t, keydev)
3279 __field(xfs_daddr_t, block)
3280 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003281 __field(uint64_t, owner)
3282 __field(uint64_t, offset)
3283 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003284 ),
3285 TP_fast_assign(
3286 __entry->dev = mp->m_super->s_dev;
3287 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3288 __entry->block = fsmap->fmr_physical;
3289 __entry->len = fsmap->fmr_length;
3290 __entry->owner = fsmap->fmr_owner;
3291 __entry->offset = fsmap->fmr_offset;
3292 __entry->flags = fsmap->fmr_flags;
3293 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003294 TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld offset %llu flags 0x%llx",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003295 MAJOR(__entry->dev), MINOR(__entry->dev),
3296 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3297 __entry->block,
3298 __entry->len,
3299 __entry->owner,
3300 __entry->offset,
3301 __entry->flags)
3302)
3303#define DEFINE_GETFSMAP_EVENT(name) \
3304DEFINE_EVENT(xfs_getfsmap_class, name, \
3305 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3306 TP_ARGS(mp, fsmap))
3307DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3308DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3309DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3310
Darrick J. Wongb872af22018-01-08 10:51:26 -08003311TRACE_EVENT(xfs_trans_resv_calc,
3312 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3313 struct xfs_trans_res *res),
3314 TP_ARGS(mp, type, res),
3315 TP_STRUCT__entry(
3316 __field(dev_t, dev)
3317 __field(int, type)
3318 __field(uint, logres)
3319 __field(int, logcount)
3320 __field(int, logflags)
3321 ),
3322 TP_fast_assign(
3323 __entry->dev = mp->m_super->s_dev;
3324 __entry->type = type;
3325 __entry->logres = res->tr_logres;
3326 __entry->logcount = res->tr_logcount;
3327 __entry->logflags = res->tr_logflags;
3328 ),
3329 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3330 MAJOR(__entry->dev), MINOR(__entry->dev),
3331 __entry->type,
3332 __entry->logres,
3333 __entry->logcount,
3334 __entry->logflags)
3335);
3336
Dave Chinnerba187812018-05-09 07:47:57 -07003337DECLARE_EVENT_CLASS(xfs_trans_class,
3338 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3339 TP_ARGS(tp, caller_ip),
3340 TP_STRUCT__entry(
3341 __field(dev_t, dev)
3342 __field(uint32_t, tid)
3343 __field(uint32_t, flags)
3344 __field(unsigned long, caller_ip)
3345 ),
3346 TP_fast_assign(
3347 __entry->dev = tp->t_mountp->m_super->s_dev;
3348 __entry->tid = 0;
3349 if (tp->t_ticket)
3350 __entry->tid = tp->t_ticket->t_tid;
3351 __entry->flags = tp->t_flags;
3352 __entry->caller_ip = caller_ip;
3353 ),
3354 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3355 MAJOR(__entry->dev), MINOR(__entry->dev),
3356 __entry->tid,
3357 __entry->flags,
3358 (char *)__entry->caller_ip)
3359)
3360
3361#define DEFINE_TRANS_EVENT(name) \
3362DEFINE_EVENT(xfs_trans_class, name, \
3363 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3364 TP_ARGS(tp, caller_ip))
3365DEFINE_TRANS_EVENT(xfs_trans_alloc);
3366DEFINE_TRANS_EVENT(xfs_trans_cancel);
3367DEFINE_TRANS_EVENT(xfs_trans_commit);
3368DEFINE_TRANS_EVENT(xfs_trans_dup);
3369DEFINE_TRANS_EVENT(xfs_trans_free);
3370DEFINE_TRANS_EVENT(xfs_trans_roll);
3371DEFINE_TRANS_EVENT(xfs_trans_add_item);
3372DEFINE_TRANS_EVENT(xfs_trans_free_items);
3373
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003374#endif /* _TRACE_XFS_H */
3375
3376#undef TRACE_INCLUDE_PATH
3377#define TRACE_INCLUDE_PATH .
3378#define TRACE_INCLUDE_FILE xfs_trace
3379#include <trace/define_trace.h>