blob: 9d741571b61e3113a52bb210fd9b42141f4d193a [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);
313DEFINE_BUF_EVENT(xfs_buf_submit_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000314DEFINE_BUF_EVENT(xfs_buf_lock);
315DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000316DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200317DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000318DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000319DEFINE_BUF_EVENT(xfs_buf_iowait);
320DEFINE_BUF_EVENT(xfs_buf_iowait_done);
321DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000322DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000323DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700324DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000325DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000326DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000327DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
328DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100329DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000330DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
331
332/* not really buffer traces, but the buf provides useful information */
333DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000334DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000335
336/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000337DECLARE_EVENT_CLASS(xfs_buf_flags_class,
338 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
339 TP_ARGS(bp, flags, caller_ip),
340 TP_STRUCT__entry(
341 __field(dev_t, dev)
342 __field(xfs_daddr_t, bno)
343 __field(size_t, buffer_length)
344 __field(int, hold)
345 __field(int, pincount)
346 __field(unsigned, lockval)
347 __field(unsigned, flags)
348 __field(unsigned long, caller_ip)
349 ),
350 TP_fast_assign(
351 __entry->dev = bp->b_target->bt_dev;
352 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000353 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000354 __entry->flags = flags;
355 __entry->hold = atomic_read(&bp->b_hold);
356 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200357 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000358 __entry->caller_ip = caller_ip;
359 ),
360 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800361 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000362 MAJOR(__entry->dev), MINOR(__entry->dev),
363 (unsigned long long)__entry->bno,
364 __entry->buffer_length,
365 __entry->hold,
366 __entry->pincount,
367 __entry->lockval,
368 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
369 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000370)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000371
372#define DEFINE_BUF_FLAGS_EVENT(name) \
373DEFINE_EVENT(xfs_buf_flags_class, name, \
374 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
375 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000376DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
377DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
378DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
379
380TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800381 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000382 TP_ARGS(bp, error, caller_ip),
383 TP_STRUCT__entry(
384 __field(dev_t, dev)
385 __field(xfs_daddr_t, bno)
386 __field(size_t, buffer_length)
387 __field(unsigned, flags)
388 __field(int, hold)
389 __field(int, pincount)
390 __field(unsigned, lockval)
391 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800392 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000393 ),
394 TP_fast_assign(
395 __entry->dev = bp->b_target->bt_dev;
396 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000397 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000398 __entry->hold = atomic_read(&bp->b_hold);
399 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200400 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000401 __entry->error = error;
402 __entry->flags = bp->b_flags;
403 __entry->caller_ip = caller_ip;
404 ),
405 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800406 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000407 MAJOR(__entry->dev), MINOR(__entry->dev),
408 (unsigned long long)__entry->bno,
409 __entry->buffer_length,
410 __entry->hold,
411 __entry->pincount,
412 __entry->lockval,
413 __entry->error,
414 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
415 (void *)__entry->caller_ip)
416);
417
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000418DECLARE_EVENT_CLASS(xfs_buf_item_class,
419 TP_PROTO(struct xfs_buf_log_item *bip),
420 TP_ARGS(bip),
421 TP_STRUCT__entry(
422 __field(dev_t, dev)
423 __field(xfs_daddr_t, buf_bno)
424 __field(size_t, buf_len)
425 __field(int, buf_hold)
426 __field(int, buf_pincount)
427 __field(int, buf_lockval)
428 __field(unsigned, buf_flags)
429 __field(unsigned, bli_recur)
430 __field(int, bli_refcount)
431 __field(unsigned, bli_flags)
Dave Chinner22525c12018-05-09 07:47:34 -0700432 __field(unsigned long, li_flags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000433 ),
434 TP_fast_assign(
435 __entry->dev = bip->bli_buf->b_target->bt_dev;
436 __entry->bli_flags = bip->bli_flags;
437 __entry->bli_recur = bip->bli_recur;
438 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
439 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000440 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000441 __entry->buf_flags = bip->bli_buf->b_flags;
442 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
443 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200444 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000445 __entry->li_flags = bip->bli_item.li_flags;
446 ),
447 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
448 "lock %d flags %s recur %d refcount %d bliflags %s "
Dave Chinnere6631f82018-05-09 07:49:37 -0700449 "liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000450 MAJOR(__entry->dev), MINOR(__entry->dev),
451 (unsigned long long)__entry->buf_bno,
452 __entry->buf_len,
453 __entry->buf_hold,
454 __entry->buf_pincount,
455 __entry->buf_lockval,
456 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
457 __entry->bli_recur,
458 __entry->bli_refcount,
459 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000460 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000461)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000462
463#define DEFINE_BUF_ITEM_EVENT(name) \
464DEFINE_EVENT(xfs_buf_item_class, name, \
465 TP_PROTO(struct xfs_buf_log_item *bip), \
466 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000467DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000468DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000469DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
470DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
471DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000472DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000473DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
474DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
475DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000476DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
477DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
478DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
479DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
480DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
481DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
482DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
483DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
484DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
485DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
486DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
487DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
488DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
489DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
490DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
491DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
492
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000493DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700494 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
495 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000496 TP_STRUCT__entry(
497 __field(dev_t, dev)
498 __field(xfs_ino_t, ino)
499 __field(xfs_agnumber_t, agno)
500 __field(int, streams)
501 ),
502 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700503 __entry->dev = mp->m_super->s_dev;
504 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000505 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700506 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000507 ),
508 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
509 MAJOR(__entry->dev), MINOR(__entry->dev),
510 __entry->ino,
511 __entry->agno,
512 __entry->streams)
513)
514#define DEFINE_FILESTREAM_EVENT(name) \
515DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700516 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
517 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000518DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
519DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
520DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
521
522TRACE_EVENT(xfs_filestream_pick,
523 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
524 xfs_extlen_t free, int nscan),
525 TP_ARGS(ip, agno, free, nscan),
526 TP_STRUCT__entry(
527 __field(dev_t, dev)
528 __field(xfs_ino_t, ino)
529 __field(xfs_agnumber_t, agno)
530 __field(int, streams)
531 __field(xfs_extlen_t, free)
532 __field(int, nscan)
533 ),
534 TP_fast_assign(
535 __entry->dev = VFS_I(ip)->i_sb->s_dev;
536 __entry->ino = ip->i_ino;
537 __entry->agno = agno;
538 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
539 __entry->free = free;
540 __entry->nscan = nscan;
541 ),
542 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
543 MAJOR(__entry->dev), MINOR(__entry->dev),
544 __entry->ino,
545 __entry->agno,
546 __entry->streams,
547 __entry->free,
548 __entry->nscan)
549);
550
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000551DECLARE_EVENT_CLASS(xfs_lock_class,
552 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
553 unsigned long caller_ip),
554 TP_ARGS(ip, lock_flags, caller_ip),
555 TP_STRUCT__entry(
556 __field(dev_t, dev)
557 __field(xfs_ino_t, ino)
558 __field(int, lock_flags)
559 __field(unsigned long, caller_ip)
560 ),
561 TP_fast_assign(
562 __entry->dev = VFS_I(ip)->i_sb->s_dev;
563 __entry->ino = ip->i_ino;
564 __entry->lock_flags = lock_flags;
565 __entry->caller_ip = caller_ip;
566 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800567 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000568 MAJOR(__entry->dev), MINOR(__entry->dev),
569 __entry->ino,
570 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
571 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000572)
573
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000574#define DEFINE_LOCK_EVENT(name) \
575DEFINE_EVENT(xfs_lock_class, name, \
576 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
577 unsigned long caller_ip), \
578 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000579DEFINE_LOCK_EVENT(xfs_ilock);
580DEFINE_LOCK_EVENT(xfs_ilock_nowait);
581DEFINE_LOCK_EVENT(xfs_ilock_demote);
582DEFINE_LOCK_EVENT(xfs_iunlock);
583
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000584DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000585 TP_PROTO(struct xfs_inode *ip),
586 TP_ARGS(ip),
587 TP_STRUCT__entry(
588 __field(dev_t, dev)
589 __field(xfs_ino_t, ino)
590 ),
591 TP_fast_assign(
592 __entry->dev = VFS_I(ip)->i_sb->s_dev;
593 __entry->ino = ip->i_ino;
594 ),
595 TP_printk("dev %d:%d ino 0x%llx",
596 MAJOR(__entry->dev), MINOR(__entry->dev),
597 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000598)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000599
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000600#define DEFINE_INODE_EVENT(name) \
601DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000602 TP_PROTO(struct xfs_inode *ip), \
603 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000604DEFINE_INODE_EVENT(xfs_iget_skip);
605DEFINE_INODE_EVENT(xfs_iget_reclaim);
606DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
607DEFINE_INODE_EVENT(xfs_iget_hit);
608DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000609
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000610DEFINE_INODE_EVENT(xfs_getattr);
611DEFINE_INODE_EVENT(xfs_setattr);
612DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500613DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000614DEFINE_INODE_EVENT(xfs_alloc_file_space);
615DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000616DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100617DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100618DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000619DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000620#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200621DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000622#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000623DEFINE_INODE_EVENT(xfs_vm_bmap);
624DEFINE_INODE_EVENT(xfs_file_ioctl);
625DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
626DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000627DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000628DEFINE_INODE_EVENT(xfs_file_fsync);
629DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400630DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000631
632DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
633DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
634
Brian Foster27b52862012-11-06 09:50:38 -0500635DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
636DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500637DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700638DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
639DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
640DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500641
Christoph Hellwigd522d562017-08-29 10:08:41 -0700642TRACE_EVENT(xfs_filemap_fault,
643 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
644 bool write_fault),
645 TP_ARGS(ip, pe_size, write_fault),
646 TP_STRUCT__entry(
647 __field(dev_t, dev)
648 __field(xfs_ino_t, ino)
649 __field(enum page_entry_size, pe_size)
650 __field(bool, write_fault)
651 ),
652 TP_fast_assign(
653 __entry->dev = VFS_I(ip)->i_sb->s_dev;
654 __entry->ino = ip->i_ino;
655 __entry->pe_size = pe_size;
656 __entry->write_fault = write_fault;
657 ),
658 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
659 MAJOR(__entry->dev), MINOR(__entry->dev),
660 __entry->ino,
661 __print_symbolic(__entry->pe_size,
662 { PE_SIZE_PTE, "PTE" },
663 { PE_SIZE_PMD, "PMD" },
664 { PE_SIZE_PUD, "PUD" }),
665 __entry->write_fault)
666)
667
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000668DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000669 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
670 TP_ARGS(ip, caller_ip),
671 TP_STRUCT__entry(
672 __field(dev_t, dev)
673 __field(xfs_ino_t, ino)
674 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100675 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000676 __field(unsigned long, caller_ip)
677 ),
678 TP_fast_assign(
679 __entry->dev = VFS_I(ip)->i_sb->s_dev;
680 __entry->ino = ip->i_ino;
681 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100682 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000683 __entry->caller_ip = caller_ip;
684 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800685 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000686 MAJOR(__entry->dev), MINOR(__entry->dev),
687 __entry->ino,
688 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100689 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000690 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000691)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000692
Brian Foster19cb7e32013-03-18 10:51:48 -0400693TRACE_EVENT(xfs_iomap_prealloc_size,
694 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
695 unsigned int writeio_blocks),
696 TP_ARGS(ip, blocks, shift, writeio_blocks),
697 TP_STRUCT__entry(
698 __field(dev_t, dev)
699 __field(xfs_ino_t, ino)
700 __field(xfs_fsblock_t, blocks)
701 __field(int, shift)
702 __field(unsigned int, writeio_blocks)
703 ),
704 TP_fast_assign(
705 __entry->dev = VFS_I(ip)->i_sb->s_dev;
706 __entry->ino = ip->i_ino;
707 __entry->blocks = blocks;
708 __entry->shift = shift;
709 __entry->writeio_blocks = writeio_blocks;
710 ),
711 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
712 "m_writeio_blocks %u",
713 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
714 __entry->blocks, __entry->shift, __entry->writeio_blocks)
715)
716
Brian Foster56d11152015-05-29 09:18:32 +1000717TRACE_EVENT(xfs_irec_merge_pre,
718 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
719 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
720 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
721 TP_STRUCT__entry(
722 __field(dev_t, dev)
723 __field(xfs_agnumber_t, agno)
724 __field(xfs_agino_t, agino)
725 __field(uint16_t, holemask)
726 __field(xfs_agino_t, nagino)
727 __field(uint16_t, nholemask)
728 ),
729 TP_fast_assign(
730 __entry->dev = mp->m_super->s_dev;
731 __entry->agno = agno;
732 __entry->agino = agino;
733 __entry->holemask = holemask;
734 __entry->nagino = nagino;
735 __entry->nholemask = holemask;
736 ),
737 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
738 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
739 __entry->agino, __entry->holemask, __entry->nagino,
740 __entry->nholemask)
741)
742
743TRACE_EVENT(xfs_irec_merge_post,
744 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
745 uint16_t holemask),
746 TP_ARGS(mp, agno, agino, holemask),
747 TP_STRUCT__entry(
748 __field(dev_t, dev)
749 __field(xfs_agnumber_t, agno)
750 __field(xfs_agino_t, agino)
751 __field(uint16_t, holemask)
752 ),
753 TP_fast_assign(
754 __entry->dev = mp->m_super->s_dev;
755 __entry->agno = agno;
756 __entry->agino = agino;
757 __entry->holemask = holemask;
758 ),
759 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
760 MINOR(__entry->dev), __entry->agno, __entry->agino,
761 __entry->holemask)
762)
763
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000764#define DEFINE_IREF_EVENT(name) \
765DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000766 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
767 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000768DEFINE_IREF_EVENT(xfs_irele);
769DEFINE_IREF_EVENT(xfs_inode_pin);
770DEFINE_IREF_EVENT(xfs_inode_unpin);
771DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100772
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000773DECLARE_EVENT_CLASS(xfs_namespace_class,
774 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
775 TP_ARGS(dp, name),
776 TP_STRUCT__entry(
777 __field(dev_t, dev)
778 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000779 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000780 __dynamic_array(char, name, name->len)
781 ),
782 TP_fast_assign(
783 __entry->dev = VFS_I(dp)->i_sb->s_dev;
784 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000785 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000786 memcpy(__get_str(name), name->name, name->len);
787 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000788 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000789 MAJOR(__entry->dev), MINOR(__entry->dev),
790 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000791 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000792 __get_str(name))
793)
794
795#define DEFINE_NAMESPACE_EVENT(name) \
796DEFINE_EVENT(xfs_namespace_class, name, \
797 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
798 TP_ARGS(dp, name))
799DEFINE_NAMESPACE_EVENT(xfs_remove);
800DEFINE_NAMESPACE_EVENT(xfs_link);
801DEFINE_NAMESPACE_EVENT(xfs_lookup);
802DEFINE_NAMESPACE_EVENT(xfs_create);
803DEFINE_NAMESPACE_EVENT(xfs_symlink);
804
805TRACE_EVENT(xfs_rename,
806 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
807 struct xfs_name *src_name, struct xfs_name *target_name),
808 TP_ARGS(src_dp, target_dp, src_name, target_name),
809 TP_STRUCT__entry(
810 __field(dev_t, dev)
811 __field(xfs_ino_t, src_dp_ino)
812 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000813 __field(int, src_namelen)
814 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000815 __dynamic_array(char, src_name, src_name->len)
816 __dynamic_array(char, target_name, target_name->len)
817 ),
818 TP_fast_assign(
819 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
820 __entry->src_dp_ino = src_dp->i_ino;
821 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000822 __entry->src_namelen = src_name->len;
823 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000824 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000825 memcpy(__get_str(target_name), target_name->name,
826 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000827 ),
828 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000829 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000830 MAJOR(__entry->dev), MINOR(__entry->dev),
831 __entry->src_dp_ino,
832 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000833 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000834 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000835 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000836 __get_str(target_name))
837)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000838
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000839DECLARE_EVENT_CLASS(xfs_dquot_class,
840 TP_PROTO(struct xfs_dquot *dqp),
841 TP_ARGS(dqp),
842 TP_STRUCT__entry(
843 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000844 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000845 __field(unsigned, flags)
846 __field(unsigned, nrefs)
847 __field(unsigned long long, res_bcount)
848 __field(unsigned long long, bcount)
849 __field(unsigned long long, icount)
850 __field(unsigned long long, blk_hardlimit)
851 __field(unsigned long long, blk_softlimit)
852 __field(unsigned long long, ino_hardlimit)
853 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000854 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000855 TP_fast_assign(
856 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000857 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000858 __entry->flags = dqp->dq_flags;
859 __entry->nrefs = dqp->q_nrefs;
860 __entry->res_bcount = dqp->q_res_bcount;
861 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
862 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
863 __entry->blk_hardlimit =
864 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
865 __entry->blk_softlimit =
866 be64_to_cpu(dqp->q_core.d_blk_softlimit);
867 __entry->ino_hardlimit =
868 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
869 __entry->ino_softlimit =
870 be64_to_cpu(dqp->q_core.d_ino_softlimit);
871 ),
872 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000873 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
874 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000875 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000876 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000877 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
878 __entry->nrefs,
879 __entry->res_bcount,
880 __entry->bcount,
881 __entry->blk_hardlimit,
882 __entry->blk_softlimit,
883 __entry->icount,
884 __entry->ino_hardlimit,
885 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000886)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000887
888#define DEFINE_DQUOT_EVENT(name) \
889DEFINE_EVENT(xfs_dquot_class, name, \
890 TP_PROTO(struct xfs_dquot *dqp), \
891 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000892DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000893DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
894DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000895DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
896DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000897DEFINE_DQUOT_EVENT(xfs_dqattach_found);
898DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000899DEFINE_DQUOT_EVENT(xfs_dqalloc);
900DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
901DEFINE_DQUOT_EVENT(xfs_dqread);
902DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000903DEFINE_DQUOT_EVENT(xfs_dqget_hit);
904DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000905DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
906DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000907DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000908DEFINE_DQUOT_EVENT(xfs_dqput_free);
909DEFINE_DQUOT_EVENT(xfs_dqrele);
910DEFINE_DQUOT_EVENT(xfs_dqflush);
911DEFINE_DQUOT_EVENT(xfs_dqflush_force);
912DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000913
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000914DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500915 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000916 TP_ARGS(log, tic),
917 TP_STRUCT__entry(
918 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000919 __field(char, ocnt)
920 __field(char, cnt)
921 __field(int, curr_res)
922 __field(int, unit_res)
923 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100924 __field(int, reserveq)
925 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000926 __field(int, grant_reserve_cycle)
927 __field(int, grant_reserve_bytes)
928 __field(int, grant_write_cycle)
929 __field(int, grant_write_bytes)
930 __field(int, curr_cycle)
931 __field(int, curr_block)
932 __field(xfs_lsn_t, tail_lsn)
933 ),
934 TP_fast_assign(
935 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000936 __entry->ocnt = tic->t_ocnt;
937 __entry->cnt = tic->t_cnt;
938 __entry->curr_res = tic->t_curr_res;
939 __entry->unit_res = tic->t_unit_res;
940 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000941 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
942 __entry->writeq = list_empty(&log->l_write_head.waiters);
943 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100944 &__entry->grant_reserve_cycle,
945 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000946 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100947 &__entry->grant_write_cycle,
948 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000949 __entry->curr_cycle = log->l_curr_cycle;
950 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100951 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000952 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000953 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100954 "t_unit_res %u t_flags %s reserveq %s "
955 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000956 "grant_reserve_bytes %d grant_write_cycle %d "
957 "grant_write_bytes %d curr_cycle %d curr_block %d "
958 "tail_cycle %d tail_block %d",
959 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000960 __entry->ocnt,
961 __entry->cnt,
962 __entry->curr_res,
963 __entry->unit_res,
964 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100965 __entry->reserveq ? "empty" : "active",
966 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000967 __entry->grant_reserve_cycle,
968 __entry->grant_reserve_bytes,
969 __entry->grant_write_cycle,
970 __entry->grant_write_bytes,
971 __entry->curr_cycle,
972 __entry->curr_block,
973 CYCLE_LSN(__entry->tail_lsn),
974 BLOCK_LSN(__entry->tail_lsn)
975 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000976)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000977
978#define DEFINE_LOGGRANT_EVENT(name) \
979DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500980 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000981 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000982DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
983DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000984DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +0000985DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
986DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +1100987DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +0000988DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
989DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
990DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
991DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000992DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
993DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
994DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
995DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
996DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
997DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
998
Christoph Hellwig9e4c1092011-10-11 15:14:11 +0000999DECLARE_EVENT_CLASS(xfs_log_item_class,
1000 TP_PROTO(struct xfs_log_item *lip),
1001 TP_ARGS(lip),
1002 TP_STRUCT__entry(
1003 __field(dev_t, dev)
1004 __field(void *, lip)
1005 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001006 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001007 __field(xfs_lsn_t, lsn)
1008 ),
1009 TP_fast_assign(
1010 __entry->dev = lip->li_mountp->m_super->s_dev;
1011 __entry->lip = lip;
1012 __entry->type = lip->li_type;
1013 __entry->flags = lip->li_flags;
1014 __entry->lsn = lip->li_lsn;
1015 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001016 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001017 MAJOR(__entry->dev), MINOR(__entry->dev),
1018 __entry->lip,
1019 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1020 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1021 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1022)
1023
Dave Chinner14c26c62012-04-24 16:33:31 +10001024TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001025 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1026 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001027 TP_STRUCT__entry(
1028 __field(dev_t, dev)
1029 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001030 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001031 ),
1032 TP_fast_assign(
1033 __entry->dev = mp->m_super->s_dev;
1034 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001035 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001036 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001037 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001038 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001039 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001040)
1041
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001042#define DEFINE_LOG_ITEM_EVENT(name) \
1043DEFINE_EVENT(xfs_log_item_class, name, \
1044 TP_PROTO(struct xfs_log_item *lip), \
1045 TP_ARGS(lip))
1046DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001047DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1048DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001049DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001050
Dave Chinner750b9c92013-11-01 15:27:18 +11001051DECLARE_EVENT_CLASS(xfs_ail_class,
1052 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1053 TP_ARGS(lip, old_lsn, new_lsn),
1054 TP_STRUCT__entry(
1055 __field(dev_t, dev)
1056 __field(void *, lip)
1057 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001058 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001059 __field(xfs_lsn_t, old_lsn)
1060 __field(xfs_lsn_t, new_lsn)
1061 ),
1062 TP_fast_assign(
1063 __entry->dev = lip->li_mountp->m_super->s_dev;
1064 __entry->lip = lip;
1065 __entry->type = lip->li_type;
1066 __entry->flags = lip->li_flags;
1067 __entry->old_lsn = old_lsn;
1068 __entry->new_lsn = new_lsn;
1069 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001070 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 +11001071 MAJOR(__entry->dev), MINOR(__entry->dev),
1072 __entry->lip,
1073 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1074 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1075 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1076 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1077)
1078
1079#define DEFINE_AIL_EVENT(name) \
1080DEFINE_EVENT(xfs_ail_class, name, \
1081 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1082 TP_ARGS(lip, old_lsn, new_lsn))
1083DEFINE_AIL_EVENT(xfs_ail_insert);
1084DEFINE_AIL_EVENT(xfs_ail_move);
1085DEFINE_AIL_EVENT(xfs_ail_delete);
1086
1087TRACE_EVENT(xfs_log_assign_tail_lsn,
1088 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1089 TP_ARGS(log, new_lsn),
1090 TP_STRUCT__entry(
1091 __field(dev_t, dev)
1092 __field(xfs_lsn_t, new_lsn)
1093 __field(xfs_lsn_t, old_lsn)
1094 __field(xfs_lsn_t, last_sync_lsn)
1095 ),
1096 TP_fast_assign(
1097 __entry->dev = log->l_mp->m_super->s_dev;
1098 __entry->new_lsn = new_lsn;
1099 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1100 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1101 ),
1102 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1103 MAJOR(__entry->dev), MINOR(__entry->dev),
1104 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1105 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1106 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1107)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001108
Li Zefanf8adb4d2010-05-24 08:25:57 +00001109DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001110 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1111 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001112 TP_STRUCT__entry(
1113 __field(dev_t, dev)
1114 __field(xfs_ino_t, ino)
1115 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001116 __field(loff_t, offset)
1117 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001118 ),
1119 TP_fast_assign(
1120 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1121 __entry->ino = ip->i_ino;
1122 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001123 __entry->offset = offset;
1124 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001125 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001126 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001127 MAJOR(__entry->dev), MINOR(__entry->dev),
1128 __entry->ino,
1129 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001130 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001131 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001132)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001133
1134#define DEFINE_RW_EVENT(name) \
1135DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001136 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1137 TP_ARGS(ip, count, offset))
1138DEFINE_RW_EVENT(xfs_file_buffered_read);
1139DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001140DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001141DEFINE_RW_EVENT(xfs_file_buffered_write);
1142DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001143DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001144
Li Zefanf8adb4d2010-05-24 08:25:57 +00001145DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001146 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1147 unsigned int len),
1148 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001149 TP_STRUCT__entry(
1150 __field(dev_t, dev)
1151 __field(xfs_ino_t, ino)
1152 __field(pgoff_t, pgoff)
1153 __field(loff_t, size)
1154 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001155 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001156 ),
1157 TP_fast_assign(
Li Zefanf8adb4d2010-05-24 08:25:57 +00001158 __entry->dev = inode->i_sb->s_dev;
1159 __entry->ino = XFS_I(inode)->i_ino;
1160 __entry->pgoff = page_offset(page);
1161 __entry->size = i_size_read(inode);
1162 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001163 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001164 ),
1165 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001166 "length %x",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001167 MAJOR(__entry->dev), MINOR(__entry->dev),
1168 __entry->ino,
1169 __entry->pgoff,
1170 __entry->size,
1171 __entry->offset,
Christoph Hellwig82cb1412018-07-11 22:26:05 -07001172 __entry->length)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001173)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001174
1175#define DEFINE_PAGE_EVENT(name) \
1176DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001177 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1178 unsigned int len), \
1179 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001180DEFINE_PAGE_EVENT(xfs_writepage);
1181DEFINE_PAGE_EVENT(xfs_releasepage);
1182DEFINE_PAGE_EVENT(xfs_invalidatepage);
1183
Dave Chinner121e2132016-01-08 11:28:35 +11001184DECLARE_EVENT_CLASS(xfs_readpage_class,
1185 TP_PROTO(struct inode *inode, int nr_pages),
1186 TP_ARGS(inode, nr_pages),
1187 TP_STRUCT__entry(
1188 __field(dev_t, dev)
1189 __field(xfs_ino_t, ino)
1190 __field(int, nr_pages)
1191 ),
1192 TP_fast_assign(
1193 __entry->dev = inode->i_sb->s_dev;
1194 __entry->ino = inode->i_ino;
1195 __entry->nr_pages = nr_pages;
1196 ),
1197 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1198 MAJOR(__entry->dev), MINOR(__entry->dev),
1199 __entry->ino,
1200 __entry->nr_pages)
1201)
1202
1203#define DEFINE_READPAGE_EVENT(name) \
1204DEFINE_EVENT(xfs_readpage_class, name, \
1205 TP_PROTO(struct inode *inode, int nr_pages), \
1206 TP_ARGS(inode, nr_pages))
1207DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1208DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1209
Christoph Hellwiga206c812010-12-10 08:42:20 +00001210DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001211 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001212 int type, struct xfs_bmbt_irec *irec),
1213 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001214 TP_STRUCT__entry(
1215 __field(dev_t, dev)
1216 __field(xfs_ino_t, ino)
1217 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001218 __field(loff_t, offset)
1219 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001220 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001221 __field(xfs_fileoff_t, startoff)
1222 __field(xfs_fsblock_t, startblock)
1223 __field(xfs_filblks_t, blockcount)
1224 ),
1225 TP_fast_assign(
1226 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1227 __entry->ino = ip->i_ino;
1228 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001229 __entry->offset = offset;
1230 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001231 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001232 __entry->startoff = irec ? irec->br_startoff : 0;
1233 __entry->startblock = irec ? irec->br_startblock : 0;
1234 __entry->blockcount = irec ? irec->br_blockcount : 0;
1235 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001236 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1237 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001238 MAJOR(__entry->dev), MINOR(__entry->dev),
1239 __entry->ino,
1240 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001241 __entry->offset,
1242 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001243 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001244 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001245 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001246 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001247)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001248
1249#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001250DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001251 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001252 int type, struct xfs_bmbt_irec *irec), \
1253 TP_ARGS(ip, offset, count, type, irec))
1254DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1255DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001256DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1257DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001258
Li Zefanf8adb4d2010-05-24 08:25:57 +00001259DECLARE_EVENT_CLASS(xfs_simple_io_class,
1260 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1261 TP_ARGS(ip, offset, count),
1262 TP_STRUCT__entry(
1263 __field(dev_t, dev)
1264 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001265 __field(loff_t, isize)
1266 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001267 __field(loff_t, offset)
1268 __field(size_t, count)
1269 ),
1270 TP_fast_assign(
1271 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1272 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001273 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001274 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001275 __entry->offset = offset;
1276 __entry->count = count;
1277 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001278 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001279 "offset 0x%llx count %zd",
1280 MAJOR(__entry->dev), MINOR(__entry->dev),
1281 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001282 __entry->isize,
1283 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001284 __entry->offset,
1285 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001286);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001287
1288#define DEFINE_SIMPLE_IO_EVENT(name) \
1289DEFINE_EVENT(xfs_simple_io_class, name, \
1290 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1291 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001292DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1293DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001294DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001295DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001296DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1297DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1298DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001299
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001300DECLARE_EVENT_CLASS(xfs_itrunc_class,
1301 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1302 TP_ARGS(ip, new_size),
1303 TP_STRUCT__entry(
1304 __field(dev_t, dev)
1305 __field(xfs_ino_t, ino)
1306 __field(xfs_fsize_t, size)
1307 __field(xfs_fsize_t, new_size)
1308 ),
1309 TP_fast_assign(
1310 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1311 __entry->ino = ip->i_ino;
1312 __entry->size = ip->i_d.di_size;
1313 __entry->new_size = new_size;
1314 ),
1315 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1316 MAJOR(__entry->dev), MINOR(__entry->dev),
1317 __entry->ino,
1318 __entry->size,
1319 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001320)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001321
1322#define DEFINE_ITRUNC_EVENT(name) \
1323DEFINE_EVENT(xfs_itrunc_class, name, \
1324 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1325 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001326DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1327DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001328
1329TRACE_EVENT(xfs_pagecache_inval,
1330 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1331 TP_ARGS(ip, start, finish),
1332 TP_STRUCT__entry(
1333 __field(dev_t, dev)
1334 __field(xfs_ino_t, ino)
1335 __field(xfs_fsize_t, size)
1336 __field(xfs_off_t, start)
1337 __field(xfs_off_t, finish)
1338 ),
1339 TP_fast_assign(
1340 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1341 __entry->ino = ip->i_ino;
1342 __entry->size = ip->i_d.di_size;
1343 __entry->start = start;
1344 __entry->finish = finish;
1345 ),
1346 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1347 MAJOR(__entry->dev), MINOR(__entry->dev),
1348 __entry->ino,
1349 __entry->size,
1350 __entry->start,
1351 __entry->finish)
1352);
1353
1354TRACE_EVENT(xfs_bunmap,
1355 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1356 int flags, unsigned long caller_ip),
1357 TP_ARGS(ip, bno, len, flags, caller_ip),
1358 TP_STRUCT__entry(
1359 __field(dev_t, dev)
1360 __field(xfs_ino_t, ino)
1361 __field(xfs_fsize_t, size)
1362 __field(xfs_fileoff_t, bno)
1363 __field(xfs_filblks_t, len)
1364 __field(unsigned long, caller_ip)
1365 __field(int, flags)
1366 ),
1367 TP_fast_assign(
1368 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1369 __entry->ino = ip->i_ino;
1370 __entry->size = ip->i_d.di_size;
1371 __entry->bno = bno;
1372 __entry->len = len;
1373 __entry->caller_ip = caller_ip;
1374 __entry->flags = flags;
1375 ),
1376 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 -08001377 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001378 MAJOR(__entry->dev), MINOR(__entry->dev),
1379 __entry->ino,
1380 __entry->size,
1381 __entry->bno,
1382 __entry->len,
1383 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1384 (void *)__entry->caller_ip)
1385
1386);
1387
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001388DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001389 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1390 xfs_agblock_t agbno, xfs_extlen_t len),
1391 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001392 TP_STRUCT__entry(
1393 __field(dev_t, dev)
1394 __field(xfs_agnumber_t, agno)
1395 __field(xfs_agblock_t, agbno)
1396 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001397 ),
1398 TP_fast_assign(
1399 __entry->dev = mp->m_super->s_dev;
1400 __entry->agno = agno;
1401 __entry->agbno = agbno;
1402 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001403 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001404 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001405 MAJOR(__entry->dev), MINOR(__entry->dev),
1406 __entry->agno,
1407 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001408 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001409);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001410#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001411DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001412 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1413 xfs_agblock_t agbno, xfs_extlen_t len), \
1414 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001415DEFINE_BUSY_EVENT(xfs_extent_busy);
1416DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1417DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1418DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1419DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001420
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001421TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001422 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1423 xfs_agblock_t agbno, xfs_extlen_t len,
1424 xfs_agblock_t tbno, xfs_extlen_t tlen),
1425 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1426 TP_STRUCT__entry(
1427 __field(dev_t, dev)
1428 __field(xfs_agnumber_t, agno)
1429 __field(xfs_agblock_t, agbno)
1430 __field(xfs_extlen_t, len)
1431 __field(xfs_agblock_t, tbno)
1432 __field(xfs_extlen_t, tlen)
1433 ),
1434 TP_fast_assign(
1435 __entry->dev = mp->m_super->s_dev;
1436 __entry->agno = agno;
1437 __entry->agbno = agbno;
1438 __entry->len = len;
1439 __entry->tbno = tbno;
1440 __entry->tlen = tlen;
1441 ),
1442 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1443 MAJOR(__entry->dev), MINOR(__entry->dev),
1444 __entry->agno,
1445 __entry->agbno,
1446 __entry->len,
1447 __entry->tbno,
1448 __entry->tlen)
1449);
1450
Brian Fostera27ba262018-03-15 10:51:58 -07001451DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001452 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1453 unsigned long caller_ip),
1454 TP_ARGS(mp, agf, flags, caller_ip),
1455 TP_STRUCT__entry(
1456 __field(dev_t, dev)
1457 __field(xfs_agnumber_t, agno)
1458 __field(int, flags)
1459 __field(__u32, length)
1460 __field(__u32, bno_root)
1461 __field(__u32, cnt_root)
1462 __field(__u32, bno_level)
1463 __field(__u32, cnt_level)
1464 __field(__u32, flfirst)
1465 __field(__u32, fllast)
1466 __field(__u32, flcount)
1467 __field(__u32, freeblks)
1468 __field(__u32, longest)
1469 __field(unsigned long, caller_ip)
1470 ),
1471 TP_fast_assign(
1472 __entry->dev = mp->m_super->s_dev;
1473 __entry->agno = be32_to_cpu(agf->agf_seqno),
1474 __entry->flags = flags;
1475 __entry->length = be32_to_cpu(agf->agf_length),
1476 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1477 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1478 __entry->bno_level =
1479 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1480 __entry->cnt_level =
1481 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1482 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1483 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1484 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1485 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1486 __entry->longest = be32_to_cpu(agf->agf_longest);
1487 __entry->caller_ip = caller_ip;
1488 ),
1489 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1490 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001491 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001492 MAJOR(__entry->dev), MINOR(__entry->dev),
1493 __entry->agno,
1494 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1495 __entry->length,
1496 __entry->bno_root,
1497 __entry->cnt_root,
1498 __entry->bno_level,
1499 __entry->cnt_level,
1500 __entry->flfirst,
1501 __entry->fllast,
1502 __entry->flcount,
1503 __entry->freeblks,
1504 __entry->longest,
1505 (void *)__entry->caller_ip)
1506);
Brian Fostera27ba262018-03-15 10:51:58 -07001507#define DEFINE_AGF_EVENT(name) \
1508DEFINE_EVENT(xfs_agf_class, name, \
1509 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1510 unsigned long caller_ip), \
1511 TP_ARGS(mp, agf, flags, caller_ip))
1512DEFINE_AGF_EVENT(xfs_agf);
1513DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001514
1515TRACE_EVENT(xfs_free_extent,
1516 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001517 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1518 int haveright),
1519 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001520 TP_STRUCT__entry(
1521 __field(dev_t, dev)
1522 __field(xfs_agnumber_t, agno)
1523 __field(xfs_agblock_t, agbno)
1524 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001525 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001526 __field(int, haveleft)
1527 __field(int, haveright)
1528 ),
1529 TP_fast_assign(
1530 __entry->dev = mp->m_super->s_dev;
1531 __entry->agno = agno;
1532 __entry->agbno = agbno;
1533 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001534 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001535 __entry->haveleft = haveleft;
1536 __entry->haveright = haveright;
1537 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001538 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001539 MAJOR(__entry->dev), MINOR(__entry->dev),
1540 __entry->agno,
1541 __entry->agbno,
1542 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001543 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001544 __entry->haveleft ?
1545 (__entry->haveright ? "both" : "left") :
1546 (__entry->haveright ? "right" : "none"))
1547
1548);
1549
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001550DECLARE_EVENT_CLASS(xfs_alloc_class,
1551 TP_PROTO(struct xfs_alloc_arg *args),
1552 TP_ARGS(args),
1553 TP_STRUCT__entry(
1554 __field(dev_t, dev)
1555 __field(xfs_agnumber_t, agno)
1556 __field(xfs_agblock_t, agbno)
1557 __field(xfs_extlen_t, minlen)
1558 __field(xfs_extlen_t, maxlen)
1559 __field(xfs_extlen_t, mod)
1560 __field(xfs_extlen_t, prod)
1561 __field(xfs_extlen_t, minleft)
1562 __field(xfs_extlen_t, total)
1563 __field(xfs_extlen_t, alignment)
1564 __field(xfs_extlen_t, minalignslop)
1565 __field(xfs_extlen_t, len)
1566 __field(short, type)
1567 __field(short, otype)
1568 __field(char, wasdel)
1569 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001570 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001571 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001572 __field(xfs_fsblock_t, firstblock)
1573 ),
1574 TP_fast_assign(
1575 __entry->dev = args->mp->m_super->s_dev;
1576 __entry->agno = args->agno;
1577 __entry->agbno = args->agbno;
1578 __entry->minlen = args->minlen;
1579 __entry->maxlen = args->maxlen;
1580 __entry->mod = args->mod;
1581 __entry->prod = args->prod;
1582 __entry->minleft = args->minleft;
1583 __entry->total = args->total;
1584 __entry->alignment = args->alignment;
1585 __entry->minalignslop = args->minalignslop;
1586 __entry->len = args->len;
1587 __entry->type = args->type;
1588 __entry->otype = args->otype;
1589 __entry->wasdel = args->wasdel;
1590 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001591 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001592 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001593 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001594 ),
1595 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1596 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001597 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001598 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001599 MAJOR(__entry->dev), MINOR(__entry->dev),
1600 __entry->agno,
1601 __entry->agbno,
1602 __entry->minlen,
1603 __entry->maxlen,
1604 __entry->mod,
1605 __entry->prod,
1606 __entry->minleft,
1607 __entry->total,
1608 __entry->alignment,
1609 __entry->minalignslop,
1610 __entry->len,
1611 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1612 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1613 __entry->wasdel,
1614 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001615 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001616 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001617 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001618)
1619
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001620#define DEFINE_ALLOC_EVENT(name) \
1621DEFINE_EVENT(xfs_alloc_class, name, \
1622 TP_PROTO(struct xfs_alloc_arg *args), \
1623 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001624DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001625DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001626DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1627DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1628DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1629DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1630DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1631DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001632DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1633DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001634DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1635DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1636DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1637DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1638DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001639DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001640DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1641DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1642DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1643DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1644DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1645DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1646DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1647DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1648DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1649
Dave Chinner5a5881c2012-03-22 05:15:13 +00001650DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001651 TP_PROTO(struct xfs_da_args *args),
1652 TP_ARGS(args),
1653 TP_STRUCT__entry(
1654 __field(dev_t, dev)
1655 __field(xfs_ino_t, ino)
1656 __dynamic_array(char, name, args->namelen)
1657 __field(int, namelen)
1658 __field(xfs_dahash_t, hashval)
1659 __field(xfs_ino_t, inumber)
1660 __field(int, op_flags)
1661 ),
1662 TP_fast_assign(
1663 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1664 __entry->ino = args->dp->i_ino;
1665 if (args->namelen)
1666 memcpy(__get_str(name), args->name, args->namelen);
1667 __entry->namelen = args->namelen;
1668 __entry->hashval = args->hashval;
1669 __entry->inumber = args->inumber;
1670 __entry->op_flags = args->op_flags;
1671 ),
1672 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1673 "inumber 0x%llx op_flags %s",
1674 MAJOR(__entry->dev), MINOR(__entry->dev),
1675 __entry->ino,
1676 __entry->namelen,
1677 __entry->namelen ? __get_str(name) : NULL,
1678 __entry->namelen,
1679 __entry->hashval,
1680 __entry->inumber,
1681 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001682)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001683
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001684#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001685DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001686 TP_PROTO(struct xfs_da_args *args), \
1687 TP_ARGS(args))
1688DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1689DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1690DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1691DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1692DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1693DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1694DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1695DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1696DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1697DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1698DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1699DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1700DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1701DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1702DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1703DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1704DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1705DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1706DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1707DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1708DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1709DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1710DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1711DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1712DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1713
Dave Chinneree732592012-11-12 22:53:53 +11001714DECLARE_EVENT_CLASS(xfs_attr_class,
1715 TP_PROTO(struct xfs_da_args *args),
1716 TP_ARGS(args),
1717 TP_STRUCT__entry(
1718 __field(dev_t, dev)
1719 __field(xfs_ino_t, ino)
1720 __dynamic_array(char, name, args->namelen)
1721 __field(int, namelen)
1722 __field(int, valuelen)
1723 __field(xfs_dahash_t, hashval)
Eric Sandeene4435232018-04-17 17:17:35 -07001724 __field(int, flags)
Dave Chinneree732592012-11-12 22:53:53 +11001725 __field(int, op_flags)
1726 ),
1727 TP_fast_assign(
1728 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1729 __entry->ino = args->dp->i_ino;
1730 if (args->namelen)
1731 memcpy(__get_str(name), args->name, args->namelen);
1732 __entry->namelen = args->namelen;
1733 __entry->valuelen = args->valuelen;
1734 __entry->hashval = args->hashval;
Eric Sandeene4435232018-04-17 17:17:35 -07001735 __entry->flags = args->flags;
Dave Chinneree732592012-11-12 22:53:53 +11001736 __entry->op_flags = args->op_flags;
1737 ),
1738 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Eric Sandeene4435232018-04-17 17:17:35 -07001739 "hashval 0x%x flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001740 MAJOR(__entry->dev), MINOR(__entry->dev),
1741 __entry->ino,
1742 __entry->namelen,
1743 __entry->namelen ? __get_str(name) : NULL,
1744 __entry->namelen,
1745 __entry->valuelen,
1746 __entry->hashval,
Eric Sandeene4435232018-04-17 17:17:35 -07001747 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
Dave Chinneree732592012-11-12 22:53:53 +11001748 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1749)
1750
Dave Chinner5a5881c2012-03-22 05:15:13 +00001751#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001752DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001753 TP_PROTO(struct xfs_da_args *args), \
1754 TP_ARGS(args))
1755DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1756DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1757DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1758DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1759DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001760DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1761
1762DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1763DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1764DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001765DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001766DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1767DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001768DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1769DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001770DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1771DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001772DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001773DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1774DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1775DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1776DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1777DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1778DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1779DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1780DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1782DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1783DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001784DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001785
1786DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001787DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001788DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1789DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1790
Dave Chinneree732592012-11-12 22:53:53 +11001791DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1792DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1793
1794DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1795DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1796DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1797
Dave Chinner5a5881c2012-03-22 05:15:13 +00001798#define DEFINE_DA_EVENT(name) \
1799DEFINE_EVENT(xfs_da_class, name, \
1800 TP_PROTO(struct xfs_da_args *args), \
1801 TP_ARGS(args))
1802DEFINE_DA_EVENT(xfs_da_split);
1803DEFINE_DA_EVENT(xfs_da_join);
1804DEFINE_DA_EVENT(xfs_da_link_before);
1805DEFINE_DA_EVENT(xfs_da_link_after);
1806DEFINE_DA_EVENT(xfs_da_unlink_back);
1807DEFINE_DA_EVENT(xfs_da_unlink_forward);
1808DEFINE_DA_EVENT(xfs_da_root_split);
1809DEFINE_DA_EVENT(xfs_da_root_join);
1810DEFINE_DA_EVENT(xfs_da_node_add);
1811DEFINE_DA_EVENT(xfs_da_node_create);
1812DEFINE_DA_EVENT(xfs_da_node_split);
1813DEFINE_DA_EVENT(xfs_da_node_remove);
1814DEFINE_DA_EVENT(xfs_da_node_rebalance);
1815DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001816DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001817DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1818DEFINE_DA_EVENT(xfs_da_grow_inode);
1819DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001820DEFINE_DA_EVENT(xfs_da_fixhashpath);
1821DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001822
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001823DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1824 TP_PROTO(struct xfs_da_args *args, int idx),
1825 TP_ARGS(args, idx),
1826 TP_STRUCT__entry(
1827 __field(dev_t, dev)
1828 __field(xfs_ino_t, ino)
1829 __field(int, op_flags)
1830 __field(int, idx)
1831 ),
1832 TP_fast_assign(
1833 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1834 __entry->ino = args->dp->i_ino;
1835 __entry->op_flags = args->op_flags;
1836 __entry->idx = idx;
1837 ),
1838 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1839 MAJOR(__entry->dev), MINOR(__entry->dev),
1840 __entry->ino,
1841 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1842 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001843)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001844
1845#define DEFINE_DIR2_SPACE_EVENT(name) \
1846DEFINE_EVENT(xfs_dir2_space_class, name, \
1847 TP_PROTO(struct xfs_da_args *args, int idx), \
1848 TP_ARGS(args, idx))
1849DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1850DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1851DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1852DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001853
1854TRACE_EVENT(xfs_dir2_leafn_moveents,
1855 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1856 TP_ARGS(args, src_idx, dst_idx, count),
1857 TP_STRUCT__entry(
1858 __field(dev_t, dev)
1859 __field(xfs_ino_t, ino)
1860 __field(int, op_flags)
1861 __field(int, src_idx)
1862 __field(int, dst_idx)
1863 __field(int, count)
1864 ),
1865 TP_fast_assign(
1866 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1867 __entry->ino = args->dp->i_ino;
1868 __entry->op_flags = args->op_flags;
1869 __entry->src_idx = src_idx;
1870 __entry->dst_idx = dst_idx;
1871 __entry->count = count;
1872 ),
1873 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1874 "src_idx %d dst_idx %d count %d",
1875 MAJOR(__entry->dev), MINOR(__entry->dev),
1876 __entry->ino,
1877 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1878 __entry->src_idx,
1879 __entry->dst_idx,
1880 __entry->count)
1881);
1882
Dave Chinner3a85cd92010-01-14 01:33:55 +00001883#define XFS_SWAPEXT_INODES \
1884 { 0, "target" }, \
1885 { 1, "temp" }
1886
1887#define XFS_INODE_FORMAT_STR \
1888 { 0, "invalid" }, \
1889 { 1, "local" }, \
1890 { 2, "extent" }, \
1891 { 3, "btree" }
1892
1893DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1894 TP_PROTO(struct xfs_inode *ip, int which),
1895 TP_ARGS(ip, which),
1896 TP_STRUCT__entry(
1897 __field(dev_t, dev)
1898 __field(int, which)
1899 __field(xfs_ino_t, ino)
1900 __field(int, format)
1901 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001902 __field(int, broot_size)
1903 __field(int, fork_off)
1904 ),
1905 TP_fast_assign(
1906 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1907 __entry->which = which;
1908 __entry->ino = ip->i_ino;
1909 __entry->format = ip->i_d.di_format;
1910 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001911 __entry->broot_size = ip->i_df.if_broot_bytes;
1912 __entry->fork_off = XFS_IFORK_BOFF(ip);
1913 ),
1914 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001915 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001916 MAJOR(__entry->dev), MINOR(__entry->dev),
1917 __entry->ino,
1918 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1919 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1920 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001921 __entry->broot_size,
1922 __entry->fork_off)
1923)
1924
1925#define DEFINE_SWAPEXT_EVENT(name) \
1926DEFINE_EVENT(xfs_swap_extent_class, name, \
1927 TP_PROTO(struct xfs_inode *ip, int which), \
1928 TP_ARGS(ip, which))
1929
1930DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1931DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1932
Brian Fostere67d3d42017-08-08 18:21:53 -07001933TRACE_EVENT(xfs_log_recover,
1934 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1935 TP_ARGS(log, headblk, tailblk),
1936 TP_STRUCT__entry(
1937 __field(dev_t, dev)
1938 __field(xfs_daddr_t, headblk)
1939 __field(xfs_daddr_t, tailblk)
1940 ),
1941 TP_fast_assign(
1942 __entry->dev = log->l_mp->m_super->s_dev;
1943 __entry->headblk = headblk;
1944 __entry->tailblk = tailblk;
1945 ),
1946 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1947 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1948 __entry->tailblk)
1949)
1950
Brian Foster5cd9cee2016-09-26 08:34:52 +10001951TRACE_EVENT(xfs_log_recover_record,
1952 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1953 TP_ARGS(log, rhead, pass),
1954 TP_STRUCT__entry(
1955 __field(dev_t, dev)
1956 __field(xfs_lsn_t, lsn)
1957 __field(int, len)
1958 __field(int, num_logops)
1959 __field(int, pass)
1960 ),
1961 TP_fast_assign(
1962 __entry->dev = log->l_mp->m_super->s_dev;
1963 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1964 __entry->len = be32_to_cpu(rhead->h_len);
1965 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1966 __entry->pass = pass;
1967 ),
1968 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1969 MAJOR(__entry->dev), MINOR(__entry->dev),
1970 __entry->lsn, __entry->len, __entry->num_logops,
1971 __entry->pass)
1972)
1973
Dave Chinner9abbc532010-04-13 15:06:46 +10001974DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001975 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001976 struct xlog_recover_item *item, int pass),
1977 TP_ARGS(log, trans, item, pass),
1978 TP_STRUCT__entry(
1979 __field(dev_t, dev)
1980 __field(unsigned long, item)
1981 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001982 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10001983 __field(int, type)
1984 __field(int, pass)
1985 __field(int, count)
1986 __field(int, total)
1987 ),
1988 TP_fast_assign(
1989 __entry->dev = log->l_mp->m_super->s_dev;
1990 __entry->item = (unsigned long)item;
1991 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10001992 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10001993 __entry->type = ITEM_TYPE(item);
1994 __entry->pass = pass;
1995 __entry->count = item->ri_cnt;
1996 __entry->total = item->ri_total;
1997 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001998 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10001999 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002000 MAJOR(__entry->dev), MINOR(__entry->dev),
2001 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002002 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002003 __entry->pass,
2004 (void *)__entry->item,
2005 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2006 __entry->count,
2007 __entry->total)
2008)
2009
2010#define DEFINE_LOG_RECOVER_ITEM(name) \
2011DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002012 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002013 struct xlog_recover_item *item, int pass), \
2014 TP_ARGS(log, trans, item, pass))
2015
2016DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2017DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2018DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2019DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2020DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2021
2022DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002023 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002024 TP_ARGS(log, buf_f),
2025 TP_STRUCT__entry(
2026 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002027 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002028 __field(unsigned short, len)
2029 __field(unsigned short, flags)
2030 __field(unsigned short, size)
2031 __field(unsigned int, map_size)
2032 ),
2033 TP_fast_assign(
2034 __entry->dev = log->l_mp->m_super->s_dev;
2035 __entry->blkno = buf_f->blf_blkno;
2036 __entry->len = buf_f->blf_len;
2037 __entry->flags = buf_f->blf_flags;
2038 __entry->size = buf_f->blf_size;
2039 __entry->map_size = buf_f->blf_map_size;
2040 ),
2041 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2042 "map_size %d",
2043 MAJOR(__entry->dev), MINOR(__entry->dev),
2044 __entry->blkno,
2045 __entry->len,
2046 __entry->flags,
2047 __entry->size,
2048 __entry->map_size)
2049)
2050
2051#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2052DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002053 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002054 TP_ARGS(log, buf_f))
2055
2056DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2057DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2058DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2059DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2060DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002061DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002062DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2063DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2064DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2065
2066DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002067 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002068 TP_ARGS(log, in_f),
2069 TP_STRUCT__entry(
2070 __field(dev_t, dev)
2071 __field(xfs_ino_t, ino)
2072 __field(unsigned short, size)
2073 __field(int, fields)
2074 __field(unsigned short, asize)
2075 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002076 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002077 __field(int, len)
2078 __field(int, boffset)
2079 ),
2080 TP_fast_assign(
2081 __entry->dev = log->l_mp->m_super->s_dev;
2082 __entry->ino = in_f->ilf_ino;
2083 __entry->size = in_f->ilf_size;
2084 __entry->fields = in_f->ilf_fields;
2085 __entry->asize = in_f->ilf_asize;
2086 __entry->dsize = in_f->ilf_dsize;
2087 __entry->blkno = in_f->ilf_blkno;
2088 __entry->len = in_f->ilf_len;
2089 __entry->boffset = in_f->ilf_boffset;
2090 ),
2091 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2092 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2093 MAJOR(__entry->dev), MINOR(__entry->dev),
2094 __entry->ino,
2095 __entry->size,
2096 __entry->fields,
2097 __entry->asize,
2098 __entry->dsize,
2099 __entry->blkno,
2100 __entry->len,
2101 __entry->boffset)
2102)
2103#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2104DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002105 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002106 TP_ARGS(log, in_f))
2107
2108DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2109DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2110DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2111
Brian Foster78d57e42015-08-19 09:58:48 +10002112DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2113 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2114 TP_ARGS(log, in_f),
2115 TP_STRUCT__entry(
2116 __field(dev_t, dev)
2117 __field(xfs_agnumber_t, agno)
2118 __field(xfs_agblock_t, agbno)
2119 __field(unsigned int, count)
2120 __field(unsigned int, isize)
2121 __field(xfs_agblock_t, length)
2122 __field(unsigned int, gen)
2123 ),
2124 TP_fast_assign(
2125 __entry->dev = log->l_mp->m_super->s_dev;
2126 __entry->agno = be32_to_cpu(in_f->icl_ag);
2127 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2128 __entry->count = be32_to_cpu(in_f->icl_count);
2129 __entry->isize = be32_to_cpu(in_f->icl_isize);
2130 __entry->length = be32_to_cpu(in_f->icl_length);
2131 __entry->gen = be32_to_cpu(in_f->icl_gen);
2132 ),
2133 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2134 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2135 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2136 __entry->length, __entry->gen)
2137)
2138#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2139DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2140 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2141 TP_ARGS(log, in_f))
2142
2143DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2144DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2145
Christoph Hellwiga46db602011-01-07 13:02:04 +00002146DECLARE_EVENT_CLASS(xfs_discard_class,
2147 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2148 xfs_agblock_t agbno, xfs_extlen_t len),
2149 TP_ARGS(mp, agno, agbno, len),
2150 TP_STRUCT__entry(
2151 __field(dev_t, dev)
2152 __field(xfs_agnumber_t, agno)
2153 __field(xfs_agblock_t, agbno)
2154 __field(xfs_extlen_t, len)
2155 ),
2156 TP_fast_assign(
2157 __entry->dev = mp->m_super->s_dev;
2158 __entry->agno = agno;
2159 __entry->agbno = agbno;
2160 __entry->len = len;
2161 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002162 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002163 MAJOR(__entry->dev), MINOR(__entry->dev),
2164 __entry->agno,
2165 __entry->agbno,
2166 __entry->len)
2167)
2168
2169#define DEFINE_DISCARD_EVENT(name) \
2170DEFINE_EVENT(xfs_discard_class, name, \
2171 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2172 xfs_agblock_t agbno, xfs_extlen_t len), \
2173 TP_ARGS(mp, agno, agbno, len))
2174DEFINE_DISCARD_EVENT(xfs_discard_extent);
2175DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2176DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2177DEFINE_DISCARD_EVENT(xfs_discard_busy);
2178
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002179/* btree cursor events */
2180DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2181 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2182 TP_ARGS(cur, level, bp),
2183 TP_STRUCT__entry(
2184 __field(dev_t, dev)
2185 __field(xfs_btnum_t, btnum)
2186 __field(int, level)
2187 __field(int, nlevels)
2188 __field(int, ptr)
2189 __field(xfs_daddr_t, daddr)
2190 ),
2191 TP_fast_assign(
2192 __entry->dev = cur->bc_mp->m_super->s_dev;
2193 __entry->btnum = cur->bc_btnum;
2194 __entry->level = level;
2195 __entry->nlevels = cur->bc_nlevels;
2196 __entry->ptr = cur->bc_ptrs[level];
2197 __entry->daddr = bp ? bp->b_bn : -1;
2198 ),
2199 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2200 MAJOR(__entry->dev), MINOR(__entry->dev),
2201 __entry->btnum,
2202 __entry->level,
2203 __entry->nlevels,
2204 __entry->ptr,
2205 (unsigned long long)__entry->daddr)
2206)
2207
2208#define DEFINE_BTREE_CUR_EVENT(name) \
2209DEFINE_EVENT(xfs_btree_cur_class, name, \
2210 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2211 TP_ARGS(cur, level, bp))
2212DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002213DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002214
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002215/* deferred ops */
2216struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002217struct xfs_defer_ops;
2218
2219DECLARE_EVENT_CLASS(xfs_defer_class,
Dave Chinnere632a562018-05-09 07:48:52 -07002220 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop,
2221 unsigned long caller_ip),
2222 TP_ARGS(mp, dop, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002223 TP_STRUCT__entry(
2224 __field(dev_t, dev)
2225 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002226 __field(char, committed)
2227 __field(char, low)
Dave Chinnere632a562018-05-09 07:48:52 -07002228 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002229 ),
2230 TP_fast_assign(
2231 __entry->dev = mp ? mp->m_super->s_dev : 0;
2232 __entry->dop = dop;
2233 __entry->committed = dop->dop_committed;
2234 __entry->low = dop->dop_low;
Dave Chinnere632a562018-05-09 07:48:52 -07002235 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002236 ),
Dave Chinnere632a562018-05-09 07:48:52 -07002237 TP_printk("dev %d:%d ops %p committed %d low %d, caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002238 MAJOR(__entry->dev), MINOR(__entry->dev),
2239 __entry->dop,
2240 __entry->committed,
Dave Chinnere632a562018-05-09 07:48:52 -07002241 __entry->low,
2242 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002243)
2244#define DEFINE_DEFER_EVENT(name) \
2245DEFINE_EVENT(xfs_defer_class, name, \
Dave Chinnere632a562018-05-09 07:48:52 -07002246 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, \
2247 unsigned long caller_ip), \
2248 TP_ARGS(mp, dop, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002249
2250DECLARE_EVENT_CLASS(xfs_defer_error_class,
2251 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2252 TP_ARGS(mp, dop, error),
2253 TP_STRUCT__entry(
2254 __field(dev_t, dev)
2255 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002256 __field(char, committed)
2257 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002258 __field(int, error)
2259 ),
2260 TP_fast_assign(
2261 __entry->dev = mp ? mp->m_super->s_dev : 0;
2262 __entry->dop = dop;
2263 __entry->committed = dop->dop_committed;
2264 __entry->low = dop->dop_low;
2265 __entry->error = error;
2266 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002267 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002268 MAJOR(__entry->dev), MINOR(__entry->dev),
2269 __entry->dop,
2270 __entry->committed,
2271 __entry->low,
2272 __entry->error)
2273)
2274#define DEFINE_DEFER_ERROR_EVENT(name) \
2275DEFINE_EVENT(xfs_defer_error_class, name, \
2276 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2277 TP_ARGS(mp, dop, error))
2278
2279DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2280 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2281 TP_ARGS(mp, dfp),
2282 TP_STRUCT__entry(
2283 __field(dev_t, dev)
2284 __field(int, type)
2285 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002286 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002287 __field(int, nr)
2288 ),
2289 TP_fast_assign(
2290 __entry->dev = mp ? mp->m_super->s_dev : 0;
2291 __entry->type = dfp->dfp_type->type;
2292 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002293 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002294 __entry->nr = dfp->dfp_count;
2295 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002296 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002297 MAJOR(__entry->dev), MINOR(__entry->dev),
2298 __entry->type,
2299 __entry->intent,
2300 __entry->committed,
2301 __entry->nr)
2302)
2303#define DEFINE_DEFER_PENDING_EVENT(name) \
2304DEFINE_EVENT(xfs_defer_pending_class, name, \
2305 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2306 TP_ARGS(mp, dfp))
2307
2308DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2309 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2310 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2311 TP_ARGS(mp, agno, type, agbno, len),
2312 TP_STRUCT__entry(
2313 __field(dev_t, dev)
2314 __field(xfs_agnumber_t, agno)
2315 __field(int, type)
2316 __field(xfs_agblock_t, agbno)
2317 __field(xfs_extlen_t, len)
2318 ),
2319 TP_fast_assign(
2320 __entry->dev = mp->m_super->s_dev;
2321 __entry->agno = agno;
2322 __entry->type = type;
2323 __entry->agbno = agbno;
2324 __entry->len = len;
2325 ),
2326 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2327 MAJOR(__entry->dev), MINOR(__entry->dev),
2328 __entry->type,
2329 __entry->agno,
2330 __entry->agbno,
2331 __entry->len)
2332);
2333#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2334DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2335 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2336 int type, \
2337 xfs_agblock_t bno, \
2338 xfs_extlen_t len), \
2339 TP_ARGS(mp, agno, type, bno, len))
2340
2341DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2342 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2343 int op,
2344 xfs_agblock_t agbno,
2345 xfs_ino_t ino,
2346 int whichfork,
2347 xfs_fileoff_t offset,
2348 xfs_filblks_t len,
2349 xfs_exntst_t state),
2350 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2351 TP_STRUCT__entry(
2352 __field(dev_t, dev)
2353 __field(xfs_agnumber_t, agno)
2354 __field(xfs_ino_t, ino)
2355 __field(xfs_agblock_t, agbno)
2356 __field(int, whichfork)
2357 __field(xfs_fileoff_t, l_loff)
2358 __field(xfs_filblks_t, l_len)
2359 __field(xfs_exntst_t, l_state)
2360 __field(int, op)
2361 ),
2362 TP_fast_assign(
2363 __entry->dev = mp->m_super->s_dev;
2364 __entry->agno = agno;
2365 __entry->ino = ino;
2366 __entry->agbno = agbno;
2367 __entry->whichfork = whichfork;
2368 __entry->l_loff = offset;
2369 __entry->l_len = len;
2370 __entry->l_state = state;
2371 __entry->op = op;
2372 ),
2373 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2374 MAJOR(__entry->dev), MINOR(__entry->dev),
2375 __entry->op,
2376 __entry->agno,
2377 __entry->agbno,
2378 __entry->ino,
2379 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2380 __entry->l_loff,
2381 __entry->l_len,
2382 __entry->l_state)
2383);
2384#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2385DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2386 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2387 int op, \
2388 xfs_agblock_t agbno, \
2389 xfs_ino_t ino, \
2390 int whichfork, \
2391 xfs_fileoff_t offset, \
2392 xfs_filblks_t len, \
2393 xfs_exntst_t state), \
2394 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2395
2396DEFINE_DEFER_EVENT(xfs_defer_init);
2397DEFINE_DEFER_EVENT(xfs_defer_cancel);
2398DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2399DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2400DEFINE_DEFER_EVENT(xfs_defer_finish);
2401DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2402
2403DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2404DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002405
2406DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2407DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002408DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2409DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2410DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2411
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002412#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2413DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2414DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002415DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2416DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002417
Darrick J. Wong673930c2016-08-03 11:33:43 +10002418/* rmap tracepoints */
2419DECLARE_EVENT_CLASS(xfs_rmap_class,
2420 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2421 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2422 struct xfs_owner_info *oinfo),
2423 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2424 TP_STRUCT__entry(
2425 __field(dev_t, dev)
2426 __field(xfs_agnumber_t, agno)
2427 __field(xfs_agblock_t, agbno)
2428 __field(xfs_extlen_t, len)
2429 __field(uint64_t, owner)
2430 __field(uint64_t, offset)
2431 __field(unsigned long, flags)
2432 ),
2433 TP_fast_assign(
2434 __entry->dev = mp->m_super->s_dev;
2435 __entry->agno = agno;
2436 __entry->agbno = agbno;
2437 __entry->len = len;
2438 __entry->owner = oinfo->oi_owner;
2439 __entry->offset = oinfo->oi_offset;
2440 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002441 if (unwritten)
2442 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002443 ),
2444 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2445 MAJOR(__entry->dev), MINOR(__entry->dev),
2446 __entry->agno,
2447 __entry->agbno,
2448 __entry->len,
2449 __entry->owner,
2450 __entry->offset,
2451 __entry->flags)
2452);
2453#define DEFINE_RMAP_EVENT(name) \
2454DEFINE_EVENT(xfs_rmap_class, name, \
2455 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2456 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2457 struct xfs_owner_info *oinfo), \
2458 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2459
2460/* simple AG-based error/%ip tracepoint class */
2461DECLARE_EVENT_CLASS(xfs_ag_error_class,
2462 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2463 unsigned long caller_ip),
2464 TP_ARGS(mp, agno, error, caller_ip),
2465 TP_STRUCT__entry(
2466 __field(dev_t, dev)
2467 __field(xfs_agnumber_t, agno)
2468 __field(int, error)
2469 __field(unsigned long, caller_ip)
2470 ),
2471 TP_fast_assign(
2472 __entry->dev = mp->m_super->s_dev;
2473 __entry->agno = agno;
2474 __entry->error = error;
2475 __entry->caller_ip = caller_ip;
2476 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002477 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002478 MAJOR(__entry->dev), MINOR(__entry->dev),
2479 __entry->agno,
2480 __entry->error,
2481 (char *)__entry->caller_ip)
2482);
2483
2484#define DEFINE_AG_ERROR_EVENT(name) \
2485DEFINE_EVENT(xfs_ag_error_class, name, \
2486 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2487 unsigned long caller_ip), \
2488 TP_ARGS(mp, agno, error, caller_ip))
2489
2490DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2491DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2492DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2493DEFINE_RMAP_EVENT(xfs_rmap_map);
2494DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2495DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002496DEFINE_RMAP_EVENT(xfs_rmap_convert);
2497DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2498DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2499DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002500
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002501DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2502 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2503 xfs_agblock_t agbno, xfs_extlen_t len,
2504 uint64_t owner, uint64_t offset, unsigned int flags),
2505 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2506 TP_STRUCT__entry(
2507 __field(dev_t, dev)
2508 __field(xfs_agnumber_t, agno)
2509 __field(xfs_agblock_t, agbno)
2510 __field(xfs_extlen_t, len)
2511 __field(uint64_t, owner)
2512 __field(uint64_t, offset)
2513 __field(unsigned int, flags)
2514 ),
2515 TP_fast_assign(
2516 __entry->dev = mp->m_super->s_dev;
2517 __entry->agno = agno;
2518 __entry->agbno = agbno;
2519 __entry->len = len;
2520 __entry->owner = owner;
2521 __entry->offset = offset;
2522 __entry->flags = flags;
2523 ),
2524 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2525 MAJOR(__entry->dev), MINOR(__entry->dev),
2526 __entry->agno,
2527 __entry->agbno,
2528 __entry->len,
2529 __entry->owner,
2530 __entry->offset,
2531 __entry->flags)
2532);
2533#define DEFINE_RMAPBT_EVENT(name) \
2534DEFINE_EVENT(xfs_rmapbt_class, name, \
2535 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2536 xfs_agblock_t agbno, xfs_extlen_t len, \
2537 uint64_t owner, uint64_t offset, unsigned int flags), \
2538 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2539
2540#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2541DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2542DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2543
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002544DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2545DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002546DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2547DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2548DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2549DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2550DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2551DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002552
2553DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2554DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2555DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2556DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002557DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2558DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002559DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002560
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002561/* deferred bmbt updates */
2562#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2563DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2564DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2565
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002566/* per-AG reservation */
2567DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2568 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2569 xfs_extlen_t len),
2570 TP_ARGS(pag, resv, len),
2571 TP_STRUCT__entry(
2572 __field(dev_t, dev)
2573 __field(xfs_agnumber_t, agno)
2574 __field(int, resv)
2575 __field(xfs_extlen_t, freeblks)
2576 __field(xfs_extlen_t, flcount)
2577 __field(xfs_extlen_t, reserved)
2578 __field(xfs_extlen_t, asked)
2579 __field(xfs_extlen_t, len)
2580 ),
2581 TP_fast_assign(
2582 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2583
2584 __entry->dev = pag->pag_mount->m_super->s_dev;
2585 __entry->agno = pag->pag_agno;
2586 __entry->resv = resv;
2587 __entry->freeblks = pag->pagf_freeblks;
2588 __entry->flcount = pag->pagf_flcount;
2589 __entry->reserved = r ? r->ar_reserved : 0;
2590 __entry->asked = r ? r->ar_asked : 0;
2591 __entry->len = len;
2592 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002593 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2594 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002595 MAJOR(__entry->dev), MINOR(__entry->dev),
2596 __entry->agno,
2597 __entry->resv,
2598 __entry->freeblks,
2599 __entry->flcount,
2600 __entry->reserved,
2601 __entry->asked,
2602 __entry->len)
2603)
2604#define DEFINE_AG_RESV_EVENT(name) \
2605DEFINE_EVENT(xfs_ag_resv_class, name, \
2606 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2607 xfs_extlen_t len), \
2608 TP_ARGS(pag, type, len))
2609
2610/* per-AG reservation tracepoints */
2611DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2612DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2613DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2614DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2615DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2616DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2617
2618DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2619DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2620
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002621/* refcount tracepoint classes */
2622
2623/* reuse the discard trace class for agbno/aglen-based traces */
2624#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2625
2626/* ag btree lookup tracepoint class */
2627#define XFS_AG_BTREE_CMP_FORMAT_STR \
2628 { XFS_LOOKUP_EQ, "eq" }, \
2629 { XFS_LOOKUP_LE, "le" }, \
2630 { XFS_LOOKUP_GE, "ge" }
2631DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2632 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2633 xfs_agblock_t agbno, xfs_lookup_t dir),
2634 TP_ARGS(mp, agno, agbno, dir),
2635 TP_STRUCT__entry(
2636 __field(dev_t, dev)
2637 __field(xfs_agnumber_t, agno)
2638 __field(xfs_agblock_t, agbno)
2639 __field(xfs_lookup_t, dir)
2640 ),
2641 TP_fast_assign(
2642 __entry->dev = mp->m_super->s_dev;
2643 __entry->agno = agno;
2644 __entry->agbno = agbno;
2645 __entry->dir = dir;
2646 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002647 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002648 MAJOR(__entry->dev), MINOR(__entry->dev),
2649 __entry->agno,
2650 __entry->agbno,
2651 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2652 __entry->dir)
2653)
2654
2655#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2656DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2657 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2658 xfs_agblock_t agbno, xfs_lookup_t dir), \
2659 TP_ARGS(mp, agno, agbno, dir))
2660
2661/* single-rcext tracepoint class */
2662DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2663 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2664 struct xfs_refcount_irec *irec),
2665 TP_ARGS(mp, agno, irec),
2666 TP_STRUCT__entry(
2667 __field(dev_t, dev)
2668 __field(xfs_agnumber_t, agno)
2669 __field(xfs_agblock_t, startblock)
2670 __field(xfs_extlen_t, blockcount)
2671 __field(xfs_nlink_t, refcount)
2672 ),
2673 TP_fast_assign(
2674 __entry->dev = mp->m_super->s_dev;
2675 __entry->agno = agno;
2676 __entry->startblock = irec->rc_startblock;
2677 __entry->blockcount = irec->rc_blockcount;
2678 __entry->refcount = irec->rc_refcount;
2679 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002680 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002681 MAJOR(__entry->dev), MINOR(__entry->dev),
2682 __entry->agno,
2683 __entry->startblock,
2684 __entry->blockcount,
2685 __entry->refcount)
2686)
2687
2688#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2689DEFINE_EVENT(xfs_refcount_extent_class, name, \
2690 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2691 struct xfs_refcount_irec *irec), \
2692 TP_ARGS(mp, agno, irec))
2693
2694/* single-rcext and an agbno tracepoint class */
2695DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2696 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2697 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2698 TP_ARGS(mp, agno, irec, agbno),
2699 TP_STRUCT__entry(
2700 __field(dev_t, dev)
2701 __field(xfs_agnumber_t, agno)
2702 __field(xfs_agblock_t, startblock)
2703 __field(xfs_extlen_t, blockcount)
2704 __field(xfs_nlink_t, refcount)
2705 __field(xfs_agblock_t, agbno)
2706 ),
2707 TP_fast_assign(
2708 __entry->dev = mp->m_super->s_dev;
2709 __entry->agno = agno;
2710 __entry->startblock = irec->rc_startblock;
2711 __entry->blockcount = irec->rc_blockcount;
2712 __entry->refcount = irec->rc_refcount;
2713 __entry->agbno = agbno;
2714 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002715 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002716 MAJOR(__entry->dev), MINOR(__entry->dev),
2717 __entry->agno,
2718 __entry->startblock,
2719 __entry->blockcount,
2720 __entry->refcount,
2721 __entry->agbno)
2722)
2723
2724#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2725DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2726 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2727 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2728 TP_ARGS(mp, agno, irec, agbno))
2729
2730/* double-rcext tracepoint class */
2731DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2732 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2733 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2734 TP_ARGS(mp, agno, i1, i2),
2735 TP_STRUCT__entry(
2736 __field(dev_t, dev)
2737 __field(xfs_agnumber_t, agno)
2738 __field(xfs_agblock_t, i1_startblock)
2739 __field(xfs_extlen_t, i1_blockcount)
2740 __field(xfs_nlink_t, i1_refcount)
2741 __field(xfs_agblock_t, i2_startblock)
2742 __field(xfs_extlen_t, i2_blockcount)
2743 __field(xfs_nlink_t, i2_refcount)
2744 ),
2745 TP_fast_assign(
2746 __entry->dev = mp->m_super->s_dev;
2747 __entry->agno = agno;
2748 __entry->i1_startblock = i1->rc_startblock;
2749 __entry->i1_blockcount = i1->rc_blockcount;
2750 __entry->i1_refcount = i1->rc_refcount;
2751 __entry->i2_startblock = i2->rc_startblock;
2752 __entry->i2_blockcount = i2->rc_blockcount;
2753 __entry->i2_refcount = i2->rc_refcount;
2754 ),
2755 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002756 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002757 MAJOR(__entry->dev), MINOR(__entry->dev),
2758 __entry->agno,
2759 __entry->i1_startblock,
2760 __entry->i1_blockcount,
2761 __entry->i1_refcount,
2762 __entry->i2_startblock,
2763 __entry->i2_blockcount,
2764 __entry->i2_refcount)
2765)
2766
2767#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2768DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2769 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2770 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2771 TP_ARGS(mp, agno, i1, i2))
2772
2773/* double-rcext and an agbno tracepoint class */
2774DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2775 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2776 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2777 xfs_agblock_t agbno),
2778 TP_ARGS(mp, agno, i1, i2, agbno),
2779 TP_STRUCT__entry(
2780 __field(dev_t, dev)
2781 __field(xfs_agnumber_t, agno)
2782 __field(xfs_agblock_t, i1_startblock)
2783 __field(xfs_extlen_t, i1_blockcount)
2784 __field(xfs_nlink_t, i1_refcount)
2785 __field(xfs_agblock_t, i2_startblock)
2786 __field(xfs_extlen_t, i2_blockcount)
2787 __field(xfs_nlink_t, i2_refcount)
2788 __field(xfs_agblock_t, agbno)
2789 ),
2790 TP_fast_assign(
2791 __entry->dev = mp->m_super->s_dev;
2792 __entry->agno = agno;
2793 __entry->i1_startblock = i1->rc_startblock;
2794 __entry->i1_blockcount = i1->rc_blockcount;
2795 __entry->i1_refcount = i1->rc_refcount;
2796 __entry->i2_startblock = i2->rc_startblock;
2797 __entry->i2_blockcount = i2->rc_blockcount;
2798 __entry->i2_refcount = i2->rc_refcount;
2799 __entry->agbno = agbno;
2800 ),
2801 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002802 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002803 MAJOR(__entry->dev), MINOR(__entry->dev),
2804 __entry->agno,
2805 __entry->i1_startblock,
2806 __entry->i1_blockcount,
2807 __entry->i1_refcount,
2808 __entry->i2_startblock,
2809 __entry->i2_blockcount,
2810 __entry->i2_refcount,
2811 __entry->agbno)
2812)
2813
2814#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2815DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2816 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2817 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2818 xfs_agblock_t agbno), \
2819 TP_ARGS(mp, agno, i1, i2, agbno))
2820
2821/* triple-rcext tracepoint class */
2822DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2823 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2824 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2825 struct xfs_refcount_irec *i3),
2826 TP_ARGS(mp, agno, i1, i2, i3),
2827 TP_STRUCT__entry(
2828 __field(dev_t, dev)
2829 __field(xfs_agnumber_t, agno)
2830 __field(xfs_agblock_t, i1_startblock)
2831 __field(xfs_extlen_t, i1_blockcount)
2832 __field(xfs_nlink_t, i1_refcount)
2833 __field(xfs_agblock_t, i2_startblock)
2834 __field(xfs_extlen_t, i2_blockcount)
2835 __field(xfs_nlink_t, i2_refcount)
2836 __field(xfs_agblock_t, i3_startblock)
2837 __field(xfs_extlen_t, i3_blockcount)
2838 __field(xfs_nlink_t, i3_refcount)
2839 ),
2840 TP_fast_assign(
2841 __entry->dev = mp->m_super->s_dev;
2842 __entry->agno = agno;
2843 __entry->i1_startblock = i1->rc_startblock;
2844 __entry->i1_blockcount = i1->rc_blockcount;
2845 __entry->i1_refcount = i1->rc_refcount;
2846 __entry->i2_startblock = i2->rc_startblock;
2847 __entry->i2_blockcount = i2->rc_blockcount;
2848 __entry->i2_refcount = i2->rc_refcount;
2849 __entry->i3_startblock = i3->rc_startblock;
2850 __entry->i3_blockcount = i3->rc_blockcount;
2851 __entry->i3_refcount = i3->rc_refcount;
2852 ),
2853 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2854 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002855 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002856 MAJOR(__entry->dev), MINOR(__entry->dev),
2857 __entry->agno,
2858 __entry->i1_startblock,
2859 __entry->i1_blockcount,
2860 __entry->i1_refcount,
2861 __entry->i2_startblock,
2862 __entry->i2_blockcount,
2863 __entry->i2_refcount,
2864 __entry->i3_startblock,
2865 __entry->i3_blockcount,
2866 __entry->i3_refcount)
2867);
2868
2869#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2870DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2871 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2872 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2873 struct xfs_refcount_irec *i3), \
2874 TP_ARGS(mp, agno, i1, i2, i3))
2875
2876/* refcount btree tracepoints */
2877DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2878DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2879DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2880DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2881DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2882DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2883DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2884DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2885DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2886DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2887
2888/* refcount adjustment tracepoints */
2889DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2890DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002891DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2892DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002893DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2894DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002895DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002896DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2897DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2898DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2899DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2900DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2901DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002902DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002903DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2904DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2905DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2906DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2907DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2908DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2909DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2910
2911/* reflink helpers */
2912DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2913DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2914DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002915#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2916DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2917DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002918
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002919TRACE_EVENT(xfs_refcount_finish_one_leftover,
2920 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2921 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2922 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2923 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2924 TP_STRUCT__entry(
2925 __field(dev_t, dev)
2926 __field(xfs_agnumber_t, agno)
2927 __field(int, type)
2928 __field(xfs_agblock_t, agbno)
2929 __field(xfs_extlen_t, len)
2930 __field(xfs_agblock_t, new_agbno)
2931 __field(xfs_extlen_t, new_len)
2932 ),
2933 TP_fast_assign(
2934 __entry->dev = mp->m_super->s_dev;
2935 __entry->agno = agno;
2936 __entry->type = type;
2937 __entry->agbno = agbno;
2938 __entry->len = len;
2939 __entry->new_agbno = new_agbno;
2940 __entry->new_len = new_len;
2941 ),
2942 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2943 MAJOR(__entry->dev), MINOR(__entry->dev),
2944 __entry->type,
2945 __entry->agno,
2946 __entry->agbno,
2947 __entry->len,
2948 __entry->new_agbno,
2949 __entry->new_len)
2950);
2951
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002952/* simple inode-based error/%ip tracepoint class */
2953DECLARE_EVENT_CLASS(xfs_inode_error_class,
2954 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2955 TP_ARGS(ip, error, caller_ip),
2956 TP_STRUCT__entry(
2957 __field(dev_t, dev)
2958 __field(xfs_ino_t, ino)
2959 __field(int, error)
2960 __field(unsigned long, caller_ip)
2961 ),
2962 TP_fast_assign(
2963 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2964 __entry->ino = ip->i_ino;
2965 __entry->error = error;
2966 __entry->caller_ip = caller_ip;
2967 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002968 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002969 MAJOR(__entry->dev), MINOR(__entry->dev),
2970 __entry->ino,
2971 __entry->error,
2972 (char *)__entry->caller_ip)
2973);
2974
2975#define DEFINE_INODE_ERROR_EVENT(name) \
2976DEFINE_EVENT(xfs_inode_error_class, name, \
2977 TP_PROTO(struct xfs_inode *ip, int error, \
2978 unsigned long caller_ip), \
2979 TP_ARGS(ip, error, caller_ip))
2980
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002981/* reflink tracepoint classes */
2982
2983/* two-file io tracepoint class */
2984DECLARE_EVENT_CLASS(xfs_double_io_class,
2985 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2986 struct xfs_inode *dest, xfs_off_t doffset),
2987 TP_ARGS(src, soffset, len, dest, doffset),
2988 TP_STRUCT__entry(
2989 __field(dev_t, dev)
2990 __field(xfs_ino_t, src_ino)
2991 __field(loff_t, src_isize)
2992 __field(loff_t, src_disize)
2993 __field(loff_t, src_offset)
2994 __field(size_t, len)
2995 __field(xfs_ino_t, dest_ino)
2996 __field(loff_t, dest_isize)
2997 __field(loff_t, dest_disize)
2998 __field(loff_t, dest_offset)
2999 ),
3000 TP_fast_assign(
3001 __entry->dev = VFS_I(src)->i_sb->s_dev;
3002 __entry->src_ino = src->i_ino;
3003 __entry->src_isize = VFS_I(src)->i_size;
3004 __entry->src_disize = src->i_d.di_size;
3005 __entry->src_offset = soffset;
3006 __entry->len = len;
3007 __entry->dest_ino = dest->i_ino;
3008 __entry->dest_isize = VFS_I(dest)->i_size;
3009 __entry->dest_disize = dest->i_d.di_size;
3010 __entry->dest_offset = doffset;
3011 ),
3012 TP_printk("dev %d:%d count %zd "
3013 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3014 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3015 MAJOR(__entry->dev), MINOR(__entry->dev),
3016 __entry->len,
3017 __entry->src_ino,
3018 __entry->src_isize,
3019 __entry->src_disize,
3020 __entry->src_offset,
3021 __entry->dest_ino,
3022 __entry->dest_isize,
3023 __entry->dest_disize,
3024 __entry->dest_offset)
3025)
3026
3027#define DEFINE_DOUBLE_IO_EVENT(name) \
3028DEFINE_EVENT(xfs_double_io_class, name, \
3029 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3030 struct xfs_inode *dest, xfs_off_t doffset), \
3031 TP_ARGS(src, soffset, len, dest, doffset))
3032
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003033/* inode/irec events */
3034DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3035 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3036 TP_ARGS(ip, irec),
3037 TP_STRUCT__entry(
3038 __field(dev_t, dev)
3039 __field(xfs_ino_t, ino)
3040 __field(xfs_fileoff_t, lblk)
3041 __field(xfs_extlen_t, len)
3042 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003043 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003044 ),
3045 TP_fast_assign(
3046 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3047 __entry->ino = ip->i_ino;
3048 __entry->lblk = irec->br_startoff;
3049 __entry->len = irec->br_blockcount;
3050 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003051 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003052 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003053 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 -07003054 MAJOR(__entry->dev), MINOR(__entry->dev),
3055 __entry->ino,
3056 __entry->lblk,
3057 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003058 __entry->pblk,
3059 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003060);
3061#define DEFINE_INODE_IREC_EVENT(name) \
3062DEFINE_EVENT(xfs_inode_irec_class, name, \
3063 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3064 TP_ARGS(ip, irec))
3065
3066/* refcount/reflink tracepoint definitions */
3067
3068/* reflink tracepoints */
3069DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3070DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3071DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3072DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3073TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3074 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3075 xfs_filblks_t len, struct xfs_inode *dest,
3076 xfs_fileoff_t doffset),
3077 TP_ARGS(src, soffset, len, dest, doffset),
3078 TP_STRUCT__entry(
3079 __field(dev_t, dev)
3080 __field(xfs_ino_t, src_ino)
3081 __field(xfs_fileoff_t, src_lblk)
3082 __field(xfs_filblks_t, len)
3083 __field(xfs_ino_t, dest_ino)
3084 __field(xfs_fileoff_t, dest_lblk)
3085 ),
3086 TP_fast_assign(
3087 __entry->dev = VFS_I(src)->i_sb->s_dev;
3088 __entry->src_ino = src->i_ino;
3089 __entry->src_lblk = soffset;
3090 __entry->len = len;
3091 __entry->dest_ino = dest->i_ino;
3092 __entry->dest_lblk = doffset;
3093 ),
3094 TP_printk("dev %d:%d len 0x%llx "
3095 "ino 0x%llx offset 0x%llx blocks -> "
3096 "ino 0x%llx offset 0x%llx blocks",
3097 MAJOR(__entry->dev), MINOR(__entry->dev),
3098 __entry->len,
3099 __entry->src_ino,
3100 __entry->src_lblk,
3101 __entry->dest_ino,
3102 __entry->dest_lblk)
3103);
3104TRACE_EVENT(xfs_reflink_punch_range,
3105 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3106 xfs_extlen_t len),
3107 TP_ARGS(ip, lblk, len),
3108 TP_STRUCT__entry(
3109 __field(dev_t, dev)
3110 __field(xfs_ino_t, ino)
3111 __field(xfs_fileoff_t, lblk)
3112 __field(xfs_extlen_t, len)
3113 ),
3114 TP_fast_assign(
3115 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3116 __entry->ino = ip->i_ino;
3117 __entry->lblk = lblk;
3118 __entry->len = len;
3119 ),
3120 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3121 MAJOR(__entry->dev), MINOR(__entry->dev),
3122 __entry->ino,
3123 __entry->lblk,
3124 __entry->len)
3125);
3126TRACE_EVENT(xfs_reflink_remap,
3127 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3128 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3129 TP_ARGS(ip, lblk, len, new_pblk),
3130 TP_STRUCT__entry(
3131 __field(dev_t, dev)
3132 __field(xfs_ino_t, ino)
3133 __field(xfs_fileoff_t, lblk)
3134 __field(xfs_extlen_t, len)
3135 __field(xfs_fsblock_t, new_pblk)
3136 ),
3137 TP_fast_assign(
3138 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3139 __entry->ino = ip->i_ino;
3140 __entry->lblk = lblk;
3141 __entry->len = len;
3142 __entry->new_pblk = new_pblk;
3143 ),
3144 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3145 MAJOR(__entry->dev), MINOR(__entry->dev),
3146 __entry->ino,
3147 __entry->lblk,
3148 __entry->len,
3149 __entry->new_pblk)
3150);
3151DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3152DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3153DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3154DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003155DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3156DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3157
3158/* dedupe tracepoints */
3159DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3160DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3161
3162/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003163TRACE_EVENT(xfs_ioctl_clone,
3164 TP_PROTO(struct inode *src, struct inode *dest),
3165 TP_ARGS(src, dest),
3166 TP_STRUCT__entry(
3167 __field(dev_t, dev)
3168 __field(unsigned long, src_ino)
3169 __field(loff_t, src_isize)
3170 __field(unsigned long, dest_ino)
3171 __field(loff_t, dest_isize)
3172 ),
3173 TP_fast_assign(
3174 __entry->dev = src->i_sb->s_dev;
3175 __entry->src_ino = src->i_ino;
3176 __entry->src_isize = i_size_read(src);
3177 __entry->dest_ino = dest->i_ino;
3178 __entry->dest_isize = i_size_read(dest);
3179 ),
3180 TP_printk("dev %d:%d "
3181 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003182 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003183 MAJOR(__entry->dev), MINOR(__entry->dev),
3184 __entry->src_ino,
3185 __entry->src_isize,
3186 __entry->dest_ino,
3187 __entry->dest_isize)
3188);
3189
3190/* unshare tracepoints */
3191DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003192DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003193
3194/* copy on write */
3195DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003196DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3197DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3198DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003199DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003200
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003201DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003202
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003203DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003204
3205DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3206DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3207DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003208
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003209DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3210DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3211
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003212
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003213DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003214
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003215/* rmap swapext tracepoints */
3216DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3217DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3218DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3219
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003220/* fsmap traces */
3221DECLARE_EVENT_CLASS(xfs_fsmap_class,
3222 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3223 struct xfs_rmap_irec *rmap),
3224 TP_ARGS(mp, keydev, agno, rmap),
3225 TP_STRUCT__entry(
3226 __field(dev_t, dev)
3227 __field(dev_t, keydev)
3228 __field(xfs_agnumber_t, agno)
3229 __field(xfs_fsblock_t, bno)
3230 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003231 __field(uint64_t, owner)
3232 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003233 __field(unsigned int, flags)
3234 ),
3235 TP_fast_assign(
3236 __entry->dev = mp->m_super->s_dev;
3237 __entry->keydev = new_decode_dev(keydev);
3238 __entry->agno = agno;
3239 __entry->bno = rmap->rm_startblock;
3240 __entry->len = rmap->rm_blockcount;
3241 __entry->owner = rmap->rm_owner;
3242 __entry->offset = rmap->rm_offset;
3243 __entry->flags = rmap->rm_flags;
3244 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003245 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 -07003246 MAJOR(__entry->dev), MINOR(__entry->dev),
3247 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3248 __entry->agno,
3249 __entry->bno,
3250 __entry->len,
3251 __entry->owner,
3252 __entry->offset,
3253 __entry->flags)
3254)
3255#define DEFINE_FSMAP_EVENT(name) \
3256DEFINE_EVENT(xfs_fsmap_class, name, \
3257 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3258 struct xfs_rmap_irec *rmap), \
3259 TP_ARGS(mp, keydev, agno, rmap))
3260DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3261DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3262DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3263
3264DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3265 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3266 TP_ARGS(mp, fsmap),
3267 TP_STRUCT__entry(
3268 __field(dev_t, dev)
3269 __field(dev_t, keydev)
3270 __field(xfs_daddr_t, block)
3271 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003272 __field(uint64_t, owner)
3273 __field(uint64_t, offset)
3274 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003275 ),
3276 TP_fast_assign(
3277 __entry->dev = mp->m_super->s_dev;
3278 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3279 __entry->block = fsmap->fmr_physical;
3280 __entry->len = fsmap->fmr_length;
3281 __entry->owner = fsmap->fmr_owner;
3282 __entry->offset = fsmap->fmr_offset;
3283 __entry->flags = fsmap->fmr_flags;
3284 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003285 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 -07003286 MAJOR(__entry->dev), MINOR(__entry->dev),
3287 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3288 __entry->block,
3289 __entry->len,
3290 __entry->owner,
3291 __entry->offset,
3292 __entry->flags)
3293)
3294#define DEFINE_GETFSMAP_EVENT(name) \
3295DEFINE_EVENT(xfs_getfsmap_class, name, \
3296 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3297 TP_ARGS(mp, fsmap))
3298DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3299DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3300DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3301
Darrick J. Wongb872af22018-01-08 10:51:26 -08003302TRACE_EVENT(xfs_trans_resv_calc,
3303 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3304 struct xfs_trans_res *res),
3305 TP_ARGS(mp, type, res),
3306 TP_STRUCT__entry(
3307 __field(dev_t, dev)
3308 __field(int, type)
3309 __field(uint, logres)
3310 __field(int, logcount)
3311 __field(int, logflags)
3312 ),
3313 TP_fast_assign(
3314 __entry->dev = mp->m_super->s_dev;
3315 __entry->type = type;
3316 __entry->logres = res->tr_logres;
3317 __entry->logcount = res->tr_logcount;
3318 __entry->logflags = res->tr_logflags;
3319 ),
3320 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3321 MAJOR(__entry->dev), MINOR(__entry->dev),
3322 __entry->type,
3323 __entry->logres,
3324 __entry->logcount,
3325 __entry->logflags)
3326);
3327
Dave Chinnerba187812018-05-09 07:47:57 -07003328DECLARE_EVENT_CLASS(xfs_trans_class,
3329 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3330 TP_ARGS(tp, caller_ip),
3331 TP_STRUCT__entry(
3332 __field(dev_t, dev)
3333 __field(uint32_t, tid)
3334 __field(uint32_t, flags)
3335 __field(unsigned long, caller_ip)
3336 ),
3337 TP_fast_assign(
3338 __entry->dev = tp->t_mountp->m_super->s_dev;
3339 __entry->tid = 0;
3340 if (tp->t_ticket)
3341 __entry->tid = tp->t_ticket->t_tid;
3342 __entry->flags = tp->t_flags;
3343 __entry->caller_ip = caller_ip;
3344 ),
3345 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3346 MAJOR(__entry->dev), MINOR(__entry->dev),
3347 __entry->tid,
3348 __entry->flags,
3349 (char *)__entry->caller_ip)
3350)
3351
3352#define DEFINE_TRANS_EVENT(name) \
3353DEFINE_EVENT(xfs_trans_class, name, \
3354 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3355 TP_ARGS(tp, caller_ip))
3356DEFINE_TRANS_EVENT(xfs_trans_alloc);
3357DEFINE_TRANS_EVENT(xfs_trans_cancel);
3358DEFINE_TRANS_EVENT(xfs_trans_commit);
3359DEFINE_TRANS_EVENT(xfs_trans_dup);
3360DEFINE_TRANS_EVENT(xfs_trans_free);
3361DEFINE_TRANS_EVENT(xfs_trans_roll);
3362DEFINE_TRANS_EVENT(xfs_trans_add_item);
3363DEFINE_TRANS_EVENT(xfs_trans_free_items);
3364
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003365#endif /* _TRACE_XFS_H */
3366
3367#undef TRACE_INCLUDE_PATH
3368#define TRACE_INCLUDE_PATH .
3369#define TRACE_INCLUDE_FILE xfs_trace
3370#include <trace/define_trace.h>