blob: 3043e5ed6495580de11de6932117addca0e85aec [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. Wongaff68a52018-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. Wongaff68a52018-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;
283 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000284 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000285 __entry->hold = atomic_read(&bp->b_hold);
286 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200287 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000288 __entry->flags = bp->b_flags;
289 __entry->caller_ip = caller_ip;
290 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000291 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Darrick J. Wongaff68a52018-01-09 11:46:05 -0800292 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000293 MAJOR(__entry->dev), MINOR(__entry->dev),
294 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000295 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000296 __entry->hold,
297 __entry->pincount,
298 __entry->lockval,
299 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
300 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000301)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000302
303#define DEFINE_BUF_EVENT(name) \
304DEFINE_EVENT(xfs_buf_class, name, \
305 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
306 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000307DEFINE_BUF_EVENT(xfs_buf_init);
308DEFINE_BUF_EVENT(xfs_buf_free);
309DEFINE_BUF_EVENT(xfs_buf_hold);
310DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000311DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000312DEFINE_BUF_EVENT(xfs_buf_submit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000313DEFINE_BUF_EVENT(xfs_buf_lock);
314DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000315DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200316DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000317DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000318DEFINE_BUF_EVENT(xfs_buf_iowait);
319DEFINE_BUF_EVENT(xfs_buf_iowait_done);
320DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000321DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000322DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700323DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000324DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000325DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000326DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
327DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100328DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000329DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
330
331/* not really buffer traces, but the buf provides useful information */
332DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000333DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000334
335/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000336DECLARE_EVENT_CLASS(xfs_buf_flags_class,
337 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
338 TP_ARGS(bp, flags, caller_ip),
339 TP_STRUCT__entry(
340 __field(dev_t, dev)
341 __field(xfs_daddr_t, bno)
342 __field(size_t, buffer_length)
343 __field(int, hold)
344 __field(int, pincount)
345 __field(unsigned, lockval)
346 __field(unsigned, flags)
347 __field(unsigned long, caller_ip)
348 ),
349 TP_fast_assign(
350 __entry->dev = bp->b_target->bt_dev;
351 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000352 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000353 __entry->flags = flags;
354 __entry->hold = atomic_read(&bp->b_hold);
355 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200356 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000357 __entry->caller_ip = caller_ip;
358 ),
359 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a52018-01-09 11:46:05 -0800360 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000361 MAJOR(__entry->dev), MINOR(__entry->dev),
362 (unsigned long long)__entry->bno,
363 __entry->buffer_length,
364 __entry->hold,
365 __entry->pincount,
366 __entry->lockval,
367 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
368 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000369)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000370
371#define DEFINE_BUF_FLAGS_EVENT(name) \
372DEFINE_EVENT(xfs_buf_flags_class, name, \
373 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
374 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000375DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
376DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
377DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
378
379TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800380 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000381 TP_ARGS(bp, error, caller_ip),
382 TP_STRUCT__entry(
383 __field(dev_t, dev)
384 __field(xfs_daddr_t, bno)
385 __field(size_t, buffer_length)
386 __field(unsigned, flags)
387 __field(int, hold)
388 __field(int, pincount)
389 __field(unsigned, lockval)
390 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800391 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000392 ),
393 TP_fast_assign(
394 __entry->dev = bp->b_target->bt_dev;
395 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000396 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000397 __entry->hold = atomic_read(&bp->b_hold);
398 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200399 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000400 __entry->error = error;
401 __entry->flags = bp->b_flags;
402 __entry->caller_ip = caller_ip;
403 ),
404 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800405 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000406 MAJOR(__entry->dev), MINOR(__entry->dev),
407 (unsigned long long)__entry->bno,
408 __entry->buffer_length,
409 __entry->hold,
410 __entry->pincount,
411 __entry->lockval,
412 __entry->error,
413 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
414 (void *)__entry->caller_ip)
415);
416
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000417DECLARE_EVENT_CLASS(xfs_buf_item_class,
418 TP_PROTO(struct xfs_buf_log_item *bip),
419 TP_ARGS(bip),
420 TP_STRUCT__entry(
421 __field(dev_t, dev)
422 __field(xfs_daddr_t, buf_bno)
423 __field(size_t, buf_len)
424 __field(int, buf_hold)
425 __field(int, buf_pincount)
426 __field(int, buf_lockval)
427 __field(unsigned, buf_flags)
428 __field(unsigned, bli_recur)
429 __field(int, bli_refcount)
430 __field(unsigned, bli_flags)
Dave Chinner22525c12018-05-09 07:47:34 -0700431 __field(unsigned long, li_flags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000432 ),
433 TP_fast_assign(
434 __entry->dev = bip->bli_buf->b_target->bt_dev;
435 __entry->bli_flags = bip->bli_flags;
436 __entry->bli_recur = bip->bli_recur;
437 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
438 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000439 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000440 __entry->buf_flags = bip->bli_buf->b_flags;
441 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
442 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200443 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000444 __entry->li_flags = bip->bli_item.li_flags;
445 ),
446 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
447 "lock %d flags %s recur %d refcount %d bliflags %s "
Dave Chinnere6631f82018-05-09 07:49:37 -0700448 "liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000449 MAJOR(__entry->dev), MINOR(__entry->dev),
450 (unsigned long long)__entry->buf_bno,
451 __entry->buf_len,
452 __entry->buf_hold,
453 __entry->buf_pincount,
454 __entry->buf_lockval,
455 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
456 __entry->bli_recur,
457 __entry->bli_refcount,
458 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000459 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000460)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000461
462#define DEFINE_BUF_ITEM_EVENT(name) \
463DEFINE_EVENT(xfs_buf_item_class, name, \
464 TP_PROTO(struct xfs_buf_log_item *bip), \
465 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000466DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000467DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000468DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
469DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
470DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000471DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000472DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
473DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
474DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000475DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000476DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
477DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
478DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
479DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
480DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
481DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
482DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
483DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
484DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
485DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
486DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
487DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
488DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
489DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
490
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000491DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700492 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
493 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000494 TP_STRUCT__entry(
495 __field(dev_t, dev)
496 __field(xfs_ino_t, ino)
497 __field(xfs_agnumber_t, agno)
498 __field(int, streams)
499 ),
500 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700501 __entry->dev = mp->m_super->s_dev;
502 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000503 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700504 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000505 ),
506 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
507 MAJOR(__entry->dev), MINOR(__entry->dev),
508 __entry->ino,
509 __entry->agno,
510 __entry->streams)
511)
512#define DEFINE_FILESTREAM_EVENT(name) \
513DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700514 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
515 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000516DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
517DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
518DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
519
520TRACE_EVENT(xfs_filestream_pick,
521 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
522 xfs_extlen_t free, int nscan),
523 TP_ARGS(ip, agno, free, nscan),
524 TP_STRUCT__entry(
525 __field(dev_t, dev)
526 __field(xfs_ino_t, ino)
527 __field(xfs_agnumber_t, agno)
528 __field(int, streams)
529 __field(xfs_extlen_t, free)
530 __field(int, nscan)
531 ),
532 TP_fast_assign(
533 __entry->dev = VFS_I(ip)->i_sb->s_dev;
534 __entry->ino = ip->i_ino;
535 __entry->agno = agno;
536 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
537 __entry->free = free;
538 __entry->nscan = nscan;
539 ),
540 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
541 MAJOR(__entry->dev), MINOR(__entry->dev),
542 __entry->ino,
543 __entry->agno,
544 __entry->streams,
545 __entry->free,
546 __entry->nscan)
547);
548
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000549DECLARE_EVENT_CLASS(xfs_lock_class,
550 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
551 unsigned long caller_ip),
552 TP_ARGS(ip, lock_flags, caller_ip),
553 TP_STRUCT__entry(
554 __field(dev_t, dev)
555 __field(xfs_ino_t, ino)
556 __field(int, lock_flags)
557 __field(unsigned long, caller_ip)
558 ),
559 TP_fast_assign(
560 __entry->dev = VFS_I(ip)->i_sb->s_dev;
561 __entry->ino = ip->i_ino;
562 __entry->lock_flags = lock_flags;
563 __entry->caller_ip = caller_ip;
564 ),
Darrick J. Wongaff68a52018-01-09 11:46:05 -0800565 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000566 MAJOR(__entry->dev), MINOR(__entry->dev),
567 __entry->ino,
568 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
569 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000570)
571
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000572#define DEFINE_LOCK_EVENT(name) \
573DEFINE_EVENT(xfs_lock_class, name, \
574 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
575 unsigned long caller_ip), \
576 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000577DEFINE_LOCK_EVENT(xfs_ilock);
578DEFINE_LOCK_EVENT(xfs_ilock_nowait);
579DEFINE_LOCK_EVENT(xfs_ilock_demote);
580DEFINE_LOCK_EVENT(xfs_iunlock);
581
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000582DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000583 TP_PROTO(struct xfs_inode *ip),
584 TP_ARGS(ip),
585 TP_STRUCT__entry(
586 __field(dev_t, dev)
587 __field(xfs_ino_t, ino)
588 ),
589 TP_fast_assign(
590 __entry->dev = VFS_I(ip)->i_sb->s_dev;
591 __entry->ino = ip->i_ino;
592 ),
593 TP_printk("dev %d:%d ino 0x%llx",
594 MAJOR(__entry->dev), MINOR(__entry->dev),
595 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000596)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000597
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000598#define DEFINE_INODE_EVENT(name) \
599DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000600 TP_PROTO(struct xfs_inode *ip), \
601 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000602DEFINE_INODE_EVENT(xfs_iget_skip);
603DEFINE_INODE_EVENT(xfs_iget_reclaim);
604DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
605DEFINE_INODE_EVENT(xfs_iget_hit);
606DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000607
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000608DEFINE_INODE_EVENT(xfs_getattr);
609DEFINE_INODE_EVENT(xfs_setattr);
610DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500611DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000612DEFINE_INODE_EVENT(xfs_alloc_file_space);
613DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000614DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100615DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100616DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000617DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000618#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200619DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000620#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000621DEFINE_INODE_EVENT(xfs_vm_bmap);
622DEFINE_INODE_EVENT(xfs_file_ioctl);
623DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
624DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000625DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000626DEFINE_INODE_EVENT(xfs_file_fsync);
627DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400628DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000629
630DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
631DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
632
Brian Foster27b52862012-11-06 09:50:38 -0500633DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
634DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500635DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700636DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
637DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
638DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500639
Christoph Hellwigd522d562017-08-29 10:08:41 -0700640TRACE_EVENT(xfs_filemap_fault,
641 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
642 bool write_fault),
643 TP_ARGS(ip, pe_size, write_fault),
644 TP_STRUCT__entry(
645 __field(dev_t, dev)
646 __field(xfs_ino_t, ino)
647 __field(enum page_entry_size, pe_size)
648 __field(bool, write_fault)
649 ),
650 TP_fast_assign(
651 __entry->dev = VFS_I(ip)->i_sb->s_dev;
652 __entry->ino = ip->i_ino;
653 __entry->pe_size = pe_size;
654 __entry->write_fault = write_fault;
655 ),
656 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
657 MAJOR(__entry->dev), MINOR(__entry->dev),
658 __entry->ino,
659 __print_symbolic(__entry->pe_size,
660 { PE_SIZE_PTE, "PTE" },
661 { PE_SIZE_PMD, "PMD" },
662 { PE_SIZE_PUD, "PUD" }),
663 __entry->write_fault)
664)
665
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000666DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000667 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
668 TP_ARGS(ip, caller_ip),
669 TP_STRUCT__entry(
670 __field(dev_t, dev)
671 __field(xfs_ino_t, ino)
672 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100673 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000674 __field(unsigned long, caller_ip)
675 ),
676 TP_fast_assign(
677 __entry->dev = VFS_I(ip)->i_sb->s_dev;
678 __entry->ino = ip->i_ino;
679 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100680 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000681 __entry->caller_ip = caller_ip;
682 ),
Darrick J. Wongaff68a52018-01-09 11:46:05 -0800683 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000684 MAJOR(__entry->dev), MINOR(__entry->dev),
685 __entry->ino,
686 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100687 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000688 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000689)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000690
Brian Foster19cb7e32013-03-18 10:51:48 -0400691TRACE_EVENT(xfs_iomap_prealloc_size,
692 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
693 unsigned int writeio_blocks),
694 TP_ARGS(ip, blocks, shift, writeio_blocks),
695 TP_STRUCT__entry(
696 __field(dev_t, dev)
697 __field(xfs_ino_t, ino)
698 __field(xfs_fsblock_t, blocks)
699 __field(int, shift)
700 __field(unsigned int, writeio_blocks)
701 ),
702 TP_fast_assign(
703 __entry->dev = VFS_I(ip)->i_sb->s_dev;
704 __entry->ino = ip->i_ino;
705 __entry->blocks = blocks;
706 __entry->shift = shift;
707 __entry->writeio_blocks = writeio_blocks;
708 ),
709 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
710 "m_writeio_blocks %u",
711 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
712 __entry->blocks, __entry->shift, __entry->writeio_blocks)
713)
714
Brian Foster56d11152015-05-29 09:18:32 +1000715TRACE_EVENT(xfs_irec_merge_pre,
716 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
717 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
718 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
719 TP_STRUCT__entry(
720 __field(dev_t, dev)
721 __field(xfs_agnumber_t, agno)
722 __field(xfs_agino_t, agino)
723 __field(uint16_t, holemask)
724 __field(xfs_agino_t, nagino)
725 __field(uint16_t, nholemask)
726 ),
727 TP_fast_assign(
728 __entry->dev = mp->m_super->s_dev;
729 __entry->agno = agno;
730 __entry->agino = agino;
731 __entry->holemask = holemask;
732 __entry->nagino = nagino;
733 __entry->nholemask = holemask;
734 ),
735 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
736 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
737 __entry->agino, __entry->holemask, __entry->nagino,
738 __entry->nholemask)
739)
740
741TRACE_EVENT(xfs_irec_merge_post,
742 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
743 uint16_t holemask),
744 TP_ARGS(mp, agno, agino, holemask),
745 TP_STRUCT__entry(
746 __field(dev_t, dev)
747 __field(xfs_agnumber_t, agno)
748 __field(xfs_agino_t, agino)
749 __field(uint16_t, holemask)
750 ),
751 TP_fast_assign(
752 __entry->dev = mp->m_super->s_dev;
753 __entry->agno = agno;
754 __entry->agino = agino;
755 __entry->holemask = holemask;
756 ),
757 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
758 MINOR(__entry->dev), __entry->agno, __entry->agino,
759 __entry->holemask)
760)
761
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000762#define DEFINE_IREF_EVENT(name) \
763DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000764 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
765 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000766DEFINE_IREF_EVENT(xfs_irele);
767DEFINE_IREF_EVENT(xfs_inode_pin);
768DEFINE_IREF_EVENT(xfs_inode_unpin);
769DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100770
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000771DECLARE_EVENT_CLASS(xfs_namespace_class,
772 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
773 TP_ARGS(dp, name),
774 TP_STRUCT__entry(
775 __field(dev_t, dev)
776 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000777 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000778 __dynamic_array(char, name, name->len)
779 ),
780 TP_fast_assign(
781 __entry->dev = VFS_I(dp)->i_sb->s_dev;
782 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000783 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000784 memcpy(__get_str(name), name->name, name->len);
785 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000786 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000787 MAJOR(__entry->dev), MINOR(__entry->dev),
788 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000789 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000790 __get_str(name))
791)
792
793#define DEFINE_NAMESPACE_EVENT(name) \
794DEFINE_EVENT(xfs_namespace_class, name, \
795 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
796 TP_ARGS(dp, name))
797DEFINE_NAMESPACE_EVENT(xfs_remove);
798DEFINE_NAMESPACE_EVENT(xfs_link);
799DEFINE_NAMESPACE_EVENT(xfs_lookup);
800DEFINE_NAMESPACE_EVENT(xfs_create);
801DEFINE_NAMESPACE_EVENT(xfs_symlink);
802
803TRACE_EVENT(xfs_rename,
804 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
805 struct xfs_name *src_name, struct xfs_name *target_name),
806 TP_ARGS(src_dp, target_dp, src_name, target_name),
807 TP_STRUCT__entry(
808 __field(dev_t, dev)
809 __field(xfs_ino_t, src_dp_ino)
810 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000811 __field(int, src_namelen)
812 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000813 __dynamic_array(char, src_name, src_name->len)
814 __dynamic_array(char, target_name, target_name->len)
815 ),
816 TP_fast_assign(
817 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
818 __entry->src_dp_ino = src_dp->i_ino;
819 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000820 __entry->src_namelen = src_name->len;
821 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000822 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000823 memcpy(__get_str(target_name), target_name->name,
824 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000825 ),
826 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000827 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000828 MAJOR(__entry->dev), MINOR(__entry->dev),
829 __entry->src_dp_ino,
830 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000831 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000832 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000833 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000834 __get_str(target_name))
835)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000836
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000837DECLARE_EVENT_CLASS(xfs_dquot_class,
838 TP_PROTO(struct xfs_dquot *dqp),
839 TP_ARGS(dqp),
840 TP_STRUCT__entry(
841 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000842 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000843 __field(unsigned, flags)
844 __field(unsigned, nrefs)
845 __field(unsigned long long, res_bcount)
846 __field(unsigned long long, bcount)
847 __field(unsigned long long, icount)
848 __field(unsigned long long, blk_hardlimit)
849 __field(unsigned long long, blk_softlimit)
850 __field(unsigned long long, ino_hardlimit)
851 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000852 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000853 TP_fast_assign(
854 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000855 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000856 __entry->flags = dqp->dq_flags;
857 __entry->nrefs = dqp->q_nrefs;
858 __entry->res_bcount = dqp->q_res_bcount;
859 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
860 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
861 __entry->blk_hardlimit =
862 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
863 __entry->blk_softlimit =
864 be64_to_cpu(dqp->q_core.d_blk_softlimit);
865 __entry->ino_hardlimit =
866 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
867 __entry->ino_softlimit =
868 be64_to_cpu(dqp->q_core.d_ino_softlimit);
869 ),
870 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000871 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
872 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000873 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000874 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000875 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
876 __entry->nrefs,
877 __entry->res_bcount,
878 __entry->bcount,
879 __entry->blk_hardlimit,
880 __entry->blk_softlimit,
881 __entry->icount,
882 __entry->ino_hardlimit,
883 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000884)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000885
886#define DEFINE_DQUOT_EVENT(name) \
887DEFINE_EVENT(xfs_dquot_class, name, \
888 TP_PROTO(struct xfs_dquot *dqp), \
889 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000890DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000891DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
892DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000893DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
894DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000895DEFINE_DQUOT_EVENT(xfs_dqattach_found);
896DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000897DEFINE_DQUOT_EVENT(xfs_dqalloc);
898DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
899DEFINE_DQUOT_EVENT(xfs_dqread);
900DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000901DEFINE_DQUOT_EVENT(xfs_dqget_hit);
902DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000903DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
904DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000905DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000906DEFINE_DQUOT_EVENT(xfs_dqput_free);
907DEFINE_DQUOT_EVENT(xfs_dqrele);
908DEFINE_DQUOT_EVENT(xfs_dqflush);
909DEFINE_DQUOT_EVENT(xfs_dqflush_force);
910DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000911
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000912DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500913 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000914 TP_ARGS(log, tic),
915 TP_STRUCT__entry(
916 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000917 __field(char, ocnt)
918 __field(char, cnt)
919 __field(int, curr_res)
920 __field(int, unit_res)
921 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100922 __field(int, reserveq)
923 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000924 __field(int, grant_reserve_cycle)
925 __field(int, grant_reserve_bytes)
926 __field(int, grant_write_cycle)
927 __field(int, grant_write_bytes)
928 __field(int, curr_cycle)
929 __field(int, curr_block)
930 __field(xfs_lsn_t, tail_lsn)
931 ),
932 TP_fast_assign(
933 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000934 __entry->ocnt = tic->t_ocnt;
935 __entry->cnt = tic->t_cnt;
936 __entry->curr_res = tic->t_curr_res;
937 __entry->unit_res = tic->t_unit_res;
938 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000939 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
940 __entry->writeq = list_empty(&log->l_write_head.waiters);
941 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100942 &__entry->grant_reserve_cycle,
943 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000944 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100945 &__entry->grant_write_cycle,
946 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000947 __entry->curr_cycle = log->l_curr_cycle;
948 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100949 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000950 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000951 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100952 "t_unit_res %u t_flags %s reserveq %s "
953 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000954 "grant_reserve_bytes %d grant_write_cycle %d "
955 "grant_write_bytes %d curr_cycle %d curr_block %d "
956 "tail_cycle %d tail_block %d",
957 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000958 __entry->ocnt,
959 __entry->cnt,
960 __entry->curr_res,
961 __entry->unit_res,
962 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100963 __entry->reserveq ? "empty" : "active",
964 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000965 __entry->grant_reserve_cycle,
966 __entry->grant_reserve_bytes,
967 __entry->grant_write_cycle,
968 __entry->grant_write_bytes,
969 __entry->curr_cycle,
970 __entry->curr_block,
971 CYCLE_LSN(__entry->tail_lsn),
972 BLOCK_LSN(__entry->tail_lsn)
973 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000974)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000975
976#define DEFINE_LOGGRANT_EVENT(name) \
977DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500978 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000979 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000980DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
981DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000982DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +0000983DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
984DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +1100985DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +0000986DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
987DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
988DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
989DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000990DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
991DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
992DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
993DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
994DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
995DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
996
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000997DECLARE_EVENT_CLASS(xfs_log_item_class,
998 TP_PROTO(struct xfs_log_item *lip),
999 TP_ARGS(lip),
1000 TP_STRUCT__entry(
1001 __field(dev_t, dev)
1002 __field(void *, lip)
1003 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001004 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001005 __field(xfs_lsn_t, lsn)
1006 ),
1007 TP_fast_assign(
1008 __entry->dev = lip->li_mountp->m_super->s_dev;
1009 __entry->lip = lip;
1010 __entry->type = lip->li_type;
1011 __entry->flags = lip->li_flags;
1012 __entry->lsn = lip->li_lsn;
1013 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001014 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001015 MAJOR(__entry->dev), MINOR(__entry->dev),
1016 __entry->lip,
1017 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1018 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1019 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1020)
1021
Dave Chinner14c26c62012-04-24 16:33:31 +10001022TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001023 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1024 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001025 TP_STRUCT__entry(
1026 __field(dev_t, dev)
1027 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001028 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001029 ),
1030 TP_fast_assign(
1031 __entry->dev = mp->m_super->s_dev;
1032 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001033 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001034 ),
Darrick J. Wongaff68a52018-01-09 11:46:05 -08001035 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001036 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001037 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001038)
1039
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001040#define DEFINE_LOG_ITEM_EVENT(name) \
1041DEFINE_EVENT(xfs_log_item_class, name, \
1042 TP_PROTO(struct xfs_log_item *lip), \
1043 TP_ARGS(lip))
1044DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001045DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1046DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001047DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001048
Dave Chinner750b9c92013-11-01 15:27:18 +11001049DECLARE_EVENT_CLASS(xfs_ail_class,
1050 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1051 TP_ARGS(lip, old_lsn, new_lsn),
1052 TP_STRUCT__entry(
1053 __field(dev_t, dev)
1054 __field(void *, lip)
1055 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001056 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001057 __field(xfs_lsn_t, old_lsn)
1058 __field(xfs_lsn_t, new_lsn)
1059 ),
1060 TP_fast_assign(
1061 __entry->dev = lip->li_mountp->m_super->s_dev;
1062 __entry->lip = lip;
1063 __entry->type = lip->li_type;
1064 __entry->flags = lip->li_flags;
1065 __entry->old_lsn = old_lsn;
1066 __entry->new_lsn = new_lsn;
1067 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001068 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 +11001069 MAJOR(__entry->dev), MINOR(__entry->dev),
1070 __entry->lip,
1071 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1072 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1073 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1074 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1075)
1076
1077#define DEFINE_AIL_EVENT(name) \
1078DEFINE_EVENT(xfs_ail_class, name, \
1079 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1080 TP_ARGS(lip, old_lsn, new_lsn))
1081DEFINE_AIL_EVENT(xfs_ail_insert);
1082DEFINE_AIL_EVENT(xfs_ail_move);
1083DEFINE_AIL_EVENT(xfs_ail_delete);
1084
1085TRACE_EVENT(xfs_log_assign_tail_lsn,
1086 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1087 TP_ARGS(log, new_lsn),
1088 TP_STRUCT__entry(
1089 __field(dev_t, dev)
1090 __field(xfs_lsn_t, new_lsn)
1091 __field(xfs_lsn_t, old_lsn)
1092 __field(xfs_lsn_t, last_sync_lsn)
1093 ),
1094 TP_fast_assign(
1095 __entry->dev = log->l_mp->m_super->s_dev;
1096 __entry->new_lsn = new_lsn;
1097 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1098 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1099 ),
1100 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1101 MAJOR(__entry->dev), MINOR(__entry->dev),
1102 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1103 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1104 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1105)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001106
Li Zefanf8adb4d2010-05-24 08:25:57 +00001107DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001108 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1109 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001110 TP_STRUCT__entry(
1111 __field(dev_t, dev)
1112 __field(xfs_ino_t, ino)
1113 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001114 __field(loff_t, offset)
1115 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001116 ),
1117 TP_fast_assign(
1118 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1119 __entry->ino = ip->i_ino;
1120 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001121 __entry->offset = offset;
1122 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001123 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001124 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001125 MAJOR(__entry->dev), MINOR(__entry->dev),
1126 __entry->ino,
1127 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001128 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001129 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001130)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001131
1132#define DEFINE_RW_EVENT(name) \
1133DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001134 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1135 TP_ARGS(ip, count, offset))
1136DEFINE_RW_EVENT(xfs_file_buffered_read);
1137DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001138DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001139DEFINE_RW_EVENT(xfs_file_buffered_write);
1140DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001141DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001142
Li Zefanf8adb4d2010-05-24 08:25:57 +00001143DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001144 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1145 unsigned int len),
1146 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001147 TP_STRUCT__entry(
1148 __field(dev_t, dev)
1149 __field(xfs_ino_t, ino)
1150 __field(pgoff_t, pgoff)
1151 __field(loff_t, size)
1152 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001153 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001154 ),
1155 TP_fast_assign(
Li Zefanf8adb4d2010-05-24 08:25:57 +00001156 __entry->dev = inode->i_sb->s_dev;
1157 __entry->ino = XFS_I(inode)->i_ino;
1158 __entry->pgoff = page_offset(page);
1159 __entry->size = i_size_read(inode);
1160 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001161 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001162 ),
1163 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001164 "length %x",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001165 MAJOR(__entry->dev), MINOR(__entry->dev),
1166 __entry->ino,
1167 __entry->pgoff,
1168 __entry->size,
1169 __entry->offset,
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001170 __entry->length)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001171)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001172
1173#define DEFINE_PAGE_EVENT(name) \
1174DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001175 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1176 unsigned int len), \
1177 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001178DEFINE_PAGE_EVENT(xfs_writepage);
1179DEFINE_PAGE_EVENT(xfs_releasepage);
1180DEFINE_PAGE_EVENT(xfs_invalidatepage);
1181
Dave Chinner121e2132016-01-08 11:28:35 +11001182DECLARE_EVENT_CLASS(xfs_readpage_class,
1183 TP_PROTO(struct inode *inode, int nr_pages),
1184 TP_ARGS(inode, nr_pages),
1185 TP_STRUCT__entry(
1186 __field(dev_t, dev)
1187 __field(xfs_ino_t, ino)
1188 __field(int, nr_pages)
1189 ),
1190 TP_fast_assign(
1191 __entry->dev = inode->i_sb->s_dev;
1192 __entry->ino = inode->i_ino;
1193 __entry->nr_pages = nr_pages;
1194 ),
1195 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1196 MAJOR(__entry->dev), MINOR(__entry->dev),
1197 __entry->ino,
1198 __entry->nr_pages)
1199)
1200
1201#define DEFINE_READPAGE_EVENT(name) \
1202DEFINE_EVENT(xfs_readpage_class, name, \
1203 TP_PROTO(struct inode *inode, int nr_pages), \
1204 TP_ARGS(inode, nr_pages))
1205DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1206DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1207
Christoph Hellwiga206c812010-12-10 08:42:20 +00001208DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001209 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001210 int type, struct xfs_bmbt_irec *irec),
1211 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001212 TP_STRUCT__entry(
1213 __field(dev_t, dev)
1214 __field(xfs_ino_t, ino)
1215 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001216 __field(loff_t, offset)
1217 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001218 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001219 __field(xfs_fileoff_t, startoff)
1220 __field(xfs_fsblock_t, startblock)
1221 __field(xfs_filblks_t, blockcount)
1222 ),
1223 TP_fast_assign(
1224 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1225 __entry->ino = ip->i_ino;
1226 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001227 __entry->offset = offset;
1228 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001229 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001230 __entry->startoff = irec ? irec->br_startoff : 0;
1231 __entry->startblock = irec ? irec->br_startblock : 0;
1232 __entry->blockcount = irec ? irec->br_blockcount : 0;
1233 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001234 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1235 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001236 MAJOR(__entry->dev), MINOR(__entry->dev),
1237 __entry->ino,
1238 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001239 __entry->offset,
1240 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001241 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001242 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001243 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001244 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001245)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001246
1247#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001248DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001249 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001250 int type, struct xfs_bmbt_irec *irec), \
1251 TP_ARGS(ip, offset, count, type, irec))
1252DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1253DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001254DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1255DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001256
Li Zefanf8adb4d2010-05-24 08:25:57 +00001257DECLARE_EVENT_CLASS(xfs_simple_io_class,
1258 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1259 TP_ARGS(ip, offset, count),
1260 TP_STRUCT__entry(
1261 __field(dev_t, dev)
1262 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001263 __field(loff_t, isize)
1264 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001265 __field(loff_t, offset)
1266 __field(size_t, count)
1267 ),
1268 TP_fast_assign(
1269 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1270 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001271 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001272 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001273 __entry->offset = offset;
1274 __entry->count = count;
1275 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001276 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001277 "offset 0x%llx count %zd",
1278 MAJOR(__entry->dev), MINOR(__entry->dev),
1279 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001280 __entry->isize,
1281 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001282 __entry->offset,
1283 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001284);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001285
1286#define DEFINE_SIMPLE_IO_EVENT(name) \
1287DEFINE_EVENT(xfs_simple_io_class, name, \
1288 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1289 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001290DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1291DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001292DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001293DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001294DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1295DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1296DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001297
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001298DECLARE_EVENT_CLASS(xfs_itrunc_class,
1299 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1300 TP_ARGS(ip, new_size),
1301 TP_STRUCT__entry(
1302 __field(dev_t, dev)
1303 __field(xfs_ino_t, ino)
1304 __field(xfs_fsize_t, size)
1305 __field(xfs_fsize_t, new_size)
1306 ),
1307 TP_fast_assign(
1308 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1309 __entry->ino = ip->i_ino;
1310 __entry->size = ip->i_d.di_size;
1311 __entry->new_size = new_size;
1312 ),
1313 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1314 MAJOR(__entry->dev), MINOR(__entry->dev),
1315 __entry->ino,
1316 __entry->size,
1317 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001318)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001319
1320#define DEFINE_ITRUNC_EVENT(name) \
1321DEFINE_EVENT(xfs_itrunc_class, name, \
1322 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1323 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001324DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1325DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001326
1327TRACE_EVENT(xfs_pagecache_inval,
1328 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1329 TP_ARGS(ip, start, finish),
1330 TP_STRUCT__entry(
1331 __field(dev_t, dev)
1332 __field(xfs_ino_t, ino)
1333 __field(xfs_fsize_t, size)
1334 __field(xfs_off_t, start)
1335 __field(xfs_off_t, finish)
1336 ),
1337 TP_fast_assign(
1338 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1339 __entry->ino = ip->i_ino;
1340 __entry->size = ip->i_d.di_size;
1341 __entry->start = start;
1342 __entry->finish = finish;
1343 ),
1344 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1345 MAJOR(__entry->dev), MINOR(__entry->dev),
1346 __entry->ino,
1347 __entry->size,
1348 __entry->start,
1349 __entry->finish)
1350);
1351
1352TRACE_EVENT(xfs_bunmap,
1353 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1354 int flags, unsigned long caller_ip),
1355 TP_ARGS(ip, bno, len, flags, caller_ip),
1356 TP_STRUCT__entry(
1357 __field(dev_t, dev)
1358 __field(xfs_ino_t, ino)
1359 __field(xfs_fsize_t, size)
1360 __field(xfs_fileoff_t, bno)
1361 __field(xfs_filblks_t, len)
1362 __field(unsigned long, caller_ip)
1363 __field(int, flags)
1364 ),
1365 TP_fast_assign(
1366 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1367 __entry->ino = ip->i_ino;
1368 __entry->size = ip->i_d.di_size;
1369 __entry->bno = bno;
1370 __entry->len = len;
1371 __entry->caller_ip = caller_ip;
1372 __entry->flags = flags;
1373 ),
1374 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Darrick J. Wongaff68a52018-01-09 11:46:05 -08001375 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001376 MAJOR(__entry->dev), MINOR(__entry->dev),
1377 __entry->ino,
1378 __entry->size,
1379 __entry->bno,
1380 __entry->len,
1381 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1382 (void *)__entry->caller_ip)
1383
1384);
1385
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001386DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001387 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1388 xfs_agblock_t agbno, xfs_extlen_t len),
1389 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001390 TP_STRUCT__entry(
1391 __field(dev_t, dev)
1392 __field(xfs_agnumber_t, agno)
1393 __field(xfs_agblock_t, agbno)
1394 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001395 ),
1396 TP_fast_assign(
1397 __entry->dev = mp->m_super->s_dev;
1398 __entry->agno = agno;
1399 __entry->agbno = agbno;
1400 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001401 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001402 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001403 MAJOR(__entry->dev), MINOR(__entry->dev),
1404 __entry->agno,
1405 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001406 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001407);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001408#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001409DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001410 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1411 xfs_agblock_t agbno, xfs_extlen_t len), \
1412 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001413DEFINE_BUSY_EVENT(xfs_extent_busy);
1414DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1415DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1416DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1417DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001418
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001419TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001420 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1421 xfs_agblock_t agbno, xfs_extlen_t len,
1422 xfs_agblock_t tbno, xfs_extlen_t tlen),
1423 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1424 TP_STRUCT__entry(
1425 __field(dev_t, dev)
1426 __field(xfs_agnumber_t, agno)
1427 __field(xfs_agblock_t, agbno)
1428 __field(xfs_extlen_t, len)
1429 __field(xfs_agblock_t, tbno)
1430 __field(xfs_extlen_t, tlen)
1431 ),
1432 TP_fast_assign(
1433 __entry->dev = mp->m_super->s_dev;
1434 __entry->agno = agno;
1435 __entry->agbno = agbno;
1436 __entry->len = len;
1437 __entry->tbno = tbno;
1438 __entry->tlen = tlen;
1439 ),
1440 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1441 MAJOR(__entry->dev), MINOR(__entry->dev),
1442 __entry->agno,
1443 __entry->agbno,
1444 __entry->len,
1445 __entry->tbno,
1446 __entry->tlen)
1447);
1448
Brian Fostera27ba262018-03-15 10:51:58 -07001449DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001450 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1451 unsigned long caller_ip),
1452 TP_ARGS(mp, agf, flags, caller_ip),
1453 TP_STRUCT__entry(
1454 __field(dev_t, dev)
1455 __field(xfs_agnumber_t, agno)
1456 __field(int, flags)
1457 __field(__u32, length)
1458 __field(__u32, bno_root)
1459 __field(__u32, cnt_root)
1460 __field(__u32, bno_level)
1461 __field(__u32, cnt_level)
1462 __field(__u32, flfirst)
1463 __field(__u32, fllast)
1464 __field(__u32, flcount)
1465 __field(__u32, freeblks)
1466 __field(__u32, longest)
1467 __field(unsigned long, caller_ip)
1468 ),
1469 TP_fast_assign(
1470 __entry->dev = mp->m_super->s_dev;
1471 __entry->agno = be32_to_cpu(agf->agf_seqno),
1472 __entry->flags = flags;
1473 __entry->length = be32_to_cpu(agf->agf_length),
1474 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1475 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1476 __entry->bno_level =
1477 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1478 __entry->cnt_level =
1479 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1480 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1481 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1482 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1483 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1484 __entry->longest = be32_to_cpu(agf->agf_longest);
1485 __entry->caller_ip = caller_ip;
1486 ),
1487 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1488 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a52018-01-09 11:46:05 -08001489 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001490 MAJOR(__entry->dev), MINOR(__entry->dev),
1491 __entry->agno,
1492 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1493 __entry->length,
1494 __entry->bno_root,
1495 __entry->cnt_root,
1496 __entry->bno_level,
1497 __entry->cnt_level,
1498 __entry->flfirst,
1499 __entry->fllast,
1500 __entry->flcount,
1501 __entry->freeblks,
1502 __entry->longest,
1503 (void *)__entry->caller_ip)
1504);
Brian Fostera27ba262018-03-15 10:51:58 -07001505#define DEFINE_AGF_EVENT(name) \
1506DEFINE_EVENT(xfs_agf_class, name, \
1507 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1508 unsigned long caller_ip), \
1509 TP_ARGS(mp, agf, flags, caller_ip))
1510DEFINE_AGF_EVENT(xfs_agf);
1511DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001512
1513TRACE_EVENT(xfs_free_extent,
1514 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001515 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1516 int haveright),
1517 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001518 TP_STRUCT__entry(
1519 __field(dev_t, dev)
1520 __field(xfs_agnumber_t, agno)
1521 __field(xfs_agblock_t, agbno)
1522 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001523 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001524 __field(int, haveleft)
1525 __field(int, haveright)
1526 ),
1527 TP_fast_assign(
1528 __entry->dev = mp->m_super->s_dev;
1529 __entry->agno = agno;
1530 __entry->agbno = agbno;
1531 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001532 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001533 __entry->haveleft = haveleft;
1534 __entry->haveright = haveright;
1535 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001536 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001537 MAJOR(__entry->dev), MINOR(__entry->dev),
1538 __entry->agno,
1539 __entry->agbno,
1540 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001541 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001542 __entry->haveleft ?
1543 (__entry->haveright ? "both" : "left") :
1544 (__entry->haveright ? "right" : "none"))
1545
1546);
1547
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001548DECLARE_EVENT_CLASS(xfs_alloc_class,
1549 TP_PROTO(struct xfs_alloc_arg *args),
1550 TP_ARGS(args),
1551 TP_STRUCT__entry(
1552 __field(dev_t, dev)
1553 __field(xfs_agnumber_t, agno)
1554 __field(xfs_agblock_t, agbno)
1555 __field(xfs_extlen_t, minlen)
1556 __field(xfs_extlen_t, maxlen)
1557 __field(xfs_extlen_t, mod)
1558 __field(xfs_extlen_t, prod)
1559 __field(xfs_extlen_t, minleft)
1560 __field(xfs_extlen_t, total)
1561 __field(xfs_extlen_t, alignment)
1562 __field(xfs_extlen_t, minalignslop)
1563 __field(xfs_extlen_t, len)
1564 __field(short, type)
1565 __field(short, otype)
1566 __field(char, wasdel)
1567 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001568 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001569 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001570 __field(xfs_fsblock_t, firstblock)
1571 ),
1572 TP_fast_assign(
1573 __entry->dev = args->mp->m_super->s_dev;
1574 __entry->agno = args->agno;
1575 __entry->agbno = args->agbno;
1576 __entry->minlen = args->minlen;
1577 __entry->maxlen = args->maxlen;
1578 __entry->mod = args->mod;
1579 __entry->prod = args->prod;
1580 __entry->minleft = args->minleft;
1581 __entry->total = args->total;
1582 __entry->alignment = args->alignment;
1583 __entry->minalignslop = args->minalignslop;
1584 __entry->len = args->len;
1585 __entry->type = args->type;
1586 __entry->otype = args->otype;
1587 __entry->wasdel = args->wasdel;
1588 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001589 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001590 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001591 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001592 ),
1593 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1594 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001595 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001596 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001597 MAJOR(__entry->dev), MINOR(__entry->dev),
1598 __entry->agno,
1599 __entry->agbno,
1600 __entry->minlen,
1601 __entry->maxlen,
1602 __entry->mod,
1603 __entry->prod,
1604 __entry->minleft,
1605 __entry->total,
1606 __entry->alignment,
1607 __entry->minalignslop,
1608 __entry->len,
1609 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1610 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1611 __entry->wasdel,
1612 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001613 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001614 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001615 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001616)
1617
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001618#define DEFINE_ALLOC_EVENT(name) \
1619DEFINE_EVENT(xfs_alloc_class, name, \
1620 TP_PROTO(struct xfs_alloc_arg *args), \
1621 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001622DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001623DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001624DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1625DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1626DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1627DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1628DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1629DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001630DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1631DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001632DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1633DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1634DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1635DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1636DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001637DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001638DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1639DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1640DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1641DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1642DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1643DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1644DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1645DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1646DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1647
Dave Chinner5a5881c2012-03-22 05:15:13 +00001648DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001649 TP_PROTO(struct xfs_da_args *args),
1650 TP_ARGS(args),
1651 TP_STRUCT__entry(
1652 __field(dev_t, dev)
1653 __field(xfs_ino_t, ino)
1654 __dynamic_array(char, name, args->namelen)
1655 __field(int, namelen)
1656 __field(xfs_dahash_t, hashval)
1657 __field(xfs_ino_t, inumber)
1658 __field(int, op_flags)
1659 ),
1660 TP_fast_assign(
1661 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1662 __entry->ino = args->dp->i_ino;
1663 if (args->namelen)
1664 memcpy(__get_str(name), args->name, args->namelen);
1665 __entry->namelen = args->namelen;
1666 __entry->hashval = args->hashval;
1667 __entry->inumber = args->inumber;
1668 __entry->op_flags = args->op_flags;
1669 ),
1670 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1671 "inumber 0x%llx op_flags %s",
1672 MAJOR(__entry->dev), MINOR(__entry->dev),
1673 __entry->ino,
1674 __entry->namelen,
1675 __entry->namelen ? __get_str(name) : NULL,
1676 __entry->namelen,
1677 __entry->hashval,
1678 __entry->inumber,
1679 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001680)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001681
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001682#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001683DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001684 TP_PROTO(struct xfs_da_args *args), \
1685 TP_ARGS(args))
1686DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1687DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1688DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1689DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1690DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1691DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1692DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1693DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1694DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1695DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1696DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1697DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1698DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1699DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1700DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1701DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1702DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1703DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1704DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1705DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1706DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1707DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1708DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1709DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1710DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1711
Dave Chinneree732592012-11-12 22:53:53 +11001712DECLARE_EVENT_CLASS(xfs_attr_class,
1713 TP_PROTO(struct xfs_da_args *args),
1714 TP_ARGS(args),
1715 TP_STRUCT__entry(
1716 __field(dev_t, dev)
1717 __field(xfs_ino_t, ino)
1718 __dynamic_array(char, name, args->namelen)
1719 __field(int, namelen)
1720 __field(int, valuelen)
1721 __field(xfs_dahash_t, hashval)
Eric Sandeene4435232018-04-17 17:17:35 -07001722 __field(int, flags)
Dave Chinneree732592012-11-12 22:53:53 +11001723 __field(int, op_flags)
1724 ),
1725 TP_fast_assign(
1726 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1727 __entry->ino = args->dp->i_ino;
1728 if (args->namelen)
1729 memcpy(__get_str(name), args->name, args->namelen);
1730 __entry->namelen = args->namelen;
1731 __entry->valuelen = args->valuelen;
1732 __entry->hashval = args->hashval;
Eric Sandeene4435232018-04-17 17:17:35 -07001733 __entry->flags = args->flags;
Dave Chinneree732592012-11-12 22:53:53 +11001734 __entry->op_flags = args->op_flags;
1735 ),
1736 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Eric Sandeene4435232018-04-17 17:17:35 -07001737 "hashval 0x%x flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001738 MAJOR(__entry->dev), MINOR(__entry->dev),
1739 __entry->ino,
1740 __entry->namelen,
1741 __entry->namelen ? __get_str(name) : NULL,
1742 __entry->namelen,
1743 __entry->valuelen,
1744 __entry->hashval,
Eric Sandeene4435232018-04-17 17:17:35 -07001745 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
Dave Chinneree732592012-11-12 22:53:53 +11001746 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1747)
1748
Dave Chinner5a5881c2012-03-22 05:15:13 +00001749#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001750DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001751 TP_PROTO(struct xfs_da_args *args), \
1752 TP_ARGS(args))
1753DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1754DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1755DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1756DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1757DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001758DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1759
1760DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1761DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1762DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001763DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001764DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1765DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001766DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1767DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001768DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1769DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001770DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001771DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1772DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1773DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1774DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1775DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1776DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1777DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1778DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1779DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1780DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001782DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001783
1784DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001785DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001786DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1787DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1788
Dave Chinneree732592012-11-12 22:53:53 +11001789DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1790DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1791
1792DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1793DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1794DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1795
Dave Chinner5a5881c2012-03-22 05:15:13 +00001796#define DEFINE_DA_EVENT(name) \
1797DEFINE_EVENT(xfs_da_class, name, \
1798 TP_PROTO(struct xfs_da_args *args), \
1799 TP_ARGS(args))
1800DEFINE_DA_EVENT(xfs_da_split);
1801DEFINE_DA_EVENT(xfs_da_join);
1802DEFINE_DA_EVENT(xfs_da_link_before);
1803DEFINE_DA_EVENT(xfs_da_link_after);
1804DEFINE_DA_EVENT(xfs_da_unlink_back);
1805DEFINE_DA_EVENT(xfs_da_unlink_forward);
1806DEFINE_DA_EVENT(xfs_da_root_split);
1807DEFINE_DA_EVENT(xfs_da_root_join);
1808DEFINE_DA_EVENT(xfs_da_node_add);
1809DEFINE_DA_EVENT(xfs_da_node_create);
1810DEFINE_DA_EVENT(xfs_da_node_split);
1811DEFINE_DA_EVENT(xfs_da_node_remove);
1812DEFINE_DA_EVENT(xfs_da_node_rebalance);
1813DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001814DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001815DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1816DEFINE_DA_EVENT(xfs_da_grow_inode);
1817DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001818DEFINE_DA_EVENT(xfs_da_fixhashpath);
1819DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001820
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001821DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1822 TP_PROTO(struct xfs_da_args *args, int idx),
1823 TP_ARGS(args, idx),
1824 TP_STRUCT__entry(
1825 __field(dev_t, dev)
1826 __field(xfs_ino_t, ino)
1827 __field(int, op_flags)
1828 __field(int, idx)
1829 ),
1830 TP_fast_assign(
1831 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1832 __entry->ino = args->dp->i_ino;
1833 __entry->op_flags = args->op_flags;
1834 __entry->idx = idx;
1835 ),
1836 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1837 MAJOR(__entry->dev), MINOR(__entry->dev),
1838 __entry->ino,
1839 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1840 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001841)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001842
1843#define DEFINE_DIR2_SPACE_EVENT(name) \
1844DEFINE_EVENT(xfs_dir2_space_class, name, \
1845 TP_PROTO(struct xfs_da_args *args, int idx), \
1846 TP_ARGS(args, idx))
1847DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1848DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1849DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1850DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001851
1852TRACE_EVENT(xfs_dir2_leafn_moveents,
1853 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1854 TP_ARGS(args, src_idx, dst_idx, count),
1855 TP_STRUCT__entry(
1856 __field(dev_t, dev)
1857 __field(xfs_ino_t, ino)
1858 __field(int, op_flags)
1859 __field(int, src_idx)
1860 __field(int, dst_idx)
1861 __field(int, count)
1862 ),
1863 TP_fast_assign(
1864 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1865 __entry->ino = args->dp->i_ino;
1866 __entry->op_flags = args->op_flags;
1867 __entry->src_idx = src_idx;
1868 __entry->dst_idx = dst_idx;
1869 __entry->count = count;
1870 ),
1871 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1872 "src_idx %d dst_idx %d count %d",
1873 MAJOR(__entry->dev), MINOR(__entry->dev),
1874 __entry->ino,
1875 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1876 __entry->src_idx,
1877 __entry->dst_idx,
1878 __entry->count)
1879);
1880
Dave Chinner3a85cd92010-01-14 01:33:55 +00001881#define XFS_SWAPEXT_INODES \
1882 { 0, "target" }, \
1883 { 1, "temp" }
1884
1885#define XFS_INODE_FORMAT_STR \
1886 { 0, "invalid" }, \
1887 { 1, "local" }, \
1888 { 2, "extent" }, \
1889 { 3, "btree" }
1890
1891DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1892 TP_PROTO(struct xfs_inode *ip, int which),
1893 TP_ARGS(ip, which),
1894 TP_STRUCT__entry(
1895 __field(dev_t, dev)
1896 __field(int, which)
1897 __field(xfs_ino_t, ino)
1898 __field(int, format)
1899 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001900 __field(int, broot_size)
1901 __field(int, fork_off)
1902 ),
1903 TP_fast_assign(
1904 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1905 __entry->which = which;
1906 __entry->ino = ip->i_ino;
1907 __entry->format = ip->i_d.di_format;
1908 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001909 __entry->broot_size = ip->i_df.if_broot_bytes;
1910 __entry->fork_off = XFS_IFORK_BOFF(ip);
1911 ),
1912 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001913 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001914 MAJOR(__entry->dev), MINOR(__entry->dev),
1915 __entry->ino,
1916 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1917 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1918 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001919 __entry->broot_size,
1920 __entry->fork_off)
1921)
1922
1923#define DEFINE_SWAPEXT_EVENT(name) \
1924DEFINE_EVENT(xfs_swap_extent_class, name, \
1925 TP_PROTO(struct xfs_inode *ip, int which), \
1926 TP_ARGS(ip, which))
1927
1928DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1929DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1930
Brian Fostere67d3d42017-08-08 18:21:53 -07001931TRACE_EVENT(xfs_log_recover,
1932 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1933 TP_ARGS(log, headblk, tailblk),
1934 TP_STRUCT__entry(
1935 __field(dev_t, dev)
1936 __field(xfs_daddr_t, headblk)
1937 __field(xfs_daddr_t, tailblk)
1938 ),
1939 TP_fast_assign(
1940 __entry->dev = log->l_mp->m_super->s_dev;
1941 __entry->headblk = headblk;
1942 __entry->tailblk = tailblk;
1943 ),
1944 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1945 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1946 __entry->tailblk)
1947)
1948
Brian Foster5cd9cee2016-09-26 08:34:52 +10001949TRACE_EVENT(xfs_log_recover_record,
1950 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1951 TP_ARGS(log, rhead, pass),
1952 TP_STRUCT__entry(
1953 __field(dev_t, dev)
1954 __field(xfs_lsn_t, lsn)
1955 __field(int, len)
1956 __field(int, num_logops)
1957 __field(int, pass)
1958 ),
1959 TP_fast_assign(
1960 __entry->dev = log->l_mp->m_super->s_dev;
1961 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1962 __entry->len = be32_to_cpu(rhead->h_len);
1963 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1964 __entry->pass = pass;
1965 ),
1966 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1967 MAJOR(__entry->dev), MINOR(__entry->dev),
1968 __entry->lsn, __entry->len, __entry->num_logops,
1969 __entry->pass)
1970)
1971
Dave Chinner9abbc532010-04-13 15:06:46 +10001972DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001973 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001974 struct xlog_recover_item *item, int pass),
1975 TP_ARGS(log, trans, item, pass),
1976 TP_STRUCT__entry(
1977 __field(dev_t, dev)
1978 __field(unsigned long, item)
1979 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001980 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10001981 __field(int, type)
1982 __field(int, pass)
1983 __field(int, count)
1984 __field(int, total)
1985 ),
1986 TP_fast_assign(
1987 __entry->dev = log->l_mp->m_super->s_dev;
1988 __entry->item = (unsigned long)item;
1989 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10001990 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10001991 __entry->type = ITEM_TYPE(item);
1992 __entry->pass = pass;
1993 __entry->count = item->ri_cnt;
1994 __entry->total = item->ri_total;
1995 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001996 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10001997 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10001998 MAJOR(__entry->dev), MINOR(__entry->dev),
1999 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002000 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002001 __entry->pass,
2002 (void *)__entry->item,
2003 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2004 __entry->count,
2005 __entry->total)
2006)
2007
2008#define DEFINE_LOG_RECOVER_ITEM(name) \
2009DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002010 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002011 struct xlog_recover_item *item, int pass), \
2012 TP_ARGS(log, trans, item, pass))
2013
2014DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2015DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2016DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2017DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2018DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2019
2020DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002021 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002022 TP_ARGS(log, buf_f),
2023 TP_STRUCT__entry(
2024 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002025 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002026 __field(unsigned short, len)
2027 __field(unsigned short, flags)
2028 __field(unsigned short, size)
2029 __field(unsigned int, map_size)
2030 ),
2031 TP_fast_assign(
2032 __entry->dev = log->l_mp->m_super->s_dev;
2033 __entry->blkno = buf_f->blf_blkno;
2034 __entry->len = buf_f->blf_len;
2035 __entry->flags = buf_f->blf_flags;
2036 __entry->size = buf_f->blf_size;
2037 __entry->map_size = buf_f->blf_map_size;
2038 ),
2039 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2040 "map_size %d",
2041 MAJOR(__entry->dev), MINOR(__entry->dev),
2042 __entry->blkno,
2043 __entry->len,
2044 __entry->flags,
2045 __entry->size,
2046 __entry->map_size)
2047)
2048
2049#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2050DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002051 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002052 TP_ARGS(log, buf_f))
2053
2054DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2055DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2056DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2057DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2058DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002059DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002060DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2061DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2062DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2063
2064DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002065 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002066 TP_ARGS(log, in_f),
2067 TP_STRUCT__entry(
2068 __field(dev_t, dev)
2069 __field(xfs_ino_t, ino)
2070 __field(unsigned short, size)
2071 __field(int, fields)
2072 __field(unsigned short, asize)
2073 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002074 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002075 __field(int, len)
2076 __field(int, boffset)
2077 ),
2078 TP_fast_assign(
2079 __entry->dev = log->l_mp->m_super->s_dev;
2080 __entry->ino = in_f->ilf_ino;
2081 __entry->size = in_f->ilf_size;
2082 __entry->fields = in_f->ilf_fields;
2083 __entry->asize = in_f->ilf_asize;
2084 __entry->dsize = in_f->ilf_dsize;
2085 __entry->blkno = in_f->ilf_blkno;
2086 __entry->len = in_f->ilf_len;
2087 __entry->boffset = in_f->ilf_boffset;
2088 ),
2089 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2090 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2091 MAJOR(__entry->dev), MINOR(__entry->dev),
2092 __entry->ino,
2093 __entry->size,
2094 __entry->fields,
2095 __entry->asize,
2096 __entry->dsize,
2097 __entry->blkno,
2098 __entry->len,
2099 __entry->boffset)
2100)
2101#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2102DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002103 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002104 TP_ARGS(log, in_f))
2105
2106DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2107DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2108DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2109
Brian Foster78d57e42015-08-19 09:58:48 +10002110DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2111 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2112 TP_ARGS(log, in_f),
2113 TP_STRUCT__entry(
2114 __field(dev_t, dev)
2115 __field(xfs_agnumber_t, agno)
2116 __field(xfs_agblock_t, agbno)
2117 __field(unsigned int, count)
2118 __field(unsigned int, isize)
2119 __field(xfs_agblock_t, length)
2120 __field(unsigned int, gen)
2121 ),
2122 TP_fast_assign(
2123 __entry->dev = log->l_mp->m_super->s_dev;
2124 __entry->agno = be32_to_cpu(in_f->icl_ag);
2125 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2126 __entry->count = be32_to_cpu(in_f->icl_count);
2127 __entry->isize = be32_to_cpu(in_f->icl_isize);
2128 __entry->length = be32_to_cpu(in_f->icl_length);
2129 __entry->gen = be32_to_cpu(in_f->icl_gen);
2130 ),
2131 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2132 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2133 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2134 __entry->length, __entry->gen)
2135)
2136#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2137DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2138 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2139 TP_ARGS(log, in_f))
2140
2141DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2142DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2143
Christoph Hellwiga46db602011-01-07 13:02:04 +00002144DECLARE_EVENT_CLASS(xfs_discard_class,
2145 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2146 xfs_agblock_t agbno, xfs_extlen_t len),
2147 TP_ARGS(mp, agno, agbno, len),
2148 TP_STRUCT__entry(
2149 __field(dev_t, dev)
2150 __field(xfs_agnumber_t, agno)
2151 __field(xfs_agblock_t, agbno)
2152 __field(xfs_extlen_t, len)
2153 ),
2154 TP_fast_assign(
2155 __entry->dev = mp->m_super->s_dev;
2156 __entry->agno = agno;
2157 __entry->agbno = agbno;
2158 __entry->len = len;
2159 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002160 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002161 MAJOR(__entry->dev), MINOR(__entry->dev),
2162 __entry->agno,
2163 __entry->agbno,
2164 __entry->len)
2165)
2166
2167#define DEFINE_DISCARD_EVENT(name) \
2168DEFINE_EVENT(xfs_discard_class, name, \
2169 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2170 xfs_agblock_t agbno, xfs_extlen_t len), \
2171 TP_ARGS(mp, agno, agbno, len))
2172DEFINE_DISCARD_EVENT(xfs_discard_extent);
2173DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2174DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2175DEFINE_DISCARD_EVENT(xfs_discard_busy);
2176
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002177/* btree cursor events */
2178DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2179 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2180 TP_ARGS(cur, level, bp),
2181 TP_STRUCT__entry(
2182 __field(dev_t, dev)
2183 __field(xfs_btnum_t, btnum)
2184 __field(int, level)
2185 __field(int, nlevels)
2186 __field(int, ptr)
2187 __field(xfs_daddr_t, daddr)
2188 ),
2189 TP_fast_assign(
2190 __entry->dev = cur->bc_mp->m_super->s_dev;
2191 __entry->btnum = cur->bc_btnum;
2192 __entry->level = level;
2193 __entry->nlevels = cur->bc_nlevels;
2194 __entry->ptr = cur->bc_ptrs[level];
2195 __entry->daddr = bp ? bp->b_bn : -1;
2196 ),
2197 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2198 MAJOR(__entry->dev), MINOR(__entry->dev),
2199 __entry->btnum,
2200 __entry->level,
2201 __entry->nlevels,
2202 __entry->ptr,
2203 (unsigned long long)__entry->daddr)
2204)
2205
2206#define DEFINE_BTREE_CUR_EVENT(name) \
2207DEFINE_EVENT(xfs_btree_cur_class, name, \
2208 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2209 TP_ARGS(cur, level, bp))
2210DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002211DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002212
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002213/* deferred ops */
2214struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002215
2216DECLARE_EVENT_CLASS(xfs_defer_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002217 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2218 TP_ARGS(tp, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002219 TP_STRUCT__entry(
2220 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002221 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002222 __field(char, committed)
Dave Chinnere632a562018-05-09 07:48:52 -07002223 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002224 ),
2225 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002226 __entry->dev = tp->t_mountp->m_super->s_dev;
2227 __entry->tp = tp;
Dave Chinnere632a562018-05-09 07:48:52 -07002228 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002229 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002230 TP_printk("dev %d:%d tp %p caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002231 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002232 __entry->tp,
Dave Chinnere632a562018-05-09 07:48:52 -07002233 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002234)
2235#define DEFINE_DEFER_EVENT(name) \
2236DEFINE_EVENT(xfs_defer_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002237 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2238 TP_ARGS(tp, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002239
2240DECLARE_EVENT_CLASS(xfs_defer_error_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002241 TP_PROTO(struct xfs_trans *tp, int error),
2242 TP_ARGS(tp, error),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002243 TP_STRUCT__entry(
2244 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002245 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002246 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002247 __field(int, error)
2248 ),
2249 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002250 __entry->dev = tp->t_mountp->m_super->s_dev;
2251 __entry->tp = tp;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002252 __entry->error = error;
2253 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002254 TP_printk("dev %d:%d tp %p err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002255 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002256 __entry->tp,
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002257 __entry->error)
2258)
2259#define DEFINE_DEFER_ERROR_EVENT(name) \
2260DEFINE_EVENT(xfs_defer_error_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002261 TP_PROTO(struct xfs_trans *tp, int error), \
2262 TP_ARGS(tp, error))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002263
2264DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2266 TP_ARGS(mp, dfp),
2267 TP_STRUCT__entry(
2268 __field(dev_t, dev)
2269 __field(int, type)
2270 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002271 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002272 __field(int, nr)
2273 ),
2274 TP_fast_assign(
2275 __entry->dev = mp ? mp->m_super->s_dev : 0;
2276 __entry->type = dfp->dfp_type->type;
2277 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002278 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002279 __entry->nr = dfp->dfp_count;
2280 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002281 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002282 MAJOR(__entry->dev), MINOR(__entry->dev),
2283 __entry->type,
2284 __entry->intent,
2285 __entry->committed,
2286 __entry->nr)
2287)
2288#define DEFINE_DEFER_PENDING_EVENT(name) \
2289DEFINE_EVENT(xfs_defer_pending_class, name, \
2290 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2291 TP_ARGS(mp, dfp))
2292
2293DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2294 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2295 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2296 TP_ARGS(mp, agno, type, agbno, len),
2297 TP_STRUCT__entry(
2298 __field(dev_t, dev)
2299 __field(xfs_agnumber_t, agno)
2300 __field(int, type)
2301 __field(xfs_agblock_t, agbno)
2302 __field(xfs_extlen_t, len)
2303 ),
2304 TP_fast_assign(
2305 __entry->dev = mp->m_super->s_dev;
2306 __entry->agno = agno;
2307 __entry->type = type;
2308 __entry->agbno = agbno;
2309 __entry->len = len;
2310 ),
2311 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2312 MAJOR(__entry->dev), MINOR(__entry->dev),
2313 __entry->type,
2314 __entry->agno,
2315 __entry->agbno,
2316 __entry->len)
2317);
2318#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2319DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2320 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2321 int type, \
2322 xfs_agblock_t bno, \
2323 xfs_extlen_t len), \
2324 TP_ARGS(mp, agno, type, bno, len))
2325
2326DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2327 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2328 int op,
2329 xfs_agblock_t agbno,
2330 xfs_ino_t ino,
2331 int whichfork,
2332 xfs_fileoff_t offset,
2333 xfs_filblks_t len,
2334 xfs_exntst_t state),
2335 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2336 TP_STRUCT__entry(
2337 __field(dev_t, dev)
2338 __field(xfs_agnumber_t, agno)
2339 __field(xfs_ino_t, ino)
2340 __field(xfs_agblock_t, agbno)
2341 __field(int, whichfork)
2342 __field(xfs_fileoff_t, l_loff)
2343 __field(xfs_filblks_t, l_len)
2344 __field(xfs_exntst_t, l_state)
2345 __field(int, op)
2346 ),
2347 TP_fast_assign(
2348 __entry->dev = mp->m_super->s_dev;
2349 __entry->agno = agno;
2350 __entry->ino = ino;
2351 __entry->agbno = agbno;
2352 __entry->whichfork = whichfork;
2353 __entry->l_loff = offset;
2354 __entry->l_len = len;
2355 __entry->l_state = state;
2356 __entry->op = op;
2357 ),
2358 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2359 MAJOR(__entry->dev), MINOR(__entry->dev),
2360 __entry->op,
2361 __entry->agno,
2362 __entry->agbno,
2363 __entry->ino,
2364 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2365 __entry->l_loff,
2366 __entry->l_len,
2367 __entry->l_state)
2368);
2369#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2370DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2371 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2372 int op, \
2373 xfs_agblock_t agbno, \
2374 xfs_ino_t ino, \
2375 int whichfork, \
2376 xfs_fileoff_t offset, \
2377 xfs_filblks_t len, \
2378 xfs_exntst_t state), \
2379 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2380
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002381DEFINE_DEFER_EVENT(xfs_defer_cancel);
2382DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2383DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2384DEFINE_DEFER_EVENT(xfs_defer_finish);
2385DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2386
2387DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2388DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002389
Brian Foster1ae093cb2018-08-01 07:20:34 -07002390DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2391DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002392DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2393DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2394
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002395#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2396DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2397DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002398DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2399DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002400
Darrick J. Wong673930c2016-08-03 11:33:43 +10002401/* rmap tracepoints */
2402DECLARE_EVENT_CLASS(xfs_rmap_class,
2403 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2404 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2405 struct xfs_owner_info *oinfo),
2406 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2407 TP_STRUCT__entry(
2408 __field(dev_t, dev)
2409 __field(xfs_agnumber_t, agno)
2410 __field(xfs_agblock_t, agbno)
2411 __field(xfs_extlen_t, len)
2412 __field(uint64_t, owner)
2413 __field(uint64_t, offset)
2414 __field(unsigned long, flags)
2415 ),
2416 TP_fast_assign(
2417 __entry->dev = mp->m_super->s_dev;
2418 __entry->agno = agno;
2419 __entry->agbno = agbno;
2420 __entry->len = len;
2421 __entry->owner = oinfo->oi_owner;
2422 __entry->offset = oinfo->oi_offset;
2423 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002424 if (unwritten)
2425 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002426 ),
2427 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2428 MAJOR(__entry->dev), MINOR(__entry->dev),
2429 __entry->agno,
2430 __entry->agbno,
2431 __entry->len,
2432 __entry->owner,
2433 __entry->offset,
2434 __entry->flags)
2435);
2436#define DEFINE_RMAP_EVENT(name) \
2437DEFINE_EVENT(xfs_rmap_class, name, \
2438 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2439 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2440 struct xfs_owner_info *oinfo), \
2441 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2442
2443/* simple AG-based error/%ip tracepoint class */
2444DECLARE_EVENT_CLASS(xfs_ag_error_class,
2445 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2446 unsigned long caller_ip),
2447 TP_ARGS(mp, agno, error, caller_ip),
2448 TP_STRUCT__entry(
2449 __field(dev_t, dev)
2450 __field(xfs_agnumber_t, agno)
2451 __field(int, error)
2452 __field(unsigned long, caller_ip)
2453 ),
2454 TP_fast_assign(
2455 __entry->dev = mp->m_super->s_dev;
2456 __entry->agno = agno;
2457 __entry->error = error;
2458 __entry->caller_ip = caller_ip;
2459 ),
Darrick J. Wongaff68a52018-01-09 11:46:05 -08002460 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002461 MAJOR(__entry->dev), MINOR(__entry->dev),
2462 __entry->agno,
2463 __entry->error,
2464 (char *)__entry->caller_ip)
2465);
2466
2467#define DEFINE_AG_ERROR_EVENT(name) \
2468DEFINE_EVENT(xfs_ag_error_class, name, \
2469 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2470 unsigned long caller_ip), \
2471 TP_ARGS(mp, agno, error, caller_ip))
2472
2473DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2474DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2475DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2476DEFINE_RMAP_EVENT(xfs_rmap_map);
2477DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2478DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002479DEFINE_RMAP_EVENT(xfs_rmap_convert);
2480DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2481DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2482DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002483
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002484DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2485 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2486 xfs_agblock_t agbno, xfs_extlen_t len,
2487 uint64_t owner, uint64_t offset, unsigned int flags),
2488 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2489 TP_STRUCT__entry(
2490 __field(dev_t, dev)
2491 __field(xfs_agnumber_t, agno)
2492 __field(xfs_agblock_t, agbno)
2493 __field(xfs_extlen_t, len)
2494 __field(uint64_t, owner)
2495 __field(uint64_t, offset)
2496 __field(unsigned int, flags)
2497 ),
2498 TP_fast_assign(
2499 __entry->dev = mp->m_super->s_dev;
2500 __entry->agno = agno;
2501 __entry->agbno = agbno;
2502 __entry->len = len;
2503 __entry->owner = owner;
2504 __entry->offset = offset;
2505 __entry->flags = flags;
2506 ),
2507 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2508 MAJOR(__entry->dev), MINOR(__entry->dev),
2509 __entry->agno,
2510 __entry->agbno,
2511 __entry->len,
2512 __entry->owner,
2513 __entry->offset,
2514 __entry->flags)
2515);
2516#define DEFINE_RMAPBT_EVENT(name) \
2517DEFINE_EVENT(xfs_rmapbt_class, name, \
2518 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2519 xfs_agblock_t agbno, xfs_extlen_t len, \
2520 uint64_t owner, uint64_t offset, unsigned int flags), \
2521 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2522
2523#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2524DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2525DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2526
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002527DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2528DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002529DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2530DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2531DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2532DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2533DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2534DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002535
2536DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2537DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2538DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2539DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002540DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2541DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002542DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002543
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002544/* deferred bmbt updates */
2545#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2546DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2547DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2548
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002549/* per-AG reservation */
2550DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2551 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2552 xfs_extlen_t len),
2553 TP_ARGS(pag, resv, len),
2554 TP_STRUCT__entry(
2555 __field(dev_t, dev)
2556 __field(xfs_agnumber_t, agno)
2557 __field(int, resv)
2558 __field(xfs_extlen_t, freeblks)
2559 __field(xfs_extlen_t, flcount)
2560 __field(xfs_extlen_t, reserved)
2561 __field(xfs_extlen_t, asked)
2562 __field(xfs_extlen_t, len)
2563 ),
2564 TP_fast_assign(
2565 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2566
2567 __entry->dev = pag->pag_mount->m_super->s_dev;
2568 __entry->agno = pag->pag_agno;
2569 __entry->resv = resv;
2570 __entry->freeblks = pag->pagf_freeblks;
2571 __entry->flcount = pag->pagf_flcount;
2572 __entry->reserved = r ? r->ar_reserved : 0;
2573 __entry->asked = r ? r->ar_asked : 0;
2574 __entry->len = len;
2575 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002576 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2577 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002578 MAJOR(__entry->dev), MINOR(__entry->dev),
2579 __entry->agno,
2580 __entry->resv,
2581 __entry->freeblks,
2582 __entry->flcount,
2583 __entry->reserved,
2584 __entry->asked,
2585 __entry->len)
2586)
2587#define DEFINE_AG_RESV_EVENT(name) \
2588DEFINE_EVENT(xfs_ag_resv_class, name, \
2589 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2590 xfs_extlen_t len), \
2591 TP_ARGS(pag, type, len))
2592
2593/* per-AG reservation tracepoints */
2594DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2595DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2596DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2597DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2598DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2599DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2600
2601DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2602DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2603
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002604/* refcount tracepoint classes */
2605
2606/* reuse the discard trace class for agbno/aglen-based traces */
2607#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2608
2609/* ag btree lookup tracepoint class */
2610#define XFS_AG_BTREE_CMP_FORMAT_STR \
2611 { XFS_LOOKUP_EQ, "eq" }, \
2612 { XFS_LOOKUP_LE, "le" }, \
2613 { XFS_LOOKUP_GE, "ge" }
2614DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2615 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2616 xfs_agblock_t agbno, xfs_lookup_t dir),
2617 TP_ARGS(mp, agno, agbno, dir),
2618 TP_STRUCT__entry(
2619 __field(dev_t, dev)
2620 __field(xfs_agnumber_t, agno)
2621 __field(xfs_agblock_t, agbno)
2622 __field(xfs_lookup_t, dir)
2623 ),
2624 TP_fast_assign(
2625 __entry->dev = mp->m_super->s_dev;
2626 __entry->agno = agno;
2627 __entry->agbno = agbno;
2628 __entry->dir = dir;
2629 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002630 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002631 MAJOR(__entry->dev), MINOR(__entry->dev),
2632 __entry->agno,
2633 __entry->agbno,
2634 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2635 __entry->dir)
2636)
2637
2638#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2639DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2640 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2641 xfs_agblock_t agbno, xfs_lookup_t dir), \
2642 TP_ARGS(mp, agno, agbno, dir))
2643
2644/* single-rcext tracepoint class */
2645DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2646 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2647 struct xfs_refcount_irec *irec),
2648 TP_ARGS(mp, agno, irec),
2649 TP_STRUCT__entry(
2650 __field(dev_t, dev)
2651 __field(xfs_agnumber_t, agno)
2652 __field(xfs_agblock_t, startblock)
2653 __field(xfs_extlen_t, blockcount)
2654 __field(xfs_nlink_t, refcount)
2655 ),
2656 TP_fast_assign(
2657 __entry->dev = mp->m_super->s_dev;
2658 __entry->agno = agno;
2659 __entry->startblock = irec->rc_startblock;
2660 __entry->blockcount = irec->rc_blockcount;
2661 __entry->refcount = irec->rc_refcount;
2662 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002663 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002664 MAJOR(__entry->dev), MINOR(__entry->dev),
2665 __entry->agno,
2666 __entry->startblock,
2667 __entry->blockcount,
2668 __entry->refcount)
2669)
2670
2671#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2672DEFINE_EVENT(xfs_refcount_extent_class, name, \
2673 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2674 struct xfs_refcount_irec *irec), \
2675 TP_ARGS(mp, agno, irec))
2676
2677/* single-rcext and an agbno tracepoint class */
2678DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2679 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2680 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2681 TP_ARGS(mp, agno, irec, agbno),
2682 TP_STRUCT__entry(
2683 __field(dev_t, dev)
2684 __field(xfs_agnumber_t, agno)
2685 __field(xfs_agblock_t, startblock)
2686 __field(xfs_extlen_t, blockcount)
2687 __field(xfs_nlink_t, refcount)
2688 __field(xfs_agblock_t, agbno)
2689 ),
2690 TP_fast_assign(
2691 __entry->dev = mp->m_super->s_dev;
2692 __entry->agno = agno;
2693 __entry->startblock = irec->rc_startblock;
2694 __entry->blockcount = irec->rc_blockcount;
2695 __entry->refcount = irec->rc_refcount;
2696 __entry->agbno = agbno;
2697 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002698 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002699 MAJOR(__entry->dev), MINOR(__entry->dev),
2700 __entry->agno,
2701 __entry->startblock,
2702 __entry->blockcount,
2703 __entry->refcount,
2704 __entry->agbno)
2705)
2706
2707#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2708DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2709 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2710 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2711 TP_ARGS(mp, agno, irec, agbno))
2712
2713/* double-rcext tracepoint class */
2714DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2715 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2716 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2717 TP_ARGS(mp, agno, i1, i2),
2718 TP_STRUCT__entry(
2719 __field(dev_t, dev)
2720 __field(xfs_agnumber_t, agno)
2721 __field(xfs_agblock_t, i1_startblock)
2722 __field(xfs_extlen_t, i1_blockcount)
2723 __field(xfs_nlink_t, i1_refcount)
2724 __field(xfs_agblock_t, i2_startblock)
2725 __field(xfs_extlen_t, i2_blockcount)
2726 __field(xfs_nlink_t, i2_refcount)
2727 ),
2728 TP_fast_assign(
2729 __entry->dev = mp->m_super->s_dev;
2730 __entry->agno = agno;
2731 __entry->i1_startblock = i1->rc_startblock;
2732 __entry->i1_blockcount = i1->rc_blockcount;
2733 __entry->i1_refcount = i1->rc_refcount;
2734 __entry->i2_startblock = i2->rc_startblock;
2735 __entry->i2_blockcount = i2->rc_blockcount;
2736 __entry->i2_refcount = i2->rc_refcount;
2737 ),
2738 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002739 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002740 MAJOR(__entry->dev), MINOR(__entry->dev),
2741 __entry->agno,
2742 __entry->i1_startblock,
2743 __entry->i1_blockcount,
2744 __entry->i1_refcount,
2745 __entry->i2_startblock,
2746 __entry->i2_blockcount,
2747 __entry->i2_refcount)
2748)
2749
2750#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2751DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2752 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2753 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2754 TP_ARGS(mp, agno, i1, i2))
2755
2756/* double-rcext and an agbno tracepoint class */
2757DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2758 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2759 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2760 xfs_agblock_t agbno),
2761 TP_ARGS(mp, agno, i1, i2, agbno),
2762 TP_STRUCT__entry(
2763 __field(dev_t, dev)
2764 __field(xfs_agnumber_t, agno)
2765 __field(xfs_agblock_t, i1_startblock)
2766 __field(xfs_extlen_t, i1_blockcount)
2767 __field(xfs_nlink_t, i1_refcount)
2768 __field(xfs_agblock_t, i2_startblock)
2769 __field(xfs_extlen_t, i2_blockcount)
2770 __field(xfs_nlink_t, i2_refcount)
2771 __field(xfs_agblock_t, agbno)
2772 ),
2773 TP_fast_assign(
2774 __entry->dev = mp->m_super->s_dev;
2775 __entry->agno = agno;
2776 __entry->i1_startblock = i1->rc_startblock;
2777 __entry->i1_blockcount = i1->rc_blockcount;
2778 __entry->i1_refcount = i1->rc_refcount;
2779 __entry->i2_startblock = i2->rc_startblock;
2780 __entry->i2_blockcount = i2->rc_blockcount;
2781 __entry->i2_refcount = i2->rc_refcount;
2782 __entry->agbno = agbno;
2783 ),
2784 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002785 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002786 MAJOR(__entry->dev), MINOR(__entry->dev),
2787 __entry->agno,
2788 __entry->i1_startblock,
2789 __entry->i1_blockcount,
2790 __entry->i1_refcount,
2791 __entry->i2_startblock,
2792 __entry->i2_blockcount,
2793 __entry->i2_refcount,
2794 __entry->agbno)
2795)
2796
2797#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2798DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2799 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2800 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2801 xfs_agblock_t agbno), \
2802 TP_ARGS(mp, agno, i1, i2, agbno))
2803
2804/* triple-rcext tracepoint class */
2805DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2806 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2807 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2808 struct xfs_refcount_irec *i3),
2809 TP_ARGS(mp, agno, i1, i2, i3),
2810 TP_STRUCT__entry(
2811 __field(dev_t, dev)
2812 __field(xfs_agnumber_t, agno)
2813 __field(xfs_agblock_t, i1_startblock)
2814 __field(xfs_extlen_t, i1_blockcount)
2815 __field(xfs_nlink_t, i1_refcount)
2816 __field(xfs_agblock_t, i2_startblock)
2817 __field(xfs_extlen_t, i2_blockcount)
2818 __field(xfs_nlink_t, i2_refcount)
2819 __field(xfs_agblock_t, i3_startblock)
2820 __field(xfs_extlen_t, i3_blockcount)
2821 __field(xfs_nlink_t, i3_refcount)
2822 ),
2823 TP_fast_assign(
2824 __entry->dev = mp->m_super->s_dev;
2825 __entry->agno = agno;
2826 __entry->i1_startblock = i1->rc_startblock;
2827 __entry->i1_blockcount = i1->rc_blockcount;
2828 __entry->i1_refcount = i1->rc_refcount;
2829 __entry->i2_startblock = i2->rc_startblock;
2830 __entry->i2_blockcount = i2->rc_blockcount;
2831 __entry->i2_refcount = i2->rc_refcount;
2832 __entry->i3_startblock = i3->rc_startblock;
2833 __entry->i3_blockcount = i3->rc_blockcount;
2834 __entry->i3_refcount = i3->rc_refcount;
2835 ),
2836 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2837 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002838 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002839 MAJOR(__entry->dev), MINOR(__entry->dev),
2840 __entry->agno,
2841 __entry->i1_startblock,
2842 __entry->i1_blockcount,
2843 __entry->i1_refcount,
2844 __entry->i2_startblock,
2845 __entry->i2_blockcount,
2846 __entry->i2_refcount,
2847 __entry->i3_startblock,
2848 __entry->i3_blockcount,
2849 __entry->i3_refcount)
2850);
2851
2852#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2853DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2854 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2855 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2856 struct xfs_refcount_irec *i3), \
2857 TP_ARGS(mp, agno, i1, i2, i3))
2858
2859/* refcount btree tracepoints */
2860DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2861DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2862DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2863DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2864DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2865DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2866DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2867DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2868DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2869DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2870
2871/* refcount adjustment tracepoints */
2872DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2873DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002874DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2875DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002876DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2877DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002878DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002879DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2880DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2881DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2882DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2883DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2884DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002885DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002886DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2887DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2888DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2889DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2890DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2891DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2892DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2893
2894/* reflink helpers */
2895DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2896DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2897DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba6122016-10-03 09:11:22 -07002898#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2899DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2900DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002901
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002902TRACE_EVENT(xfs_refcount_finish_one_leftover,
2903 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2904 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2905 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2906 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2907 TP_STRUCT__entry(
2908 __field(dev_t, dev)
2909 __field(xfs_agnumber_t, agno)
2910 __field(int, type)
2911 __field(xfs_agblock_t, agbno)
2912 __field(xfs_extlen_t, len)
2913 __field(xfs_agblock_t, new_agbno)
2914 __field(xfs_extlen_t, new_len)
2915 ),
2916 TP_fast_assign(
2917 __entry->dev = mp->m_super->s_dev;
2918 __entry->agno = agno;
2919 __entry->type = type;
2920 __entry->agbno = agbno;
2921 __entry->len = len;
2922 __entry->new_agbno = new_agbno;
2923 __entry->new_len = new_len;
2924 ),
2925 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2926 MAJOR(__entry->dev), MINOR(__entry->dev),
2927 __entry->type,
2928 __entry->agno,
2929 __entry->agbno,
2930 __entry->len,
2931 __entry->new_agbno,
2932 __entry->new_len)
2933);
2934
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002935/* simple inode-based error/%ip tracepoint class */
2936DECLARE_EVENT_CLASS(xfs_inode_error_class,
2937 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2938 TP_ARGS(ip, error, caller_ip),
2939 TP_STRUCT__entry(
2940 __field(dev_t, dev)
2941 __field(xfs_ino_t, ino)
2942 __field(int, error)
2943 __field(unsigned long, caller_ip)
2944 ),
2945 TP_fast_assign(
2946 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2947 __entry->ino = ip->i_ino;
2948 __entry->error = error;
2949 __entry->caller_ip = caller_ip;
2950 ),
Darrick J. Wongaff68a52018-01-09 11:46:05 -08002951 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002952 MAJOR(__entry->dev), MINOR(__entry->dev),
2953 __entry->ino,
2954 __entry->error,
2955 (char *)__entry->caller_ip)
2956);
2957
2958#define DEFINE_INODE_ERROR_EVENT(name) \
2959DEFINE_EVENT(xfs_inode_error_class, name, \
2960 TP_PROTO(struct xfs_inode *ip, int error, \
2961 unsigned long caller_ip), \
2962 TP_ARGS(ip, error, caller_ip))
2963
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002964/* reflink tracepoint classes */
2965
2966/* two-file io tracepoint class */
2967DECLARE_EVENT_CLASS(xfs_double_io_class,
2968 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2969 struct xfs_inode *dest, xfs_off_t doffset),
2970 TP_ARGS(src, soffset, len, dest, doffset),
2971 TP_STRUCT__entry(
2972 __field(dev_t, dev)
2973 __field(xfs_ino_t, src_ino)
2974 __field(loff_t, src_isize)
2975 __field(loff_t, src_disize)
2976 __field(loff_t, src_offset)
2977 __field(size_t, len)
2978 __field(xfs_ino_t, dest_ino)
2979 __field(loff_t, dest_isize)
2980 __field(loff_t, dest_disize)
2981 __field(loff_t, dest_offset)
2982 ),
2983 TP_fast_assign(
2984 __entry->dev = VFS_I(src)->i_sb->s_dev;
2985 __entry->src_ino = src->i_ino;
2986 __entry->src_isize = VFS_I(src)->i_size;
2987 __entry->src_disize = src->i_d.di_size;
2988 __entry->src_offset = soffset;
2989 __entry->len = len;
2990 __entry->dest_ino = dest->i_ino;
2991 __entry->dest_isize = VFS_I(dest)->i_size;
2992 __entry->dest_disize = dest->i_d.di_size;
2993 __entry->dest_offset = doffset;
2994 ),
2995 TP_printk("dev %d:%d count %zd "
2996 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
2997 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
2998 MAJOR(__entry->dev), MINOR(__entry->dev),
2999 __entry->len,
3000 __entry->src_ino,
3001 __entry->src_isize,
3002 __entry->src_disize,
3003 __entry->src_offset,
3004 __entry->dest_ino,
3005 __entry->dest_isize,
3006 __entry->dest_disize,
3007 __entry->dest_offset)
3008)
3009
3010#define DEFINE_DOUBLE_IO_EVENT(name) \
3011DEFINE_EVENT(xfs_double_io_class, name, \
3012 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3013 struct xfs_inode *dest, xfs_off_t doffset), \
3014 TP_ARGS(src, soffset, len, dest, doffset))
3015
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003016/* inode/irec events */
3017DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3018 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3019 TP_ARGS(ip, irec),
3020 TP_STRUCT__entry(
3021 __field(dev_t, dev)
3022 __field(xfs_ino_t, ino)
3023 __field(xfs_fileoff_t, lblk)
3024 __field(xfs_extlen_t, len)
3025 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003026 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003027 ),
3028 TP_fast_assign(
3029 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3030 __entry->ino = ip->i_ino;
3031 __entry->lblk = irec->br_startoff;
3032 __entry->len = irec->br_blockcount;
3033 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003034 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003035 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003036 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 -07003037 MAJOR(__entry->dev), MINOR(__entry->dev),
3038 __entry->ino,
3039 __entry->lblk,
3040 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003041 __entry->pblk,
3042 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003043);
3044#define DEFINE_INODE_IREC_EVENT(name) \
3045DEFINE_EVENT(xfs_inode_irec_class, name, \
3046 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3047 TP_ARGS(ip, irec))
3048
3049/* refcount/reflink tracepoint definitions */
3050
3051/* reflink tracepoints */
3052DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3053DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3054DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3055DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3056TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3057 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3058 xfs_filblks_t len, struct xfs_inode *dest,
3059 xfs_fileoff_t doffset),
3060 TP_ARGS(src, soffset, len, dest, doffset),
3061 TP_STRUCT__entry(
3062 __field(dev_t, dev)
3063 __field(xfs_ino_t, src_ino)
3064 __field(xfs_fileoff_t, src_lblk)
3065 __field(xfs_filblks_t, len)
3066 __field(xfs_ino_t, dest_ino)
3067 __field(xfs_fileoff_t, dest_lblk)
3068 ),
3069 TP_fast_assign(
3070 __entry->dev = VFS_I(src)->i_sb->s_dev;
3071 __entry->src_ino = src->i_ino;
3072 __entry->src_lblk = soffset;
3073 __entry->len = len;
3074 __entry->dest_ino = dest->i_ino;
3075 __entry->dest_lblk = doffset;
3076 ),
3077 TP_printk("dev %d:%d len 0x%llx "
3078 "ino 0x%llx offset 0x%llx blocks -> "
3079 "ino 0x%llx offset 0x%llx blocks",
3080 MAJOR(__entry->dev), MINOR(__entry->dev),
3081 __entry->len,
3082 __entry->src_ino,
3083 __entry->src_lblk,
3084 __entry->dest_ino,
3085 __entry->dest_lblk)
3086);
3087TRACE_EVENT(xfs_reflink_punch_range,
3088 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3089 xfs_extlen_t len),
3090 TP_ARGS(ip, lblk, len),
3091 TP_STRUCT__entry(
3092 __field(dev_t, dev)
3093 __field(xfs_ino_t, ino)
3094 __field(xfs_fileoff_t, lblk)
3095 __field(xfs_extlen_t, len)
3096 ),
3097 TP_fast_assign(
3098 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3099 __entry->ino = ip->i_ino;
3100 __entry->lblk = lblk;
3101 __entry->len = len;
3102 ),
3103 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3104 MAJOR(__entry->dev), MINOR(__entry->dev),
3105 __entry->ino,
3106 __entry->lblk,
3107 __entry->len)
3108);
3109TRACE_EVENT(xfs_reflink_remap,
3110 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3111 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3112 TP_ARGS(ip, lblk, len, new_pblk),
3113 TP_STRUCT__entry(
3114 __field(dev_t, dev)
3115 __field(xfs_ino_t, ino)
3116 __field(xfs_fileoff_t, lblk)
3117 __field(xfs_extlen_t, len)
3118 __field(xfs_fsblock_t, new_pblk)
3119 ),
3120 TP_fast_assign(
3121 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3122 __entry->ino = ip->i_ino;
3123 __entry->lblk = lblk;
3124 __entry->len = len;
3125 __entry->new_pblk = new_pblk;
3126 ),
3127 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3128 MAJOR(__entry->dev), MINOR(__entry->dev),
3129 __entry->ino,
3130 __entry->lblk,
3131 __entry->len,
3132 __entry->new_pblk)
3133);
3134DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3135DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3136DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3137DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003138DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3139DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3140
3141/* dedupe tracepoints */
3142DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3143DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3144
3145/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003146TRACE_EVENT(xfs_ioctl_clone,
3147 TP_PROTO(struct inode *src, struct inode *dest),
3148 TP_ARGS(src, dest),
3149 TP_STRUCT__entry(
3150 __field(dev_t, dev)
3151 __field(unsigned long, src_ino)
3152 __field(loff_t, src_isize)
3153 __field(unsigned long, dest_ino)
3154 __field(loff_t, dest_isize)
3155 ),
3156 TP_fast_assign(
3157 __entry->dev = src->i_sb->s_dev;
3158 __entry->src_ino = src->i_ino;
3159 __entry->src_isize = i_size_read(src);
3160 __entry->dest_ino = dest->i_ino;
3161 __entry->dest_isize = i_size_read(dest);
3162 ),
3163 TP_printk("dev %d:%d "
3164 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003165 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003166 MAJOR(__entry->dev), MINOR(__entry->dev),
3167 __entry->src_ino,
3168 __entry->src_isize,
3169 __entry->dest_ino,
3170 __entry->dest_isize)
3171);
3172
3173/* unshare tracepoints */
3174DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003175DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003176
3177/* copy on write */
3178DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003179DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3180DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3181DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003182DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003183
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003184DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003185
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003186DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003187
3188DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3189DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3190DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003191
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003192DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3193DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3194
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003195
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003196DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003197
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003198/* rmap swapext tracepoints */
3199DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3200DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3201DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3202
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003203/* fsmap traces */
3204DECLARE_EVENT_CLASS(xfs_fsmap_class,
3205 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3206 struct xfs_rmap_irec *rmap),
3207 TP_ARGS(mp, keydev, agno, rmap),
3208 TP_STRUCT__entry(
3209 __field(dev_t, dev)
3210 __field(dev_t, keydev)
3211 __field(xfs_agnumber_t, agno)
3212 __field(xfs_fsblock_t, bno)
3213 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003214 __field(uint64_t, owner)
3215 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003216 __field(unsigned int, flags)
3217 ),
3218 TP_fast_assign(
3219 __entry->dev = mp->m_super->s_dev;
3220 __entry->keydev = new_decode_dev(keydev);
3221 __entry->agno = agno;
3222 __entry->bno = rmap->rm_startblock;
3223 __entry->len = rmap->rm_blockcount;
3224 __entry->owner = rmap->rm_owner;
3225 __entry->offset = rmap->rm_offset;
3226 __entry->flags = rmap->rm_flags;
3227 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003228 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 -07003229 MAJOR(__entry->dev), MINOR(__entry->dev),
3230 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3231 __entry->agno,
3232 __entry->bno,
3233 __entry->len,
3234 __entry->owner,
3235 __entry->offset,
3236 __entry->flags)
3237)
3238#define DEFINE_FSMAP_EVENT(name) \
3239DEFINE_EVENT(xfs_fsmap_class, name, \
3240 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3241 struct xfs_rmap_irec *rmap), \
3242 TP_ARGS(mp, keydev, agno, rmap))
3243DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3244DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3245DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3246
3247DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3248 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3249 TP_ARGS(mp, fsmap),
3250 TP_STRUCT__entry(
3251 __field(dev_t, dev)
3252 __field(dev_t, keydev)
3253 __field(xfs_daddr_t, block)
3254 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003255 __field(uint64_t, owner)
3256 __field(uint64_t, offset)
3257 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003258 ),
3259 TP_fast_assign(
3260 __entry->dev = mp->m_super->s_dev;
3261 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3262 __entry->block = fsmap->fmr_physical;
3263 __entry->len = fsmap->fmr_length;
3264 __entry->owner = fsmap->fmr_owner;
3265 __entry->offset = fsmap->fmr_offset;
3266 __entry->flags = fsmap->fmr_flags;
3267 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003268 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 -07003269 MAJOR(__entry->dev), MINOR(__entry->dev),
3270 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3271 __entry->block,
3272 __entry->len,
3273 __entry->owner,
3274 __entry->offset,
3275 __entry->flags)
3276)
3277#define DEFINE_GETFSMAP_EVENT(name) \
3278DEFINE_EVENT(xfs_getfsmap_class, name, \
3279 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3280 TP_ARGS(mp, fsmap))
3281DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3282DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3283DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3284
Darrick J. Wongb872af22018-01-08 10:51:26 -08003285TRACE_EVENT(xfs_trans_resv_calc,
3286 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3287 struct xfs_trans_res *res),
3288 TP_ARGS(mp, type, res),
3289 TP_STRUCT__entry(
3290 __field(dev_t, dev)
3291 __field(int, type)
3292 __field(uint, logres)
3293 __field(int, logcount)
3294 __field(int, logflags)
3295 ),
3296 TP_fast_assign(
3297 __entry->dev = mp->m_super->s_dev;
3298 __entry->type = type;
3299 __entry->logres = res->tr_logres;
3300 __entry->logcount = res->tr_logcount;
3301 __entry->logflags = res->tr_logflags;
3302 ),
3303 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3304 MAJOR(__entry->dev), MINOR(__entry->dev),
3305 __entry->type,
3306 __entry->logres,
3307 __entry->logcount,
3308 __entry->logflags)
3309);
3310
Dave Chinnerba187812018-05-09 07:47:57 -07003311DECLARE_EVENT_CLASS(xfs_trans_class,
3312 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3313 TP_ARGS(tp, caller_ip),
3314 TP_STRUCT__entry(
3315 __field(dev_t, dev)
3316 __field(uint32_t, tid)
3317 __field(uint32_t, flags)
3318 __field(unsigned long, caller_ip)
3319 ),
3320 TP_fast_assign(
3321 __entry->dev = tp->t_mountp->m_super->s_dev;
3322 __entry->tid = 0;
3323 if (tp->t_ticket)
3324 __entry->tid = tp->t_ticket->t_tid;
3325 __entry->flags = tp->t_flags;
3326 __entry->caller_ip = caller_ip;
3327 ),
3328 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3329 MAJOR(__entry->dev), MINOR(__entry->dev),
3330 __entry->tid,
3331 __entry->flags,
3332 (char *)__entry->caller_ip)
3333)
3334
3335#define DEFINE_TRANS_EVENT(name) \
3336DEFINE_EVENT(xfs_trans_class, name, \
3337 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3338 TP_ARGS(tp, caller_ip))
3339DEFINE_TRANS_EVENT(xfs_trans_alloc);
3340DEFINE_TRANS_EVENT(xfs_trans_cancel);
3341DEFINE_TRANS_EVENT(xfs_trans_commit);
3342DEFINE_TRANS_EVENT(xfs_trans_dup);
3343DEFINE_TRANS_EVENT(xfs_trans_free);
3344DEFINE_TRANS_EVENT(xfs_trans_roll);
3345DEFINE_TRANS_EVENT(xfs_trans_add_item);
3346DEFINE_TRANS_EVENT(xfs_trans_free_items);
3347
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003348#endif /* _TRACE_XFS_H */
3349
3350#undef TRACE_INCLUDE_PATH
3351#define TRACE_INCLUDE_PATH .
3352#define TRACE_INCLUDE_FILE xfs_trace
3353#include <trace/define_trace.h>