blob: fec9cfe3dfb421fbe551354b9a46167ce475d60b [file] [log] [blame]
Dave Chinner0b61f8a2018-06-05 19:42:14 -07001// SPDX-License-Identifier: GPL-2.0
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00002/*
3 * Copyright (c) 2009, Christoph Hellwig
4 * All Rights Reserved.
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00005 */
6#undef TRACE_SYSTEM
7#define TRACE_SYSTEM xfs
8
9#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
10#define _TRACE_XFS_H
11
12#include <linux/tracepoint.h>
13
14struct xfs_agf;
15struct xfs_alloc_arg;
16struct xfs_attr_list_context;
17struct xfs_buf_log_item;
18struct xfs_da_args;
19struct xfs_da_node_entry;
20struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000021struct xfs_log_item;
Mark Tinguelyad223e62012-06-14 09:22:15 -050022struct xlog;
Dave Chinner750b9c92013-11-01 15:27:18 +110023struct xlog_ticket;
Dave Chinner9abbc532010-04-13 15:06:46 +100024struct xlog_recover;
25struct xlog_recover_item;
26struct xfs_buf_log_format;
27struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050028struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100029struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070030struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070031struct xfs_fsmap;
32struct xfs_rmap_irec;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000033
Christoph Hellwigea9a4882009-12-21 14:03:03 +000034DECLARE_EVENT_CLASS(xfs_attr_list_class,
35 TP_PROTO(struct xfs_attr_list_context *ctx),
36 TP_ARGS(ctx),
37 TP_STRUCT__entry(
38 __field(dev_t, dev)
39 __field(xfs_ino_t, ino)
40 __field(u32, hashval)
41 __field(u32, blkno)
42 __field(u32, offset)
43 __field(void *, alist)
44 __field(int, bufsize)
45 __field(int, count)
46 __field(int, firstu)
47 __field(int, dupcnt)
48 __field(int, flags)
49 ),
50 TP_fast_assign(
51 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
52 __entry->ino = ctx->dp->i_ino;
53 __entry->hashval = ctx->cursor->hashval;
54 __entry->blkno = ctx->cursor->blkno;
55 __entry->offset = ctx->cursor->offset;
56 __entry->alist = ctx->alist;
57 __entry->bufsize = ctx->bufsize;
58 __entry->count = ctx->count;
59 __entry->firstu = ctx->firstu;
60 __entry->flags = ctx->flags;
61 ),
62 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -080063 "alist %p size %u count %u firstu %u flags %d %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +000064 MAJOR(__entry->dev), MINOR(__entry->dev),
65 __entry->ino,
66 __entry->hashval,
67 __entry->blkno,
68 __entry->offset,
69 __entry->dupcnt,
70 __entry->alist,
71 __entry->bufsize,
72 __entry->count,
73 __entry->firstu,
74 __entry->flags,
75 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
76 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000077)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000078
79#define DEFINE_ATTR_LIST_EVENT(name) \
80DEFINE_EVENT(xfs_attr_list_class, name, \
81 TP_PROTO(struct xfs_attr_list_context *ctx), \
82 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000083DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
84DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
85DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
86DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
87DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
88DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
89DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
90DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +110091DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
92DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000093
Li Zefanf8adb4d2010-05-24 08:25:57 +000094DECLARE_EVENT_CLASS(xfs_perag_class,
95 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
96 unsigned long caller_ip),
97 TP_ARGS(mp, agno, refcount, caller_ip),
98 TP_STRUCT__entry(
99 __field(dev_t, dev)
100 __field(xfs_agnumber_t, agno)
101 __field(int, refcount)
102 __field(unsigned long, caller_ip)
103 ),
104 TP_fast_assign(
105 __entry->dev = mp->m_super->s_dev;
106 __entry->agno = agno;
107 __entry->refcount = refcount;
108 __entry->caller_ip = caller_ip;
109 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800110 TP_printk("dev %d:%d agno %u refcount %d caller %pS",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000111 MAJOR(__entry->dev), MINOR(__entry->dev),
112 __entry->agno,
113 __entry->refcount,
114 (char *)__entry->caller_ip)
115);
116
117#define DEFINE_PERAG_REF_EVENT(name) \
118DEFINE_EVENT(xfs_perag_class, name, \
119 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
120 unsigned long caller_ip), \
121 TP_ARGS(mp, agno, refcount, caller_ip))
122DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000123DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000124DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000125DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
126DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500127DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
128DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700129DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
130DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000131
Dave Chinnerd1230312013-11-01 15:27:19 +1100132DECLARE_EVENT_CLASS(xfs_ag_class,
133 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
134 TP_ARGS(mp, agno),
135 TP_STRUCT__entry(
136 __field(dev_t, dev)
137 __field(xfs_agnumber_t, agno)
138 ),
139 TP_fast_assign(
140 __entry->dev = mp->m_super->s_dev;
141 __entry->agno = agno;
142 ),
143 TP_printk("dev %d:%d agno %u",
144 MAJOR(__entry->dev), MINOR(__entry->dev),
145 __entry->agno)
146);
147#define DEFINE_AG_EVENT(name) \
148DEFINE_EVENT(xfs_ag_class, name, \
149 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
150 TP_ARGS(mp, agno))
151
152DEFINE_AG_EVENT(xfs_read_agf);
153DEFINE_AG_EVENT(xfs_alloc_read_agf);
154DEFINE_AG_EVENT(xfs_read_agi);
155DEFINE_AG_EVENT(xfs_ialloc_read_agi);
156
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000157TRACE_EVENT(xfs_attr_list_node_descend,
158 TP_PROTO(struct xfs_attr_list_context *ctx,
159 struct xfs_da_node_entry *btree),
160 TP_ARGS(ctx, btree),
161 TP_STRUCT__entry(
162 __field(dev_t, dev)
163 __field(xfs_ino_t, ino)
164 __field(u32, hashval)
165 __field(u32, blkno)
166 __field(u32, offset)
167 __field(void *, alist)
168 __field(int, bufsize)
169 __field(int, count)
170 __field(int, firstu)
171 __field(int, dupcnt)
172 __field(int, flags)
173 __field(u32, bt_hashval)
174 __field(u32, bt_before)
175 ),
176 TP_fast_assign(
177 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
178 __entry->ino = ctx->dp->i_ino;
179 __entry->hashval = ctx->cursor->hashval;
180 __entry->blkno = ctx->cursor->blkno;
181 __entry->offset = ctx->cursor->offset;
182 __entry->alist = ctx->alist;
183 __entry->bufsize = ctx->bufsize;
184 __entry->count = ctx->count;
185 __entry->firstu = ctx->firstu;
186 __entry->flags = ctx->flags;
187 __entry->bt_hashval = be32_to_cpu(btree->hashval);
188 __entry->bt_before = be32_to_cpu(btree->before);
189 ),
190 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800191 "alist %p size %u count %u firstu %u flags %d %s "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000192 "node hashval %u, node before %u",
193 MAJOR(__entry->dev), MINOR(__entry->dev),
194 __entry->ino,
195 __entry->hashval,
196 __entry->blkno,
197 __entry->offset,
198 __entry->dupcnt,
199 __entry->alist,
200 __entry->bufsize,
201 __entry->count,
202 __entry->firstu,
203 __entry->flags,
204 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
205 __entry->bt_hashval,
206 __entry->bt_before)
207);
208
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000209DECLARE_EVENT_CLASS(xfs_bmap_class,
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700210 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000211 unsigned long caller_ip),
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700212 TP_ARGS(ip, cur, state, caller_ip),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000213 TP_STRUCT__entry(
214 __field(dev_t, dev)
215 __field(xfs_ino_t, ino)
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700216 __field(void *, leaf);
217 __field(int, pos);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000218 __field(xfs_fileoff_t, startoff)
219 __field(xfs_fsblock_t, startblock)
220 __field(xfs_filblks_t, blockcount)
221 __field(xfs_exntst_t, state)
222 __field(int, bmap_state)
223 __field(unsigned long, caller_ip)
224 ),
225 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700226 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000227 struct xfs_bmbt_irec r;
228
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700229 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700230 xfs_iext_get_extent(ifp, cur, &r);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000231 __entry->dev = VFS_I(ip)->i_sb->s_dev;
232 __entry->ino = ip->i_ino;
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700233 __entry->leaf = cur->leaf;
234 __entry->pos = cur->pos;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000235 __entry->startoff = r.br_startoff;
236 __entry->startblock = r.br_startblock;
237 __entry->blockcount = r.br_blockcount;
238 __entry->state = r.br_state;
239 __entry->bmap_state = state;
240 __entry->caller_ip = caller_ip;
241 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800242 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800243 "offset %lld block %lld count %lld flag %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000244 MAJOR(__entry->dev), MINOR(__entry->dev),
245 __entry->ino,
246 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700247 __entry->leaf,
248 __entry->pos,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000249 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700250 (int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000251 __entry->blockcount,
252 __entry->state,
253 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000254)
255
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000256#define DEFINE_BMAP_EVENT(name) \
257DEFINE_EVENT(xfs_bmap_class, name, \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700258 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000259 unsigned long caller_ip), \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700260 TP_ARGS(ip, cur, state, caller_ip))
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700261DEFINE_BMAP_EVENT(xfs_iext_insert);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000262DEFINE_BMAP_EVENT(xfs_iext_remove);
263DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
264DEFINE_BMAP_EVENT(xfs_bmap_post_update);
Christoph Hellwige8e0e172017-10-19 11:06:29 -0700265DEFINE_BMAP_EVENT(xfs_read_extent);
266DEFINE_BMAP_EVENT(xfs_write_extent);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000267
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000268DECLARE_EVENT_CLASS(xfs_buf_class,
269 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
270 TP_ARGS(bp, caller_ip),
271 TP_STRUCT__entry(
272 __field(dev_t, dev)
273 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000274 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000275 __field(int, hold)
276 __field(int, pincount)
277 __field(unsigned, lockval)
278 __field(unsigned, flags)
279 __field(unsigned long, caller_ip)
280 ),
281 TP_fast_assign(
282 __entry->dev = bp->b_target->bt_dev;
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. Wongaff68a552018-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. Wongaff68a552018-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);
476DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
477DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
478DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
479DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
480DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
481DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
482DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
483DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
484DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
485DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
486DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
487DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
488DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
489DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
490DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
491
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000492DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700493 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
494 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000495 TP_STRUCT__entry(
496 __field(dev_t, dev)
497 __field(xfs_ino_t, ino)
498 __field(xfs_agnumber_t, agno)
499 __field(int, streams)
500 ),
501 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700502 __entry->dev = mp->m_super->s_dev;
503 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000504 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700505 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000506 ),
507 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
508 MAJOR(__entry->dev), MINOR(__entry->dev),
509 __entry->ino,
510 __entry->agno,
511 __entry->streams)
512)
513#define DEFINE_FILESTREAM_EVENT(name) \
514DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700515 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
516 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000517DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
518DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
519DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
520
521TRACE_EVENT(xfs_filestream_pick,
522 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
523 xfs_extlen_t free, int nscan),
524 TP_ARGS(ip, agno, free, nscan),
525 TP_STRUCT__entry(
526 __field(dev_t, dev)
527 __field(xfs_ino_t, ino)
528 __field(xfs_agnumber_t, agno)
529 __field(int, streams)
530 __field(xfs_extlen_t, free)
531 __field(int, nscan)
532 ),
533 TP_fast_assign(
534 __entry->dev = VFS_I(ip)->i_sb->s_dev;
535 __entry->ino = ip->i_ino;
536 __entry->agno = agno;
537 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
538 __entry->free = free;
539 __entry->nscan = nscan;
540 ),
541 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
542 MAJOR(__entry->dev), MINOR(__entry->dev),
543 __entry->ino,
544 __entry->agno,
545 __entry->streams,
546 __entry->free,
547 __entry->nscan)
548);
549
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000550DECLARE_EVENT_CLASS(xfs_lock_class,
551 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
552 unsigned long caller_ip),
553 TP_ARGS(ip, lock_flags, caller_ip),
554 TP_STRUCT__entry(
555 __field(dev_t, dev)
556 __field(xfs_ino_t, ino)
557 __field(int, lock_flags)
558 __field(unsigned long, caller_ip)
559 ),
560 TP_fast_assign(
561 __entry->dev = VFS_I(ip)->i_sb->s_dev;
562 __entry->ino = ip->i_ino;
563 __entry->lock_flags = lock_flags;
564 __entry->caller_ip = caller_ip;
565 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800566 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000567 MAJOR(__entry->dev), MINOR(__entry->dev),
568 __entry->ino,
569 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
570 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000571)
572
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000573#define DEFINE_LOCK_EVENT(name) \
574DEFINE_EVENT(xfs_lock_class, name, \
575 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
576 unsigned long caller_ip), \
577 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000578DEFINE_LOCK_EVENT(xfs_ilock);
579DEFINE_LOCK_EVENT(xfs_ilock_nowait);
580DEFINE_LOCK_EVENT(xfs_ilock_demote);
581DEFINE_LOCK_EVENT(xfs_iunlock);
582
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000583DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000584 TP_PROTO(struct xfs_inode *ip),
585 TP_ARGS(ip),
586 TP_STRUCT__entry(
587 __field(dev_t, dev)
588 __field(xfs_ino_t, ino)
589 ),
590 TP_fast_assign(
591 __entry->dev = VFS_I(ip)->i_sb->s_dev;
592 __entry->ino = ip->i_ino;
593 ),
594 TP_printk("dev %d:%d ino 0x%llx",
595 MAJOR(__entry->dev), MINOR(__entry->dev),
596 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000597)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000598
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000599#define DEFINE_INODE_EVENT(name) \
600DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000601 TP_PROTO(struct xfs_inode *ip), \
602 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000603DEFINE_INODE_EVENT(xfs_iget_skip);
604DEFINE_INODE_EVENT(xfs_iget_reclaim);
605DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
606DEFINE_INODE_EVENT(xfs_iget_hit);
607DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000608
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000609DEFINE_INODE_EVENT(xfs_getattr);
610DEFINE_INODE_EVENT(xfs_setattr);
611DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500612DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000613DEFINE_INODE_EVENT(xfs_alloc_file_space);
614DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000615DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100616DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100617DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000618DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000619#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200620DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000621#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000622DEFINE_INODE_EVENT(xfs_vm_bmap);
623DEFINE_INODE_EVENT(xfs_file_ioctl);
624DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
625DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000626DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000627DEFINE_INODE_EVENT(xfs_file_fsync);
628DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400629DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000630
631DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
632DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
633
Brian Foster27b52862012-11-06 09:50:38 -0500634DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
635DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500636DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700637DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
638DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
639DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500640
Christoph Hellwigd522d562017-08-29 10:08:41 -0700641TRACE_EVENT(xfs_filemap_fault,
642 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
643 bool write_fault),
644 TP_ARGS(ip, pe_size, write_fault),
645 TP_STRUCT__entry(
646 __field(dev_t, dev)
647 __field(xfs_ino_t, ino)
648 __field(enum page_entry_size, pe_size)
649 __field(bool, write_fault)
650 ),
651 TP_fast_assign(
652 __entry->dev = VFS_I(ip)->i_sb->s_dev;
653 __entry->ino = ip->i_ino;
654 __entry->pe_size = pe_size;
655 __entry->write_fault = write_fault;
656 ),
657 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
658 MAJOR(__entry->dev), MINOR(__entry->dev),
659 __entry->ino,
660 __print_symbolic(__entry->pe_size,
661 { PE_SIZE_PTE, "PTE" },
662 { PE_SIZE_PMD, "PMD" },
663 { PE_SIZE_PUD, "PUD" }),
664 __entry->write_fault)
665)
666
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000667DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000668 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
669 TP_ARGS(ip, caller_ip),
670 TP_STRUCT__entry(
671 __field(dev_t, dev)
672 __field(xfs_ino_t, ino)
673 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100674 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000675 __field(unsigned long, caller_ip)
676 ),
677 TP_fast_assign(
678 __entry->dev = VFS_I(ip)->i_sb->s_dev;
679 __entry->ino = ip->i_ino;
680 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100681 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000682 __entry->caller_ip = caller_ip;
683 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800684 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000685 MAJOR(__entry->dev), MINOR(__entry->dev),
686 __entry->ino,
687 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100688 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000689 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000690)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000691
Brian Foster19cb7e32013-03-18 10:51:48 -0400692TRACE_EVENT(xfs_iomap_prealloc_size,
693 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
694 unsigned int writeio_blocks),
695 TP_ARGS(ip, blocks, shift, writeio_blocks),
696 TP_STRUCT__entry(
697 __field(dev_t, dev)
698 __field(xfs_ino_t, ino)
699 __field(xfs_fsblock_t, blocks)
700 __field(int, shift)
701 __field(unsigned int, writeio_blocks)
702 ),
703 TP_fast_assign(
704 __entry->dev = VFS_I(ip)->i_sb->s_dev;
705 __entry->ino = ip->i_ino;
706 __entry->blocks = blocks;
707 __entry->shift = shift;
708 __entry->writeio_blocks = writeio_blocks;
709 ),
710 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
711 "m_writeio_blocks %u",
712 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
713 __entry->blocks, __entry->shift, __entry->writeio_blocks)
714)
715
Brian Foster56d11152015-05-29 09:18:32 +1000716TRACE_EVENT(xfs_irec_merge_pre,
717 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
718 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
719 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
720 TP_STRUCT__entry(
721 __field(dev_t, dev)
722 __field(xfs_agnumber_t, agno)
723 __field(xfs_agino_t, agino)
724 __field(uint16_t, holemask)
725 __field(xfs_agino_t, nagino)
726 __field(uint16_t, nholemask)
727 ),
728 TP_fast_assign(
729 __entry->dev = mp->m_super->s_dev;
730 __entry->agno = agno;
731 __entry->agino = agino;
732 __entry->holemask = holemask;
733 __entry->nagino = nagino;
734 __entry->nholemask = holemask;
735 ),
736 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
737 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
738 __entry->agino, __entry->holemask, __entry->nagino,
739 __entry->nholemask)
740)
741
742TRACE_EVENT(xfs_irec_merge_post,
743 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
744 uint16_t holemask),
745 TP_ARGS(mp, agno, agino, holemask),
746 TP_STRUCT__entry(
747 __field(dev_t, dev)
748 __field(xfs_agnumber_t, agno)
749 __field(xfs_agino_t, agino)
750 __field(uint16_t, holemask)
751 ),
752 TP_fast_assign(
753 __entry->dev = mp->m_super->s_dev;
754 __entry->agno = agno;
755 __entry->agino = agino;
756 __entry->holemask = holemask;
757 ),
758 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
759 MINOR(__entry->dev), __entry->agno, __entry->agino,
760 __entry->holemask)
761)
762
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000763#define DEFINE_IREF_EVENT(name) \
764DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000765 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
766 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000767DEFINE_IREF_EVENT(xfs_irele);
768DEFINE_IREF_EVENT(xfs_inode_pin);
769DEFINE_IREF_EVENT(xfs_inode_unpin);
770DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100771
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000772DECLARE_EVENT_CLASS(xfs_namespace_class,
773 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
774 TP_ARGS(dp, name),
775 TP_STRUCT__entry(
776 __field(dev_t, dev)
777 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000778 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000779 __dynamic_array(char, name, name->len)
780 ),
781 TP_fast_assign(
782 __entry->dev = VFS_I(dp)->i_sb->s_dev;
783 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000784 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000785 memcpy(__get_str(name), name->name, name->len);
786 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000787 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000788 MAJOR(__entry->dev), MINOR(__entry->dev),
789 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000790 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000791 __get_str(name))
792)
793
794#define DEFINE_NAMESPACE_EVENT(name) \
795DEFINE_EVENT(xfs_namespace_class, name, \
796 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
797 TP_ARGS(dp, name))
798DEFINE_NAMESPACE_EVENT(xfs_remove);
799DEFINE_NAMESPACE_EVENT(xfs_link);
800DEFINE_NAMESPACE_EVENT(xfs_lookup);
801DEFINE_NAMESPACE_EVENT(xfs_create);
802DEFINE_NAMESPACE_EVENT(xfs_symlink);
803
804TRACE_EVENT(xfs_rename,
805 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
806 struct xfs_name *src_name, struct xfs_name *target_name),
807 TP_ARGS(src_dp, target_dp, src_name, target_name),
808 TP_STRUCT__entry(
809 __field(dev_t, dev)
810 __field(xfs_ino_t, src_dp_ino)
811 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000812 __field(int, src_namelen)
813 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000814 __dynamic_array(char, src_name, src_name->len)
815 __dynamic_array(char, target_name, target_name->len)
816 ),
817 TP_fast_assign(
818 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
819 __entry->src_dp_ino = src_dp->i_ino;
820 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000821 __entry->src_namelen = src_name->len;
822 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000823 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000824 memcpy(__get_str(target_name), target_name->name,
825 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000826 ),
827 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000828 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000829 MAJOR(__entry->dev), MINOR(__entry->dev),
830 __entry->src_dp_ino,
831 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000832 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000833 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000834 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000835 __get_str(target_name))
836)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000837
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000838DECLARE_EVENT_CLASS(xfs_dquot_class,
839 TP_PROTO(struct xfs_dquot *dqp),
840 TP_ARGS(dqp),
841 TP_STRUCT__entry(
842 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000843 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000844 __field(unsigned, flags)
845 __field(unsigned, nrefs)
846 __field(unsigned long long, res_bcount)
847 __field(unsigned long long, bcount)
848 __field(unsigned long long, icount)
849 __field(unsigned long long, blk_hardlimit)
850 __field(unsigned long long, blk_softlimit)
851 __field(unsigned long long, ino_hardlimit)
852 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000853 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000854 TP_fast_assign(
855 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000856 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000857 __entry->flags = dqp->dq_flags;
858 __entry->nrefs = dqp->q_nrefs;
859 __entry->res_bcount = dqp->q_res_bcount;
860 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
861 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
862 __entry->blk_hardlimit =
863 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
864 __entry->blk_softlimit =
865 be64_to_cpu(dqp->q_core.d_blk_softlimit);
866 __entry->ino_hardlimit =
867 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
868 __entry->ino_softlimit =
869 be64_to_cpu(dqp->q_core.d_ino_softlimit);
870 ),
871 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000872 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
873 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000874 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000875 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000876 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
877 __entry->nrefs,
878 __entry->res_bcount,
879 __entry->bcount,
880 __entry->blk_hardlimit,
881 __entry->blk_softlimit,
882 __entry->icount,
883 __entry->ino_hardlimit,
884 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000885)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000886
887#define DEFINE_DQUOT_EVENT(name) \
888DEFINE_EVENT(xfs_dquot_class, name, \
889 TP_PROTO(struct xfs_dquot *dqp), \
890 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000891DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000892DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
893DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000894DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
895DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000896DEFINE_DQUOT_EVENT(xfs_dqattach_found);
897DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000898DEFINE_DQUOT_EVENT(xfs_dqalloc);
899DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
900DEFINE_DQUOT_EVENT(xfs_dqread);
901DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000902DEFINE_DQUOT_EVENT(xfs_dqget_hit);
903DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000904DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
905DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000906DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000907DEFINE_DQUOT_EVENT(xfs_dqput_free);
908DEFINE_DQUOT_EVENT(xfs_dqrele);
909DEFINE_DQUOT_EVENT(xfs_dqflush);
910DEFINE_DQUOT_EVENT(xfs_dqflush_force);
911DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000912
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000913DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500914 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000915 TP_ARGS(log, tic),
916 TP_STRUCT__entry(
917 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000918 __field(char, ocnt)
919 __field(char, cnt)
920 __field(int, curr_res)
921 __field(int, unit_res)
922 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100923 __field(int, reserveq)
924 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000925 __field(int, grant_reserve_cycle)
926 __field(int, grant_reserve_bytes)
927 __field(int, grant_write_cycle)
928 __field(int, grant_write_bytes)
929 __field(int, curr_cycle)
930 __field(int, curr_block)
931 __field(xfs_lsn_t, tail_lsn)
932 ),
933 TP_fast_assign(
934 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000935 __entry->ocnt = tic->t_ocnt;
936 __entry->cnt = tic->t_cnt;
937 __entry->curr_res = tic->t_curr_res;
938 __entry->unit_res = tic->t_unit_res;
939 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000940 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
941 __entry->writeq = list_empty(&log->l_write_head.waiters);
942 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100943 &__entry->grant_reserve_cycle,
944 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000945 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100946 &__entry->grant_write_cycle,
947 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000948 __entry->curr_cycle = log->l_curr_cycle;
949 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100950 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000951 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000952 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100953 "t_unit_res %u t_flags %s reserveq %s "
954 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000955 "grant_reserve_bytes %d grant_write_cycle %d "
956 "grant_write_bytes %d curr_cycle %d curr_block %d "
957 "tail_cycle %d tail_block %d",
958 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000959 __entry->ocnt,
960 __entry->cnt,
961 __entry->curr_res,
962 __entry->unit_res,
963 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100964 __entry->reserveq ? "empty" : "active",
965 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000966 __entry->grant_reserve_cycle,
967 __entry->grant_reserve_bytes,
968 __entry->grant_write_cycle,
969 __entry->grant_write_bytes,
970 __entry->curr_cycle,
971 __entry->curr_block,
972 CYCLE_LSN(__entry->tail_lsn),
973 BLOCK_LSN(__entry->tail_lsn)
974 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000975)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000976
977#define DEFINE_LOGGRANT_EVENT(name) \
978DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500979 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000980 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000981DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
982DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000983DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +0000984DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
985DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +1100986DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +0000987DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
988DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
989DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
990DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000991DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
992DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
993DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
994DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
995DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
996DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
997
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000998DECLARE_EVENT_CLASS(xfs_log_item_class,
999 TP_PROTO(struct xfs_log_item *lip),
1000 TP_ARGS(lip),
1001 TP_STRUCT__entry(
1002 __field(dev_t, dev)
1003 __field(void *, lip)
1004 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001005 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001006 __field(xfs_lsn_t, lsn)
1007 ),
1008 TP_fast_assign(
1009 __entry->dev = lip->li_mountp->m_super->s_dev;
1010 __entry->lip = lip;
1011 __entry->type = lip->li_type;
1012 __entry->flags = lip->li_flags;
1013 __entry->lsn = lip->li_lsn;
1014 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001015 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001016 MAJOR(__entry->dev), MINOR(__entry->dev),
1017 __entry->lip,
1018 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1019 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1020 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1021)
1022
Dave Chinner14c26c62012-04-24 16:33:31 +10001023TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001024 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1025 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001026 TP_STRUCT__entry(
1027 __field(dev_t, dev)
1028 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001029 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001030 ),
1031 TP_fast_assign(
1032 __entry->dev = mp->m_super->s_dev;
1033 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001034 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001035 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001036 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001037 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001038 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001039)
1040
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001041#define DEFINE_LOG_ITEM_EVENT(name) \
1042DEFINE_EVENT(xfs_log_item_class, name, \
1043 TP_PROTO(struct xfs_log_item *lip), \
1044 TP_ARGS(lip))
1045DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001046DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1047DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001048DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001049
Dave Chinner750b9c92013-11-01 15:27:18 +11001050DECLARE_EVENT_CLASS(xfs_ail_class,
1051 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1052 TP_ARGS(lip, old_lsn, new_lsn),
1053 TP_STRUCT__entry(
1054 __field(dev_t, dev)
1055 __field(void *, lip)
1056 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001057 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001058 __field(xfs_lsn_t, old_lsn)
1059 __field(xfs_lsn_t, new_lsn)
1060 ),
1061 TP_fast_assign(
1062 __entry->dev = lip->li_mountp->m_super->s_dev;
1063 __entry->lip = lip;
1064 __entry->type = lip->li_type;
1065 __entry->flags = lip->li_flags;
1066 __entry->old_lsn = old_lsn;
1067 __entry->new_lsn = new_lsn;
1068 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001069 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 +11001070 MAJOR(__entry->dev), MINOR(__entry->dev),
1071 __entry->lip,
1072 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1073 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1074 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1075 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1076)
1077
1078#define DEFINE_AIL_EVENT(name) \
1079DEFINE_EVENT(xfs_ail_class, name, \
1080 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1081 TP_ARGS(lip, old_lsn, new_lsn))
1082DEFINE_AIL_EVENT(xfs_ail_insert);
1083DEFINE_AIL_EVENT(xfs_ail_move);
1084DEFINE_AIL_EVENT(xfs_ail_delete);
1085
1086TRACE_EVENT(xfs_log_assign_tail_lsn,
1087 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1088 TP_ARGS(log, new_lsn),
1089 TP_STRUCT__entry(
1090 __field(dev_t, dev)
1091 __field(xfs_lsn_t, new_lsn)
1092 __field(xfs_lsn_t, old_lsn)
1093 __field(xfs_lsn_t, last_sync_lsn)
1094 ),
1095 TP_fast_assign(
1096 __entry->dev = log->l_mp->m_super->s_dev;
1097 __entry->new_lsn = new_lsn;
1098 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1099 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1100 ),
1101 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1102 MAJOR(__entry->dev), MINOR(__entry->dev),
1103 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1104 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1105 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1106)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001107
Li Zefanf8adb4d2010-05-24 08:25:57 +00001108DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001109 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1110 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001111 TP_STRUCT__entry(
1112 __field(dev_t, dev)
1113 __field(xfs_ino_t, ino)
1114 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001115 __field(loff_t, offset)
1116 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001117 ),
1118 TP_fast_assign(
1119 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1120 __entry->ino = ip->i_ino;
1121 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001122 __entry->offset = offset;
1123 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001124 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001125 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001126 MAJOR(__entry->dev), MINOR(__entry->dev),
1127 __entry->ino,
1128 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001129 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001130 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001131)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001132
1133#define DEFINE_RW_EVENT(name) \
1134DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001135 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1136 TP_ARGS(ip, count, offset))
1137DEFINE_RW_EVENT(xfs_file_buffered_read);
1138DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001139DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001140DEFINE_RW_EVENT(xfs_file_buffered_write);
1141DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001142DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001143
Li Zefanf8adb4d2010-05-24 08:25:57 +00001144DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001145 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1146 unsigned int len),
1147 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001148 TP_STRUCT__entry(
1149 __field(dev_t, dev)
1150 __field(xfs_ino_t, ino)
1151 __field(pgoff_t, pgoff)
1152 __field(loff_t, size)
1153 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001154 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001155 ),
1156 TP_fast_assign(
Li Zefanf8adb4d2010-05-24 08:25:57 +00001157 __entry->dev = inode->i_sb->s_dev;
1158 __entry->ino = XFS_I(inode)->i_ino;
1159 __entry->pgoff = page_offset(page);
1160 __entry->size = i_size_read(inode);
1161 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001162 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001163 ),
1164 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001165 "length %x",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001166 MAJOR(__entry->dev), MINOR(__entry->dev),
1167 __entry->ino,
1168 __entry->pgoff,
1169 __entry->size,
1170 __entry->offset,
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001171 __entry->length)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001172)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001173
1174#define DEFINE_PAGE_EVENT(name) \
1175DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001176 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1177 unsigned int len), \
1178 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001179DEFINE_PAGE_EVENT(xfs_writepage);
1180DEFINE_PAGE_EVENT(xfs_releasepage);
1181DEFINE_PAGE_EVENT(xfs_invalidatepage);
1182
Dave Chinner121e2132016-01-08 11:28:35 +11001183DECLARE_EVENT_CLASS(xfs_readpage_class,
1184 TP_PROTO(struct inode *inode, int nr_pages),
1185 TP_ARGS(inode, nr_pages),
1186 TP_STRUCT__entry(
1187 __field(dev_t, dev)
1188 __field(xfs_ino_t, ino)
1189 __field(int, nr_pages)
1190 ),
1191 TP_fast_assign(
1192 __entry->dev = inode->i_sb->s_dev;
1193 __entry->ino = inode->i_ino;
1194 __entry->nr_pages = nr_pages;
1195 ),
1196 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1197 MAJOR(__entry->dev), MINOR(__entry->dev),
1198 __entry->ino,
1199 __entry->nr_pages)
1200)
1201
1202#define DEFINE_READPAGE_EVENT(name) \
1203DEFINE_EVENT(xfs_readpage_class, name, \
1204 TP_PROTO(struct inode *inode, int nr_pages), \
1205 TP_ARGS(inode, nr_pages))
1206DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1207DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1208
Christoph Hellwiga206c812010-12-10 08:42:20 +00001209DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001210 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001211 int type, struct xfs_bmbt_irec *irec),
1212 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001213 TP_STRUCT__entry(
1214 __field(dev_t, dev)
1215 __field(xfs_ino_t, ino)
1216 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001217 __field(loff_t, offset)
1218 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001219 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001220 __field(xfs_fileoff_t, startoff)
1221 __field(xfs_fsblock_t, startblock)
1222 __field(xfs_filblks_t, blockcount)
1223 ),
1224 TP_fast_assign(
1225 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1226 __entry->ino = ip->i_ino;
1227 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001228 __entry->offset = offset;
1229 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001230 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001231 __entry->startoff = irec ? irec->br_startoff : 0;
1232 __entry->startblock = irec ? irec->br_startblock : 0;
1233 __entry->blockcount = irec ? irec->br_blockcount : 0;
1234 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001235 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1236 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001237 MAJOR(__entry->dev), MINOR(__entry->dev),
1238 __entry->ino,
1239 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001240 __entry->offset,
1241 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001242 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001243 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001244 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001245 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001246)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001247
1248#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001249DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001250 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001251 int type, struct xfs_bmbt_irec *irec), \
1252 TP_ARGS(ip, offset, count, type, irec))
1253DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1254DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001255DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1256DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001257
Li Zefanf8adb4d2010-05-24 08:25:57 +00001258DECLARE_EVENT_CLASS(xfs_simple_io_class,
1259 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1260 TP_ARGS(ip, offset, count),
1261 TP_STRUCT__entry(
1262 __field(dev_t, dev)
1263 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001264 __field(loff_t, isize)
1265 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001266 __field(loff_t, offset)
1267 __field(size_t, count)
1268 ),
1269 TP_fast_assign(
1270 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1271 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001272 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001273 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001274 __entry->offset = offset;
1275 __entry->count = count;
1276 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001277 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001278 "offset 0x%llx count %zd",
1279 MAJOR(__entry->dev), MINOR(__entry->dev),
1280 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001281 __entry->isize,
1282 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001283 __entry->offset,
1284 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001285);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001286
1287#define DEFINE_SIMPLE_IO_EVENT(name) \
1288DEFINE_EVENT(xfs_simple_io_class, name, \
1289 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1290 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001291DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1292DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001293DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001294DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001295DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1296DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1297DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001298
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001299DECLARE_EVENT_CLASS(xfs_itrunc_class,
1300 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1301 TP_ARGS(ip, new_size),
1302 TP_STRUCT__entry(
1303 __field(dev_t, dev)
1304 __field(xfs_ino_t, ino)
1305 __field(xfs_fsize_t, size)
1306 __field(xfs_fsize_t, new_size)
1307 ),
1308 TP_fast_assign(
1309 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1310 __entry->ino = ip->i_ino;
1311 __entry->size = ip->i_d.di_size;
1312 __entry->new_size = new_size;
1313 ),
1314 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1315 MAJOR(__entry->dev), MINOR(__entry->dev),
1316 __entry->ino,
1317 __entry->size,
1318 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001319)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001320
1321#define DEFINE_ITRUNC_EVENT(name) \
1322DEFINE_EVENT(xfs_itrunc_class, name, \
1323 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1324 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001325DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1326DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001327
1328TRACE_EVENT(xfs_pagecache_inval,
1329 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1330 TP_ARGS(ip, start, finish),
1331 TP_STRUCT__entry(
1332 __field(dev_t, dev)
1333 __field(xfs_ino_t, ino)
1334 __field(xfs_fsize_t, size)
1335 __field(xfs_off_t, start)
1336 __field(xfs_off_t, finish)
1337 ),
1338 TP_fast_assign(
1339 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1340 __entry->ino = ip->i_ino;
1341 __entry->size = ip->i_d.di_size;
1342 __entry->start = start;
1343 __entry->finish = finish;
1344 ),
1345 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1346 MAJOR(__entry->dev), MINOR(__entry->dev),
1347 __entry->ino,
1348 __entry->size,
1349 __entry->start,
1350 __entry->finish)
1351);
1352
1353TRACE_EVENT(xfs_bunmap,
1354 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1355 int flags, unsigned long caller_ip),
1356 TP_ARGS(ip, bno, len, flags, caller_ip),
1357 TP_STRUCT__entry(
1358 __field(dev_t, dev)
1359 __field(xfs_ino_t, ino)
1360 __field(xfs_fsize_t, size)
1361 __field(xfs_fileoff_t, bno)
1362 __field(xfs_filblks_t, len)
1363 __field(unsigned long, caller_ip)
1364 __field(int, flags)
1365 ),
1366 TP_fast_assign(
1367 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1368 __entry->ino = ip->i_ino;
1369 __entry->size = ip->i_d.di_size;
1370 __entry->bno = bno;
1371 __entry->len = len;
1372 __entry->caller_ip = caller_ip;
1373 __entry->flags = flags;
1374 ),
1375 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001376 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001377 MAJOR(__entry->dev), MINOR(__entry->dev),
1378 __entry->ino,
1379 __entry->size,
1380 __entry->bno,
1381 __entry->len,
1382 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1383 (void *)__entry->caller_ip)
1384
1385);
1386
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001387DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001388 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1389 xfs_agblock_t agbno, xfs_extlen_t len),
1390 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001391 TP_STRUCT__entry(
1392 __field(dev_t, dev)
1393 __field(xfs_agnumber_t, agno)
1394 __field(xfs_agblock_t, agbno)
1395 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001396 ),
1397 TP_fast_assign(
1398 __entry->dev = mp->m_super->s_dev;
1399 __entry->agno = agno;
1400 __entry->agbno = agbno;
1401 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001402 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001403 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001404 MAJOR(__entry->dev), MINOR(__entry->dev),
1405 __entry->agno,
1406 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001407 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001408);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001409#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001410DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001411 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1412 xfs_agblock_t agbno, xfs_extlen_t len), \
1413 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001414DEFINE_BUSY_EVENT(xfs_extent_busy);
1415DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1416DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1417DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1418DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001419
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001420TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001421 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1422 xfs_agblock_t agbno, xfs_extlen_t len,
1423 xfs_agblock_t tbno, xfs_extlen_t tlen),
1424 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1425 TP_STRUCT__entry(
1426 __field(dev_t, dev)
1427 __field(xfs_agnumber_t, agno)
1428 __field(xfs_agblock_t, agbno)
1429 __field(xfs_extlen_t, len)
1430 __field(xfs_agblock_t, tbno)
1431 __field(xfs_extlen_t, tlen)
1432 ),
1433 TP_fast_assign(
1434 __entry->dev = mp->m_super->s_dev;
1435 __entry->agno = agno;
1436 __entry->agbno = agbno;
1437 __entry->len = len;
1438 __entry->tbno = tbno;
1439 __entry->tlen = tlen;
1440 ),
1441 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1442 MAJOR(__entry->dev), MINOR(__entry->dev),
1443 __entry->agno,
1444 __entry->agbno,
1445 __entry->len,
1446 __entry->tbno,
1447 __entry->tlen)
1448);
1449
Brian Fostera27ba262018-03-15 10:51:58 -07001450DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001451 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1452 unsigned long caller_ip),
1453 TP_ARGS(mp, agf, flags, caller_ip),
1454 TP_STRUCT__entry(
1455 __field(dev_t, dev)
1456 __field(xfs_agnumber_t, agno)
1457 __field(int, flags)
1458 __field(__u32, length)
1459 __field(__u32, bno_root)
1460 __field(__u32, cnt_root)
1461 __field(__u32, bno_level)
1462 __field(__u32, cnt_level)
1463 __field(__u32, flfirst)
1464 __field(__u32, fllast)
1465 __field(__u32, flcount)
1466 __field(__u32, freeblks)
1467 __field(__u32, longest)
1468 __field(unsigned long, caller_ip)
1469 ),
1470 TP_fast_assign(
1471 __entry->dev = mp->m_super->s_dev;
1472 __entry->agno = be32_to_cpu(agf->agf_seqno),
1473 __entry->flags = flags;
1474 __entry->length = be32_to_cpu(agf->agf_length),
1475 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1476 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1477 __entry->bno_level =
1478 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1479 __entry->cnt_level =
1480 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1481 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1482 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1483 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1484 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1485 __entry->longest = be32_to_cpu(agf->agf_longest);
1486 __entry->caller_ip = caller_ip;
1487 ),
1488 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1489 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001490 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001491 MAJOR(__entry->dev), MINOR(__entry->dev),
1492 __entry->agno,
1493 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1494 __entry->length,
1495 __entry->bno_root,
1496 __entry->cnt_root,
1497 __entry->bno_level,
1498 __entry->cnt_level,
1499 __entry->flfirst,
1500 __entry->fllast,
1501 __entry->flcount,
1502 __entry->freeblks,
1503 __entry->longest,
1504 (void *)__entry->caller_ip)
1505);
Brian Fostera27ba262018-03-15 10:51:58 -07001506#define DEFINE_AGF_EVENT(name) \
1507DEFINE_EVENT(xfs_agf_class, name, \
1508 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1509 unsigned long caller_ip), \
1510 TP_ARGS(mp, agf, flags, caller_ip))
1511DEFINE_AGF_EVENT(xfs_agf);
1512DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001513
1514TRACE_EVENT(xfs_free_extent,
1515 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001516 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1517 int haveright),
1518 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001519 TP_STRUCT__entry(
1520 __field(dev_t, dev)
1521 __field(xfs_agnumber_t, agno)
1522 __field(xfs_agblock_t, agbno)
1523 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001524 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001525 __field(int, haveleft)
1526 __field(int, haveright)
1527 ),
1528 TP_fast_assign(
1529 __entry->dev = mp->m_super->s_dev;
1530 __entry->agno = agno;
1531 __entry->agbno = agbno;
1532 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001533 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001534 __entry->haveleft = haveleft;
1535 __entry->haveright = haveright;
1536 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001537 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001538 MAJOR(__entry->dev), MINOR(__entry->dev),
1539 __entry->agno,
1540 __entry->agbno,
1541 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001542 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001543 __entry->haveleft ?
1544 (__entry->haveright ? "both" : "left") :
1545 (__entry->haveright ? "right" : "none"))
1546
1547);
1548
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001549DECLARE_EVENT_CLASS(xfs_alloc_class,
1550 TP_PROTO(struct xfs_alloc_arg *args),
1551 TP_ARGS(args),
1552 TP_STRUCT__entry(
1553 __field(dev_t, dev)
1554 __field(xfs_agnumber_t, agno)
1555 __field(xfs_agblock_t, agbno)
1556 __field(xfs_extlen_t, minlen)
1557 __field(xfs_extlen_t, maxlen)
1558 __field(xfs_extlen_t, mod)
1559 __field(xfs_extlen_t, prod)
1560 __field(xfs_extlen_t, minleft)
1561 __field(xfs_extlen_t, total)
1562 __field(xfs_extlen_t, alignment)
1563 __field(xfs_extlen_t, minalignslop)
1564 __field(xfs_extlen_t, len)
1565 __field(short, type)
1566 __field(short, otype)
1567 __field(char, wasdel)
1568 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001569 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001570 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001571 __field(xfs_fsblock_t, firstblock)
1572 ),
1573 TP_fast_assign(
1574 __entry->dev = args->mp->m_super->s_dev;
1575 __entry->agno = args->agno;
1576 __entry->agbno = args->agbno;
1577 __entry->minlen = args->minlen;
1578 __entry->maxlen = args->maxlen;
1579 __entry->mod = args->mod;
1580 __entry->prod = args->prod;
1581 __entry->minleft = args->minleft;
1582 __entry->total = args->total;
1583 __entry->alignment = args->alignment;
1584 __entry->minalignslop = args->minalignslop;
1585 __entry->len = args->len;
1586 __entry->type = args->type;
1587 __entry->otype = args->otype;
1588 __entry->wasdel = args->wasdel;
1589 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001590 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001591 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001592 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001593 ),
1594 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1595 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001596 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001597 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001598 MAJOR(__entry->dev), MINOR(__entry->dev),
1599 __entry->agno,
1600 __entry->agbno,
1601 __entry->minlen,
1602 __entry->maxlen,
1603 __entry->mod,
1604 __entry->prod,
1605 __entry->minleft,
1606 __entry->total,
1607 __entry->alignment,
1608 __entry->minalignslop,
1609 __entry->len,
1610 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1611 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1612 __entry->wasdel,
1613 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001614 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001615 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001616 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001617)
1618
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001619#define DEFINE_ALLOC_EVENT(name) \
1620DEFINE_EVENT(xfs_alloc_class, name, \
1621 TP_PROTO(struct xfs_alloc_arg *args), \
1622 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001623DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001624DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001625DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1626DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1627DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1628DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1629DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1630DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001631DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1632DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001633DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1634DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1635DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1636DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1637DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001638DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001639DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1640DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1641DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1642DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1643DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1644DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1645DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1646DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1647DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1648
Dave Chinner5a5881c2012-03-22 05:15:13 +00001649DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001650 TP_PROTO(struct xfs_da_args *args),
1651 TP_ARGS(args),
1652 TP_STRUCT__entry(
1653 __field(dev_t, dev)
1654 __field(xfs_ino_t, ino)
1655 __dynamic_array(char, name, args->namelen)
1656 __field(int, namelen)
1657 __field(xfs_dahash_t, hashval)
1658 __field(xfs_ino_t, inumber)
1659 __field(int, op_flags)
1660 ),
1661 TP_fast_assign(
1662 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1663 __entry->ino = args->dp->i_ino;
1664 if (args->namelen)
1665 memcpy(__get_str(name), args->name, args->namelen);
1666 __entry->namelen = args->namelen;
1667 __entry->hashval = args->hashval;
1668 __entry->inumber = args->inumber;
1669 __entry->op_flags = args->op_flags;
1670 ),
1671 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1672 "inumber 0x%llx op_flags %s",
1673 MAJOR(__entry->dev), MINOR(__entry->dev),
1674 __entry->ino,
1675 __entry->namelen,
1676 __entry->namelen ? __get_str(name) : NULL,
1677 __entry->namelen,
1678 __entry->hashval,
1679 __entry->inumber,
1680 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001681)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001682
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001683#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001684DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001685 TP_PROTO(struct xfs_da_args *args), \
1686 TP_ARGS(args))
1687DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1688DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1689DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1690DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1691DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1692DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1693DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1694DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1695DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1696DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1697DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1698DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1699DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1700DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1701DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1702DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1703DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1704DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1705DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1706DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1707DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1708DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1709DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1710DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1711DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1712
Dave Chinneree732592012-11-12 22:53:53 +11001713DECLARE_EVENT_CLASS(xfs_attr_class,
1714 TP_PROTO(struct xfs_da_args *args),
1715 TP_ARGS(args),
1716 TP_STRUCT__entry(
1717 __field(dev_t, dev)
1718 __field(xfs_ino_t, ino)
1719 __dynamic_array(char, name, args->namelen)
1720 __field(int, namelen)
1721 __field(int, valuelen)
1722 __field(xfs_dahash_t, hashval)
Eric Sandeene4435232018-04-17 17:17:35 -07001723 __field(int, flags)
Dave Chinneree732592012-11-12 22:53:53 +11001724 __field(int, op_flags)
1725 ),
1726 TP_fast_assign(
1727 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1728 __entry->ino = args->dp->i_ino;
1729 if (args->namelen)
1730 memcpy(__get_str(name), args->name, args->namelen);
1731 __entry->namelen = args->namelen;
1732 __entry->valuelen = args->valuelen;
1733 __entry->hashval = args->hashval;
Eric Sandeene4435232018-04-17 17:17:35 -07001734 __entry->flags = args->flags;
Dave Chinneree732592012-11-12 22:53:53 +11001735 __entry->op_flags = args->op_flags;
1736 ),
1737 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Eric Sandeene4435232018-04-17 17:17:35 -07001738 "hashval 0x%x flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001739 MAJOR(__entry->dev), MINOR(__entry->dev),
1740 __entry->ino,
1741 __entry->namelen,
1742 __entry->namelen ? __get_str(name) : NULL,
1743 __entry->namelen,
1744 __entry->valuelen,
1745 __entry->hashval,
Eric Sandeene4435232018-04-17 17:17:35 -07001746 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
Dave Chinneree732592012-11-12 22:53:53 +11001747 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1748)
1749
Dave Chinner5a5881c2012-03-22 05:15:13 +00001750#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001751DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001752 TP_PROTO(struct xfs_da_args *args), \
1753 TP_ARGS(args))
1754DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1755DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1756DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1757DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1758DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001759DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1760
1761DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1762DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1763DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001764DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001765DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1766DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001767DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1768DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001769DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1770DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001771DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001772DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1773DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1774DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1775DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1776DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1777DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1778DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1779DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1780DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1782DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001783DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001784
1785DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001786DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001787DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1788DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1789
Dave Chinneree732592012-11-12 22:53:53 +11001790DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1791DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1792
1793DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1794DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1795DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1796
Dave Chinner5a5881c2012-03-22 05:15:13 +00001797#define DEFINE_DA_EVENT(name) \
1798DEFINE_EVENT(xfs_da_class, name, \
1799 TP_PROTO(struct xfs_da_args *args), \
1800 TP_ARGS(args))
1801DEFINE_DA_EVENT(xfs_da_split);
1802DEFINE_DA_EVENT(xfs_da_join);
1803DEFINE_DA_EVENT(xfs_da_link_before);
1804DEFINE_DA_EVENT(xfs_da_link_after);
1805DEFINE_DA_EVENT(xfs_da_unlink_back);
1806DEFINE_DA_EVENT(xfs_da_unlink_forward);
1807DEFINE_DA_EVENT(xfs_da_root_split);
1808DEFINE_DA_EVENT(xfs_da_root_join);
1809DEFINE_DA_EVENT(xfs_da_node_add);
1810DEFINE_DA_EVENT(xfs_da_node_create);
1811DEFINE_DA_EVENT(xfs_da_node_split);
1812DEFINE_DA_EVENT(xfs_da_node_remove);
1813DEFINE_DA_EVENT(xfs_da_node_rebalance);
1814DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001815DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001816DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1817DEFINE_DA_EVENT(xfs_da_grow_inode);
1818DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001819DEFINE_DA_EVENT(xfs_da_fixhashpath);
1820DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001821
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001822DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1823 TP_PROTO(struct xfs_da_args *args, int idx),
1824 TP_ARGS(args, idx),
1825 TP_STRUCT__entry(
1826 __field(dev_t, dev)
1827 __field(xfs_ino_t, ino)
1828 __field(int, op_flags)
1829 __field(int, idx)
1830 ),
1831 TP_fast_assign(
1832 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1833 __entry->ino = args->dp->i_ino;
1834 __entry->op_flags = args->op_flags;
1835 __entry->idx = idx;
1836 ),
1837 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1838 MAJOR(__entry->dev), MINOR(__entry->dev),
1839 __entry->ino,
1840 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1841 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001842)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001843
1844#define DEFINE_DIR2_SPACE_EVENT(name) \
1845DEFINE_EVENT(xfs_dir2_space_class, name, \
1846 TP_PROTO(struct xfs_da_args *args, int idx), \
1847 TP_ARGS(args, idx))
1848DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1849DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1850DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1851DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001852
1853TRACE_EVENT(xfs_dir2_leafn_moveents,
1854 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1855 TP_ARGS(args, src_idx, dst_idx, count),
1856 TP_STRUCT__entry(
1857 __field(dev_t, dev)
1858 __field(xfs_ino_t, ino)
1859 __field(int, op_flags)
1860 __field(int, src_idx)
1861 __field(int, dst_idx)
1862 __field(int, count)
1863 ),
1864 TP_fast_assign(
1865 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1866 __entry->ino = args->dp->i_ino;
1867 __entry->op_flags = args->op_flags;
1868 __entry->src_idx = src_idx;
1869 __entry->dst_idx = dst_idx;
1870 __entry->count = count;
1871 ),
1872 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1873 "src_idx %d dst_idx %d count %d",
1874 MAJOR(__entry->dev), MINOR(__entry->dev),
1875 __entry->ino,
1876 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1877 __entry->src_idx,
1878 __entry->dst_idx,
1879 __entry->count)
1880);
1881
Dave Chinner3a85cd92010-01-14 01:33:55 +00001882#define XFS_SWAPEXT_INODES \
1883 { 0, "target" }, \
1884 { 1, "temp" }
1885
1886#define XFS_INODE_FORMAT_STR \
1887 { 0, "invalid" }, \
1888 { 1, "local" }, \
1889 { 2, "extent" }, \
1890 { 3, "btree" }
1891
1892DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1893 TP_PROTO(struct xfs_inode *ip, int which),
1894 TP_ARGS(ip, which),
1895 TP_STRUCT__entry(
1896 __field(dev_t, dev)
1897 __field(int, which)
1898 __field(xfs_ino_t, ino)
1899 __field(int, format)
1900 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001901 __field(int, broot_size)
1902 __field(int, fork_off)
1903 ),
1904 TP_fast_assign(
1905 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1906 __entry->which = which;
1907 __entry->ino = ip->i_ino;
1908 __entry->format = ip->i_d.di_format;
1909 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001910 __entry->broot_size = ip->i_df.if_broot_bytes;
1911 __entry->fork_off = XFS_IFORK_BOFF(ip);
1912 ),
1913 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001914 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001915 MAJOR(__entry->dev), MINOR(__entry->dev),
1916 __entry->ino,
1917 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1918 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1919 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001920 __entry->broot_size,
1921 __entry->fork_off)
1922)
1923
1924#define DEFINE_SWAPEXT_EVENT(name) \
1925DEFINE_EVENT(xfs_swap_extent_class, name, \
1926 TP_PROTO(struct xfs_inode *ip, int which), \
1927 TP_ARGS(ip, which))
1928
1929DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1930DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1931
Brian Fostere67d3d42017-08-08 18:21:53 -07001932TRACE_EVENT(xfs_log_recover,
1933 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1934 TP_ARGS(log, headblk, tailblk),
1935 TP_STRUCT__entry(
1936 __field(dev_t, dev)
1937 __field(xfs_daddr_t, headblk)
1938 __field(xfs_daddr_t, tailblk)
1939 ),
1940 TP_fast_assign(
1941 __entry->dev = log->l_mp->m_super->s_dev;
1942 __entry->headblk = headblk;
1943 __entry->tailblk = tailblk;
1944 ),
1945 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1946 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1947 __entry->tailblk)
1948)
1949
Brian Foster5cd9cee2016-09-26 08:34:52 +10001950TRACE_EVENT(xfs_log_recover_record,
1951 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1952 TP_ARGS(log, rhead, pass),
1953 TP_STRUCT__entry(
1954 __field(dev_t, dev)
1955 __field(xfs_lsn_t, lsn)
1956 __field(int, len)
1957 __field(int, num_logops)
1958 __field(int, pass)
1959 ),
1960 TP_fast_assign(
1961 __entry->dev = log->l_mp->m_super->s_dev;
1962 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1963 __entry->len = be32_to_cpu(rhead->h_len);
1964 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1965 __entry->pass = pass;
1966 ),
1967 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1968 MAJOR(__entry->dev), MINOR(__entry->dev),
1969 __entry->lsn, __entry->len, __entry->num_logops,
1970 __entry->pass)
1971)
1972
Dave Chinner9abbc532010-04-13 15:06:46 +10001973DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001974 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001975 struct xlog_recover_item *item, int pass),
1976 TP_ARGS(log, trans, item, pass),
1977 TP_STRUCT__entry(
1978 __field(dev_t, dev)
1979 __field(unsigned long, item)
1980 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001981 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10001982 __field(int, type)
1983 __field(int, pass)
1984 __field(int, count)
1985 __field(int, total)
1986 ),
1987 TP_fast_assign(
1988 __entry->dev = log->l_mp->m_super->s_dev;
1989 __entry->item = (unsigned long)item;
1990 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10001991 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10001992 __entry->type = ITEM_TYPE(item);
1993 __entry->pass = pass;
1994 __entry->count = item->ri_cnt;
1995 __entry->total = item->ri_total;
1996 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001997 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10001998 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10001999 MAJOR(__entry->dev), MINOR(__entry->dev),
2000 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002001 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002002 __entry->pass,
2003 (void *)__entry->item,
2004 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2005 __entry->count,
2006 __entry->total)
2007)
2008
2009#define DEFINE_LOG_RECOVER_ITEM(name) \
2010DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002011 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002012 struct xlog_recover_item *item, int pass), \
2013 TP_ARGS(log, trans, item, pass))
2014
2015DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2016DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2017DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2018DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2019DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2020
2021DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002022 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002023 TP_ARGS(log, buf_f),
2024 TP_STRUCT__entry(
2025 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002026 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002027 __field(unsigned short, len)
2028 __field(unsigned short, flags)
2029 __field(unsigned short, size)
2030 __field(unsigned int, map_size)
2031 ),
2032 TP_fast_assign(
2033 __entry->dev = log->l_mp->m_super->s_dev;
2034 __entry->blkno = buf_f->blf_blkno;
2035 __entry->len = buf_f->blf_len;
2036 __entry->flags = buf_f->blf_flags;
2037 __entry->size = buf_f->blf_size;
2038 __entry->map_size = buf_f->blf_map_size;
2039 ),
2040 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2041 "map_size %d",
2042 MAJOR(__entry->dev), MINOR(__entry->dev),
2043 __entry->blkno,
2044 __entry->len,
2045 __entry->flags,
2046 __entry->size,
2047 __entry->map_size)
2048)
2049
2050#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2051DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002052 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002053 TP_ARGS(log, buf_f))
2054
2055DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2056DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2057DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2058DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2059DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002060DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002061DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2062DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2063DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2064
2065DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002066 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002067 TP_ARGS(log, in_f),
2068 TP_STRUCT__entry(
2069 __field(dev_t, dev)
2070 __field(xfs_ino_t, ino)
2071 __field(unsigned short, size)
2072 __field(int, fields)
2073 __field(unsigned short, asize)
2074 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002075 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002076 __field(int, len)
2077 __field(int, boffset)
2078 ),
2079 TP_fast_assign(
2080 __entry->dev = log->l_mp->m_super->s_dev;
2081 __entry->ino = in_f->ilf_ino;
2082 __entry->size = in_f->ilf_size;
2083 __entry->fields = in_f->ilf_fields;
2084 __entry->asize = in_f->ilf_asize;
2085 __entry->dsize = in_f->ilf_dsize;
2086 __entry->blkno = in_f->ilf_blkno;
2087 __entry->len = in_f->ilf_len;
2088 __entry->boffset = in_f->ilf_boffset;
2089 ),
2090 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2091 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2092 MAJOR(__entry->dev), MINOR(__entry->dev),
2093 __entry->ino,
2094 __entry->size,
2095 __entry->fields,
2096 __entry->asize,
2097 __entry->dsize,
2098 __entry->blkno,
2099 __entry->len,
2100 __entry->boffset)
2101)
2102#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2103DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002104 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002105 TP_ARGS(log, in_f))
2106
2107DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2108DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2109DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2110
Brian Foster78d57e42015-08-19 09:58:48 +10002111DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2112 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2113 TP_ARGS(log, in_f),
2114 TP_STRUCT__entry(
2115 __field(dev_t, dev)
2116 __field(xfs_agnumber_t, agno)
2117 __field(xfs_agblock_t, agbno)
2118 __field(unsigned int, count)
2119 __field(unsigned int, isize)
2120 __field(xfs_agblock_t, length)
2121 __field(unsigned int, gen)
2122 ),
2123 TP_fast_assign(
2124 __entry->dev = log->l_mp->m_super->s_dev;
2125 __entry->agno = be32_to_cpu(in_f->icl_ag);
2126 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2127 __entry->count = be32_to_cpu(in_f->icl_count);
2128 __entry->isize = be32_to_cpu(in_f->icl_isize);
2129 __entry->length = be32_to_cpu(in_f->icl_length);
2130 __entry->gen = be32_to_cpu(in_f->icl_gen);
2131 ),
2132 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2133 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2134 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2135 __entry->length, __entry->gen)
2136)
2137#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2138DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2139 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2140 TP_ARGS(log, in_f))
2141
2142DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2143DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2144
Christoph Hellwiga46db602011-01-07 13:02:04 +00002145DECLARE_EVENT_CLASS(xfs_discard_class,
2146 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2147 xfs_agblock_t agbno, xfs_extlen_t len),
2148 TP_ARGS(mp, agno, agbno, len),
2149 TP_STRUCT__entry(
2150 __field(dev_t, dev)
2151 __field(xfs_agnumber_t, agno)
2152 __field(xfs_agblock_t, agbno)
2153 __field(xfs_extlen_t, len)
2154 ),
2155 TP_fast_assign(
2156 __entry->dev = mp->m_super->s_dev;
2157 __entry->agno = agno;
2158 __entry->agbno = agbno;
2159 __entry->len = len;
2160 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002161 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002162 MAJOR(__entry->dev), MINOR(__entry->dev),
2163 __entry->agno,
2164 __entry->agbno,
2165 __entry->len)
2166)
2167
2168#define DEFINE_DISCARD_EVENT(name) \
2169DEFINE_EVENT(xfs_discard_class, name, \
2170 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2171 xfs_agblock_t agbno, xfs_extlen_t len), \
2172 TP_ARGS(mp, agno, agbno, len))
2173DEFINE_DISCARD_EVENT(xfs_discard_extent);
2174DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2175DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2176DEFINE_DISCARD_EVENT(xfs_discard_busy);
2177
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002178/* btree cursor events */
2179DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2180 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2181 TP_ARGS(cur, level, bp),
2182 TP_STRUCT__entry(
2183 __field(dev_t, dev)
2184 __field(xfs_btnum_t, btnum)
2185 __field(int, level)
2186 __field(int, nlevels)
2187 __field(int, ptr)
2188 __field(xfs_daddr_t, daddr)
2189 ),
2190 TP_fast_assign(
2191 __entry->dev = cur->bc_mp->m_super->s_dev;
2192 __entry->btnum = cur->bc_btnum;
2193 __entry->level = level;
2194 __entry->nlevels = cur->bc_nlevels;
2195 __entry->ptr = cur->bc_ptrs[level];
2196 __entry->daddr = bp ? bp->b_bn : -1;
2197 ),
2198 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2199 MAJOR(__entry->dev), MINOR(__entry->dev),
2200 __entry->btnum,
2201 __entry->level,
2202 __entry->nlevels,
2203 __entry->ptr,
2204 (unsigned long long)__entry->daddr)
2205)
2206
2207#define DEFINE_BTREE_CUR_EVENT(name) \
2208DEFINE_EVENT(xfs_btree_cur_class, name, \
2209 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2210 TP_ARGS(cur, level, bp))
2211DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002212DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002213
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002214/* deferred ops */
2215struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002216struct xfs_defer_ops;
2217
2218DECLARE_EVENT_CLASS(xfs_defer_class,
Dave Chinnere632a562018-05-09 07:48:52 -07002219 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop,
2220 unsigned long caller_ip),
2221 TP_ARGS(mp, dop, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002222 TP_STRUCT__entry(
2223 __field(dev_t, dev)
2224 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002225 __field(char, committed)
Dave Chinnere632a562018-05-09 07:48:52 -07002226 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002227 ),
2228 TP_fast_assign(
2229 __entry->dev = mp ? mp->m_super->s_dev : 0;
2230 __entry->dop = dop;
Dave Chinnere632a562018-05-09 07:48:52 -07002231 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002232 ),
Brian Foster1214f1c2018-08-01 07:20:31 -07002233 TP_printk("dev %d:%d ops %p caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002234 MAJOR(__entry->dev), MINOR(__entry->dev),
2235 __entry->dop,
Dave Chinnere632a562018-05-09 07:48:52 -07002236 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002237)
2238#define DEFINE_DEFER_EVENT(name) \
2239DEFINE_EVENT(xfs_defer_class, name, \
Dave Chinnere632a562018-05-09 07:48:52 -07002240 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, \
2241 unsigned long caller_ip), \
2242 TP_ARGS(mp, dop, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002243
2244DECLARE_EVENT_CLASS(xfs_defer_error_class,
2245 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2246 TP_ARGS(mp, dop, error),
2247 TP_STRUCT__entry(
2248 __field(dev_t, dev)
2249 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002250 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002251 __field(int, error)
2252 ),
2253 TP_fast_assign(
2254 __entry->dev = mp ? mp->m_super->s_dev : 0;
2255 __entry->dop = dop;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002256 __entry->error = error;
2257 ),
Brian Foster1214f1c2018-08-01 07:20:31 -07002258 TP_printk("dev %d:%d ops %p err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002259 MAJOR(__entry->dev), MINOR(__entry->dev),
2260 __entry->dop,
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002261 __entry->error)
2262)
2263#define DEFINE_DEFER_ERROR_EVENT(name) \
2264DEFINE_EVENT(xfs_defer_error_class, name, \
2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2266 TP_ARGS(mp, dop, error))
2267
2268DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2269 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2270 TP_ARGS(mp, dfp),
2271 TP_STRUCT__entry(
2272 __field(dev_t, dev)
2273 __field(int, type)
2274 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002275 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002276 __field(int, nr)
2277 ),
2278 TP_fast_assign(
2279 __entry->dev = mp ? mp->m_super->s_dev : 0;
2280 __entry->type = dfp->dfp_type->type;
2281 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002282 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002283 __entry->nr = dfp->dfp_count;
2284 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002285 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002286 MAJOR(__entry->dev), MINOR(__entry->dev),
2287 __entry->type,
2288 __entry->intent,
2289 __entry->committed,
2290 __entry->nr)
2291)
2292#define DEFINE_DEFER_PENDING_EVENT(name) \
2293DEFINE_EVENT(xfs_defer_pending_class, name, \
2294 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2295 TP_ARGS(mp, dfp))
2296
2297DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2298 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2299 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2300 TP_ARGS(mp, agno, type, agbno, len),
2301 TP_STRUCT__entry(
2302 __field(dev_t, dev)
2303 __field(xfs_agnumber_t, agno)
2304 __field(int, type)
2305 __field(xfs_agblock_t, agbno)
2306 __field(xfs_extlen_t, len)
2307 ),
2308 TP_fast_assign(
2309 __entry->dev = mp->m_super->s_dev;
2310 __entry->agno = agno;
2311 __entry->type = type;
2312 __entry->agbno = agbno;
2313 __entry->len = len;
2314 ),
2315 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2316 MAJOR(__entry->dev), MINOR(__entry->dev),
2317 __entry->type,
2318 __entry->agno,
2319 __entry->agbno,
2320 __entry->len)
2321);
2322#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2323DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2324 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2325 int type, \
2326 xfs_agblock_t bno, \
2327 xfs_extlen_t len), \
2328 TP_ARGS(mp, agno, type, bno, len))
2329
2330DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2331 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2332 int op,
2333 xfs_agblock_t agbno,
2334 xfs_ino_t ino,
2335 int whichfork,
2336 xfs_fileoff_t offset,
2337 xfs_filblks_t len,
2338 xfs_exntst_t state),
2339 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2340 TP_STRUCT__entry(
2341 __field(dev_t, dev)
2342 __field(xfs_agnumber_t, agno)
2343 __field(xfs_ino_t, ino)
2344 __field(xfs_agblock_t, agbno)
2345 __field(int, whichfork)
2346 __field(xfs_fileoff_t, l_loff)
2347 __field(xfs_filblks_t, l_len)
2348 __field(xfs_exntst_t, l_state)
2349 __field(int, op)
2350 ),
2351 TP_fast_assign(
2352 __entry->dev = mp->m_super->s_dev;
2353 __entry->agno = agno;
2354 __entry->ino = ino;
2355 __entry->agbno = agbno;
2356 __entry->whichfork = whichfork;
2357 __entry->l_loff = offset;
2358 __entry->l_len = len;
2359 __entry->l_state = state;
2360 __entry->op = op;
2361 ),
2362 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2363 MAJOR(__entry->dev), MINOR(__entry->dev),
2364 __entry->op,
2365 __entry->agno,
2366 __entry->agbno,
2367 __entry->ino,
2368 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2369 __entry->l_loff,
2370 __entry->l_len,
2371 __entry->l_state)
2372);
2373#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2374DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2375 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2376 int op, \
2377 xfs_agblock_t agbno, \
2378 xfs_ino_t ino, \
2379 int whichfork, \
2380 xfs_fileoff_t offset, \
2381 xfs_filblks_t len, \
2382 xfs_exntst_t state), \
2383 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2384
2385DEFINE_DEFER_EVENT(xfs_defer_init);
2386DEFINE_DEFER_EVENT(xfs_defer_cancel);
2387DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2388DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2389DEFINE_DEFER_EVENT(xfs_defer_finish);
2390DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2391
2392DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2393DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002394
Brian Foster1ae093cb2018-08-01 07:20:34 -07002395DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2396DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002397DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2398DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2399
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002400#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2401DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2402DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002403DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2404DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002405
Darrick J. Wong673930c2016-08-03 11:33:43 +10002406/* rmap tracepoints */
2407DECLARE_EVENT_CLASS(xfs_rmap_class,
2408 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2409 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2410 struct xfs_owner_info *oinfo),
2411 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2412 TP_STRUCT__entry(
2413 __field(dev_t, dev)
2414 __field(xfs_agnumber_t, agno)
2415 __field(xfs_agblock_t, agbno)
2416 __field(xfs_extlen_t, len)
2417 __field(uint64_t, owner)
2418 __field(uint64_t, offset)
2419 __field(unsigned long, flags)
2420 ),
2421 TP_fast_assign(
2422 __entry->dev = mp->m_super->s_dev;
2423 __entry->agno = agno;
2424 __entry->agbno = agbno;
2425 __entry->len = len;
2426 __entry->owner = oinfo->oi_owner;
2427 __entry->offset = oinfo->oi_offset;
2428 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002429 if (unwritten)
2430 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002431 ),
2432 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2433 MAJOR(__entry->dev), MINOR(__entry->dev),
2434 __entry->agno,
2435 __entry->agbno,
2436 __entry->len,
2437 __entry->owner,
2438 __entry->offset,
2439 __entry->flags)
2440);
2441#define DEFINE_RMAP_EVENT(name) \
2442DEFINE_EVENT(xfs_rmap_class, name, \
2443 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2444 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2445 struct xfs_owner_info *oinfo), \
2446 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2447
2448/* simple AG-based error/%ip tracepoint class */
2449DECLARE_EVENT_CLASS(xfs_ag_error_class,
2450 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2451 unsigned long caller_ip),
2452 TP_ARGS(mp, agno, error, caller_ip),
2453 TP_STRUCT__entry(
2454 __field(dev_t, dev)
2455 __field(xfs_agnumber_t, agno)
2456 __field(int, error)
2457 __field(unsigned long, caller_ip)
2458 ),
2459 TP_fast_assign(
2460 __entry->dev = mp->m_super->s_dev;
2461 __entry->agno = agno;
2462 __entry->error = error;
2463 __entry->caller_ip = caller_ip;
2464 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002465 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002466 MAJOR(__entry->dev), MINOR(__entry->dev),
2467 __entry->agno,
2468 __entry->error,
2469 (char *)__entry->caller_ip)
2470);
2471
2472#define DEFINE_AG_ERROR_EVENT(name) \
2473DEFINE_EVENT(xfs_ag_error_class, name, \
2474 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2475 unsigned long caller_ip), \
2476 TP_ARGS(mp, agno, error, caller_ip))
2477
2478DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2479DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2480DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2481DEFINE_RMAP_EVENT(xfs_rmap_map);
2482DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2483DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002484DEFINE_RMAP_EVENT(xfs_rmap_convert);
2485DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2486DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2487DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002488
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002489DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2490 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2491 xfs_agblock_t agbno, xfs_extlen_t len,
2492 uint64_t owner, uint64_t offset, unsigned int flags),
2493 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2494 TP_STRUCT__entry(
2495 __field(dev_t, dev)
2496 __field(xfs_agnumber_t, agno)
2497 __field(xfs_agblock_t, agbno)
2498 __field(xfs_extlen_t, len)
2499 __field(uint64_t, owner)
2500 __field(uint64_t, offset)
2501 __field(unsigned int, flags)
2502 ),
2503 TP_fast_assign(
2504 __entry->dev = mp->m_super->s_dev;
2505 __entry->agno = agno;
2506 __entry->agbno = agbno;
2507 __entry->len = len;
2508 __entry->owner = owner;
2509 __entry->offset = offset;
2510 __entry->flags = flags;
2511 ),
2512 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2513 MAJOR(__entry->dev), MINOR(__entry->dev),
2514 __entry->agno,
2515 __entry->agbno,
2516 __entry->len,
2517 __entry->owner,
2518 __entry->offset,
2519 __entry->flags)
2520);
2521#define DEFINE_RMAPBT_EVENT(name) \
2522DEFINE_EVENT(xfs_rmapbt_class, name, \
2523 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2524 xfs_agblock_t agbno, xfs_extlen_t len, \
2525 uint64_t owner, uint64_t offset, unsigned int flags), \
2526 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2527
2528#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2529DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2530DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2531
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002532DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2533DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002534DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2535DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2536DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2537DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2538DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2539DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002540
2541DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2542DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2543DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2544DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002545DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2546DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002547DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002548
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002549/* deferred bmbt updates */
2550#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2551DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2552DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2553
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002554/* per-AG reservation */
2555DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2556 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2557 xfs_extlen_t len),
2558 TP_ARGS(pag, resv, len),
2559 TP_STRUCT__entry(
2560 __field(dev_t, dev)
2561 __field(xfs_agnumber_t, agno)
2562 __field(int, resv)
2563 __field(xfs_extlen_t, freeblks)
2564 __field(xfs_extlen_t, flcount)
2565 __field(xfs_extlen_t, reserved)
2566 __field(xfs_extlen_t, asked)
2567 __field(xfs_extlen_t, len)
2568 ),
2569 TP_fast_assign(
2570 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2571
2572 __entry->dev = pag->pag_mount->m_super->s_dev;
2573 __entry->agno = pag->pag_agno;
2574 __entry->resv = resv;
2575 __entry->freeblks = pag->pagf_freeblks;
2576 __entry->flcount = pag->pagf_flcount;
2577 __entry->reserved = r ? r->ar_reserved : 0;
2578 __entry->asked = r ? r->ar_asked : 0;
2579 __entry->len = len;
2580 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002581 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2582 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002583 MAJOR(__entry->dev), MINOR(__entry->dev),
2584 __entry->agno,
2585 __entry->resv,
2586 __entry->freeblks,
2587 __entry->flcount,
2588 __entry->reserved,
2589 __entry->asked,
2590 __entry->len)
2591)
2592#define DEFINE_AG_RESV_EVENT(name) \
2593DEFINE_EVENT(xfs_ag_resv_class, name, \
2594 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2595 xfs_extlen_t len), \
2596 TP_ARGS(pag, type, len))
2597
2598/* per-AG reservation tracepoints */
2599DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2600DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2601DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2602DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2603DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2604DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2605
2606DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2607DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2608
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002609/* refcount tracepoint classes */
2610
2611/* reuse the discard trace class for agbno/aglen-based traces */
2612#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2613
2614/* ag btree lookup tracepoint class */
2615#define XFS_AG_BTREE_CMP_FORMAT_STR \
2616 { XFS_LOOKUP_EQ, "eq" }, \
2617 { XFS_LOOKUP_LE, "le" }, \
2618 { XFS_LOOKUP_GE, "ge" }
2619DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2620 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2621 xfs_agblock_t agbno, xfs_lookup_t dir),
2622 TP_ARGS(mp, agno, agbno, dir),
2623 TP_STRUCT__entry(
2624 __field(dev_t, dev)
2625 __field(xfs_agnumber_t, agno)
2626 __field(xfs_agblock_t, agbno)
2627 __field(xfs_lookup_t, dir)
2628 ),
2629 TP_fast_assign(
2630 __entry->dev = mp->m_super->s_dev;
2631 __entry->agno = agno;
2632 __entry->agbno = agbno;
2633 __entry->dir = dir;
2634 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002635 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002636 MAJOR(__entry->dev), MINOR(__entry->dev),
2637 __entry->agno,
2638 __entry->agbno,
2639 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2640 __entry->dir)
2641)
2642
2643#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2644DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2645 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2646 xfs_agblock_t agbno, xfs_lookup_t dir), \
2647 TP_ARGS(mp, agno, agbno, dir))
2648
2649/* single-rcext tracepoint class */
2650DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2651 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2652 struct xfs_refcount_irec *irec),
2653 TP_ARGS(mp, agno, irec),
2654 TP_STRUCT__entry(
2655 __field(dev_t, dev)
2656 __field(xfs_agnumber_t, agno)
2657 __field(xfs_agblock_t, startblock)
2658 __field(xfs_extlen_t, blockcount)
2659 __field(xfs_nlink_t, refcount)
2660 ),
2661 TP_fast_assign(
2662 __entry->dev = mp->m_super->s_dev;
2663 __entry->agno = agno;
2664 __entry->startblock = irec->rc_startblock;
2665 __entry->blockcount = irec->rc_blockcount;
2666 __entry->refcount = irec->rc_refcount;
2667 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002668 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002669 MAJOR(__entry->dev), MINOR(__entry->dev),
2670 __entry->agno,
2671 __entry->startblock,
2672 __entry->blockcount,
2673 __entry->refcount)
2674)
2675
2676#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2677DEFINE_EVENT(xfs_refcount_extent_class, name, \
2678 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2679 struct xfs_refcount_irec *irec), \
2680 TP_ARGS(mp, agno, irec))
2681
2682/* single-rcext and an agbno tracepoint class */
2683DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2684 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2685 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2686 TP_ARGS(mp, agno, irec, agbno),
2687 TP_STRUCT__entry(
2688 __field(dev_t, dev)
2689 __field(xfs_agnumber_t, agno)
2690 __field(xfs_agblock_t, startblock)
2691 __field(xfs_extlen_t, blockcount)
2692 __field(xfs_nlink_t, refcount)
2693 __field(xfs_agblock_t, agbno)
2694 ),
2695 TP_fast_assign(
2696 __entry->dev = mp->m_super->s_dev;
2697 __entry->agno = agno;
2698 __entry->startblock = irec->rc_startblock;
2699 __entry->blockcount = irec->rc_blockcount;
2700 __entry->refcount = irec->rc_refcount;
2701 __entry->agbno = agbno;
2702 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002703 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002704 MAJOR(__entry->dev), MINOR(__entry->dev),
2705 __entry->agno,
2706 __entry->startblock,
2707 __entry->blockcount,
2708 __entry->refcount,
2709 __entry->agbno)
2710)
2711
2712#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2713DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2714 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2715 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2716 TP_ARGS(mp, agno, irec, agbno))
2717
2718/* double-rcext tracepoint class */
2719DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2720 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2721 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2722 TP_ARGS(mp, agno, i1, i2),
2723 TP_STRUCT__entry(
2724 __field(dev_t, dev)
2725 __field(xfs_agnumber_t, agno)
2726 __field(xfs_agblock_t, i1_startblock)
2727 __field(xfs_extlen_t, i1_blockcount)
2728 __field(xfs_nlink_t, i1_refcount)
2729 __field(xfs_agblock_t, i2_startblock)
2730 __field(xfs_extlen_t, i2_blockcount)
2731 __field(xfs_nlink_t, i2_refcount)
2732 ),
2733 TP_fast_assign(
2734 __entry->dev = mp->m_super->s_dev;
2735 __entry->agno = agno;
2736 __entry->i1_startblock = i1->rc_startblock;
2737 __entry->i1_blockcount = i1->rc_blockcount;
2738 __entry->i1_refcount = i1->rc_refcount;
2739 __entry->i2_startblock = i2->rc_startblock;
2740 __entry->i2_blockcount = i2->rc_blockcount;
2741 __entry->i2_refcount = i2->rc_refcount;
2742 ),
2743 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002744 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002745 MAJOR(__entry->dev), MINOR(__entry->dev),
2746 __entry->agno,
2747 __entry->i1_startblock,
2748 __entry->i1_blockcount,
2749 __entry->i1_refcount,
2750 __entry->i2_startblock,
2751 __entry->i2_blockcount,
2752 __entry->i2_refcount)
2753)
2754
2755#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2756DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2757 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2758 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2759 TP_ARGS(mp, agno, i1, i2))
2760
2761/* double-rcext and an agbno tracepoint class */
2762DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2763 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2764 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2765 xfs_agblock_t agbno),
2766 TP_ARGS(mp, agno, i1, i2, agbno),
2767 TP_STRUCT__entry(
2768 __field(dev_t, dev)
2769 __field(xfs_agnumber_t, agno)
2770 __field(xfs_agblock_t, i1_startblock)
2771 __field(xfs_extlen_t, i1_blockcount)
2772 __field(xfs_nlink_t, i1_refcount)
2773 __field(xfs_agblock_t, i2_startblock)
2774 __field(xfs_extlen_t, i2_blockcount)
2775 __field(xfs_nlink_t, i2_refcount)
2776 __field(xfs_agblock_t, agbno)
2777 ),
2778 TP_fast_assign(
2779 __entry->dev = mp->m_super->s_dev;
2780 __entry->agno = agno;
2781 __entry->i1_startblock = i1->rc_startblock;
2782 __entry->i1_blockcount = i1->rc_blockcount;
2783 __entry->i1_refcount = i1->rc_refcount;
2784 __entry->i2_startblock = i2->rc_startblock;
2785 __entry->i2_blockcount = i2->rc_blockcount;
2786 __entry->i2_refcount = i2->rc_refcount;
2787 __entry->agbno = agbno;
2788 ),
2789 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002790 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002791 MAJOR(__entry->dev), MINOR(__entry->dev),
2792 __entry->agno,
2793 __entry->i1_startblock,
2794 __entry->i1_blockcount,
2795 __entry->i1_refcount,
2796 __entry->i2_startblock,
2797 __entry->i2_blockcount,
2798 __entry->i2_refcount,
2799 __entry->agbno)
2800)
2801
2802#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2803DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2804 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2805 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2806 xfs_agblock_t agbno), \
2807 TP_ARGS(mp, agno, i1, i2, agbno))
2808
2809/* triple-rcext tracepoint class */
2810DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2811 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2812 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2813 struct xfs_refcount_irec *i3),
2814 TP_ARGS(mp, agno, i1, i2, i3),
2815 TP_STRUCT__entry(
2816 __field(dev_t, dev)
2817 __field(xfs_agnumber_t, agno)
2818 __field(xfs_agblock_t, i1_startblock)
2819 __field(xfs_extlen_t, i1_blockcount)
2820 __field(xfs_nlink_t, i1_refcount)
2821 __field(xfs_agblock_t, i2_startblock)
2822 __field(xfs_extlen_t, i2_blockcount)
2823 __field(xfs_nlink_t, i2_refcount)
2824 __field(xfs_agblock_t, i3_startblock)
2825 __field(xfs_extlen_t, i3_blockcount)
2826 __field(xfs_nlink_t, i3_refcount)
2827 ),
2828 TP_fast_assign(
2829 __entry->dev = mp->m_super->s_dev;
2830 __entry->agno = agno;
2831 __entry->i1_startblock = i1->rc_startblock;
2832 __entry->i1_blockcount = i1->rc_blockcount;
2833 __entry->i1_refcount = i1->rc_refcount;
2834 __entry->i2_startblock = i2->rc_startblock;
2835 __entry->i2_blockcount = i2->rc_blockcount;
2836 __entry->i2_refcount = i2->rc_refcount;
2837 __entry->i3_startblock = i3->rc_startblock;
2838 __entry->i3_blockcount = i3->rc_blockcount;
2839 __entry->i3_refcount = i3->rc_refcount;
2840 ),
2841 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2842 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002843 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002844 MAJOR(__entry->dev), MINOR(__entry->dev),
2845 __entry->agno,
2846 __entry->i1_startblock,
2847 __entry->i1_blockcount,
2848 __entry->i1_refcount,
2849 __entry->i2_startblock,
2850 __entry->i2_blockcount,
2851 __entry->i2_refcount,
2852 __entry->i3_startblock,
2853 __entry->i3_blockcount,
2854 __entry->i3_refcount)
2855);
2856
2857#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2858DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2859 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2860 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2861 struct xfs_refcount_irec *i3), \
2862 TP_ARGS(mp, agno, i1, i2, i3))
2863
2864/* refcount btree tracepoints */
2865DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2866DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2867DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2868DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2869DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2870DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2871DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2872DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2873DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2874DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2875
2876/* refcount adjustment tracepoints */
2877DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2878DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002879DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2880DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002881DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2882DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002883DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002884DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2885DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2886DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2887DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2888DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2889DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002890DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002891DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2892DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2893DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2894DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2895DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2896DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2897DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2898
2899/* reflink helpers */
2900DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2901DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2902DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002903#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2904DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2905DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002906
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002907TRACE_EVENT(xfs_refcount_finish_one_leftover,
2908 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2909 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2910 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2911 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2912 TP_STRUCT__entry(
2913 __field(dev_t, dev)
2914 __field(xfs_agnumber_t, agno)
2915 __field(int, type)
2916 __field(xfs_agblock_t, agbno)
2917 __field(xfs_extlen_t, len)
2918 __field(xfs_agblock_t, new_agbno)
2919 __field(xfs_extlen_t, new_len)
2920 ),
2921 TP_fast_assign(
2922 __entry->dev = mp->m_super->s_dev;
2923 __entry->agno = agno;
2924 __entry->type = type;
2925 __entry->agbno = agbno;
2926 __entry->len = len;
2927 __entry->new_agbno = new_agbno;
2928 __entry->new_len = new_len;
2929 ),
2930 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2931 MAJOR(__entry->dev), MINOR(__entry->dev),
2932 __entry->type,
2933 __entry->agno,
2934 __entry->agbno,
2935 __entry->len,
2936 __entry->new_agbno,
2937 __entry->new_len)
2938);
2939
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002940/* simple inode-based error/%ip tracepoint class */
2941DECLARE_EVENT_CLASS(xfs_inode_error_class,
2942 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2943 TP_ARGS(ip, error, caller_ip),
2944 TP_STRUCT__entry(
2945 __field(dev_t, dev)
2946 __field(xfs_ino_t, ino)
2947 __field(int, error)
2948 __field(unsigned long, caller_ip)
2949 ),
2950 TP_fast_assign(
2951 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2952 __entry->ino = ip->i_ino;
2953 __entry->error = error;
2954 __entry->caller_ip = caller_ip;
2955 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002956 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002957 MAJOR(__entry->dev), MINOR(__entry->dev),
2958 __entry->ino,
2959 __entry->error,
2960 (char *)__entry->caller_ip)
2961);
2962
2963#define DEFINE_INODE_ERROR_EVENT(name) \
2964DEFINE_EVENT(xfs_inode_error_class, name, \
2965 TP_PROTO(struct xfs_inode *ip, int error, \
2966 unsigned long caller_ip), \
2967 TP_ARGS(ip, error, caller_ip))
2968
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002969/* reflink tracepoint classes */
2970
2971/* two-file io tracepoint class */
2972DECLARE_EVENT_CLASS(xfs_double_io_class,
2973 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2974 struct xfs_inode *dest, xfs_off_t doffset),
2975 TP_ARGS(src, soffset, len, dest, doffset),
2976 TP_STRUCT__entry(
2977 __field(dev_t, dev)
2978 __field(xfs_ino_t, src_ino)
2979 __field(loff_t, src_isize)
2980 __field(loff_t, src_disize)
2981 __field(loff_t, src_offset)
2982 __field(size_t, len)
2983 __field(xfs_ino_t, dest_ino)
2984 __field(loff_t, dest_isize)
2985 __field(loff_t, dest_disize)
2986 __field(loff_t, dest_offset)
2987 ),
2988 TP_fast_assign(
2989 __entry->dev = VFS_I(src)->i_sb->s_dev;
2990 __entry->src_ino = src->i_ino;
2991 __entry->src_isize = VFS_I(src)->i_size;
2992 __entry->src_disize = src->i_d.di_size;
2993 __entry->src_offset = soffset;
2994 __entry->len = len;
2995 __entry->dest_ino = dest->i_ino;
2996 __entry->dest_isize = VFS_I(dest)->i_size;
2997 __entry->dest_disize = dest->i_d.di_size;
2998 __entry->dest_offset = doffset;
2999 ),
3000 TP_printk("dev %d:%d count %zd "
3001 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3002 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3003 MAJOR(__entry->dev), MINOR(__entry->dev),
3004 __entry->len,
3005 __entry->src_ino,
3006 __entry->src_isize,
3007 __entry->src_disize,
3008 __entry->src_offset,
3009 __entry->dest_ino,
3010 __entry->dest_isize,
3011 __entry->dest_disize,
3012 __entry->dest_offset)
3013)
3014
3015#define DEFINE_DOUBLE_IO_EVENT(name) \
3016DEFINE_EVENT(xfs_double_io_class, name, \
3017 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3018 struct xfs_inode *dest, xfs_off_t doffset), \
3019 TP_ARGS(src, soffset, len, dest, doffset))
3020
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003021/* inode/irec events */
3022DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3023 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3024 TP_ARGS(ip, irec),
3025 TP_STRUCT__entry(
3026 __field(dev_t, dev)
3027 __field(xfs_ino_t, ino)
3028 __field(xfs_fileoff_t, lblk)
3029 __field(xfs_extlen_t, len)
3030 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003031 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003032 ),
3033 TP_fast_assign(
3034 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3035 __entry->ino = ip->i_ino;
3036 __entry->lblk = irec->br_startoff;
3037 __entry->len = irec->br_blockcount;
3038 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003039 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003040 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003041 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 -07003042 MAJOR(__entry->dev), MINOR(__entry->dev),
3043 __entry->ino,
3044 __entry->lblk,
3045 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003046 __entry->pblk,
3047 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003048);
3049#define DEFINE_INODE_IREC_EVENT(name) \
3050DEFINE_EVENT(xfs_inode_irec_class, name, \
3051 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3052 TP_ARGS(ip, irec))
3053
3054/* refcount/reflink tracepoint definitions */
3055
3056/* reflink tracepoints */
3057DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3058DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3059DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3060DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3061TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3062 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3063 xfs_filblks_t len, struct xfs_inode *dest,
3064 xfs_fileoff_t doffset),
3065 TP_ARGS(src, soffset, len, dest, doffset),
3066 TP_STRUCT__entry(
3067 __field(dev_t, dev)
3068 __field(xfs_ino_t, src_ino)
3069 __field(xfs_fileoff_t, src_lblk)
3070 __field(xfs_filblks_t, len)
3071 __field(xfs_ino_t, dest_ino)
3072 __field(xfs_fileoff_t, dest_lblk)
3073 ),
3074 TP_fast_assign(
3075 __entry->dev = VFS_I(src)->i_sb->s_dev;
3076 __entry->src_ino = src->i_ino;
3077 __entry->src_lblk = soffset;
3078 __entry->len = len;
3079 __entry->dest_ino = dest->i_ino;
3080 __entry->dest_lblk = doffset;
3081 ),
3082 TP_printk("dev %d:%d len 0x%llx "
3083 "ino 0x%llx offset 0x%llx blocks -> "
3084 "ino 0x%llx offset 0x%llx blocks",
3085 MAJOR(__entry->dev), MINOR(__entry->dev),
3086 __entry->len,
3087 __entry->src_ino,
3088 __entry->src_lblk,
3089 __entry->dest_ino,
3090 __entry->dest_lblk)
3091);
3092TRACE_EVENT(xfs_reflink_punch_range,
3093 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3094 xfs_extlen_t len),
3095 TP_ARGS(ip, lblk, len),
3096 TP_STRUCT__entry(
3097 __field(dev_t, dev)
3098 __field(xfs_ino_t, ino)
3099 __field(xfs_fileoff_t, lblk)
3100 __field(xfs_extlen_t, len)
3101 ),
3102 TP_fast_assign(
3103 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3104 __entry->ino = ip->i_ino;
3105 __entry->lblk = lblk;
3106 __entry->len = len;
3107 ),
3108 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3109 MAJOR(__entry->dev), MINOR(__entry->dev),
3110 __entry->ino,
3111 __entry->lblk,
3112 __entry->len)
3113);
3114TRACE_EVENT(xfs_reflink_remap,
3115 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3116 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3117 TP_ARGS(ip, lblk, len, new_pblk),
3118 TP_STRUCT__entry(
3119 __field(dev_t, dev)
3120 __field(xfs_ino_t, ino)
3121 __field(xfs_fileoff_t, lblk)
3122 __field(xfs_extlen_t, len)
3123 __field(xfs_fsblock_t, new_pblk)
3124 ),
3125 TP_fast_assign(
3126 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3127 __entry->ino = ip->i_ino;
3128 __entry->lblk = lblk;
3129 __entry->len = len;
3130 __entry->new_pblk = new_pblk;
3131 ),
3132 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3133 MAJOR(__entry->dev), MINOR(__entry->dev),
3134 __entry->ino,
3135 __entry->lblk,
3136 __entry->len,
3137 __entry->new_pblk)
3138);
3139DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3140DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3141DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3142DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003143DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3144DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3145
3146/* dedupe tracepoints */
3147DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3148DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3149
3150/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003151TRACE_EVENT(xfs_ioctl_clone,
3152 TP_PROTO(struct inode *src, struct inode *dest),
3153 TP_ARGS(src, dest),
3154 TP_STRUCT__entry(
3155 __field(dev_t, dev)
3156 __field(unsigned long, src_ino)
3157 __field(loff_t, src_isize)
3158 __field(unsigned long, dest_ino)
3159 __field(loff_t, dest_isize)
3160 ),
3161 TP_fast_assign(
3162 __entry->dev = src->i_sb->s_dev;
3163 __entry->src_ino = src->i_ino;
3164 __entry->src_isize = i_size_read(src);
3165 __entry->dest_ino = dest->i_ino;
3166 __entry->dest_isize = i_size_read(dest);
3167 ),
3168 TP_printk("dev %d:%d "
3169 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003170 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003171 MAJOR(__entry->dev), MINOR(__entry->dev),
3172 __entry->src_ino,
3173 __entry->src_isize,
3174 __entry->dest_ino,
3175 __entry->dest_isize)
3176);
3177
3178/* unshare tracepoints */
3179DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003180DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003181
3182/* copy on write */
3183DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003184DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3185DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3186DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003187DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003188
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003189DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003190
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003191DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003192
3193DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3194DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3195DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003196
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003197DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3198DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3199
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003200
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003201DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003202
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003203/* rmap swapext tracepoints */
3204DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3205DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3206DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3207
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003208/* fsmap traces */
3209DECLARE_EVENT_CLASS(xfs_fsmap_class,
3210 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3211 struct xfs_rmap_irec *rmap),
3212 TP_ARGS(mp, keydev, agno, rmap),
3213 TP_STRUCT__entry(
3214 __field(dev_t, dev)
3215 __field(dev_t, keydev)
3216 __field(xfs_agnumber_t, agno)
3217 __field(xfs_fsblock_t, bno)
3218 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003219 __field(uint64_t, owner)
3220 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003221 __field(unsigned int, flags)
3222 ),
3223 TP_fast_assign(
3224 __entry->dev = mp->m_super->s_dev;
3225 __entry->keydev = new_decode_dev(keydev);
3226 __entry->agno = agno;
3227 __entry->bno = rmap->rm_startblock;
3228 __entry->len = rmap->rm_blockcount;
3229 __entry->owner = rmap->rm_owner;
3230 __entry->offset = rmap->rm_offset;
3231 __entry->flags = rmap->rm_flags;
3232 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003233 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 -07003234 MAJOR(__entry->dev), MINOR(__entry->dev),
3235 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3236 __entry->agno,
3237 __entry->bno,
3238 __entry->len,
3239 __entry->owner,
3240 __entry->offset,
3241 __entry->flags)
3242)
3243#define DEFINE_FSMAP_EVENT(name) \
3244DEFINE_EVENT(xfs_fsmap_class, name, \
3245 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3246 struct xfs_rmap_irec *rmap), \
3247 TP_ARGS(mp, keydev, agno, rmap))
3248DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3249DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3250DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3251
3252DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3253 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3254 TP_ARGS(mp, fsmap),
3255 TP_STRUCT__entry(
3256 __field(dev_t, dev)
3257 __field(dev_t, keydev)
3258 __field(xfs_daddr_t, block)
3259 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003260 __field(uint64_t, owner)
3261 __field(uint64_t, offset)
3262 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003263 ),
3264 TP_fast_assign(
3265 __entry->dev = mp->m_super->s_dev;
3266 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3267 __entry->block = fsmap->fmr_physical;
3268 __entry->len = fsmap->fmr_length;
3269 __entry->owner = fsmap->fmr_owner;
3270 __entry->offset = fsmap->fmr_offset;
3271 __entry->flags = fsmap->fmr_flags;
3272 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003273 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 -07003274 MAJOR(__entry->dev), MINOR(__entry->dev),
3275 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3276 __entry->block,
3277 __entry->len,
3278 __entry->owner,
3279 __entry->offset,
3280 __entry->flags)
3281)
3282#define DEFINE_GETFSMAP_EVENT(name) \
3283DEFINE_EVENT(xfs_getfsmap_class, name, \
3284 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3285 TP_ARGS(mp, fsmap))
3286DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3287DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3288DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3289
Darrick J. Wongb872af22018-01-08 10:51:26 -08003290TRACE_EVENT(xfs_trans_resv_calc,
3291 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3292 struct xfs_trans_res *res),
3293 TP_ARGS(mp, type, res),
3294 TP_STRUCT__entry(
3295 __field(dev_t, dev)
3296 __field(int, type)
3297 __field(uint, logres)
3298 __field(int, logcount)
3299 __field(int, logflags)
3300 ),
3301 TP_fast_assign(
3302 __entry->dev = mp->m_super->s_dev;
3303 __entry->type = type;
3304 __entry->logres = res->tr_logres;
3305 __entry->logcount = res->tr_logcount;
3306 __entry->logflags = res->tr_logflags;
3307 ),
3308 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3309 MAJOR(__entry->dev), MINOR(__entry->dev),
3310 __entry->type,
3311 __entry->logres,
3312 __entry->logcount,
3313 __entry->logflags)
3314);
3315
Dave Chinnerba187812018-05-09 07:47:57 -07003316DECLARE_EVENT_CLASS(xfs_trans_class,
3317 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3318 TP_ARGS(tp, caller_ip),
3319 TP_STRUCT__entry(
3320 __field(dev_t, dev)
3321 __field(uint32_t, tid)
3322 __field(uint32_t, flags)
3323 __field(unsigned long, caller_ip)
3324 ),
3325 TP_fast_assign(
3326 __entry->dev = tp->t_mountp->m_super->s_dev;
3327 __entry->tid = 0;
3328 if (tp->t_ticket)
3329 __entry->tid = tp->t_ticket->t_tid;
3330 __entry->flags = tp->t_flags;
3331 __entry->caller_ip = caller_ip;
3332 ),
3333 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3334 MAJOR(__entry->dev), MINOR(__entry->dev),
3335 __entry->tid,
3336 __entry->flags,
3337 (char *)__entry->caller_ip)
3338)
3339
3340#define DEFINE_TRANS_EVENT(name) \
3341DEFINE_EVENT(xfs_trans_class, name, \
3342 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3343 TP_ARGS(tp, caller_ip))
3344DEFINE_TRANS_EVENT(xfs_trans_alloc);
3345DEFINE_TRANS_EVENT(xfs_trans_cancel);
3346DEFINE_TRANS_EVENT(xfs_trans_commit);
3347DEFINE_TRANS_EVENT(xfs_trans_dup);
3348DEFINE_TRANS_EVENT(xfs_trans_free);
3349DEFINE_TRANS_EVENT(xfs_trans_roll);
3350DEFINE_TRANS_EVENT(xfs_trans_add_item);
3351DEFINE_TRANS_EVENT(xfs_trans_free_items);
3352
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003353#endif /* _TRACE_XFS_H */
3354
3355#undef TRACE_INCLUDE_PATH
3356#define TRACE_INCLUDE_PATH .
3357#define TRACE_INCLUDE_FILE xfs_trace
3358#include <trace/define_trace.h>