blob: 972d45d28097fc6f8612bf59179679e95663e6b5 [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 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001157 __field(int, unwritten)
1158 ),
1159 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001160 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001161
Li Zefanf8adb4d2010-05-24 08:25:57 +00001162 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001163 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001164 __entry->dev = inode->i_sb->s_dev;
1165 __entry->ino = XFS_I(inode)->i_ino;
1166 __entry->pgoff = page_offset(page);
1167 __entry->size = i_size_read(inode);
1168 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001169 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001170 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001171 __entry->unwritten = unwritten;
1172 ),
1173 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001174 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001175 MAJOR(__entry->dev), MINOR(__entry->dev),
1176 __entry->ino,
1177 __entry->pgoff,
1178 __entry->size,
1179 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001180 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001181 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001182 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001183)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001184
1185#define DEFINE_PAGE_EVENT(name) \
1186DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001187 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1188 unsigned int len), \
1189 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001190DEFINE_PAGE_EVENT(xfs_writepage);
1191DEFINE_PAGE_EVENT(xfs_releasepage);
1192DEFINE_PAGE_EVENT(xfs_invalidatepage);
1193
Dave Chinner121e2132016-01-08 11:28:35 +11001194DECLARE_EVENT_CLASS(xfs_readpage_class,
1195 TP_PROTO(struct inode *inode, int nr_pages),
1196 TP_ARGS(inode, nr_pages),
1197 TP_STRUCT__entry(
1198 __field(dev_t, dev)
1199 __field(xfs_ino_t, ino)
1200 __field(int, nr_pages)
1201 ),
1202 TP_fast_assign(
1203 __entry->dev = inode->i_sb->s_dev;
1204 __entry->ino = inode->i_ino;
1205 __entry->nr_pages = nr_pages;
1206 ),
1207 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1208 MAJOR(__entry->dev), MINOR(__entry->dev),
1209 __entry->ino,
1210 __entry->nr_pages)
1211)
1212
1213#define DEFINE_READPAGE_EVENT(name) \
1214DEFINE_EVENT(xfs_readpage_class, name, \
1215 TP_PROTO(struct inode *inode, int nr_pages), \
1216 TP_ARGS(inode, nr_pages))
1217DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1218DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1219
Christoph Hellwiga206c812010-12-10 08:42:20 +00001220DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001221 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001222 int type, struct xfs_bmbt_irec *irec),
1223 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001224 TP_STRUCT__entry(
1225 __field(dev_t, dev)
1226 __field(xfs_ino_t, ino)
1227 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001228 __field(loff_t, offset)
1229 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001230 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001231 __field(xfs_fileoff_t, startoff)
1232 __field(xfs_fsblock_t, startblock)
1233 __field(xfs_filblks_t, blockcount)
1234 ),
1235 TP_fast_assign(
1236 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1237 __entry->ino = ip->i_ino;
1238 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001239 __entry->offset = offset;
1240 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001241 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001242 __entry->startoff = irec ? irec->br_startoff : 0;
1243 __entry->startblock = irec ? irec->br_startblock : 0;
1244 __entry->blockcount = irec ? irec->br_blockcount : 0;
1245 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001246 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1247 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001248 MAJOR(__entry->dev), MINOR(__entry->dev),
1249 __entry->ino,
1250 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001251 __entry->offset,
1252 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001253 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001254 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001255 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001256 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001257)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001258
1259#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001260DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001261 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001262 int type, struct xfs_bmbt_irec *irec), \
1263 TP_ARGS(ip, offset, count, type, irec))
1264DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1265DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1266DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1267DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001268DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001269DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1270DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001271
Li Zefanf8adb4d2010-05-24 08:25:57 +00001272DECLARE_EVENT_CLASS(xfs_simple_io_class,
1273 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1274 TP_ARGS(ip, offset, count),
1275 TP_STRUCT__entry(
1276 __field(dev_t, dev)
1277 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001278 __field(loff_t, isize)
1279 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001280 __field(loff_t, offset)
1281 __field(size_t, count)
1282 ),
1283 TP_fast_assign(
1284 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1285 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001286 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001287 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001288 __entry->offset = offset;
1289 __entry->count = count;
1290 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001291 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001292 "offset 0x%llx count %zd",
1293 MAJOR(__entry->dev), MINOR(__entry->dev),
1294 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001295 __entry->isize,
1296 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001297 __entry->offset,
1298 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001299);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001300
1301#define DEFINE_SIMPLE_IO_EVENT(name) \
1302DEFINE_EVENT(xfs_simple_io_class, name, \
1303 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1304 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001305DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1306DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001307DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001308DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001309DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001310DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1311DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1312DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001313
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001314DECLARE_EVENT_CLASS(xfs_itrunc_class,
1315 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1316 TP_ARGS(ip, new_size),
1317 TP_STRUCT__entry(
1318 __field(dev_t, dev)
1319 __field(xfs_ino_t, ino)
1320 __field(xfs_fsize_t, size)
1321 __field(xfs_fsize_t, new_size)
1322 ),
1323 TP_fast_assign(
1324 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1325 __entry->ino = ip->i_ino;
1326 __entry->size = ip->i_d.di_size;
1327 __entry->new_size = new_size;
1328 ),
1329 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1330 MAJOR(__entry->dev), MINOR(__entry->dev),
1331 __entry->ino,
1332 __entry->size,
1333 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001334)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001335
1336#define DEFINE_ITRUNC_EVENT(name) \
1337DEFINE_EVENT(xfs_itrunc_class, name, \
1338 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1339 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001340DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1341DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001342
1343TRACE_EVENT(xfs_pagecache_inval,
1344 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1345 TP_ARGS(ip, start, finish),
1346 TP_STRUCT__entry(
1347 __field(dev_t, dev)
1348 __field(xfs_ino_t, ino)
1349 __field(xfs_fsize_t, size)
1350 __field(xfs_off_t, start)
1351 __field(xfs_off_t, finish)
1352 ),
1353 TP_fast_assign(
1354 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1355 __entry->ino = ip->i_ino;
1356 __entry->size = ip->i_d.di_size;
1357 __entry->start = start;
1358 __entry->finish = finish;
1359 ),
1360 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1361 MAJOR(__entry->dev), MINOR(__entry->dev),
1362 __entry->ino,
1363 __entry->size,
1364 __entry->start,
1365 __entry->finish)
1366);
1367
1368TRACE_EVENT(xfs_bunmap,
1369 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1370 int flags, unsigned long caller_ip),
1371 TP_ARGS(ip, bno, len, flags, caller_ip),
1372 TP_STRUCT__entry(
1373 __field(dev_t, dev)
1374 __field(xfs_ino_t, ino)
1375 __field(xfs_fsize_t, size)
1376 __field(xfs_fileoff_t, bno)
1377 __field(xfs_filblks_t, len)
1378 __field(unsigned long, caller_ip)
1379 __field(int, flags)
1380 ),
1381 TP_fast_assign(
1382 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1383 __entry->ino = ip->i_ino;
1384 __entry->size = ip->i_d.di_size;
1385 __entry->bno = bno;
1386 __entry->len = len;
1387 __entry->caller_ip = caller_ip;
1388 __entry->flags = flags;
1389 ),
1390 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 -08001391 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001392 MAJOR(__entry->dev), MINOR(__entry->dev),
1393 __entry->ino,
1394 __entry->size,
1395 __entry->bno,
1396 __entry->len,
1397 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1398 (void *)__entry->caller_ip)
1399
1400);
1401
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001402DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001403 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1404 xfs_agblock_t agbno, xfs_extlen_t len),
1405 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001406 TP_STRUCT__entry(
1407 __field(dev_t, dev)
1408 __field(xfs_agnumber_t, agno)
1409 __field(xfs_agblock_t, agbno)
1410 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001411 ),
1412 TP_fast_assign(
1413 __entry->dev = mp->m_super->s_dev;
1414 __entry->agno = agno;
1415 __entry->agbno = agbno;
1416 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001417 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001418 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001419 MAJOR(__entry->dev), MINOR(__entry->dev),
1420 __entry->agno,
1421 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001422 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001423);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001424#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001425DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001426 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1427 xfs_agblock_t agbno, xfs_extlen_t len), \
1428 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001429DEFINE_BUSY_EVENT(xfs_extent_busy);
1430DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1431DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1432DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1433DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001434
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001435TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001436 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1437 xfs_agblock_t agbno, xfs_extlen_t len,
1438 xfs_agblock_t tbno, xfs_extlen_t tlen),
1439 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1440 TP_STRUCT__entry(
1441 __field(dev_t, dev)
1442 __field(xfs_agnumber_t, agno)
1443 __field(xfs_agblock_t, agbno)
1444 __field(xfs_extlen_t, len)
1445 __field(xfs_agblock_t, tbno)
1446 __field(xfs_extlen_t, tlen)
1447 ),
1448 TP_fast_assign(
1449 __entry->dev = mp->m_super->s_dev;
1450 __entry->agno = agno;
1451 __entry->agbno = agbno;
1452 __entry->len = len;
1453 __entry->tbno = tbno;
1454 __entry->tlen = tlen;
1455 ),
1456 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1457 MAJOR(__entry->dev), MINOR(__entry->dev),
1458 __entry->agno,
1459 __entry->agbno,
1460 __entry->len,
1461 __entry->tbno,
1462 __entry->tlen)
1463);
1464
Brian Fostera27ba262018-03-15 10:51:58 -07001465DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001466 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1467 unsigned long caller_ip),
1468 TP_ARGS(mp, agf, flags, caller_ip),
1469 TP_STRUCT__entry(
1470 __field(dev_t, dev)
1471 __field(xfs_agnumber_t, agno)
1472 __field(int, flags)
1473 __field(__u32, length)
1474 __field(__u32, bno_root)
1475 __field(__u32, cnt_root)
1476 __field(__u32, bno_level)
1477 __field(__u32, cnt_level)
1478 __field(__u32, flfirst)
1479 __field(__u32, fllast)
1480 __field(__u32, flcount)
1481 __field(__u32, freeblks)
1482 __field(__u32, longest)
1483 __field(unsigned long, caller_ip)
1484 ),
1485 TP_fast_assign(
1486 __entry->dev = mp->m_super->s_dev;
1487 __entry->agno = be32_to_cpu(agf->agf_seqno),
1488 __entry->flags = flags;
1489 __entry->length = be32_to_cpu(agf->agf_length),
1490 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1491 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1492 __entry->bno_level =
1493 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1494 __entry->cnt_level =
1495 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1496 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1497 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1498 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1499 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1500 __entry->longest = be32_to_cpu(agf->agf_longest);
1501 __entry->caller_ip = caller_ip;
1502 ),
1503 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1504 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001505 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001506 MAJOR(__entry->dev), MINOR(__entry->dev),
1507 __entry->agno,
1508 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1509 __entry->length,
1510 __entry->bno_root,
1511 __entry->cnt_root,
1512 __entry->bno_level,
1513 __entry->cnt_level,
1514 __entry->flfirst,
1515 __entry->fllast,
1516 __entry->flcount,
1517 __entry->freeblks,
1518 __entry->longest,
1519 (void *)__entry->caller_ip)
1520);
Brian Fostera27ba262018-03-15 10:51:58 -07001521#define DEFINE_AGF_EVENT(name) \
1522DEFINE_EVENT(xfs_agf_class, name, \
1523 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1524 unsigned long caller_ip), \
1525 TP_ARGS(mp, agf, flags, caller_ip))
1526DEFINE_AGF_EVENT(xfs_agf);
1527DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001528
1529TRACE_EVENT(xfs_free_extent,
1530 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001531 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1532 int haveright),
1533 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001534 TP_STRUCT__entry(
1535 __field(dev_t, dev)
1536 __field(xfs_agnumber_t, agno)
1537 __field(xfs_agblock_t, agbno)
1538 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001539 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001540 __field(int, haveleft)
1541 __field(int, haveright)
1542 ),
1543 TP_fast_assign(
1544 __entry->dev = mp->m_super->s_dev;
1545 __entry->agno = agno;
1546 __entry->agbno = agbno;
1547 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001548 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001549 __entry->haveleft = haveleft;
1550 __entry->haveright = haveright;
1551 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001552 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001553 MAJOR(__entry->dev), MINOR(__entry->dev),
1554 __entry->agno,
1555 __entry->agbno,
1556 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001557 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001558 __entry->haveleft ?
1559 (__entry->haveright ? "both" : "left") :
1560 (__entry->haveright ? "right" : "none"))
1561
1562);
1563
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001564DECLARE_EVENT_CLASS(xfs_alloc_class,
1565 TP_PROTO(struct xfs_alloc_arg *args),
1566 TP_ARGS(args),
1567 TP_STRUCT__entry(
1568 __field(dev_t, dev)
1569 __field(xfs_agnumber_t, agno)
1570 __field(xfs_agblock_t, agbno)
1571 __field(xfs_extlen_t, minlen)
1572 __field(xfs_extlen_t, maxlen)
1573 __field(xfs_extlen_t, mod)
1574 __field(xfs_extlen_t, prod)
1575 __field(xfs_extlen_t, minleft)
1576 __field(xfs_extlen_t, total)
1577 __field(xfs_extlen_t, alignment)
1578 __field(xfs_extlen_t, minalignslop)
1579 __field(xfs_extlen_t, len)
1580 __field(short, type)
1581 __field(short, otype)
1582 __field(char, wasdel)
1583 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001584 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001585 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001586 __field(xfs_fsblock_t, firstblock)
1587 ),
1588 TP_fast_assign(
1589 __entry->dev = args->mp->m_super->s_dev;
1590 __entry->agno = args->agno;
1591 __entry->agbno = args->agbno;
1592 __entry->minlen = args->minlen;
1593 __entry->maxlen = args->maxlen;
1594 __entry->mod = args->mod;
1595 __entry->prod = args->prod;
1596 __entry->minleft = args->minleft;
1597 __entry->total = args->total;
1598 __entry->alignment = args->alignment;
1599 __entry->minalignslop = args->minalignslop;
1600 __entry->len = args->len;
1601 __entry->type = args->type;
1602 __entry->otype = args->otype;
1603 __entry->wasdel = args->wasdel;
1604 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001605 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001606 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001607 __entry->firstblock = args->firstblock;
1608 ),
1609 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1610 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001611 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001612 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001613 MAJOR(__entry->dev), MINOR(__entry->dev),
1614 __entry->agno,
1615 __entry->agbno,
1616 __entry->minlen,
1617 __entry->maxlen,
1618 __entry->mod,
1619 __entry->prod,
1620 __entry->minleft,
1621 __entry->total,
1622 __entry->alignment,
1623 __entry->minalignslop,
1624 __entry->len,
1625 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1626 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1627 __entry->wasdel,
1628 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001629 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001630 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001631 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001632)
1633
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001634#define DEFINE_ALLOC_EVENT(name) \
1635DEFINE_EVENT(xfs_alloc_class, name, \
1636 TP_PROTO(struct xfs_alloc_arg *args), \
1637 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001638DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001639DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001640DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1641DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1642DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1643DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1644DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1645DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001646DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1647DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001648DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1649DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1650DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1651DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1652DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001653DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001654DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1655DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1656DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1657DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1658DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1659DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1660DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1661DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1662DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1663
Dave Chinner5a5881c2012-03-22 05:15:13 +00001664DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001665 TP_PROTO(struct xfs_da_args *args),
1666 TP_ARGS(args),
1667 TP_STRUCT__entry(
1668 __field(dev_t, dev)
1669 __field(xfs_ino_t, ino)
1670 __dynamic_array(char, name, args->namelen)
1671 __field(int, namelen)
1672 __field(xfs_dahash_t, hashval)
1673 __field(xfs_ino_t, inumber)
1674 __field(int, op_flags)
1675 ),
1676 TP_fast_assign(
1677 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1678 __entry->ino = args->dp->i_ino;
1679 if (args->namelen)
1680 memcpy(__get_str(name), args->name, args->namelen);
1681 __entry->namelen = args->namelen;
1682 __entry->hashval = args->hashval;
1683 __entry->inumber = args->inumber;
1684 __entry->op_flags = args->op_flags;
1685 ),
1686 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1687 "inumber 0x%llx op_flags %s",
1688 MAJOR(__entry->dev), MINOR(__entry->dev),
1689 __entry->ino,
1690 __entry->namelen,
1691 __entry->namelen ? __get_str(name) : NULL,
1692 __entry->namelen,
1693 __entry->hashval,
1694 __entry->inumber,
1695 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001696)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001697
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001698#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001699DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001700 TP_PROTO(struct xfs_da_args *args), \
1701 TP_ARGS(args))
1702DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1703DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1704DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1705DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1706DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1707DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1708DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1709DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1710DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1711DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1712DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1713DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1714DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1715DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1716DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1717DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1718DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1719DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1720DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1721DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1722DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1723DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1724DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1725DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1726DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1727
Dave Chinneree732592012-11-12 22:53:53 +11001728DECLARE_EVENT_CLASS(xfs_attr_class,
1729 TP_PROTO(struct xfs_da_args *args),
1730 TP_ARGS(args),
1731 TP_STRUCT__entry(
1732 __field(dev_t, dev)
1733 __field(xfs_ino_t, ino)
1734 __dynamic_array(char, name, args->namelen)
1735 __field(int, namelen)
1736 __field(int, valuelen)
1737 __field(xfs_dahash_t, hashval)
Eric Sandeene4435232018-04-17 17:17:35 -07001738 __field(int, flags)
Dave Chinneree732592012-11-12 22:53:53 +11001739 __field(int, op_flags)
1740 ),
1741 TP_fast_assign(
1742 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1743 __entry->ino = args->dp->i_ino;
1744 if (args->namelen)
1745 memcpy(__get_str(name), args->name, args->namelen);
1746 __entry->namelen = args->namelen;
1747 __entry->valuelen = args->valuelen;
1748 __entry->hashval = args->hashval;
Eric Sandeene4435232018-04-17 17:17:35 -07001749 __entry->flags = args->flags;
Dave Chinneree732592012-11-12 22:53:53 +11001750 __entry->op_flags = args->op_flags;
1751 ),
1752 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Eric Sandeene4435232018-04-17 17:17:35 -07001753 "hashval 0x%x flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001754 MAJOR(__entry->dev), MINOR(__entry->dev),
1755 __entry->ino,
1756 __entry->namelen,
1757 __entry->namelen ? __get_str(name) : NULL,
1758 __entry->namelen,
1759 __entry->valuelen,
1760 __entry->hashval,
Eric Sandeene4435232018-04-17 17:17:35 -07001761 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
Dave Chinneree732592012-11-12 22:53:53 +11001762 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1763)
1764
Dave Chinner5a5881c2012-03-22 05:15:13 +00001765#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001766DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001767 TP_PROTO(struct xfs_da_args *args), \
1768 TP_ARGS(args))
1769DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1770DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1771DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1772DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1773DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001774DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1775
1776DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1777DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1778DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001779DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001780DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001782DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1783DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001784DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1785DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001786DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001787DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1788DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1789DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1790DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1791DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1792DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1793DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1794DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1795DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1796DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1797DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001798DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001799
1800DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001801DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001802DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1803DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1804
Dave Chinneree732592012-11-12 22:53:53 +11001805DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1806DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1807
1808DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1809DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1810DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1811
Dave Chinner5a5881c2012-03-22 05:15:13 +00001812#define DEFINE_DA_EVENT(name) \
1813DEFINE_EVENT(xfs_da_class, name, \
1814 TP_PROTO(struct xfs_da_args *args), \
1815 TP_ARGS(args))
1816DEFINE_DA_EVENT(xfs_da_split);
1817DEFINE_DA_EVENT(xfs_da_join);
1818DEFINE_DA_EVENT(xfs_da_link_before);
1819DEFINE_DA_EVENT(xfs_da_link_after);
1820DEFINE_DA_EVENT(xfs_da_unlink_back);
1821DEFINE_DA_EVENT(xfs_da_unlink_forward);
1822DEFINE_DA_EVENT(xfs_da_root_split);
1823DEFINE_DA_EVENT(xfs_da_root_join);
1824DEFINE_DA_EVENT(xfs_da_node_add);
1825DEFINE_DA_EVENT(xfs_da_node_create);
1826DEFINE_DA_EVENT(xfs_da_node_split);
1827DEFINE_DA_EVENT(xfs_da_node_remove);
1828DEFINE_DA_EVENT(xfs_da_node_rebalance);
1829DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001830DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001831DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1832DEFINE_DA_EVENT(xfs_da_grow_inode);
1833DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001834DEFINE_DA_EVENT(xfs_da_fixhashpath);
1835DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001836
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001837DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1838 TP_PROTO(struct xfs_da_args *args, int idx),
1839 TP_ARGS(args, idx),
1840 TP_STRUCT__entry(
1841 __field(dev_t, dev)
1842 __field(xfs_ino_t, ino)
1843 __field(int, op_flags)
1844 __field(int, idx)
1845 ),
1846 TP_fast_assign(
1847 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1848 __entry->ino = args->dp->i_ino;
1849 __entry->op_flags = args->op_flags;
1850 __entry->idx = idx;
1851 ),
1852 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1853 MAJOR(__entry->dev), MINOR(__entry->dev),
1854 __entry->ino,
1855 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1856 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001857)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001858
1859#define DEFINE_DIR2_SPACE_EVENT(name) \
1860DEFINE_EVENT(xfs_dir2_space_class, name, \
1861 TP_PROTO(struct xfs_da_args *args, int idx), \
1862 TP_ARGS(args, idx))
1863DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1864DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1865DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1866DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001867
1868TRACE_EVENT(xfs_dir2_leafn_moveents,
1869 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1870 TP_ARGS(args, src_idx, dst_idx, count),
1871 TP_STRUCT__entry(
1872 __field(dev_t, dev)
1873 __field(xfs_ino_t, ino)
1874 __field(int, op_flags)
1875 __field(int, src_idx)
1876 __field(int, dst_idx)
1877 __field(int, count)
1878 ),
1879 TP_fast_assign(
1880 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1881 __entry->ino = args->dp->i_ino;
1882 __entry->op_flags = args->op_flags;
1883 __entry->src_idx = src_idx;
1884 __entry->dst_idx = dst_idx;
1885 __entry->count = count;
1886 ),
1887 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1888 "src_idx %d dst_idx %d count %d",
1889 MAJOR(__entry->dev), MINOR(__entry->dev),
1890 __entry->ino,
1891 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1892 __entry->src_idx,
1893 __entry->dst_idx,
1894 __entry->count)
1895);
1896
Dave Chinner3a85cd92010-01-14 01:33:55 +00001897#define XFS_SWAPEXT_INODES \
1898 { 0, "target" }, \
1899 { 1, "temp" }
1900
1901#define XFS_INODE_FORMAT_STR \
1902 { 0, "invalid" }, \
1903 { 1, "local" }, \
1904 { 2, "extent" }, \
1905 { 3, "btree" }
1906
1907DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1908 TP_PROTO(struct xfs_inode *ip, int which),
1909 TP_ARGS(ip, which),
1910 TP_STRUCT__entry(
1911 __field(dev_t, dev)
1912 __field(int, which)
1913 __field(xfs_ino_t, ino)
1914 __field(int, format)
1915 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001916 __field(int, broot_size)
1917 __field(int, fork_off)
1918 ),
1919 TP_fast_assign(
1920 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1921 __entry->which = which;
1922 __entry->ino = ip->i_ino;
1923 __entry->format = ip->i_d.di_format;
1924 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001925 __entry->broot_size = ip->i_df.if_broot_bytes;
1926 __entry->fork_off = XFS_IFORK_BOFF(ip);
1927 ),
1928 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001929 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001930 MAJOR(__entry->dev), MINOR(__entry->dev),
1931 __entry->ino,
1932 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1933 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1934 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001935 __entry->broot_size,
1936 __entry->fork_off)
1937)
1938
1939#define DEFINE_SWAPEXT_EVENT(name) \
1940DEFINE_EVENT(xfs_swap_extent_class, name, \
1941 TP_PROTO(struct xfs_inode *ip, int which), \
1942 TP_ARGS(ip, which))
1943
1944DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1945DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1946
Brian Fostere67d3d42017-08-08 18:21:53 -07001947TRACE_EVENT(xfs_log_recover,
1948 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1949 TP_ARGS(log, headblk, tailblk),
1950 TP_STRUCT__entry(
1951 __field(dev_t, dev)
1952 __field(xfs_daddr_t, headblk)
1953 __field(xfs_daddr_t, tailblk)
1954 ),
1955 TP_fast_assign(
1956 __entry->dev = log->l_mp->m_super->s_dev;
1957 __entry->headblk = headblk;
1958 __entry->tailblk = tailblk;
1959 ),
1960 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1961 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1962 __entry->tailblk)
1963)
1964
Brian Foster5cd9cee2016-09-26 08:34:52 +10001965TRACE_EVENT(xfs_log_recover_record,
1966 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1967 TP_ARGS(log, rhead, pass),
1968 TP_STRUCT__entry(
1969 __field(dev_t, dev)
1970 __field(xfs_lsn_t, lsn)
1971 __field(int, len)
1972 __field(int, num_logops)
1973 __field(int, pass)
1974 ),
1975 TP_fast_assign(
1976 __entry->dev = log->l_mp->m_super->s_dev;
1977 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1978 __entry->len = be32_to_cpu(rhead->h_len);
1979 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1980 __entry->pass = pass;
1981 ),
1982 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1983 MAJOR(__entry->dev), MINOR(__entry->dev),
1984 __entry->lsn, __entry->len, __entry->num_logops,
1985 __entry->pass)
1986)
1987
Dave Chinner9abbc532010-04-13 15:06:46 +10001988DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001989 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001990 struct xlog_recover_item *item, int pass),
1991 TP_ARGS(log, trans, item, pass),
1992 TP_STRUCT__entry(
1993 __field(dev_t, dev)
1994 __field(unsigned long, item)
1995 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001996 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10001997 __field(int, type)
1998 __field(int, pass)
1999 __field(int, count)
2000 __field(int, total)
2001 ),
2002 TP_fast_assign(
2003 __entry->dev = log->l_mp->m_super->s_dev;
2004 __entry->item = (unsigned long)item;
2005 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002006 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002007 __entry->type = ITEM_TYPE(item);
2008 __entry->pass = pass;
2009 __entry->count = item->ri_cnt;
2010 __entry->total = item->ri_total;
2011 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08002012 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10002013 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002014 MAJOR(__entry->dev), MINOR(__entry->dev),
2015 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002016 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002017 __entry->pass,
2018 (void *)__entry->item,
2019 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2020 __entry->count,
2021 __entry->total)
2022)
2023
2024#define DEFINE_LOG_RECOVER_ITEM(name) \
2025DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002026 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002027 struct xlog_recover_item *item, int pass), \
2028 TP_ARGS(log, trans, item, pass))
2029
2030DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2031DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2032DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2033DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2034DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2035
2036DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002037 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002038 TP_ARGS(log, buf_f),
2039 TP_STRUCT__entry(
2040 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002041 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002042 __field(unsigned short, len)
2043 __field(unsigned short, flags)
2044 __field(unsigned short, size)
2045 __field(unsigned int, map_size)
2046 ),
2047 TP_fast_assign(
2048 __entry->dev = log->l_mp->m_super->s_dev;
2049 __entry->blkno = buf_f->blf_blkno;
2050 __entry->len = buf_f->blf_len;
2051 __entry->flags = buf_f->blf_flags;
2052 __entry->size = buf_f->blf_size;
2053 __entry->map_size = buf_f->blf_map_size;
2054 ),
2055 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2056 "map_size %d",
2057 MAJOR(__entry->dev), MINOR(__entry->dev),
2058 __entry->blkno,
2059 __entry->len,
2060 __entry->flags,
2061 __entry->size,
2062 __entry->map_size)
2063)
2064
2065#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2066DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002067 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002068 TP_ARGS(log, buf_f))
2069
2070DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2071DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2072DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2073DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2074DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002075DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002076DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2077DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2078DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2079
2080DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002081 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002082 TP_ARGS(log, in_f),
2083 TP_STRUCT__entry(
2084 __field(dev_t, dev)
2085 __field(xfs_ino_t, ino)
2086 __field(unsigned short, size)
2087 __field(int, fields)
2088 __field(unsigned short, asize)
2089 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002090 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002091 __field(int, len)
2092 __field(int, boffset)
2093 ),
2094 TP_fast_assign(
2095 __entry->dev = log->l_mp->m_super->s_dev;
2096 __entry->ino = in_f->ilf_ino;
2097 __entry->size = in_f->ilf_size;
2098 __entry->fields = in_f->ilf_fields;
2099 __entry->asize = in_f->ilf_asize;
2100 __entry->dsize = in_f->ilf_dsize;
2101 __entry->blkno = in_f->ilf_blkno;
2102 __entry->len = in_f->ilf_len;
2103 __entry->boffset = in_f->ilf_boffset;
2104 ),
2105 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2106 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2107 MAJOR(__entry->dev), MINOR(__entry->dev),
2108 __entry->ino,
2109 __entry->size,
2110 __entry->fields,
2111 __entry->asize,
2112 __entry->dsize,
2113 __entry->blkno,
2114 __entry->len,
2115 __entry->boffset)
2116)
2117#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2118DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002119 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002120 TP_ARGS(log, in_f))
2121
2122DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2123DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2124DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2125
Brian Foster78d57e42015-08-19 09:58:48 +10002126DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2127 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2128 TP_ARGS(log, in_f),
2129 TP_STRUCT__entry(
2130 __field(dev_t, dev)
2131 __field(xfs_agnumber_t, agno)
2132 __field(xfs_agblock_t, agbno)
2133 __field(unsigned int, count)
2134 __field(unsigned int, isize)
2135 __field(xfs_agblock_t, length)
2136 __field(unsigned int, gen)
2137 ),
2138 TP_fast_assign(
2139 __entry->dev = log->l_mp->m_super->s_dev;
2140 __entry->agno = be32_to_cpu(in_f->icl_ag);
2141 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2142 __entry->count = be32_to_cpu(in_f->icl_count);
2143 __entry->isize = be32_to_cpu(in_f->icl_isize);
2144 __entry->length = be32_to_cpu(in_f->icl_length);
2145 __entry->gen = be32_to_cpu(in_f->icl_gen);
2146 ),
2147 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2148 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2149 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2150 __entry->length, __entry->gen)
2151)
2152#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2153DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2154 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2155 TP_ARGS(log, in_f))
2156
2157DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2158DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2159
Christoph Hellwiga46db602011-01-07 13:02:04 +00002160DECLARE_EVENT_CLASS(xfs_discard_class,
2161 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2162 xfs_agblock_t agbno, xfs_extlen_t len),
2163 TP_ARGS(mp, agno, agbno, len),
2164 TP_STRUCT__entry(
2165 __field(dev_t, dev)
2166 __field(xfs_agnumber_t, agno)
2167 __field(xfs_agblock_t, agbno)
2168 __field(xfs_extlen_t, len)
2169 ),
2170 TP_fast_assign(
2171 __entry->dev = mp->m_super->s_dev;
2172 __entry->agno = agno;
2173 __entry->agbno = agbno;
2174 __entry->len = len;
2175 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002176 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002177 MAJOR(__entry->dev), MINOR(__entry->dev),
2178 __entry->agno,
2179 __entry->agbno,
2180 __entry->len)
2181)
2182
2183#define DEFINE_DISCARD_EVENT(name) \
2184DEFINE_EVENT(xfs_discard_class, name, \
2185 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2186 xfs_agblock_t agbno, xfs_extlen_t len), \
2187 TP_ARGS(mp, agno, agbno, len))
2188DEFINE_DISCARD_EVENT(xfs_discard_extent);
2189DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2190DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2191DEFINE_DISCARD_EVENT(xfs_discard_busy);
2192
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002193/* btree cursor events */
2194DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2195 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2196 TP_ARGS(cur, level, bp),
2197 TP_STRUCT__entry(
2198 __field(dev_t, dev)
2199 __field(xfs_btnum_t, btnum)
2200 __field(int, level)
2201 __field(int, nlevels)
2202 __field(int, ptr)
2203 __field(xfs_daddr_t, daddr)
2204 ),
2205 TP_fast_assign(
2206 __entry->dev = cur->bc_mp->m_super->s_dev;
2207 __entry->btnum = cur->bc_btnum;
2208 __entry->level = level;
2209 __entry->nlevels = cur->bc_nlevels;
2210 __entry->ptr = cur->bc_ptrs[level];
2211 __entry->daddr = bp ? bp->b_bn : -1;
2212 ),
2213 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2214 MAJOR(__entry->dev), MINOR(__entry->dev),
2215 __entry->btnum,
2216 __entry->level,
2217 __entry->nlevels,
2218 __entry->ptr,
2219 (unsigned long long)__entry->daddr)
2220)
2221
2222#define DEFINE_BTREE_CUR_EVENT(name) \
2223DEFINE_EVENT(xfs_btree_cur_class, name, \
2224 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2225 TP_ARGS(cur, level, bp))
2226DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002227DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002228
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002229/* deferred ops */
2230struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002231struct xfs_defer_ops;
2232
2233DECLARE_EVENT_CLASS(xfs_defer_class,
Dave Chinnere632a562018-05-09 07:48:52 -07002234 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop,
2235 unsigned long caller_ip),
2236 TP_ARGS(mp, dop, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002237 TP_STRUCT__entry(
2238 __field(dev_t, dev)
2239 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002240 __field(char, committed)
2241 __field(char, low)
Dave Chinnere632a562018-05-09 07:48:52 -07002242 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002243 ),
2244 TP_fast_assign(
2245 __entry->dev = mp ? mp->m_super->s_dev : 0;
2246 __entry->dop = dop;
2247 __entry->committed = dop->dop_committed;
2248 __entry->low = dop->dop_low;
Dave Chinnere632a562018-05-09 07:48:52 -07002249 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002250 ),
Dave Chinnere632a562018-05-09 07:48:52 -07002251 TP_printk("dev %d:%d ops %p committed %d low %d, caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002252 MAJOR(__entry->dev), MINOR(__entry->dev),
2253 __entry->dop,
2254 __entry->committed,
Dave Chinnere632a562018-05-09 07:48:52 -07002255 __entry->low,
2256 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002257)
2258#define DEFINE_DEFER_EVENT(name) \
2259DEFINE_EVENT(xfs_defer_class, name, \
Dave Chinnere632a562018-05-09 07:48:52 -07002260 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, \
2261 unsigned long caller_ip), \
2262 TP_ARGS(mp, dop, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002263
2264DECLARE_EVENT_CLASS(xfs_defer_error_class,
2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2266 TP_ARGS(mp, dop, error),
2267 TP_STRUCT__entry(
2268 __field(dev_t, dev)
2269 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002270 __field(char, committed)
2271 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002272 __field(int, error)
2273 ),
2274 TP_fast_assign(
2275 __entry->dev = mp ? mp->m_super->s_dev : 0;
2276 __entry->dop = dop;
2277 __entry->committed = dop->dop_committed;
2278 __entry->low = dop->dop_low;
2279 __entry->error = error;
2280 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002281 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002282 MAJOR(__entry->dev), MINOR(__entry->dev),
2283 __entry->dop,
2284 __entry->committed,
2285 __entry->low,
2286 __entry->error)
2287)
2288#define DEFINE_DEFER_ERROR_EVENT(name) \
2289DEFINE_EVENT(xfs_defer_error_class, name, \
2290 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2291 TP_ARGS(mp, dop, error))
2292
2293DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2294 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2295 TP_ARGS(mp, dfp),
2296 TP_STRUCT__entry(
2297 __field(dev_t, dev)
2298 __field(int, type)
2299 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002300 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002301 __field(int, nr)
2302 ),
2303 TP_fast_assign(
2304 __entry->dev = mp ? mp->m_super->s_dev : 0;
2305 __entry->type = dfp->dfp_type->type;
2306 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002307 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002308 __entry->nr = dfp->dfp_count;
2309 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002310 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002311 MAJOR(__entry->dev), MINOR(__entry->dev),
2312 __entry->type,
2313 __entry->intent,
2314 __entry->committed,
2315 __entry->nr)
2316)
2317#define DEFINE_DEFER_PENDING_EVENT(name) \
2318DEFINE_EVENT(xfs_defer_pending_class, name, \
2319 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2320 TP_ARGS(mp, dfp))
2321
2322DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2323 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2324 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2325 TP_ARGS(mp, agno, type, agbno, len),
2326 TP_STRUCT__entry(
2327 __field(dev_t, dev)
2328 __field(xfs_agnumber_t, agno)
2329 __field(int, type)
2330 __field(xfs_agblock_t, agbno)
2331 __field(xfs_extlen_t, len)
2332 ),
2333 TP_fast_assign(
2334 __entry->dev = mp->m_super->s_dev;
2335 __entry->agno = agno;
2336 __entry->type = type;
2337 __entry->agbno = agbno;
2338 __entry->len = len;
2339 ),
2340 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2341 MAJOR(__entry->dev), MINOR(__entry->dev),
2342 __entry->type,
2343 __entry->agno,
2344 __entry->agbno,
2345 __entry->len)
2346);
2347#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2348DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2349 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2350 int type, \
2351 xfs_agblock_t bno, \
2352 xfs_extlen_t len), \
2353 TP_ARGS(mp, agno, type, bno, len))
2354
2355DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2356 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2357 int op,
2358 xfs_agblock_t agbno,
2359 xfs_ino_t ino,
2360 int whichfork,
2361 xfs_fileoff_t offset,
2362 xfs_filblks_t len,
2363 xfs_exntst_t state),
2364 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2365 TP_STRUCT__entry(
2366 __field(dev_t, dev)
2367 __field(xfs_agnumber_t, agno)
2368 __field(xfs_ino_t, ino)
2369 __field(xfs_agblock_t, agbno)
2370 __field(int, whichfork)
2371 __field(xfs_fileoff_t, l_loff)
2372 __field(xfs_filblks_t, l_len)
2373 __field(xfs_exntst_t, l_state)
2374 __field(int, op)
2375 ),
2376 TP_fast_assign(
2377 __entry->dev = mp->m_super->s_dev;
2378 __entry->agno = agno;
2379 __entry->ino = ino;
2380 __entry->agbno = agbno;
2381 __entry->whichfork = whichfork;
2382 __entry->l_loff = offset;
2383 __entry->l_len = len;
2384 __entry->l_state = state;
2385 __entry->op = op;
2386 ),
2387 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2388 MAJOR(__entry->dev), MINOR(__entry->dev),
2389 __entry->op,
2390 __entry->agno,
2391 __entry->agbno,
2392 __entry->ino,
2393 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2394 __entry->l_loff,
2395 __entry->l_len,
2396 __entry->l_state)
2397);
2398#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2399DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2400 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2401 int op, \
2402 xfs_agblock_t agbno, \
2403 xfs_ino_t ino, \
2404 int whichfork, \
2405 xfs_fileoff_t offset, \
2406 xfs_filblks_t len, \
2407 xfs_exntst_t state), \
2408 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2409
2410DEFINE_DEFER_EVENT(xfs_defer_init);
2411DEFINE_DEFER_EVENT(xfs_defer_cancel);
2412DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2413DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2414DEFINE_DEFER_EVENT(xfs_defer_finish);
2415DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2416
2417DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2418DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002419
2420DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2421DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002422DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2423DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2424DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2425
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002426#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2427DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2428DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002429DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2430DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002431
Darrick J. Wong673930c2016-08-03 11:33:43 +10002432/* rmap tracepoints */
2433DECLARE_EVENT_CLASS(xfs_rmap_class,
2434 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2435 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2436 struct xfs_owner_info *oinfo),
2437 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2438 TP_STRUCT__entry(
2439 __field(dev_t, dev)
2440 __field(xfs_agnumber_t, agno)
2441 __field(xfs_agblock_t, agbno)
2442 __field(xfs_extlen_t, len)
2443 __field(uint64_t, owner)
2444 __field(uint64_t, offset)
2445 __field(unsigned long, flags)
2446 ),
2447 TP_fast_assign(
2448 __entry->dev = mp->m_super->s_dev;
2449 __entry->agno = agno;
2450 __entry->agbno = agbno;
2451 __entry->len = len;
2452 __entry->owner = oinfo->oi_owner;
2453 __entry->offset = oinfo->oi_offset;
2454 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002455 if (unwritten)
2456 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002457 ),
2458 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2459 MAJOR(__entry->dev), MINOR(__entry->dev),
2460 __entry->agno,
2461 __entry->agbno,
2462 __entry->len,
2463 __entry->owner,
2464 __entry->offset,
2465 __entry->flags)
2466);
2467#define DEFINE_RMAP_EVENT(name) \
2468DEFINE_EVENT(xfs_rmap_class, name, \
2469 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2470 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2471 struct xfs_owner_info *oinfo), \
2472 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2473
2474/* simple AG-based error/%ip tracepoint class */
2475DECLARE_EVENT_CLASS(xfs_ag_error_class,
2476 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2477 unsigned long caller_ip),
2478 TP_ARGS(mp, agno, error, caller_ip),
2479 TP_STRUCT__entry(
2480 __field(dev_t, dev)
2481 __field(xfs_agnumber_t, agno)
2482 __field(int, error)
2483 __field(unsigned long, caller_ip)
2484 ),
2485 TP_fast_assign(
2486 __entry->dev = mp->m_super->s_dev;
2487 __entry->agno = agno;
2488 __entry->error = error;
2489 __entry->caller_ip = caller_ip;
2490 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002491 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002492 MAJOR(__entry->dev), MINOR(__entry->dev),
2493 __entry->agno,
2494 __entry->error,
2495 (char *)__entry->caller_ip)
2496);
2497
2498#define DEFINE_AG_ERROR_EVENT(name) \
2499DEFINE_EVENT(xfs_ag_error_class, name, \
2500 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2501 unsigned long caller_ip), \
2502 TP_ARGS(mp, agno, error, caller_ip))
2503
2504DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2505DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2506DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2507DEFINE_RMAP_EVENT(xfs_rmap_map);
2508DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2509DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002510DEFINE_RMAP_EVENT(xfs_rmap_convert);
2511DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2512DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2513DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002514
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002515DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2516 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2517 xfs_agblock_t agbno, xfs_extlen_t len,
2518 uint64_t owner, uint64_t offset, unsigned int flags),
2519 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2520 TP_STRUCT__entry(
2521 __field(dev_t, dev)
2522 __field(xfs_agnumber_t, agno)
2523 __field(xfs_agblock_t, agbno)
2524 __field(xfs_extlen_t, len)
2525 __field(uint64_t, owner)
2526 __field(uint64_t, offset)
2527 __field(unsigned int, flags)
2528 ),
2529 TP_fast_assign(
2530 __entry->dev = mp->m_super->s_dev;
2531 __entry->agno = agno;
2532 __entry->agbno = agbno;
2533 __entry->len = len;
2534 __entry->owner = owner;
2535 __entry->offset = offset;
2536 __entry->flags = flags;
2537 ),
2538 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2539 MAJOR(__entry->dev), MINOR(__entry->dev),
2540 __entry->agno,
2541 __entry->agbno,
2542 __entry->len,
2543 __entry->owner,
2544 __entry->offset,
2545 __entry->flags)
2546);
2547#define DEFINE_RMAPBT_EVENT(name) \
2548DEFINE_EVENT(xfs_rmapbt_class, name, \
2549 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2550 xfs_agblock_t agbno, xfs_extlen_t len, \
2551 uint64_t owner, uint64_t offset, unsigned int flags), \
2552 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2553
2554#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2555DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2556DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2557
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002558DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2559DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002560DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2561DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2562DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2563DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2564DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2565DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002566
2567DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2568DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2569DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2570DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002571DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2572DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002573DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002574
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002575/* deferred bmbt updates */
2576#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2577DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2578DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2579
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002580/* per-AG reservation */
2581DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2582 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2583 xfs_extlen_t len),
2584 TP_ARGS(pag, resv, len),
2585 TP_STRUCT__entry(
2586 __field(dev_t, dev)
2587 __field(xfs_agnumber_t, agno)
2588 __field(int, resv)
2589 __field(xfs_extlen_t, freeblks)
2590 __field(xfs_extlen_t, flcount)
2591 __field(xfs_extlen_t, reserved)
2592 __field(xfs_extlen_t, asked)
2593 __field(xfs_extlen_t, len)
2594 ),
2595 TP_fast_assign(
2596 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2597
2598 __entry->dev = pag->pag_mount->m_super->s_dev;
2599 __entry->agno = pag->pag_agno;
2600 __entry->resv = resv;
2601 __entry->freeblks = pag->pagf_freeblks;
2602 __entry->flcount = pag->pagf_flcount;
2603 __entry->reserved = r ? r->ar_reserved : 0;
2604 __entry->asked = r ? r->ar_asked : 0;
2605 __entry->len = len;
2606 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002607 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2608 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002609 MAJOR(__entry->dev), MINOR(__entry->dev),
2610 __entry->agno,
2611 __entry->resv,
2612 __entry->freeblks,
2613 __entry->flcount,
2614 __entry->reserved,
2615 __entry->asked,
2616 __entry->len)
2617)
2618#define DEFINE_AG_RESV_EVENT(name) \
2619DEFINE_EVENT(xfs_ag_resv_class, name, \
2620 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2621 xfs_extlen_t len), \
2622 TP_ARGS(pag, type, len))
2623
2624/* per-AG reservation tracepoints */
2625DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2626DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2627DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2628DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2629DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2630DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2631
2632DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2633DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2634
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002635/* refcount tracepoint classes */
2636
2637/* reuse the discard trace class for agbno/aglen-based traces */
2638#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2639
2640/* ag btree lookup tracepoint class */
2641#define XFS_AG_BTREE_CMP_FORMAT_STR \
2642 { XFS_LOOKUP_EQ, "eq" }, \
2643 { XFS_LOOKUP_LE, "le" }, \
2644 { XFS_LOOKUP_GE, "ge" }
2645DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2646 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2647 xfs_agblock_t agbno, xfs_lookup_t dir),
2648 TP_ARGS(mp, agno, agbno, dir),
2649 TP_STRUCT__entry(
2650 __field(dev_t, dev)
2651 __field(xfs_agnumber_t, agno)
2652 __field(xfs_agblock_t, agbno)
2653 __field(xfs_lookup_t, dir)
2654 ),
2655 TP_fast_assign(
2656 __entry->dev = mp->m_super->s_dev;
2657 __entry->agno = agno;
2658 __entry->agbno = agbno;
2659 __entry->dir = dir;
2660 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002661 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002662 MAJOR(__entry->dev), MINOR(__entry->dev),
2663 __entry->agno,
2664 __entry->agbno,
2665 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2666 __entry->dir)
2667)
2668
2669#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2670DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2671 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2672 xfs_agblock_t agbno, xfs_lookup_t dir), \
2673 TP_ARGS(mp, agno, agbno, dir))
2674
2675/* single-rcext tracepoint class */
2676DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2677 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2678 struct xfs_refcount_irec *irec),
2679 TP_ARGS(mp, agno, irec),
2680 TP_STRUCT__entry(
2681 __field(dev_t, dev)
2682 __field(xfs_agnumber_t, agno)
2683 __field(xfs_agblock_t, startblock)
2684 __field(xfs_extlen_t, blockcount)
2685 __field(xfs_nlink_t, refcount)
2686 ),
2687 TP_fast_assign(
2688 __entry->dev = mp->m_super->s_dev;
2689 __entry->agno = agno;
2690 __entry->startblock = irec->rc_startblock;
2691 __entry->blockcount = irec->rc_blockcount;
2692 __entry->refcount = irec->rc_refcount;
2693 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002694 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002695 MAJOR(__entry->dev), MINOR(__entry->dev),
2696 __entry->agno,
2697 __entry->startblock,
2698 __entry->blockcount,
2699 __entry->refcount)
2700)
2701
2702#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2703DEFINE_EVENT(xfs_refcount_extent_class, name, \
2704 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2705 struct xfs_refcount_irec *irec), \
2706 TP_ARGS(mp, agno, irec))
2707
2708/* single-rcext and an agbno tracepoint class */
2709DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2710 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2711 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2712 TP_ARGS(mp, agno, irec, agbno),
2713 TP_STRUCT__entry(
2714 __field(dev_t, dev)
2715 __field(xfs_agnumber_t, agno)
2716 __field(xfs_agblock_t, startblock)
2717 __field(xfs_extlen_t, blockcount)
2718 __field(xfs_nlink_t, refcount)
2719 __field(xfs_agblock_t, agbno)
2720 ),
2721 TP_fast_assign(
2722 __entry->dev = mp->m_super->s_dev;
2723 __entry->agno = agno;
2724 __entry->startblock = irec->rc_startblock;
2725 __entry->blockcount = irec->rc_blockcount;
2726 __entry->refcount = irec->rc_refcount;
2727 __entry->agbno = agbno;
2728 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002729 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002730 MAJOR(__entry->dev), MINOR(__entry->dev),
2731 __entry->agno,
2732 __entry->startblock,
2733 __entry->blockcount,
2734 __entry->refcount,
2735 __entry->agbno)
2736)
2737
2738#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2739DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2740 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2741 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2742 TP_ARGS(mp, agno, irec, agbno))
2743
2744/* double-rcext tracepoint class */
2745DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2746 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2747 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2748 TP_ARGS(mp, agno, i1, i2),
2749 TP_STRUCT__entry(
2750 __field(dev_t, dev)
2751 __field(xfs_agnumber_t, agno)
2752 __field(xfs_agblock_t, i1_startblock)
2753 __field(xfs_extlen_t, i1_blockcount)
2754 __field(xfs_nlink_t, i1_refcount)
2755 __field(xfs_agblock_t, i2_startblock)
2756 __field(xfs_extlen_t, i2_blockcount)
2757 __field(xfs_nlink_t, i2_refcount)
2758 ),
2759 TP_fast_assign(
2760 __entry->dev = mp->m_super->s_dev;
2761 __entry->agno = agno;
2762 __entry->i1_startblock = i1->rc_startblock;
2763 __entry->i1_blockcount = i1->rc_blockcount;
2764 __entry->i1_refcount = i1->rc_refcount;
2765 __entry->i2_startblock = i2->rc_startblock;
2766 __entry->i2_blockcount = i2->rc_blockcount;
2767 __entry->i2_refcount = i2->rc_refcount;
2768 ),
2769 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002770 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002771 MAJOR(__entry->dev), MINOR(__entry->dev),
2772 __entry->agno,
2773 __entry->i1_startblock,
2774 __entry->i1_blockcount,
2775 __entry->i1_refcount,
2776 __entry->i2_startblock,
2777 __entry->i2_blockcount,
2778 __entry->i2_refcount)
2779)
2780
2781#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2782DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2783 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2784 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2785 TP_ARGS(mp, agno, i1, i2))
2786
2787/* double-rcext and an agbno tracepoint class */
2788DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2789 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2790 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2791 xfs_agblock_t agbno),
2792 TP_ARGS(mp, agno, i1, i2, agbno),
2793 TP_STRUCT__entry(
2794 __field(dev_t, dev)
2795 __field(xfs_agnumber_t, agno)
2796 __field(xfs_agblock_t, i1_startblock)
2797 __field(xfs_extlen_t, i1_blockcount)
2798 __field(xfs_nlink_t, i1_refcount)
2799 __field(xfs_agblock_t, i2_startblock)
2800 __field(xfs_extlen_t, i2_blockcount)
2801 __field(xfs_nlink_t, i2_refcount)
2802 __field(xfs_agblock_t, agbno)
2803 ),
2804 TP_fast_assign(
2805 __entry->dev = mp->m_super->s_dev;
2806 __entry->agno = agno;
2807 __entry->i1_startblock = i1->rc_startblock;
2808 __entry->i1_blockcount = i1->rc_blockcount;
2809 __entry->i1_refcount = i1->rc_refcount;
2810 __entry->i2_startblock = i2->rc_startblock;
2811 __entry->i2_blockcount = i2->rc_blockcount;
2812 __entry->i2_refcount = i2->rc_refcount;
2813 __entry->agbno = agbno;
2814 ),
2815 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002816 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002817 MAJOR(__entry->dev), MINOR(__entry->dev),
2818 __entry->agno,
2819 __entry->i1_startblock,
2820 __entry->i1_blockcount,
2821 __entry->i1_refcount,
2822 __entry->i2_startblock,
2823 __entry->i2_blockcount,
2824 __entry->i2_refcount,
2825 __entry->agbno)
2826)
2827
2828#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2829DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2830 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2831 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2832 xfs_agblock_t agbno), \
2833 TP_ARGS(mp, agno, i1, i2, agbno))
2834
2835/* triple-rcext tracepoint class */
2836DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2837 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2838 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2839 struct xfs_refcount_irec *i3),
2840 TP_ARGS(mp, agno, i1, i2, i3),
2841 TP_STRUCT__entry(
2842 __field(dev_t, dev)
2843 __field(xfs_agnumber_t, agno)
2844 __field(xfs_agblock_t, i1_startblock)
2845 __field(xfs_extlen_t, i1_blockcount)
2846 __field(xfs_nlink_t, i1_refcount)
2847 __field(xfs_agblock_t, i2_startblock)
2848 __field(xfs_extlen_t, i2_blockcount)
2849 __field(xfs_nlink_t, i2_refcount)
2850 __field(xfs_agblock_t, i3_startblock)
2851 __field(xfs_extlen_t, i3_blockcount)
2852 __field(xfs_nlink_t, i3_refcount)
2853 ),
2854 TP_fast_assign(
2855 __entry->dev = mp->m_super->s_dev;
2856 __entry->agno = agno;
2857 __entry->i1_startblock = i1->rc_startblock;
2858 __entry->i1_blockcount = i1->rc_blockcount;
2859 __entry->i1_refcount = i1->rc_refcount;
2860 __entry->i2_startblock = i2->rc_startblock;
2861 __entry->i2_blockcount = i2->rc_blockcount;
2862 __entry->i2_refcount = i2->rc_refcount;
2863 __entry->i3_startblock = i3->rc_startblock;
2864 __entry->i3_blockcount = i3->rc_blockcount;
2865 __entry->i3_refcount = i3->rc_refcount;
2866 ),
2867 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2868 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002869 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002870 MAJOR(__entry->dev), MINOR(__entry->dev),
2871 __entry->agno,
2872 __entry->i1_startblock,
2873 __entry->i1_blockcount,
2874 __entry->i1_refcount,
2875 __entry->i2_startblock,
2876 __entry->i2_blockcount,
2877 __entry->i2_refcount,
2878 __entry->i3_startblock,
2879 __entry->i3_blockcount,
2880 __entry->i3_refcount)
2881);
2882
2883#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2884DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2885 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2886 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2887 struct xfs_refcount_irec *i3), \
2888 TP_ARGS(mp, agno, i1, i2, i3))
2889
2890/* refcount btree tracepoints */
2891DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2892DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2893DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2894DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2895DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2896DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2897DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2898DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2899DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2900DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2901
2902/* refcount adjustment tracepoints */
2903DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2904DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002905DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2906DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002907DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2908DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002909DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002910DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2911DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2912DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2913DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2914DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2915DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002916DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002917DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2918DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2919DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2920DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2921DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2922DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2923DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2924
2925/* reflink helpers */
2926DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2927DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2928DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba6122016-10-03 09:11:22 -07002929#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2930DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2931DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002932
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002933TRACE_EVENT(xfs_refcount_finish_one_leftover,
2934 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2935 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2936 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2937 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2938 TP_STRUCT__entry(
2939 __field(dev_t, dev)
2940 __field(xfs_agnumber_t, agno)
2941 __field(int, type)
2942 __field(xfs_agblock_t, agbno)
2943 __field(xfs_extlen_t, len)
2944 __field(xfs_agblock_t, new_agbno)
2945 __field(xfs_extlen_t, new_len)
2946 ),
2947 TP_fast_assign(
2948 __entry->dev = mp->m_super->s_dev;
2949 __entry->agno = agno;
2950 __entry->type = type;
2951 __entry->agbno = agbno;
2952 __entry->len = len;
2953 __entry->new_agbno = new_agbno;
2954 __entry->new_len = new_len;
2955 ),
2956 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2957 MAJOR(__entry->dev), MINOR(__entry->dev),
2958 __entry->type,
2959 __entry->agno,
2960 __entry->agbno,
2961 __entry->len,
2962 __entry->new_agbno,
2963 __entry->new_len)
2964);
2965
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002966/* simple inode-based error/%ip tracepoint class */
2967DECLARE_EVENT_CLASS(xfs_inode_error_class,
2968 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2969 TP_ARGS(ip, error, caller_ip),
2970 TP_STRUCT__entry(
2971 __field(dev_t, dev)
2972 __field(xfs_ino_t, ino)
2973 __field(int, error)
2974 __field(unsigned long, caller_ip)
2975 ),
2976 TP_fast_assign(
2977 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2978 __entry->ino = ip->i_ino;
2979 __entry->error = error;
2980 __entry->caller_ip = caller_ip;
2981 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002982 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002983 MAJOR(__entry->dev), MINOR(__entry->dev),
2984 __entry->ino,
2985 __entry->error,
2986 (char *)__entry->caller_ip)
2987);
2988
2989#define DEFINE_INODE_ERROR_EVENT(name) \
2990DEFINE_EVENT(xfs_inode_error_class, name, \
2991 TP_PROTO(struct xfs_inode *ip, int error, \
2992 unsigned long caller_ip), \
2993 TP_ARGS(ip, error, caller_ip))
2994
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002995/* reflink tracepoint classes */
2996
2997/* two-file io tracepoint class */
2998DECLARE_EVENT_CLASS(xfs_double_io_class,
2999 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3000 struct xfs_inode *dest, xfs_off_t doffset),
3001 TP_ARGS(src, soffset, len, dest, doffset),
3002 TP_STRUCT__entry(
3003 __field(dev_t, dev)
3004 __field(xfs_ino_t, src_ino)
3005 __field(loff_t, src_isize)
3006 __field(loff_t, src_disize)
3007 __field(loff_t, src_offset)
3008 __field(size_t, len)
3009 __field(xfs_ino_t, dest_ino)
3010 __field(loff_t, dest_isize)
3011 __field(loff_t, dest_disize)
3012 __field(loff_t, dest_offset)
3013 ),
3014 TP_fast_assign(
3015 __entry->dev = VFS_I(src)->i_sb->s_dev;
3016 __entry->src_ino = src->i_ino;
3017 __entry->src_isize = VFS_I(src)->i_size;
3018 __entry->src_disize = src->i_d.di_size;
3019 __entry->src_offset = soffset;
3020 __entry->len = len;
3021 __entry->dest_ino = dest->i_ino;
3022 __entry->dest_isize = VFS_I(dest)->i_size;
3023 __entry->dest_disize = dest->i_d.di_size;
3024 __entry->dest_offset = doffset;
3025 ),
3026 TP_printk("dev %d:%d count %zd "
3027 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3028 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3029 MAJOR(__entry->dev), MINOR(__entry->dev),
3030 __entry->len,
3031 __entry->src_ino,
3032 __entry->src_isize,
3033 __entry->src_disize,
3034 __entry->src_offset,
3035 __entry->dest_ino,
3036 __entry->dest_isize,
3037 __entry->dest_disize,
3038 __entry->dest_offset)
3039)
3040
3041#define DEFINE_DOUBLE_IO_EVENT(name) \
3042DEFINE_EVENT(xfs_double_io_class, name, \
3043 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3044 struct xfs_inode *dest, xfs_off_t doffset), \
3045 TP_ARGS(src, soffset, len, dest, doffset))
3046
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003047/* inode/irec events */
3048DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3049 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3050 TP_ARGS(ip, irec),
3051 TP_STRUCT__entry(
3052 __field(dev_t, dev)
3053 __field(xfs_ino_t, ino)
3054 __field(xfs_fileoff_t, lblk)
3055 __field(xfs_extlen_t, len)
3056 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003057 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003058 ),
3059 TP_fast_assign(
3060 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3061 __entry->ino = ip->i_ino;
3062 __entry->lblk = irec->br_startoff;
3063 __entry->len = irec->br_blockcount;
3064 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003065 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003066 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003067 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 -07003068 MAJOR(__entry->dev), MINOR(__entry->dev),
3069 __entry->ino,
3070 __entry->lblk,
3071 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003072 __entry->pblk,
3073 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003074);
3075#define DEFINE_INODE_IREC_EVENT(name) \
3076DEFINE_EVENT(xfs_inode_irec_class, name, \
3077 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3078 TP_ARGS(ip, irec))
3079
3080/* refcount/reflink tracepoint definitions */
3081
3082/* reflink tracepoints */
3083DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3084DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3085DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3086DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3087TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3088 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3089 xfs_filblks_t len, struct xfs_inode *dest,
3090 xfs_fileoff_t doffset),
3091 TP_ARGS(src, soffset, len, dest, doffset),
3092 TP_STRUCT__entry(
3093 __field(dev_t, dev)
3094 __field(xfs_ino_t, src_ino)
3095 __field(xfs_fileoff_t, src_lblk)
3096 __field(xfs_filblks_t, len)
3097 __field(xfs_ino_t, dest_ino)
3098 __field(xfs_fileoff_t, dest_lblk)
3099 ),
3100 TP_fast_assign(
3101 __entry->dev = VFS_I(src)->i_sb->s_dev;
3102 __entry->src_ino = src->i_ino;
3103 __entry->src_lblk = soffset;
3104 __entry->len = len;
3105 __entry->dest_ino = dest->i_ino;
3106 __entry->dest_lblk = doffset;
3107 ),
3108 TP_printk("dev %d:%d len 0x%llx "
3109 "ino 0x%llx offset 0x%llx blocks -> "
3110 "ino 0x%llx offset 0x%llx blocks",
3111 MAJOR(__entry->dev), MINOR(__entry->dev),
3112 __entry->len,
3113 __entry->src_ino,
3114 __entry->src_lblk,
3115 __entry->dest_ino,
3116 __entry->dest_lblk)
3117);
3118TRACE_EVENT(xfs_reflink_punch_range,
3119 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3120 xfs_extlen_t len),
3121 TP_ARGS(ip, lblk, len),
3122 TP_STRUCT__entry(
3123 __field(dev_t, dev)
3124 __field(xfs_ino_t, ino)
3125 __field(xfs_fileoff_t, lblk)
3126 __field(xfs_extlen_t, len)
3127 ),
3128 TP_fast_assign(
3129 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3130 __entry->ino = ip->i_ino;
3131 __entry->lblk = lblk;
3132 __entry->len = len;
3133 ),
3134 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3135 MAJOR(__entry->dev), MINOR(__entry->dev),
3136 __entry->ino,
3137 __entry->lblk,
3138 __entry->len)
3139);
3140TRACE_EVENT(xfs_reflink_remap,
3141 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3142 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3143 TP_ARGS(ip, lblk, len, new_pblk),
3144 TP_STRUCT__entry(
3145 __field(dev_t, dev)
3146 __field(xfs_ino_t, ino)
3147 __field(xfs_fileoff_t, lblk)
3148 __field(xfs_extlen_t, len)
3149 __field(xfs_fsblock_t, new_pblk)
3150 ),
3151 TP_fast_assign(
3152 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3153 __entry->ino = ip->i_ino;
3154 __entry->lblk = lblk;
3155 __entry->len = len;
3156 __entry->new_pblk = new_pblk;
3157 ),
3158 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3159 MAJOR(__entry->dev), MINOR(__entry->dev),
3160 __entry->ino,
3161 __entry->lblk,
3162 __entry->len,
3163 __entry->new_pblk)
3164);
3165DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3166DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3167DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3168DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003169DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3170DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3171
3172/* dedupe tracepoints */
3173DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3174DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3175
3176/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003177TRACE_EVENT(xfs_ioctl_clone,
3178 TP_PROTO(struct inode *src, struct inode *dest),
3179 TP_ARGS(src, dest),
3180 TP_STRUCT__entry(
3181 __field(dev_t, dev)
3182 __field(unsigned long, src_ino)
3183 __field(loff_t, src_isize)
3184 __field(unsigned long, dest_ino)
3185 __field(loff_t, dest_isize)
3186 ),
3187 TP_fast_assign(
3188 __entry->dev = src->i_sb->s_dev;
3189 __entry->src_ino = src->i_ino;
3190 __entry->src_isize = i_size_read(src);
3191 __entry->dest_ino = dest->i_ino;
3192 __entry->dest_isize = i_size_read(dest);
3193 ),
3194 TP_printk("dev %d:%d "
3195 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003196 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003197 MAJOR(__entry->dev), MINOR(__entry->dev),
3198 __entry->src_ino,
3199 __entry->src_isize,
3200 __entry->dest_ino,
3201 __entry->dest_isize)
3202);
3203
3204/* unshare tracepoints */
3205DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003206DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003207
3208/* copy on write */
3209DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003210DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3211DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3212DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003213DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003214
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003215DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003216
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003217DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003218DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3219DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003220
3221DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3222DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3223DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003224
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003225DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3226DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3227
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003228
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003229DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003230
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003231/* rmap swapext tracepoints */
3232DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3233DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3234DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3235
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003236/* fsmap traces */
3237DECLARE_EVENT_CLASS(xfs_fsmap_class,
3238 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3239 struct xfs_rmap_irec *rmap),
3240 TP_ARGS(mp, keydev, agno, rmap),
3241 TP_STRUCT__entry(
3242 __field(dev_t, dev)
3243 __field(dev_t, keydev)
3244 __field(xfs_agnumber_t, agno)
3245 __field(xfs_fsblock_t, bno)
3246 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003247 __field(uint64_t, owner)
3248 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003249 __field(unsigned int, flags)
3250 ),
3251 TP_fast_assign(
3252 __entry->dev = mp->m_super->s_dev;
3253 __entry->keydev = new_decode_dev(keydev);
3254 __entry->agno = agno;
3255 __entry->bno = rmap->rm_startblock;
3256 __entry->len = rmap->rm_blockcount;
3257 __entry->owner = rmap->rm_owner;
3258 __entry->offset = rmap->rm_offset;
3259 __entry->flags = rmap->rm_flags;
3260 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003261 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 -07003262 MAJOR(__entry->dev), MINOR(__entry->dev),
3263 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3264 __entry->agno,
3265 __entry->bno,
3266 __entry->len,
3267 __entry->owner,
3268 __entry->offset,
3269 __entry->flags)
3270)
3271#define DEFINE_FSMAP_EVENT(name) \
3272DEFINE_EVENT(xfs_fsmap_class, name, \
3273 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3274 struct xfs_rmap_irec *rmap), \
3275 TP_ARGS(mp, keydev, agno, rmap))
3276DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3277DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3278DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3279
3280DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3281 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3282 TP_ARGS(mp, fsmap),
3283 TP_STRUCT__entry(
3284 __field(dev_t, dev)
3285 __field(dev_t, keydev)
3286 __field(xfs_daddr_t, block)
3287 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003288 __field(uint64_t, owner)
3289 __field(uint64_t, offset)
3290 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003291 ),
3292 TP_fast_assign(
3293 __entry->dev = mp->m_super->s_dev;
3294 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3295 __entry->block = fsmap->fmr_physical;
3296 __entry->len = fsmap->fmr_length;
3297 __entry->owner = fsmap->fmr_owner;
3298 __entry->offset = fsmap->fmr_offset;
3299 __entry->flags = fsmap->fmr_flags;
3300 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003301 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 -07003302 MAJOR(__entry->dev), MINOR(__entry->dev),
3303 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3304 __entry->block,
3305 __entry->len,
3306 __entry->owner,
3307 __entry->offset,
3308 __entry->flags)
3309)
3310#define DEFINE_GETFSMAP_EVENT(name) \
3311DEFINE_EVENT(xfs_getfsmap_class, name, \
3312 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3313 TP_ARGS(mp, fsmap))
3314DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3315DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3316DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3317
Darrick J. Wongb872af22018-01-08 10:51:26 -08003318TRACE_EVENT(xfs_trans_resv_calc,
3319 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3320 struct xfs_trans_res *res),
3321 TP_ARGS(mp, type, res),
3322 TP_STRUCT__entry(
3323 __field(dev_t, dev)
3324 __field(int, type)
3325 __field(uint, logres)
3326 __field(int, logcount)
3327 __field(int, logflags)
3328 ),
3329 TP_fast_assign(
3330 __entry->dev = mp->m_super->s_dev;
3331 __entry->type = type;
3332 __entry->logres = res->tr_logres;
3333 __entry->logcount = res->tr_logcount;
3334 __entry->logflags = res->tr_logflags;
3335 ),
3336 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3337 MAJOR(__entry->dev), MINOR(__entry->dev),
3338 __entry->type,
3339 __entry->logres,
3340 __entry->logcount,
3341 __entry->logflags)
3342);
3343
Dave Chinnerba187812018-05-09 07:47:57 -07003344DECLARE_EVENT_CLASS(xfs_trans_class,
3345 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3346 TP_ARGS(tp, caller_ip),
3347 TP_STRUCT__entry(
3348 __field(dev_t, dev)
3349 __field(uint32_t, tid)
3350 __field(uint32_t, flags)
3351 __field(unsigned long, caller_ip)
3352 ),
3353 TP_fast_assign(
3354 __entry->dev = tp->t_mountp->m_super->s_dev;
3355 __entry->tid = 0;
3356 if (tp->t_ticket)
3357 __entry->tid = tp->t_ticket->t_tid;
3358 __entry->flags = tp->t_flags;
3359 __entry->caller_ip = caller_ip;
3360 ),
3361 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3362 MAJOR(__entry->dev), MINOR(__entry->dev),
3363 __entry->tid,
3364 __entry->flags,
3365 (char *)__entry->caller_ip)
3366)
3367
3368#define DEFINE_TRANS_EVENT(name) \
3369DEFINE_EVENT(xfs_trans_class, name, \
3370 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3371 TP_ARGS(tp, caller_ip))
3372DEFINE_TRANS_EVENT(xfs_trans_alloc);
3373DEFINE_TRANS_EVENT(xfs_trans_cancel);
3374DEFINE_TRANS_EVENT(xfs_trans_commit);
3375DEFINE_TRANS_EVENT(xfs_trans_dup);
3376DEFINE_TRANS_EVENT(xfs_trans_free);
3377DEFINE_TRANS_EVENT(xfs_trans_roll);
3378DEFINE_TRANS_EVENT(xfs_trans_add_item);
3379DEFINE_TRANS_EVENT(xfs_trans_free_items);
3380
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003381#endif /* _TRACE_XFS_H */
3382
3383#undef TRACE_INCLUDE_PATH
3384#define TRACE_INCLUDE_PATH .
3385#define TRACE_INCLUDE_FILE xfs_trace
3386#include <trace/define_trace.h>