blob: efc7751550d9f54c842a66e2295b26510346d7ce [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;
Dave Chinner0ad95682019-08-26 12:08:10 -070026struct xlog_rec_header;
Dave Chinner9abbc532010-04-13 15:06:46 +100027struct xfs_buf_log_format;
28struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050029struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100030struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070031struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070032struct xfs_fsmap;
33struct xfs_rmap_irec;
Dave Chinner0ad95682019-08-26 12:08:10 -070034struct xfs_icreate_log;
35struct xfs_owner_info;
36struct xfs_trans_res;
37struct xfs_inobt_rec_incore;
Darrick J. Wong60e3d702020-03-11 10:51:50 -070038union xfs_btree_ptr;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000039
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080040#define XFS_ATTR_FILTER_FLAGS \
41 { XFS_ATTR_ROOT, "ROOT" }, \
Christoph Hellwig254f8002020-02-26 17:30:43 -080042 { XFS_ATTR_SECURE, "SECURE" }, \
43 { XFS_ATTR_INCOMPLETE, "INCOMPLETE" }
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080044
Christoph Hellwigea9a4882009-12-21 14:03:03 +000045DECLARE_EVENT_CLASS(xfs_attr_list_class,
46 TP_PROTO(struct xfs_attr_list_context *ctx),
47 TP_ARGS(ctx),
48 TP_STRUCT__entry(
49 __field(dev_t, dev)
50 __field(xfs_ino_t, ino)
51 __field(u32, hashval)
52 __field(u32, blkno)
53 __field(u32, offset)
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080054 __field(void *, buffer)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000055 __field(int, bufsize)
56 __field(int, count)
57 __field(int, firstu)
58 __field(int, dupcnt)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080059 __field(unsigned int, attr_filter)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000060 ),
61 TP_fast_assign(
62 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
63 __entry->ino = ctx->dp->i_ino;
Christoph Hellwige3a19cd2020-02-26 17:30:43 -080064 __entry->hashval = ctx->cursor.hashval;
65 __entry->blkno = ctx->cursor.blkno;
66 __entry->offset = ctx->cursor.offset;
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080067 __entry->buffer = ctx->buffer;
Christoph Hellwigea9a4882009-12-21 14:03:03 +000068 __entry->bufsize = ctx->bufsize;
69 __entry->count = ctx->count;
70 __entry->firstu = ctx->firstu;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080071 __entry->attr_filter = ctx->attr_filter;
Christoph Hellwigea9a4882009-12-21 14:03:03 +000072 ),
73 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080074 "buffer %p size %u count %u firstu %u filter %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +000075 MAJOR(__entry->dev), MINOR(__entry->dev),
76 __entry->ino,
77 __entry->hashval,
78 __entry->blkno,
79 __entry->offset,
80 __entry->dupcnt,
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080081 __entry->buffer,
Christoph Hellwigea9a4882009-12-21 14:03:03 +000082 __entry->bufsize,
83 __entry->count,
84 __entry->firstu,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080085 __print_flags(__entry->attr_filter, "|",
86 XFS_ATTR_FILTER_FLAGS)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000087 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000088)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000089
90#define DEFINE_ATTR_LIST_EVENT(name) \
91DEFINE_EVENT(xfs_attr_list_class, name, \
92 TP_PROTO(struct xfs_attr_list_context *ctx), \
93 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000094DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
101DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +1100102DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
103DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000104
Li Zefanf8adb4d2010-05-24 08:25:57 +0000105DECLARE_EVENT_CLASS(xfs_perag_class,
106 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
107 unsigned long caller_ip),
108 TP_ARGS(mp, agno, refcount, caller_ip),
109 TP_STRUCT__entry(
110 __field(dev_t, dev)
111 __field(xfs_agnumber_t, agno)
112 __field(int, refcount)
113 __field(unsigned long, caller_ip)
114 ),
115 TP_fast_assign(
116 __entry->dev = mp->m_super->s_dev;
117 __entry->agno = agno;
118 __entry->refcount = refcount;
119 __entry->caller_ip = caller_ip;
120 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800121 TP_printk("dev %d:%d agno %u refcount %d caller %pS",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000122 MAJOR(__entry->dev), MINOR(__entry->dev),
123 __entry->agno,
124 __entry->refcount,
125 (char *)__entry->caller_ip)
126);
127
128#define DEFINE_PERAG_REF_EVENT(name) \
129DEFINE_EVENT(xfs_perag_class, name, \
130 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
131 unsigned long caller_ip), \
132 TP_ARGS(mp, agno, refcount, caller_ip))
133DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000134DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000135DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000136DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
137DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500138DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
139DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700140DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
141DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000142
Dave Chinnerd1230312013-11-01 15:27:19 +1100143DECLARE_EVENT_CLASS(xfs_ag_class,
144 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
145 TP_ARGS(mp, agno),
146 TP_STRUCT__entry(
147 __field(dev_t, dev)
148 __field(xfs_agnumber_t, agno)
149 ),
150 TP_fast_assign(
151 __entry->dev = mp->m_super->s_dev;
152 __entry->agno = agno;
153 ),
154 TP_printk("dev %d:%d agno %u",
155 MAJOR(__entry->dev), MINOR(__entry->dev),
156 __entry->agno)
157);
158#define DEFINE_AG_EVENT(name) \
159DEFINE_EVENT(xfs_ag_class, name, \
160 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
161 TP_ARGS(mp, agno))
162
163DEFINE_AG_EVENT(xfs_read_agf);
164DEFINE_AG_EVENT(xfs_alloc_read_agf);
165DEFINE_AG_EVENT(xfs_read_agi);
166DEFINE_AG_EVENT(xfs_ialloc_read_agi);
167
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000168TRACE_EVENT(xfs_attr_list_node_descend,
169 TP_PROTO(struct xfs_attr_list_context *ctx,
170 struct xfs_da_node_entry *btree),
171 TP_ARGS(ctx, btree),
172 TP_STRUCT__entry(
173 __field(dev_t, dev)
174 __field(xfs_ino_t, ino)
175 __field(u32, hashval)
176 __field(u32, blkno)
177 __field(u32, offset)
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800178 __field(void *, buffer)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000179 __field(int, bufsize)
180 __field(int, count)
181 __field(int, firstu)
182 __field(int, dupcnt)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800183 __field(unsigned int, attr_filter)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000184 __field(u32, bt_hashval)
185 __field(u32, bt_before)
186 ),
187 TP_fast_assign(
188 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
189 __entry->ino = ctx->dp->i_ino;
Christoph Hellwige3a19cd2020-02-26 17:30:43 -0800190 __entry->hashval = ctx->cursor.hashval;
191 __entry->blkno = ctx->cursor.blkno;
192 __entry->offset = ctx->cursor.offset;
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800193 __entry->buffer = ctx->buffer;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000194 __entry->bufsize = ctx->bufsize;
195 __entry->count = ctx->count;
196 __entry->firstu = ctx->firstu;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800197 __entry->attr_filter = ctx->attr_filter;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000198 __entry->bt_hashval = be32_to_cpu(btree->hashval);
199 __entry->bt_before = be32_to_cpu(btree->before);
200 ),
201 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800202 "buffer %p size %u count %u firstu %u filter %s "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000203 "node hashval %u, node before %u",
204 MAJOR(__entry->dev), MINOR(__entry->dev),
205 __entry->ino,
206 __entry->hashval,
207 __entry->blkno,
208 __entry->offset,
209 __entry->dupcnt,
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800210 __entry->buffer,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000211 __entry->bufsize,
212 __entry->count,
213 __entry->firstu,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800214 __print_flags(__entry->attr_filter, "|",
215 XFS_ATTR_FILTER_FLAGS),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000216 __entry->bt_hashval,
217 __entry->bt_before)
218);
219
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000220DECLARE_EVENT_CLASS(xfs_bmap_class,
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700221 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000222 unsigned long caller_ip),
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700223 TP_ARGS(ip, cur, state, caller_ip),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000224 TP_STRUCT__entry(
225 __field(dev_t, dev)
226 __field(xfs_ino_t, ino)
Peter Zijlstra04ae87a2019-10-24 22:26:59 +0200227 __field(void *, leaf)
228 __field(int, pos)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000229 __field(xfs_fileoff_t, startoff)
230 __field(xfs_fsblock_t, startblock)
231 __field(xfs_filblks_t, blockcount)
232 __field(xfs_exntst_t, state)
233 __field(int, bmap_state)
234 __field(unsigned long, caller_ip)
235 ),
236 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700237 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000238 struct xfs_bmbt_irec r;
239
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700240 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700241 xfs_iext_get_extent(ifp, cur, &r);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000242 __entry->dev = VFS_I(ip)->i_sb->s_dev;
243 __entry->ino = ip->i_ino;
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700244 __entry->leaf = cur->leaf;
245 __entry->pos = cur->pos;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000246 __entry->startoff = r.br_startoff;
247 __entry->startblock = r.br_startblock;
248 __entry->blockcount = r.br_blockcount;
249 __entry->state = r.br_state;
250 __entry->bmap_state = state;
251 __entry->caller_ip = caller_ip;
252 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800253 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800254 "offset %lld block %lld count %lld flag %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000255 MAJOR(__entry->dev), MINOR(__entry->dev),
256 __entry->ino,
257 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700258 __entry->leaf,
259 __entry->pos,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000260 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700261 (int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000262 __entry->blockcount,
263 __entry->state,
264 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000265)
266
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000267#define DEFINE_BMAP_EVENT(name) \
268DEFINE_EVENT(xfs_bmap_class, name, \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700269 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000270 unsigned long caller_ip), \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700271 TP_ARGS(ip, cur, state, caller_ip))
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700272DEFINE_BMAP_EVENT(xfs_iext_insert);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000273DEFINE_BMAP_EVENT(xfs_iext_remove);
274DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
275DEFINE_BMAP_EVENT(xfs_bmap_post_update);
Christoph Hellwige8e0e172017-10-19 11:06:29 -0700276DEFINE_BMAP_EVENT(xfs_read_extent);
277DEFINE_BMAP_EVENT(xfs_write_extent);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000278
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000279DECLARE_EVENT_CLASS(xfs_buf_class,
280 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
281 TP_ARGS(bp, caller_ip),
282 TP_STRUCT__entry(
283 __field(dev_t, dev)
284 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000285 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000286 __field(int, hold)
287 __field(int, pincount)
288 __field(unsigned, lockval)
289 __field(unsigned, flags)
290 __field(unsigned long, caller_ip)
291 ),
292 TP_fast_assign(
293 __entry->dev = bp->b_target->bt_dev;
Dave Chinnerd61fa8c2018-11-19 13:31:07 -0800294 if (bp->b_bn == XFS_BUF_DADDR_NULL)
295 __entry->bno = bp->b_maps[0].bm_bn;
296 else
297 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000298 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000299 __entry->hold = atomic_read(&bp->b_hold);
300 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200301 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000302 __entry->flags = bp->b_flags;
303 __entry->caller_ip = caller_ip;
304 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000305 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800306 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000307 MAJOR(__entry->dev), MINOR(__entry->dev),
308 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000309 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000310 __entry->hold,
311 __entry->pincount,
312 __entry->lockval,
313 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
314 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000315)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000316
317#define DEFINE_BUF_EVENT(name) \
318DEFINE_EVENT(xfs_buf_class, name, \
319 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
320 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000321DEFINE_BUF_EVENT(xfs_buf_init);
322DEFINE_BUF_EVENT(xfs_buf_free);
323DEFINE_BUF_EVENT(xfs_buf_hold);
324DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000325DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000326DEFINE_BUF_EVENT(xfs_buf_submit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000327DEFINE_BUF_EVENT(xfs_buf_lock);
328DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000329DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200330DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000331DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000332DEFINE_BUF_EVENT(xfs_buf_iowait);
333DEFINE_BUF_EVENT(xfs_buf_iowait_done);
334DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000335DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000336DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700337DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000338DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000339DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000340DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
341DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100342DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000343DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
344
345/* not really buffer traces, but the buf provides useful information */
346DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000347DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000348
349/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000350DECLARE_EVENT_CLASS(xfs_buf_flags_class,
351 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
352 TP_ARGS(bp, flags, caller_ip),
353 TP_STRUCT__entry(
354 __field(dev_t, dev)
355 __field(xfs_daddr_t, bno)
356 __field(size_t, buffer_length)
357 __field(int, hold)
358 __field(int, pincount)
359 __field(unsigned, lockval)
360 __field(unsigned, flags)
361 __field(unsigned long, caller_ip)
362 ),
363 TP_fast_assign(
364 __entry->dev = bp->b_target->bt_dev;
365 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000366 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000367 __entry->flags = flags;
368 __entry->hold = atomic_read(&bp->b_hold);
369 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200370 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000371 __entry->caller_ip = caller_ip;
372 ),
373 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800374 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000375 MAJOR(__entry->dev), MINOR(__entry->dev),
376 (unsigned long long)__entry->bno,
377 __entry->buffer_length,
378 __entry->hold,
379 __entry->pincount,
380 __entry->lockval,
381 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
382 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000383)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000384
385#define DEFINE_BUF_FLAGS_EVENT(name) \
386DEFINE_EVENT(xfs_buf_flags_class, name, \
387 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
388 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000389DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
390DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
391DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
392
393TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800394 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000395 TP_ARGS(bp, error, caller_ip),
396 TP_STRUCT__entry(
397 __field(dev_t, dev)
398 __field(xfs_daddr_t, bno)
399 __field(size_t, buffer_length)
400 __field(unsigned, flags)
401 __field(int, hold)
402 __field(int, pincount)
403 __field(unsigned, lockval)
404 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800405 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000406 ),
407 TP_fast_assign(
408 __entry->dev = bp->b_target->bt_dev;
409 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000410 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000411 __entry->hold = atomic_read(&bp->b_hold);
412 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200413 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000414 __entry->error = error;
415 __entry->flags = bp->b_flags;
416 __entry->caller_ip = caller_ip;
417 ),
418 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800419 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000420 MAJOR(__entry->dev), MINOR(__entry->dev),
421 (unsigned long long)__entry->bno,
422 __entry->buffer_length,
423 __entry->hold,
424 __entry->pincount,
425 __entry->lockval,
426 __entry->error,
427 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
428 (void *)__entry->caller_ip)
429);
430
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000431DECLARE_EVENT_CLASS(xfs_buf_item_class,
432 TP_PROTO(struct xfs_buf_log_item *bip),
433 TP_ARGS(bip),
434 TP_STRUCT__entry(
435 __field(dev_t, dev)
436 __field(xfs_daddr_t, buf_bno)
437 __field(size_t, buf_len)
438 __field(int, buf_hold)
439 __field(int, buf_pincount)
440 __field(int, buf_lockval)
441 __field(unsigned, buf_flags)
442 __field(unsigned, bli_recur)
443 __field(int, bli_refcount)
444 __field(unsigned, bli_flags)
Dave Chinner22525c12018-05-09 07:47:34 -0700445 __field(unsigned long, li_flags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000446 ),
447 TP_fast_assign(
448 __entry->dev = bip->bli_buf->b_target->bt_dev;
449 __entry->bli_flags = bip->bli_flags;
450 __entry->bli_recur = bip->bli_recur;
451 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
452 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000453 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000454 __entry->buf_flags = bip->bli_buf->b_flags;
455 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
456 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200457 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000458 __entry->li_flags = bip->bli_item.li_flags;
459 ),
460 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
461 "lock %d flags %s recur %d refcount %d bliflags %s "
Dave Chinnere6631f82018-05-09 07:49:37 -0700462 "liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000463 MAJOR(__entry->dev), MINOR(__entry->dev),
464 (unsigned long long)__entry->buf_bno,
465 __entry->buf_len,
466 __entry->buf_hold,
467 __entry->buf_pincount,
468 __entry->buf_lockval,
469 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
470 __entry->bli_recur,
471 __entry->bli_refcount,
472 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000473 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000474)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000475
476#define DEFINE_BUF_ITEM_EVENT(name) \
477DEFINE_EVENT(xfs_buf_item_class, name, \
478 TP_PROTO(struct xfs_buf_log_item *bip), \
479 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000480DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000481DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000482DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
483DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
484DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000485DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000486DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
487DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
488DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwigddf92052019-06-28 19:27:32 -0700489DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000490DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
491DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
492DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
493DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
494DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
495DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
496DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
497DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
498DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
499DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
500DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
501DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
502DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
503DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
504
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000505DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700506 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
507 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000508 TP_STRUCT__entry(
509 __field(dev_t, dev)
510 __field(xfs_ino_t, ino)
511 __field(xfs_agnumber_t, agno)
512 __field(int, streams)
513 ),
514 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700515 __entry->dev = mp->m_super->s_dev;
516 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000517 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700518 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000519 ),
520 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
521 MAJOR(__entry->dev), MINOR(__entry->dev),
522 __entry->ino,
523 __entry->agno,
524 __entry->streams)
525)
526#define DEFINE_FILESTREAM_EVENT(name) \
527DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700528 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
529 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000530DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
531DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
532DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
533
534TRACE_EVENT(xfs_filestream_pick,
535 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
536 xfs_extlen_t free, int nscan),
537 TP_ARGS(ip, agno, free, nscan),
538 TP_STRUCT__entry(
539 __field(dev_t, dev)
540 __field(xfs_ino_t, ino)
541 __field(xfs_agnumber_t, agno)
542 __field(int, streams)
543 __field(xfs_extlen_t, free)
544 __field(int, nscan)
545 ),
546 TP_fast_assign(
547 __entry->dev = VFS_I(ip)->i_sb->s_dev;
548 __entry->ino = ip->i_ino;
549 __entry->agno = agno;
550 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
551 __entry->free = free;
552 __entry->nscan = nscan;
553 ),
554 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
555 MAJOR(__entry->dev), MINOR(__entry->dev),
556 __entry->ino,
557 __entry->agno,
558 __entry->streams,
559 __entry->free,
560 __entry->nscan)
561);
562
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000563DECLARE_EVENT_CLASS(xfs_lock_class,
564 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
565 unsigned long caller_ip),
566 TP_ARGS(ip, lock_flags, caller_ip),
567 TP_STRUCT__entry(
568 __field(dev_t, dev)
569 __field(xfs_ino_t, ino)
570 __field(int, lock_flags)
571 __field(unsigned long, caller_ip)
572 ),
573 TP_fast_assign(
574 __entry->dev = VFS_I(ip)->i_sb->s_dev;
575 __entry->ino = ip->i_ino;
576 __entry->lock_flags = lock_flags;
577 __entry->caller_ip = caller_ip;
578 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800579 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000580 MAJOR(__entry->dev), MINOR(__entry->dev),
581 __entry->ino,
582 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
583 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000584)
585
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000586#define DEFINE_LOCK_EVENT(name) \
587DEFINE_EVENT(xfs_lock_class, name, \
588 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
589 unsigned long caller_ip), \
590 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000591DEFINE_LOCK_EVENT(xfs_ilock);
592DEFINE_LOCK_EVENT(xfs_ilock_nowait);
593DEFINE_LOCK_EVENT(xfs_ilock_demote);
594DEFINE_LOCK_EVENT(xfs_iunlock);
595
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000596DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000597 TP_PROTO(struct xfs_inode *ip),
598 TP_ARGS(ip),
599 TP_STRUCT__entry(
600 __field(dev_t, dev)
601 __field(xfs_ino_t, ino)
602 ),
603 TP_fast_assign(
604 __entry->dev = VFS_I(ip)->i_sb->s_dev;
605 __entry->ino = ip->i_ino;
606 ),
607 TP_printk("dev %d:%d ino 0x%llx",
608 MAJOR(__entry->dev), MINOR(__entry->dev),
609 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000610)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000611
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000612#define DEFINE_INODE_EVENT(name) \
613DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000614 TP_PROTO(struct xfs_inode *ip), \
615 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000616DEFINE_INODE_EVENT(xfs_iget_skip);
617DEFINE_INODE_EVENT(xfs_iget_reclaim);
618DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
619DEFINE_INODE_EVENT(xfs_iget_hit);
620DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000621
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000622DEFINE_INODE_EVENT(xfs_getattr);
623DEFINE_INODE_EVENT(xfs_setattr);
624DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500625DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000626DEFINE_INODE_EVENT(xfs_alloc_file_space);
627DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000628DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100629DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100630DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000631DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000632#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200633DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000634#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000635DEFINE_INODE_EVENT(xfs_vm_bmap);
636DEFINE_INODE_EVENT(xfs_file_ioctl);
637DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
638DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000639DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000640DEFINE_INODE_EVENT(xfs_file_fsync);
641DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400642DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000643
644DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
645DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
646
Brian Foster27b52862012-11-06 09:50:38 -0500647DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
648DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500649DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700650DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
651DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
652DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500653
Darrick J. Wong85f8dff2018-12-18 14:32:29 -0800654/*
655 * ftrace's __print_symbolic requires that all enum values be wrapped in the
656 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
657 * ring buffer. Somehow this was only worth mentioning in the ftrace sample
658 * code.
659 */
660TRACE_DEFINE_ENUM(PE_SIZE_PTE);
661TRACE_DEFINE_ENUM(PE_SIZE_PMD);
662TRACE_DEFINE_ENUM(PE_SIZE_PUD);
663
Christoph Hellwigd522d562017-08-29 10:08:41 -0700664TRACE_EVENT(xfs_filemap_fault,
665 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
666 bool write_fault),
667 TP_ARGS(ip, pe_size, write_fault),
668 TP_STRUCT__entry(
669 __field(dev_t, dev)
670 __field(xfs_ino_t, ino)
671 __field(enum page_entry_size, pe_size)
672 __field(bool, write_fault)
673 ),
674 TP_fast_assign(
675 __entry->dev = VFS_I(ip)->i_sb->s_dev;
676 __entry->ino = ip->i_ino;
677 __entry->pe_size = pe_size;
678 __entry->write_fault = write_fault;
679 ),
680 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
681 MAJOR(__entry->dev), MINOR(__entry->dev),
682 __entry->ino,
683 __print_symbolic(__entry->pe_size,
684 { PE_SIZE_PTE, "PTE" },
685 { PE_SIZE_PMD, "PMD" },
686 { PE_SIZE_PUD, "PUD" }),
687 __entry->write_fault)
688)
689
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000690DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000691 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
692 TP_ARGS(ip, caller_ip),
693 TP_STRUCT__entry(
694 __field(dev_t, dev)
695 __field(xfs_ino_t, ino)
696 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100697 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000698 __field(unsigned long, caller_ip)
699 ),
700 TP_fast_assign(
701 __entry->dev = VFS_I(ip)->i_sb->s_dev;
702 __entry->ino = ip->i_ino;
703 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100704 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000705 __entry->caller_ip = caller_ip;
706 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800707 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000708 MAJOR(__entry->dev), MINOR(__entry->dev),
709 __entry->ino,
710 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100711 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000712 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000713)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000714
Brian Foster19cb7e32013-03-18 10:51:48 -0400715TRACE_EVENT(xfs_iomap_prealloc_size,
716 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
717 unsigned int writeio_blocks),
718 TP_ARGS(ip, blocks, shift, writeio_blocks),
719 TP_STRUCT__entry(
720 __field(dev_t, dev)
721 __field(xfs_ino_t, ino)
722 __field(xfs_fsblock_t, blocks)
723 __field(int, shift)
724 __field(unsigned int, writeio_blocks)
725 ),
726 TP_fast_assign(
727 __entry->dev = VFS_I(ip)->i_sb->s_dev;
728 __entry->ino = ip->i_ino;
729 __entry->blocks = blocks;
730 __entry->shift = shift;
731 __entry->writeio_blocks = writeio_blocks;
732 ),
733 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
Christoph Hellwig5da8a072019-10-28 08:41:44 -0700734 "m_allocsize_blocks %u",
Brian Foster19cb7e32013-03-18 10:51:48 -0400735 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
736 __entry->blocks, __entry->shift, __entry->writeio_blocks)
737)
738
Brian Foster56d11152015-05-29 09:18:32 +1000739TRACE_EVENT(xfs_irec_merge_pre,
740 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
741 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
742 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
743 TP_STRUCT__entry(
744 __field(dev_t, dev)
745 __field(xfs_agnumber_t, agno)
746 __field(xfs_agino_t, agino)
747 __field(uint16_t, holemask)
748 __field(xfs_agino_t, nagino)
749 __field(uint16_t, nholemask)
750 ),
751 TP_fast_assign(
752 __entry->dev = mp->m_super->s_dev;
753 __entry->agno = agno;
754 __entry->agino = agino;
755 __entry->holemask = holemask;
756 __entry->nagino = nagino;
757 __entry->nholemask = holemask;
758 ),
759 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
760 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
761 __entry->agino, __entry->holemask, __entry->nagino,
762 __entry->nholemask)
763)
764
765TRACE_EVENT(xfs_irec_merge_post,
766 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
767 uint16_t holemask),
768 TP_ARGS(mp, agno, agino, holemask),
769 TP_STRUCT__entry(
770 __field(dev_t, dev)
771 __field(xfs_agnumber_t, agno)
772 __field(xfs_agino_t, agino)
773 __field(uint16_t, holemask)
774 ),
775 TP_fast_assign(
776 __entry->dev = mp->m_super->s_dev;
777 __entry->agno = agno;
778 __entry->agino = agino;
779 __entry->holemask = holemask;
780 ),
781 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
782 MINOR(__entry->dev), __entry->agno, __entry->agino,
783 __entry->holemask)
784)
785
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000786#define DEFINE_IREF_EVENT(name) \
787DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000788 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
789 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000790DEFINE_IREF_EVENT(xfs_irele);
791DEFINE_IREF_EVENT(xfs_inode_pin);
792DEFINE_IREF_EVENT(xfs_inode_unpin);
793DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100794
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000795DECLARE_EVENT_CLASS(xfs_namespace_class,
796 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
797 TP_ARGS(dp, name),
798 TP_STRUCT__entry(
799 __field(dev_t, dev)
800 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000801 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000802 __dynamic_array(char, name, name->len)
803 ),
804 TP_fast_assign(
805 __entry->dev = VFS_I(dp)->i_sb->s_dev;
806 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000807 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000808 memcpy(__get_str(name), name->name, name->len);
809 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000810 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000811 MAJOR(__entry->dev), MINOR(__entry->dev),
812 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000813 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000814 __get_str(name))
815)
816
817#define DEFINE_NAMESPACE_EVENT(name) \
818DEFINE_EVENT(xfs_namespace_class, name, \
819 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
820 TP_ARGS(dp, name))
821DEFINE_NAMESPACE_EVENT(xfs_remove);
822DEFINE_NAMESPACE_EVENT(xfs_link);
823DEFINE_NAMESPACE_EVENT(xfs_lookup);
824DEFINE_NAMESPACE_EVENT(xfs_create);
825DEFINE_NAMESPACE_EVENT(xfs_symlink);
826
827TRACE_EVENT(xfs_rename,
828 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
829 struct xfs_name *src_name, struct xfs_name *target_name),
830 TP_ARGS(src_dp, target_dp, src_name, target_name),
831 TP_STRUCT__entry(
832 __field(dev_t, dev)
833 __field(xfs_ino_t, src_dp_ino)
834 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000835 __field(int, src_namelen)
836 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000837 __dynamic_array(char, src_name, src_name->len)
838 __dynamic_array(char, target_name, target_name->len)
839 ),
840 TP_fast_assign(
841 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
842 __entry->src_dp_ino = src_dp->i_ino;
843 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000844 __entry->src_namelen = src_name->len;
845 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000846 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000847 memcpy(__get_str(target_name), target_name->name,
848 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000849 ),
850 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000851 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000852 MAJOR(__entry->dev), MINOR(__entry->dev),
853 __entry->src_dp_ino,
854 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000855 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000856 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000857 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000858 __get_str(target_name))
859)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000860
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000861DECLARE_EVENT_CLASS(xfs_dquot_class,
862 TP_PROTO(struct xfs_dquot *dqp),
863 TP_ARGS(dqp),
864 TP_STRUCT__entry(
865 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000866 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000867 __field(unsigned, flags)
868 __field(unsigned, nrefs)
869 __field(unsigned long long, res_bcount)
870 __field(unsigned long long, bcount)
871 __field(unsigned long long, icount)
872 __field(unsigned long long, blk_hardlimit)
873 __field(unsigned long long, blk_softlimit)
874 __field(unsigned long long, ino_hardlimit)
875 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000876 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000877 TP_fast_assign(
878 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000879 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000880 __entry->flags = dqp->dq_flags;
881 __entry->nrefs = dqp->q_nrefs;
882 __entry->res_bcount = dqp->q_res_bcount;
883 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
884 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
885 __entry->blk_hardlimit =
886 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
887 __entry->blk_softlimit =
888 be64_to_cpu(dqp->q_core.d_blk_softlimit);
889 __entry->ino_hardlimit =
890 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
891 __entry->ino_softlimit =
892 be64_to_cpu(dqp->q_core.d_ino_softlimit);
893 ),
894 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000895 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
896 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000897 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000898 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000899 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
900 __entry->nrefs,
901 __entry->res_bcount,
902 __entry->bcount,
903 __entry->blk_hardlimit,
904 __entry->blk_softlimit,
905 __entry->icount,
906 __entry->ino_hardlimit,
907 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000908)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000909
910#define DEFINE_DQUOT_EVENT(name) \
911DEFINE_EVENT(xfs_dquot_class, name, \
912 TP_PROTO(struct xfs_dquot *dqp), \
913 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000914DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000915DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
916DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000917DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
918DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000919DEFINE_DQUOT_EVENT(xfs_dqattach_found);
920DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000921DEFINE_DQUOT_EVENT(xfs_dqalloc);
922DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
923DEFINE_DQUOT_EVENT(xfs_dqread);
924DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000925DEFINE_DQUOT_EVENT(xfs_dqget_hit);
926DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000927DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
928DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000929DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000930DEFINE_DQUOT_EVENT(xfs_dqput_free);
931DEFINE_DQUOT_EVENT(xfs_dqrele);
932DEFINE_DQUOT_EVENT(xfs_dqflush);
933DEFINE_DQUOT_EVENT(xfs_dqflush_force);
934DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000935
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000936DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500937 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000938 TP_ARGS(log, tic),
939 TP_STRUCT__entry(
940 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000941 __field(char, ocnt)
942 __field(char, cnt)
943 __field(int, curr_res)
944 __field(int, unit_res)
945 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100946 __field(int, reserveq)
947 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000948 __field(int, grant_reserve_cycle)
949 __field(int, grant_reserve_bytes)
950 __field(int, grant_write_cycle)
951 __field(int, grant_write_bytes)
952 __field(int, curr_cycle)
953 __field(int, curr_block)
954 __field(xfs_lsn_t, tail_lsn)
955 ),
956 TP_fast_assign(
957 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000958 __entry->ocnt = tic->t_ocnt;
959 __entry->cnt = tic->t_cnt;
960 __entry->curr_res = tic->t_curr_res;
961 __entry->unit_res = tic->t_unit_res;
962 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000963 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
964 __entry->writeq = list_empty(&log->l_write_head.waiters);
965 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100966 &__entry->grant_reserve_cycle,
967 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000968 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100969 &__entry->grant_write_cycle,
970 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000971 __entry->curr_cycle = log->l_curr_cycle;
972 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100973 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000974 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000975 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100976 "t_unit_res %u t_flags %s reserveq %s "
977 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000978 "grant_reserve_bytes %d grant_write_cycle %d "
979 "grant_write_bytes %d curr_cycle %d curr_block %d "
980 "tail_cycle %d tail_block %d",
981 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000982 __entry->ocnt,
983 __entry->cnt,
984 __entry->curr_res,
985 __entry->unit_res,
986 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100987 __entry->reserveq ? "empty" : "active",
988 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000989 __entry->grant_reserve_cycle,
990 __entry->grant_reserve_bytes,
991 __entry->grant_write_cycle,
992 __entry->grant_write_bytes,
993 __entry->curr_cycle,
994 __entry->curr_block,
995 CYCLE_LSN(__entry->tail_lsn),
996 BLOCK_LSN(__entry->tail_lsn)
997 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000998)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000999
1000#define DEFINE_LOGGRANT_EVENT(name) \
1001DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001002 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001003 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001004DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1005DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001006DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001007DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1008DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001009DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001010DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1011DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1012DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1013DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001014DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1015DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1016DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1017DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1018DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1019DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1020
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001021DECLARE_EVENT_CLASS(xfs_log_item_class,
1022 TP_PROTO(struct xfs_log_item *lip),
1023 TP_ARGS(lip),
1024 TP_STRUCT__entry(
1025 __field(dev_t, dev)
1026 __field(void *, lip)
1027 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001028 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001029 __field(xfs_lsn_t, lsn)
1030 ),
1031 TP_fast_assign(
1032 __entry->dev = lip->li_mountp->m_super->s_dev;
1033 __entry->lip = lip;
1034 __entry->type = lip->li_type;
1035 __entry->flags = lip->li_flags;
1036 __entry->lsn = lip->li_lsn;
1037 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001038 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001039 MAJOR(__entry->dev), MINOR(__entry->dev),
1040 __entry->lip,
1041 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1042 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1043 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1044)
1045
Dave Chinner14c26c62012-04-24 16:33:31 +10001046TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001047 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1048 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001049 TP_STRUCT__entry(
1050 __field(dev_t, dev)
1051 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001052 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001053 ),
1054 TP_fast_assign(
1055 __entry->dev = mp->m_super->s_dev;
1056 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001057 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001058 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001059 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001060 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001061 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001062)
1063
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001064#define DEFINE_LOG_ITEM_EVENT(name) \
1065DEFINE_EVENT(xfs_log_item_class, name, \
1066 TP_PROTO(struct xfs_log_item *lip), \
1067 TP_ARGS(lip))
1068DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001069DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1070DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001071DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001072
Dave Chinner750b9c92013-11-01 15:27:18 +11001073DECLARE_EVENT_CLASS(xfs_ail_class,
1074 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1075 TP_ARGS(lip, old_lsn, new_lsn),
1076 TP_STRUCT__entry(
1077 __field(dev_t, dev)
1078 __field(void *, lip)
1079 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001080 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001081 __field(xfs_lsn_t, old_lsn)
1082 __field(xfs_lsn_t, new_lsn)
1083 ),
1084 TP_fast_assign(
1085 __entry->dev = lip->li_mountp->m_super->s_dev;
1086 __entry->lip = lip;
1087 __entry->type = lip->li_type;
1088 __entry->flags = lip->li_flags;
1089 __entry->old_lsn = old_lsn;
1090 __entry->new_lsn = new_lsn;
1091 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001092 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 +11001093 MAJOR(__entry->dev), MINOR(__entry->dev),
1094 __entry->lip,
1095 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1096 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1097 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1098 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1099)
1100
1101#define DEFINE_AIL_EVENT(name) \
1102DEFINE_EVENT(xfs_ail_class, name, \
1103 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1104 TP_ARGS(lip, old_lsn, new_lsn))
1105DEFINE_AIL_EVENT(xfs_ail_insert);
1106DEFINE_AIL_EVENT(xfs_ail_move);
1107DEFINE_AIL_EVENT(xfs_ail_delete);
1108
1109TRACE_EVENT(xfs_log_assign_tail_lsn,
1110 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1111 TP_ARGS(log, new_lsn),
1112 TP_STRUCT__entry(
1113 __field(dev_t, dev)
1114 __field(xfs_lsn_t, new_lsn)
1115 __field(xfs_lsn_t, old_lsn)
1116 __field(xfs_lsn_t, last_sync_lsn)
1117 ),
1118 TP_fast_assign(
1119 __entry->dev = log->l_mp->m_super->s_dev;
1120 __entry->new_lsn = new_lsn;
1121 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1122 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1123 ),
1124 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1125 MAJOR(__entry->dev), MINOR(__entry->dev),
1126 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1127 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1128 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1129)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001130
Li Zefanf8adb4d2010-05-24 08:25:57 +00001131DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001132 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1133 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001134 TP_STRUCT__entry(
1135 __field(dev_t, dev)
1136 __field(xfs_ino_t, ino)
1137 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001138 __field(loff_t, offset)
1139 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001140 ),
1141 TP_fast_assign(
1142 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1143 __entry->ino = ip->i_ino;
1144 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001145 __entry->offset = offset;
1146 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001147 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001148 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001149 MAJOR(__entry->dev), MINOR(__entry->dev),
1150 __entry->ino,
1151 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001152 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001153 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001154)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001155
1156#define DEFINE_RW_EVENT(name) \
1157DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001158 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1159 TP_ARGS(ip, count, offset))
1160DEFINE_RW_EVENT(xfs_file_buffered_read);
1161DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001162DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001163DEFINE_RW_EVENT(xfs_file_buffered_write);
1164DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001165DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001166
Christoph Hellwiga206c812010-12-10 08:42:20 +00001167DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001168 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001169 int whichfork, struct xfs_bmbt_irec *irec),
1170 TP_ARGS(ip, offset, count, whichfork, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001171 TP_STRUCT__entry(
1172 __field(dev_t, dev)
1173 __field(xfs_ino_t, ino)
1174 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001175 __field(loff_t, offset)
1176 __field(size_t, count)
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001177 __field(int, whichfork)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001178 __field(xfs_fileoff_t, startoff)
1179 __field(xfs_fsblock_t, startblock)
1180 __field(xfs_filblks_t, blockcount)
1181 ),
1182 TP_fast_assign(
1183 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1184 __entry->ino = ip->i_ino;
1185 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001186 __entry->offset = offset;
1187 __entry->count = count;
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001188 __entry->whichfork = whichfork;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001189 __entry->startoff = irec ? irec->br_startoff : 0;
1190 __entry->startblock = irec ? irec->br_startblock : 0;
1191 __entry->blockcount = irec ? irec->br_blockcount : 0;
1192 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001193 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001194 "fork %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001195 MAJOR(__entry->dev), MINOR(__entry->dev),
1196 __entry->ino,
1197 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001198 __entry->offset,
1199 __entry->count,
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001200 __entry->whichfork == XFS_COW_FORK ? "cow" : "data",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001201 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001202 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001203 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001204)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001205
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001206#define DEFINE_IMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001207DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001208 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001209 int whichfork, struct xfs_bmbt_irec *irec), \
1210 TP_ARGS(ip, offset, count, whichfork, irec))
1211DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1212DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1213DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1214DEFINE_IMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001215
Li Zefanf8adb4d2010-05-24 08:25:57 +00001216DECLARE_EVENT_CLASS(xfs_simple_io_class,
1217 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1218 TP_ARGS(ip, offset, count),
1219 TP_STRUCT__entry(
1220 __field(dev_t, dev)
1221 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001222 __field(loff_t, isize)
1223 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001224 __field(loff_t, offset)
1225 __field(size_t, count)
1226 ),
1227 TP_fast_assign(
1228 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1229 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001230 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001231 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001232 __entry->offset = offset;
1233 __entry->count = count;
1234 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001235 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001236 "offset 0x%llx count %zd",
1237 MAJOR(__entry->dev), MINOR(__entry->dev),
1238 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001239 __entry->isize,
1240 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001241 __entry->offset,
1242 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001243);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001244
1245#define DEFINE_SIMPLE_IO_EVENT(name) \
1246DEFINE_EVENT(xfs_simple_io_class, name, \
1247 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1248 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001249DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1250DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001251DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001252DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001253DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1254DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1255DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001256
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001257DECLARE_EVENT_CLASS(xfs_itrunc_class,
1258 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1259 TP_ARGS(ip, new_size),
1260 TP_STRUCT__entry(
1261 __field(dev_t, dev)
1262 __field(xfs_ino_t, ino)
1263 __field(xfs_fsize_t, size)
1264 __field(xfs_fsize_t, new_size)
1265 ),
1266 TP_fast_assign(
1267 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1268 __entry->ino = ip->i_ino;
1269 __entry->size = ip->i_d.di_size;
1270 __entry->new_size = new_size;
1271 ),
1272 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1273 MAJOR(__entry->dev), MINOR(__entry->dev),
1274 __entry->ino,
1275 __entry->size,
1276 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001277)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001278
1279#define DEFINE_ITRUNC_EVENT(name) \
1280DEFINE_EVENT(xfs_itrunc_class, name, \
1281 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1282 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001283DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1284DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001285
1286TRACE_EVENT(xfs_pagecache_inval,
1287 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1288 TP_ARGS(ip, start, finish),
1289 TP_STRUCT__entry(
1290 __field(dev_t, dev)
1291 __field(xfs_ino_t, ino)
1292 __field(xfs_fsize_t, size)
1293 __field(xfs_off_t, start)
1294 __field(xfs_off_t, finish)
1295 ),
1296 TP_fast_assign(
1297 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1298 __entry->ino = ip->i_ino;
1299 __entry->size = ip->i_d.di_size;
1300 __entry->start = start;
1301 __entry->finish = finish;
1302 ),
1303 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1304 MAJOR(__entry->dev), MINOR(__entry->dev),
1305 __entry->ino,
1306 __entry->size,
1307 __entry->start,
1308 __entry->finish)
1309);
1310
1311TRACE_EVENT(xfs_bunmap,
1312 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1313 int flags, unsigned long caller_ip),
1314 TP_ARGS(ip, bno, len, flags, caller_ip),
1315 TP_STRUCT__entry(
1316 __field(dev_t, dev)
1317 __field(xfs_ino_t, ino)
1318 __field(xfs_fsize_t, size)
1319 __field(xfs_fileoff_t, bno)
1320 __field(xfs_filblks_t, len)
1321 __field(unsigned long, caller_ip)
1322 __field(int, flags)
1323 ),
1324 TP_fast_assign(
1325 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1326 __entry->ino = ip->i_ino;
1327 __entry->size = ip->i_d.di_size;
1328 __entry->bno = bno;
1329 __entry->len = len;
1330 __entry->caller_ip = caller_ip;
1331 __entry->flags = flags;
1332 ),
1333 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 -08001334 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001335 MAJOR(__entry->dev), MINOR(__entry->dev),
1336 __entry->ino,
1337 __entry->size,
1338 __entry->bno,
1339 __entry->len,
1340 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1341 (void *)__entry->caller_ip)
1342
1343);
1344
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001345DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001346 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1347 xfs_agblock_t agbno, xfs_extlen_t len),
1348 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001349 TP_STRUCT__entry(
1350 __field(dev_t, dev)
1351 __field(xfs_agnumber_t, agno)
1352 __field(xfs_agblock_t, agbno)
1353 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001354 ),
1355 TP_fast_assign(
1356 __entry->dev = mp->m_super->s_dev;
1357 __entry->agno = agno;
1358 __entry->agbno = agbno;
1359 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001360 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001361 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001362 MAJOR(__entry->dev), MINOR(__entry->dev),
1363 __entry->agno,
1364 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001365 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001366);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001367#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001368DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001369 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1370 xfs_agblock_t agbno, xfs_extlen_t len), \
1371 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001372DEFINE_BUSY_EVENT(xfs_extent_busy);
1373DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1374DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1375DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1376DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001377
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001378TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001379 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1380 xfs_agblock_t agbno, xfs_extlen_t len,
1381 xfs_agblock_t tbno, xfs_extlen_t tlen),
1382 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1383 TP_STRUCT__entry(
1384 __field(dev_t, dev)
1385 __field(xfs_agnumber_t, agno)
1386 __field(xfs_agblock_t, agbno)
1387 __field(xfs_extlen_t, len)
1388 __field(xfs_agblock_t, tbno)
1389 __field(xfs_extlen_t, tlen)
1390 ),
1391 TP_fast_assign(
1392 __entry->dev = mp->m_super->s_dev;
1393 __entry->agno = agno;
1394 __entry->agbno = agbno;
1395 __entry->len = len;
1396 __entry->tbno = tbno;
1397 __entry->tlen = tlen;
1398 ),
1399 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1400 MAJOR(__entry->dev), MINOR(__entry->dev),
1401 __entry->agno,
1402 __entry->agbno,
1403 __entry->len,
1404 __entry->tbno,
1405 __entry->tlen)
1406);
1407
Brian Fostera27ba262018-03-15 10:51:58 -07001408DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001409 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1410 unsigned long caller_ip),
1411 TP_ARGS(mp, agf, flags, caller_ip),
1412 TP_STRUCT__entry(
1413 __field(dev_t, dev)
1414 __field(xfs_agnumber_t, agno)
1415 __field(int, flags)
1416 __field(__u32, length)
1417 __field(__u32, bno_root)
1418 __field(__u32, cnt_root)
1419 __field(__u32, bno_level)
1420 __field(__u32, cnt_level)
1421 __field(__u32, flfirst)
1422 __field(__u32, fllast)
1423 __field(__u32, flcount)
1424 __field(__u32, freeblks)
1425 __field(__u32, longest)
1426 __field(unsigned long, caller_ip)
1427 ),
1428 TP_fast_assign(
1429 __entry->dev = mp->m_super->s_dev;
1430 __entry->agno = be32_to_cpu(agf->agf_seqno),
1431 __entry->flags = flags;
1432 __entry->length = be32_to_cpu(agf->agf_length),
1433 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1434 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1435 __entry->bno_level =
1436 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1437 __entry->cnt_level =
1438 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1439 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1440 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1441 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1442 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1443 __entry->longest = be32_to_cpu(agf->agf_longest);
1444 __entry->caller_ip = caller_ip;
1445 ),
1446 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1447 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001448 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001449 MAJOR(__entry->dev), MINOR(__entry->dev),
1450 __entry->agno,
1451 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1452 __entry->length,
1453 __entry->bno_root,
1454 __entry->cnt_root,
1455 __entry->bno_level,
1456 __entry->cnt_level,
1457 __entry->flfirst,
1458 __entry->fllast,
1459 __entry->flcount,
1460 __entry->freeblks,
1461 __entry->longest,
1462 (void *)__entry->caller_ip)
1463);
Brian Fostera27ba262018-03-15 10:51:58 -07001464#define DEFINE_AGF_EVENT(name) \
1465DEFINE_EVENT(xfs_agf_class, name, \
1466 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))
1469DEFINE_AGF_EVENT(xfs_agf);
1470DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001471
1472TRACE_EVENT(xfs_free_extent,
1473 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001474 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1475 int haveright),
1476 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001477 TP_STRUCT__entry(
1478 __field(dev_t, dev)
1479 __field(xfs_agnumber_t, agno)
1480 __field(xfs_agblock_t, agbno)
1481 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001482 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001483 __field(int, haveleft)
1484 __field(int, haveright)
1485 ),
1486 TP_fast_assign(
1487 __entry->dev = mp->m_super->s_dev;
1488 __entry->agno = agno;
1489 __entry->agbno = agbno;
1490 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001491 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001492 __entry->haveleft = haveleft;
1493 __entry->haveright = haveright;
1494 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001495 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001496 MAJOR(__entry->dev), MINOR(__entry->dev),
1497 __entry->agno,
1498 __entry->agbno,
1499 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001500 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001501 __entry->haveleft ?
1502 (__entry->haveright ? "both" : "left") :
1503 (__entry->haveright ? "right" : "none"))
1504
1505);
1506
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001507DECLARE_EVENT_CLASS(xfs_alloc_class,
1508 TP_PROTO(struct xfs_alloc_arg *args),
1509 TP_ARGS(args),
1510 TP_STRUCT__entry(
1511 __field(dev_t, dev)
1512 __field(xfs_agnumber_t, agno)
1513 __field(xfs_agblock_t, agbno)
1514 __field(xfs_extlen_t, minlen)
1515 __field(xfs_extlen_t, maxlen)
1516 __field(xfs_extlen_t, mod)
1517 __field(xfs_extlen_t, prod)
1518 __field(xfs_extlen_t, minleft)
1519 __field(xfs_extlen_t, total)
1520 __field(xfs_extlen_t, alignment)
1521 __field(xfs_extlen_t, minalignslop)
1522 __field(xfs_extlen_t, len)
1523 __field(short, type)
1524 __field(short, otype)
1525 __field(char, wasdel)
1526 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001527 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001528 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001529 __field(xfs_fsblock_t, firstblock)
1530 ),
1531 TP_fast_assign(
1532 __entry->dev = args->mp->m_super->s_dev;
1533 __entry->agno = args->agno;
1534 __entry->agbno = args->agbno;
1535 __entry->minlen = args->minlen;
1536 __entry->maxlen = args->maxlen;
1537 __entry->mod = args->mod;
1538 __entry->prod = args->prod;
1539 __entry->minleft = args->minleft;
1540 __entry->total = args->total;
1541 __entry->alignment = args->alignment;
1542 __entry->minalignslop = args->minalignslop;
1543 __entry->len = args->len;
1544 __entry->type = args->type;
1545 __entry->otype = args->otype;
1546 __entry->wasdel = args->wasdel;
1547 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001548 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001549 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001550 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001551 ),
1552 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1553 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001554 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001555 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001556 MAJOR(__entry->dev), MINOR(__entry->dev),
1557 __entry->agno,
1558 __entry->agbno,
1559 __entry->minlen,
1560 __entry->maxlen,
1561 __entry->mod,
1562 __entry->prod,
1563 __entry->minleft,
1564 __entry->total,
1565 __entry->alignment,
1566 __entry->minalignslop,
1567 __entry->len,
1568 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1569 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1570 __entry->wasdel,
1571 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001572 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001573 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001574 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001575)
1576
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001577#define DEFINE_ALLOC_EVENT(name) \
1578DEFINE_EVENT(xfs_alloc_class, name, \
1579 TP_PROTO(struct xfs_alloc_arg *args), \
1580 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001581DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001582DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001583DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1584DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1585DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
Brian Fosterd2968822019-10-13 17:10:35 -07001586DEFINE_ALLOC_EVENT(xfs_alloc_cur);
Brian Fosterfec0afd2019-10-13 17:10:33 -07001587DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1588DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
Brian Fosterdc8e69b2019-10-13 17:10:36 -07001589DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
1590DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001591DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001592DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1593DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001594DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1595DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1596DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1597DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1598DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001599DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001600DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1601DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1602DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1603DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1604DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1605DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1606DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1607DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1608DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1609
Brian Foster396bbf32019-10-13 17:10:33 -07001610TRACE_EVENT(xfs_alloc_cur_check,
1611 TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1612 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1613 TP_ARGS(mp, btnum, bno, len, diff, new),
1614 TP_STRUCT__entry(
1615 __field(dev_t, dev)
1616 __field(xfs_btnum_t, btnum)
1617 __field(xfs_agblock_t, bno)
1618 __field(xfs_extlen_t, len)
1619 __field(xfs_extlen_t, diff)
1620 __field(bool, new)
1621 ),
1622 TP_fast_assign(
1623 __entry->dev = mp->m_super->s_dev;
1624 __entry->btnum = btnum;
1625 __entry->bno = bno;
1626 __entry->len = len;
1627 __entry->diff = diff;
1628 __entry->new = new;
1629 ),
1630 TP_printk("dev %d:%d btree %s bno 0x%x len 0x%x diff 0x%x new %d",
1631 MAJOR(__entry->dev), MINOR(__entry->dev),
1632 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1633 __entry->bno, __entry->len, __entry->diff, __entry->new)
1634)
1635
Dave Chinner5a5881c2012-03-22 05:15:13 +00001636DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001637 TP_PROTO(struct xfs_da_args *args),
1638 TP_ARGS(args),
1639 TP_STRUCT__entry(
1640 __field(dev_t, dev)
1641 __field(xfs_ino_t, ino)
1642 __dynamic_array(char, name, args->namelen)
1643 __field(int, namelen)
1644 __field(xfs_dahash_t, hashval)
1645 __field(xfs_ino_t, inumber)
1646 __field(int, op_flags)
1647 ),
1648 TP_fast_assign(
1649 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1650 __entry->ino = args->dp->i_ino;
1651 if (args->namelen)
1652 memcpy(__get_str(name), args->name, args->namelen);
1653 __entry->namelen = args->namelen;
1654 __entry->hashval = args->hashval;
1655 __entry->inumber = args->inumber;
1656 __entry->op_flags = args->op_flags;
1657 ),
1658 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1659 "inumber 0x%llx op_flags %s",
1660 MAJOR(__entry->dev), MINOR(__entry->dev),
1661 __entry->ino,
1662 __entry->namelen,
1663 __entry->namelen ? __get_str(name) : NULL,
1664 __entry->namelen,
1665 __entry->hashval,
1666 __entry->inumber,
1667 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001668)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001669
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001670#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001671DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001672 TP_PROTO(struct xfs_da_args *args), \
1673 TP_ARGS(args))
1674DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1675DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1676DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1677DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1678DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1679DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1680DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1681DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1682DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1683DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1684DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1685DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1686DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1687DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1688DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1689DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1690DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1691DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1692DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1693DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1694DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1695DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1696DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1697DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1698DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1699
Dave Chinneree732592012-11-12 22:53:53 +11001700DECLARE_EVENT_CLASS(xfs_attr_class,
1701 TP_PROTO(struct xfs_da_args *args),
1702 TP_ARGS(args),
1703 TP_STRUCT__entry(
1704 __field(dev_t, dev)
1705 __field(xfs_ino_t, ino)
1706 __dynamic_array(char, name, args->namelen)
1707 __field(int, namelen)
1708 __field(int, valuelen)
1709 __field(xfs_dahash_t, hashval)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001710 __field(unsigned int, attr_filter)
1711 __field(unsigned int, attr_flags)
Dave Chinneree732592012-11-12 22:53:53 +11001712 __field(int, op_flags)
1713 ),
1714 TP_fast_assign(
1715 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1716 __entry->ino = args->dp->i_ino;
1717 if (args->namelen)
1718 memcpy(__get_str(name), args->name, args->namelen);
1719 __entry->namelen = args->namelen;
1720 __entry->valuelen = args->valuelen;
1721 __entry->hashval = args->hashval;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001722 __entry->attr_filter = args->attr_filter;
1723 __entry->attr_flags = args->attr_flags;
Dave Chinneree732592012-11-12 22:53:53 +11001724 __entry->op_flags = args->op_flags;
1725 ),
1726 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001727 "hashval 0x%x filter %s flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001728 MAJOR(__entry->dev), MINOR(__entry->dev),
1729 __entry->ino,
1730 __entry->namelen,
1731 __entry->namelen ? __get_str(name) : NULL,
1732 __entry->namelen,
1733 __entry->valuelen,
1734 __entry->hashval,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001735 __print_flags(__entry->attr_filter, "|",
1736 XFS_ATTR_FILTER_FLAGS),
1737 __print_flags(__entry->attr_flags, "|",
1738 { XATTR_CREATE, "CREATE" },
1739 { XATTR_REPLACE, "REPLACE" }),
Dave Chinneree732592012-11-12 22:53:53 +11001740 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1741)
1742
Dave Chinner5a5881c2012-03-22 05:15:13 +00001743#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001744DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001745 TP_PROTO(struct xfs_da_args *args), \
1746 TP_ARGS(args))
1747DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1748DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1749DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1750DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1751DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001752DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1753
1754DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1755DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1756DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001757DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001758DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1759DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001760DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1761DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001762DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1763DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001764DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001765DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1766DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1767DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1768DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1769DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1770DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1771DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1772DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1773DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1774DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1775DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001776DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001777
1778DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001779DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001780DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1781DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1782
Dave Chinneree732592012-11-12 22:53:53 +11001783DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1784DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1785
1786DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1787DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1788DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1789
Dave Chinner5a5881c2012-03-22 05:15:13 +00001790#define DEFINE_DA_EVENT(name) \
1791DEFINE_EVENT(xfs_da_class, name, \
1792 TP_PROTO(struct xfs_da_args *args), \
1793 TP_ARGS(args))
1794DEFINE_DA_EVENT(xfs_da_split);
1795DEFINE_DA_EVENT(xfs_da_join);
1796DEFINE_DA_EVENT(xfs_da_link_before);
1797DEFINE_DA_EVENT(xfs_da_link_after);
1798DEFINE_DA_EVENT(xfs_da_unlink_back);
1799DEFINE_DA_EVENT(xfs_da_unlink_forward);
1800DEFINE_DA_EVENT(xfs_da_root_split);
1801DEFINE_DA_EVENT(xfs_da_root_join);
1802DEFINE_DA_EVENT(xfs_da_node_add);
1803DEFINE_DA_EVENT(xfs_da_node_create);
1804DEFINE_DA_EVENT(xfs_da_node_split);
1805DEFINE_DA_EVENT(xfs_da_node_remove);
1806DEFINE_DA_EVENT(xfs_da_node_rebalance);
1807DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001808DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001809DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1810DEFINE_DA_EVENT(xfs_da_grow_inode);
1811DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001812DEFINE_DA_EVENT(xfs_da_fixhashpath);
1813DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001814
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001815DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1816 TP_PROTO(struct xfs_da_args *args, int idx),
1817 TP_ARGS(args, idx),
1818 TP_STRUCT__entry(
1819 __field(dev_t, dev)
1820 __field(xfs_ino_t, ino)
1821 __field(int, op_flags)
1822 __field(int, idx)
1823 ),
1824 TP_fast_assign(
1825 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1826 __entry->ino = args->dp->i_ino;
1827 __entry->op_flags = args->op_flags;
1828 __entry->idx = idx;
1829 ),
1830 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1831 MAJOR(__entry->dev), MINOR(__entry->dev),
1832 __entry->ino,
1833 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1834 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001835)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001836
1837#define DEFINE_DIR2_SPACE_EVENT(name) \
1838DEFINE_EVENT(xfs_dir2_space_class, name, \
1839 TP_PROTO(struct xfs_da_args *args, int idx), \
1840 TP_ARGS(args, idx))
1841DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1842DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1843DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1844DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001845
1846TRACE_EVENT(xfs_dir2_leafn_moveents,
1847 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1848 TP_ARGS(args, src_idx, dst_idx, count),
1849 TP_STRUCT__entry(
1850 __field(dev_t, dev)
1851 __field(xfs_ino_t, ino)
1852 __field(int, op_flags)
1853 __field(int, src_idx)
1854 __field(int, dst_idx)
1855 __field(int, count)
1856 ),
1857 TP_fast_assign(
1858 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1859 __entry->ino = args->dp->i_ino;
1860 __entry->op_flags = args->op_flags;
1861 __entry->src_idx = src_idx;
1862 __entry->dst_idx = dst_idx;
1863 __entry->count = count;
1864 ),
1865 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1866 "src_idx %d dst_idx %d count %d",
1867 MAJOR(__entry->dev), MINOR(__entry->dev),
1868 __entry->ino,
1869 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1870 __entry->src_idx,
1871 __entry->dst_idx,
1872 __entry->count)
1873);
1874
Dave Chinner3a85cd92010-01-14 01:33:55 +00001875#define XFS_SWAPEXT_INODES \
1876 { 0, "target" }, \
1877 { 1, "temp" }
1878
Darrick J. Wong0357d212018-12-18 14:32:30 -08001879TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
1880TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
1881TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
1882TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
1883TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
Dave Chinner3a85cd92010-01-14 01:33:55 +00001884
1885DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1886 TP_PROTO(struct xfs_inode *ip, int which),
1887 TP_ARGS(ip, which),
1888 TP_STRUCT__entry(
1889 __field(dev_t, dev)
1890 __field(int, which)
1891 __field(xfs_ino_t, ino)
1892 __field(int, format)
1893 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001894 __field(int, broot_size)
1895 __field(int, fork_off)
1896 ),
1897 TP_fast_assign(
1898 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1899 __entry->which = which;
1900 __entry->ino = ip->i_ino;
1901 __entry->format = ip->i_d.di_format;
1902 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001903 __entry->broot_size = ip->i_df.if_broot_bytes;
1904 __entry->fork_off = XFS_IFORK_BOFF(ip);
1905 ),
1906 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001907 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001908 MAJOR(__entry->dev), MINOR(__entry->dev),
1909 __entry->ino,
1910 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1911 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1912 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001913 __entry->broot_size,
1914 __entry->fork_off)
1915)
1916
1917#define DEFINE_SWAPEXT_EVENT(name) \
1918DEFINE_EVENT(xfs_swap_extent_class, name, \
1919 TP_PROTO(struct xfs_inode *ip, int which), \
1920 TP_ARGS(ip, which))
1921
1922DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1923DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1924
Brian Fostere67d3d42017-08-08 18:21:53 -07001925TRACE_EVENT(xfs_log_recover,
1926 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1927 TP_ARGS(log, headblk, tailblk),
1928 TP_STRUCT__entry(
1929 __field(dev_t, dev)
1930 __field(xfs_daddr_t, headblk)
1931 __field(xfs_daddr_t, tailblk)
1932 ),
1933 TP_fast_assign(
1934 __entry->dev = log->l_mp->m_super->s_dev;
1935 __entry->headblk = headblk;
1936 __entry->tailblk = tailblk;
1937 ),
1938 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1939 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1940 __entry->tailblk)
1941)
1942
Brian Foster5cd9cee2016-09-26 08:34:52 +10001943TRACE_EVENT(xfs_log_recover_record,
1944 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1945 TP_ARGS(log, rhead, pass),
1946 TP_STRUCT__entry(
1947 __field(dev_t, dev)
1948 __field(xfs_lsn_t, lsn)
1949 __field(int, len)
1950 __field(int, num_logops)
1951 __field(int, pass)
1952 ),
1953 TP_fast_assign(
1954 __entry->dev = log->l_mp->m_super->s_dev;
1955 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1956 __entry->len = be32_to_cpu(rhead->h_len);
1957 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1958 __entry->pass = pass;
1959 ),
1960 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1961 MAJOR(__entry->dev), MINOR(__entry->dev),
1962 __entry->lsn, __entry->len, __entry->num_logops,
1963 __entry->pass)
1964)
1965
Dave Chinner9abbc532010-04-13 15:06:46 +10001966DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001967 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001968 struct xlog_recover_item *item, int pass),
1969 TP_ARGS(log, trans, item, pass),
1970 TP_STRUCT__entry(
1971 __field(dev_t, dev)
1972 __field(unsigned long, item)
1973 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10001974 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10001975 __field(int, type)
1976 __field(int, pass)
1977 __field(int, count)
1978 __field(int, total)
1979 ),
1980 TP_fast_assign(
1981 __entry->dev = log->l_mp->m_super->s_dev;
1982 __entry->item = (unsigned long)item;
1983 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10001984 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10001985 __entry->type = ITEM_TYPE(item);
1986 __entry->pass = pass;
1987 __entry->count = item->ri_cnt;
1988 __entry->total = item->ri_total;
1989 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001990 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10001991 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10001992 MAJOR(__entry->dev), MINOR(__entry->dev),
1993 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10001994 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10001995 __entry->pass,
1996 (void *)__entry->item,
1997 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1998 __entry->count,
1999 __entry->total)
2000)
2001
2002#define DEFINE_LOG_RECOVER_ITEM(name) \
2003DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002004 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002005 struct xlog_recover_item *item, int pass), \
2006 TP_ARGS(log, trans, item, pass))
2007
2008DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2009DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2010DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2011DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2012DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2013
2014DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002015 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002016 TP_ARGS(log, buf_f),
2017 TP_STRUCT__entry(
2018 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002019 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002020 __field(unsigned short, len)
2021 __field(unsigned short, flags)
2022 __field(unsigned short, size)
2023 __field(unsigned int, map_size)
2024 ),
2025 TP_fast_assign(
2026 __entry->dev = log->l_mp->m_super->s_dev;
2027 __entry->blkno = buf_f->blf_blkno;
2028 __entry->len = buf_f->blf_len;
2029 __entry->flags = buf_f->blf_flags;
2030 __entry->size = buf_f->blf_size;
2031 __entry->map_size = buf_f->blf_map_size;
2032 ),
2033 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2034 "map_size %d",
2035 MAJOR(__entry->dev), MINOR(__entry->dev),
2036 __entry->blkno,
2037 __entry->len,
2038 __entry->flags,
2039 __entry->size,
2040 __entry->map_size)
2041)
2042
2043#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2044DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002045 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002046 TP_ARGS(log, buf_f))
2047
2048DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2049DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2050DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2051DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2052DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002053DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002054DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2055DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2056DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2057
2058DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002059 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002060 TP_ARGS(log, in_f),
2061 TP_STRUCT__entry(
2062 __field(dev_t, dev)
2063 __field(xfs_ino_t, ino)
2064 __field(unsigned short, size)
2065 __field(int, fields)
2066 __field(unsigned short, asize)
2067 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002068 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002069 __field(int, len)
2070 __field(int, boffset)
2071 ),
2072 TP_fast_assign(
2073 __entry->dev = log->l_mp->m_super->s_dev;
2074 __entry->ino = in_f->ilf_ino;
2075 __entry->size = in_f->ilf_size;
2076 __entry->fields = in_f->ilf_fields;
2077 __entry->asize = in_f->ilf_asize;
2078 __entry->dsize = in_f->ilf_dsize;
2079 __entry->blkno = in_f->ilf_blkno;
2080 __entry->len = in_f->ilf_len;
2081 __entry->boffset = in_f->ilf_boffset;
2082 ),
2083 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2084 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2085 MAJOR(__entry->dev), MINOR(__entry->dev),
2086 __entry->ino,
2087 __entry->size,
2088 __entry->fields,
2089 __entry->asize,
2090 __entry->dsize,
2091 __entry->blkno,
2092 __entry->len,
2093 __entry->boffset)
2094)
2095#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2096DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002097 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002098 TP_ARGS(log, in_f))
2099
2100DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2101DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2102DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2103
Brian Foster78d57e42015-08-19 09:58:48 +10002104DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2105 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2106 TP_ARGS(log, in_f),
2107 TP_STRUCT__entry(
2108 __field(dev_t, dev)
2109 __field(xfs_agnumber_t, agno)
2110 __field(xfs_agblock_t, agbno)
2111 __field(unsigned int, count)
2112 __field(unsigned int, isize)
2113 __field(xfs_agblock_t, length)
2114 __field(unsigned int, gen)
2115 ),
2116 TP_fast_assign(
2117 __entry->dev = log->l_mp->m_super->s_dev;
2118 __entry->agno = be32_to_cpu(in_f->icl_ag);
2119 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2120 __entry->count = be32_to_cpu(in_f->icl_count);
2121 __entry->isize = be32_to_cpu(in_f->icl_isize);
2122 __entry->length = be32_to_cpu(in_f->icl_length);
2123 __entry->gen = be32_to_cpu(in_f->icl_gen);
2124 ),
2125 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2126 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2127 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2128 __entry->length, __entry->gen)
2129)
2130#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2131DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2132 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2133 TP_ARGS(log, in_f))
2134
2135DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2136DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2137
Christoph Hellwiga46db602011-01-07 13:02:04 +00002138DECLARE_EVENT_CLASS(xfs_discard_class,
2139 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2140 xfs_agblock_t agbno, xfs_extlen_t len),
2141 TP_ARGS(mp, agno, agbno, len),
2142 TP_STRUCT__entry(
2143 __field(dev_t, dev)
2144 __field(xfs_agnumber_t, agno)
2145 __field(xfs_agblock_t, agbno)
2146 __field(xfs_extlen_t, len)
2147 ),
2148 TP_fast_assign(
2149 __entry->dev = mp->m_super->s_dev;
2150 __entry->agno = agno;
2151 __entry->agbno = agbno;
2152 __entry->len = len;
2153 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002154 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002155 MAJOR(__entry->dev), MINOR(__entry->dev),
2156 __entry->agno,
2157 __entry->agbno,
2158 __entry->len)
2159)
2160
2161#define DEFINE_DISCARD_EVENT(name) \
2162DEFINE_EVENT(xfs_discard_class, name, \
2163 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2164 xfs_agblock_t agbno, xfs_extlen_t len), \
2165 TP_ARGS(mp, agno, agbno, len))
2166DEFINE_DISCARD_EVENT(xfs_discard_extent);
2167DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2168DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2169DEFINE_DISCARD_EVENT(xfs_discard_busy);
2170
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002171/* btree cursor events */
Darrick J. Wongc4942132018-12-18 14:32:31 -08002172TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2173TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2174TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2175TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2176TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2177TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2178TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2179
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002180DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2181 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2182 TP_ARGS(cur, level, bp),
2183 TP_STRUCT__entry(
2184 __field(dev_t, dev)
2185 __field(xfs_btnum_t, btnum)
2186 __field(int, level)
2187 __field(int, nlevels)
2188 __field(int, ptr)
2189 __field(xfs_daddr_t, daddr)
2190 ),
2191 TP_fast_assign(
2192 __entry->dev = cur->bc_mp->m_super->s_dev;
2193 __entry->btnum = cur->bc_btnum;
2194 __entry->level = level;
2195 __entry->nlevels = cur->bc_nlevels;
2196 __entry->ptr = cur->bc_ptrs[level];
2197 __entry->daddr = bp ? bp->b_bn : -1;
2198 ),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002199 TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002200 MAJOR(__entry->dev), MINOR(__entry->dev),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002201 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002202 __entry->level,
2203 __entry->nlevels,
2204 __entry->ptr,
2205 (unsigned long long)__entry->daddr)
2206)
2207
2208#define DEFINE_BTREE_CUR_EVENT(name) \
2209DEFINE_EVENT(xfs_btree_cur_class, name, \
2210 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2211 TP_ARGS(cur, level, bp))
2212DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002213DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002214
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002215/* deferred ops */
2216struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002217
2218DECLARE_EVENT_CLASS(xfs_defer_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002219 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2220 TP_ARGS(tp, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002221 TP_STRUCT__entry(
2222 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002223 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002224 __field(char, committed)
Dave Chinnere632a562018-05-09 07:48:52 -07002225 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002226 ),
2227 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002228 __entry->dev = tp->t_mountp->m_super->s_dev;
2229 __entry->tp = tp;
Dave Chinnere632a562018-05-09 07:48:52 -07002230 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002231 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002232 TP_printk("dev %d:%d tp %p caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002233 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002234 __entry->tp,
Dave Chinnere632a562018-05-09 07:48:52 -07002235 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002236)
2237#define DEFINE_DEFER_EVENT(name) \
2238DEFINE_EVENT(xfs_defer_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002239 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2240 TP_ARGS(tp, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002241
2242DECLARE_EVENT_CLASS(xfs_defer_error_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002243 TP_PROTO(struct xfs_trans *tp, int error),
2244 TP_ARGS(tp, error),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002245 TP_STRUCT__entry(
2246 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002247 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002248 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002249 __field(int, error)
2250 ),
2251 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002252 __entry->dev = tp->t_mountp->m_super->s_dev;
2253 __entry->tp = tp;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002254 __entry->error = error;
2255 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002256 TP_printk("dev %d:%d tp %p err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002257 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002258 __entry->tp,
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002259 __entry->error)
2260)
2261#define DEFINE_DEFER_ERROR_EVENT(name) \
2262DEFINE_EVENT(xfs_defer_error_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002263 TP_PROTO(struct xfs_trans *tp, int error), \
2264 TP_ARGS(tp, error))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002265
2266DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2267 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2268 TP_ARGS(mp, dfp),
2269 TP_STRUCT__entry(
2270 __field(dev_t, dev)
2271 __field(int, type)
2272 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002273 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002274 __field(int, nr)
2275 ),
2276 TP_fast_assign(
2277 __entry->dev = mp ? mp->m_super->s_dev : 0;
Darrick J. Wong02b100f2018-12-12 08:46:22 -08002278 __entry->type = dfp->dfp_type;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002279 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002280 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002281 __entry->nr = dfp->dfp_count;
2282 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002283 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002284 MAJOR(__entry->dev), MINOR(__entry->dev),
2285 __entry->type,
2286 __entry->intent,
2287 __entry->committed,
2288 __entry->nr)
2289)
2290#define DEFINE_DEFER_PENDING_EVENT(name) \
2291DEFINE_EVENT(xfs_defer_pending_class, name, \
2292 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2293 TP_ARGS(mp, dfp))
2294
2295DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2296 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2297 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2298 TP_ARGS(mp, agno, type, agbno, len),
2299 TP_STRUCT__entry(
2300 __field(dev_t, dev)
2301 __field(xfs_agnumber_t, agno)
2302 __field(int, type)
2303 __field(xfs_agblock_t, agbno)
2304 __field(xfs_extlen_t, len)
2305 ),
2306 TP_fast_assign(
2307 __entry->dev = mp->m_super->s_dev;
2308 __entry->agno = agno;
2309 __entry->type = type;
2310 __entry->agbno = agbno;
2311 __entry->len = len;
2312 ),
2313 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2314 MAJOR(__entry->dev), MINOR(__entry->dev),
2315 __entry->type,
2316 __entry->agno,
2317 __entry->agbno,
2318 __entry->len)
2319);
2320#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2321DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2322 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2323 int type, \
2324 xfs_agblock_t bno, \
2325 xfs_extlen_t len), \
2326 TP_ARGS(mp, agno, type, bno, len))
2327
2328DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2329 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2330 int op,
2331 xfs_agblock_t agbno,
2332 xfs_ino_t ino,
2333 int whichfork,
2334 xfs_fileoff_t offset,
2335 xfs_filblks_t len,
2336 xfs_exntst_t state),
2337 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2338 TP_STRUCT__entry(
2339 __field(dev_t, dev)
2340 __field(xfs_agnumber_t, agno)
2341 __field(xfs_ino_t, ino)
2342 __field(xfs_agblock_t, agbno)
2343 __field(int, whichfork)
2344 __field(xfs_fileoff_t, l_loff)
2345 __field(xfs_filblks_t, l_len)
2346 __field(xfs_exntst_t, l_state)
2347 __field(int, op)
2348 ),
2349 TP_fast_assign(
2350 __entry->dev = mp->m_super->s_dev;
2351 __entry->agno = agno;
2352 __entry->ino = ino;
2353 __entry->agbno = agbno;
2354 __entry->whichfork = whichfork;
2355 __entry->l_loff = offset;
2356 __entry->l_len = len;
2357 __entry->l_state = state;
2358 __entry->op = op;
2359 ),
2360 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2361 MAJOR(__entry->dev), MINOR(__entry->dev),
2362 __entry->op,
2363 __entry->agno,
2364 __entry->agbno,
2365 __entry->ino,
2366 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2367 __entry->l_loff,
2368 __entry->l_len,
2369 __entry->l_state)
2370);
2371#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2372DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2373 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2374 int op, \
2375 xfs_agblock_t agbno, \
2376 xfs_ino_t ino, \
2377 int whichfork, \
2378 xfs_fileoff_t offset, \
2379 xfs_filblks_t len, \
2380 xfs_exntst_t state), \
2381 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2382
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002383DEFINE_DEFER_EVENT(xfs_defer_cancel);
2384DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2385DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2386DEFINE_DEFER_EVENT(xfs_defer_finish);
2387DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2388
2389DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2390DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002391
Brian Foster1ae093cb2018-08-01 07:20:34 -07002392DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2393DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002394DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2395DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2396
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002397#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2398DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2399DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002400DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2401DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002402
Darrick J. Wong673930c2016-08-03 11:33:43 +10002403/* rmap tracepoints */
2404DECLARE_EVENT_CLASS(xfs_rmap_class,
2405 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2406 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
Darrick J. Wong66e32372018-12-12 08:46:23 -08002407 const struct xfs_owner_info *oinfo),
Darrick J. Wong673930c2016-08-03 11:33:43 +10002408 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2409 TP_STRUCT__entry(
2410 __field(dev_t, dev)
2411 __field(xfs_agnumber_t, agno)
2412 __field(xfs_agblock_t, agbno)
2413 __field(xfs_extlen_t, len)
2414 __field(uint64_t, owner)
2415 __field(uint64_t, offset)
2416 __field(unsigned long, flags)
2417 ),
2418 TP_fast_assign(
2419 __entry->dev = mp->m_super->s_dev;
2420 __entry->agno = agno;
2421 __entry->agbno = agbno;
2422 __entry->len = len;
2423 __entry->owner = oinfo->oi_owner;
2424 __entry->offset = oinfo->oi_offset;
2425 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002426 if (unwritten)
2427 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002428 ),
2429 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2430 MAJOR(__entry->dev), MINOR(__entry->dev),
2431 __entry->agno,
2432 __entry->agbno,
2433 __entry->len,
2434 __entry->owner,
2435 __entry->offset,
2436 __entry->flags)
2437);
2438#define DEFINE_RMAP_EVENT(name) \
2439DEFINE_EVENT(xfs_rmap_class, name, \
2440 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2441 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
Darrick J. Wong66e32372018-12-12 08:46:23 -08002442 const struct xfs_owner_info *oinfo), \
Darrick J. Wong673930c2016-08-03 11:33:43 +10002443 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2444
2445/* simple AG-based error/%ip tracepoint class */
2446DECLARE_EVENT_CLASS(xfs_ag_error_class,
2447 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2448 unsigned long caller_ip),
2449 TP_ARGS(mp, agno, error, caller_ip),
2450 TP_STRUCT__entry(
2451 __field(dev_t, dev)
2452 __field(xfs_agnumber_t, agno)
2453 __field(int, error)
2454 __field(unsigned long, caller_ip)
2455 ),
2456 TP_fast_assign(
2457 __entry->dev = mp->m_super->s_dev;
2458 __entry->agno = agno;
2459 __entry->error = error;
2460 __entry->caller_ip = caller_ip;
2461 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002462 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002463 MAJOR(__entry->dev), MINOR(__entry->dev),
2464 __entry->agno,
2465 __entry->error,
2466 (char *)__entry->caller_ip)
2467);
2468
2469#define DEFINE_AG_ERROR_EVENT(name) \
2470DEFINE_EVENT(xfs_ag_error_class, name, \
2471 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2472 unsigned long caller_ip), \
2473 TP_ARGS(mp, agno, error, caller_ip))
2474
2475DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2476DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2477DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2478DEFINE_RMAP_EVENT(xfs_rmap_map);
2479DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2480DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002481DEFINE_RMAP_EVENT(xfs_rmap_convert);
2482DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2483DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2484DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002485
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002486DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2487 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2488 xfs_agblock_t agbno, xfs_extlen_t len,
2489 uint64_t owner, uint64_t offset, unsigned int flags),
2490 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2491 TP_STRUCT__entry(
2492 __field(dev_t, dev)
2493 __field(xfs_agnumber_t, agno)
2494 __field(xfs_agblock_t, agbno)
2495 __field(xfs_extlen_t, len)
2496 __field(uint64_t, owner)
2497 __field(uint64_t, offset)
2498 __field(unsigned int, flags)
2499 ),
2500 TP_fast_assign(
2501 __entry->dev = mp->m_super->s_dev;
2502 __entry->agno = agno;
2503 __entry->agbno = agbno;
2504 __entry->len = len;
2505 __entry->owner = owner;
2506 __entry->offset = offset;
2507 __entry->flags = flags;
2508 ),
2509 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2510 MAJOR(__entry->dev), MINOR(__entry->dev),
2511 __entry->agno,
2512 __entry->agbno,
2513 __entry->len,
2514 __entry->owner,
2515 __entry->offset,
2516 __entry->flags)
2517);
2518#define DEFINE_RMAPBT_EVENT(name) \
2519DEFINE_EVENT(xfs_rmapbt_class, name, \
2520 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2521 xfs_agblock_t agbno, xfs_extlen_t len, \
2522 uint64_t owner, uint64_t offset, unsigned int flags), \
2523 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2524
2525#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2526DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2527DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2528
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002529DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2530DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002531DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2532DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2533DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2534DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2535DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2536DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002537
2538DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2539DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2540DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2541DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002542DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2543DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002544DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002545
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002546/* deferred bmbt updates */
2547#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2548DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2549DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2550
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002551/* per-AG reservation */
2552DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2553 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2554 xfs_extlen_t len),
2555 TP_ARGS(pag, resv, len),
2556 TP_STRUCT__entry(
2557 __field(dev_t, dev)
2558 __field(xfs_agnumber_t, agno)
2559 __field(int, resv)
2560 __field(xfs_extlen_t, freeblks)
2561 __field(xfs_extlen_t, flcount)
2562 __field(xfs_extlen_t, reserved)
2563 __field(xfs_extlen_t, asked)
2564 __field(xfs_extlen_t, len)
2565 ),
2566 TP_fast_assign(
2567 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2568
2569 __entry->dev = pag->pag_mount->m_super->s_dev;
2570 __entry->agno = pag->pag_agno;
2571 __entry->resv = resv;
2572 __entry->freeblks = pag->pagf_freeblks;
2573 __entry->flcount = pag->pagf_flcount;
2574 __entry->reserved = r ? r->ar_reserved : 0;
2575 __entry->asked = r ? r->ar_asked : 0;
2576 __entry->len = len;
2577 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002578 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2579 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002580 MAJOR(__entry->dev), MINOR(__entry->dev),
2581 __entry->agno,
2582 __entry->resv,
2583 __entry->freeblks,
2584 __entry->flcount,
2585 __entry->reserved,
2586 __entry->asked,
2587 __entry->len)
2588)
2589#define DEFINE_AG_RESV_EVENT(name) \
2590DEFINE_EVENT(xfs_ag_resv_class, name, \
2591 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2592 xfs_extlen_t len), \
2593 TP_ARGS(pag, type, len))
2594
2595/* per-AG reservation tracepoints */
2596DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2597DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2598DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2599DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2600DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2601DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2602
2603DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2604DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2605
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002606/* refcount tracepoint classes */
2607
2608/* reuse the discard trace class for agbno/aglen-based traces */
2609#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2610
2611/* ag btree lookup tracepoint class */
Darrick J. Wong85f8dff2018-12-18 14:32:29 -08002612TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2613TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2614TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002615DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2616 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2617 xfs_agblock_t agbno, xfs_lookup_t dir),
2618 TP_ARGS(mp, agno, agbno, dir),
2619 TP_STRUCT__entry(
2620 __field(dev_t, dev)
2621 __field(xfs_agnumber_t, agno)
2622 __field(xfs_agblock_t, agbno)
2623 __field(xfs_lookup_t, dir)
2624 ),
2625 TP_fast_assign(
2626 __entry->dev = mp->m_super->s_dev;
2627 __entry->agno = agno;
2628 __entry->agbno = agbno;
2629 __entry->dir = dir;
2630 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002631 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002632 MAJOR(__entry->dev), MINOR(__entry->dev),
2633 __entry->agno,
2634 __entry->agbno,
2635 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2636 __entry->dir)
2637)
2638
2639#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2640DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2641 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2642 xfs_agblock_t agbno, xfs_lookup_t dir), \
2643 TP_ARGS(mp, agno, agbno, dir))
2644
2645/* single-rcext tracepoint class */
2646DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2647 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2648 struct xfs_refcount_irec *irec),
2649 TP_ARGS(mp, agno, irec),
2650 TP_STRUCT__entry(
2651 __field(dev_t, dev)
2652 __field(xfs_agnumber_t, agno)
2653 __field(xfs_agblock_t, startblock)
2654 __field(xfs_extlen_t, blockcount)
2655 __field(xfs_nlink_t, refcount)
2656 ),
2657 TP_fast_assign(
2658 __entry->dev = mp->m_super->s_dev;
2659 __entry->agno = agno;
2660 __entry->startblock = irec->rc_startblock;
2661 __entry->blockcount = irec->rc_blockcount;
2662 __entry->refcount = irec->rc_refcount;
2663 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002664 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002665 MAJOR(__entry->dev), MINOR(__entry->dev),
2666 __entry->agno,
2667 __entry->startblock,
2668 __entry->blockcount,
2669 __entry->refcount)
2670)
2671
2672#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2673DEFINE_EVENT(xfs_refcount_extent_class, name, \
2674 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2675 struct xfs_refcount_irec *irec), \
2676 TP_ARGS(mp, agno, irec))
2677
2678/* single-rcext and an agbno tracepoint class */
2679DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2680 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2681 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2682 TP_ARGS(mp, agno, irec, agbno),
2683 TP_STRUCT__entry(
2684 __field(dev_t, dev)
2685 __field(xfs_agnumber_t, agno)
2686 __field(xfs_agblock_t, startblock)
2687 __field(xfs_extlen_t, blockcount)
2688 __field(xfs_nlink_t, refcount)
2689 __field(xfs_agblock_t, agbno)
2690 ),
2691 TP_fast_assign(
2692 __entry->dev = mp->m_super->s_dev;
2693 __entry->agno = agno;
2694 __entry->startblock = irec->rc_startblock;
2695 __entry->blockcount = irec->rc_blockcount;
2696 __entry->refcount = irec->rc_refcount;
2697 __entry->agbno = agbno;
2698 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002699 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002700 MAJOR(__entry->dev), MINOR(__entry->dev),
2701 __entry->agno,
2702 __entry->startblock,
2703 __entry->blockcount,
2704 __entry->refcount,
2705 __entry->agbno)
2706)
2707
2708#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2709DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
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
2714/* double-rcext tracepoint class */
2715DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2716 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2717 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2718 TP_ARGS(mp, agno, i1, i2),
2719 TP_STRUCT__entry(
2720 __field(dev_t, dev)
2721 __field(xfs_agnumber_t, agno)
2722 __field(xfs_agblock_t, i1_startblock)
2723 __field(xfs_extlen_t, i1_blockcount)
2724 __field(xfs_nlink_t, i1_refcount)
2725 __field(xfs_agblock_t, i2_startblock)
2726 __field(xfs_extlen_t, i2_blockcount)
2727 __field(xfs_nlink_t, i2_refcount)
2728 ),
2729 TP_fast_assign(
2730 __entry->dev = mp->m_super->s_dev;
2731 __entry->agno = agno;
2732 __entry->i1_startblock = i1->rc_startblock;
2733 __entry->i1_blockcount = i1->rc_blockcount;
2734 __entry->i1_refcount = i1->rc_refcount;
2735 __entry->i2_startblock = i2->rc_startblock;
2736 __entry->i2_blockcount = i2->rc_blockcount;
2737 __entry->i2_refcount = i2->rc_refcount;
2738 ),
2739 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002740 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002741 MAJOR(__entry->dev), MINOR(__entry->dev),
2742 __entry->agno,
2743 __entry->i1_startblock,
2744 __entry->i1_blockcount,
2745 __entry->i1_refcount,
2746 __entry->i2_startblock,
2747 __entry->i2_blockcount,
2748 __entry->i2_refcount)
2749)
2750
2751#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2752DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2753 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2754 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2755 TP_ARGS(mp, agno, i1, i2))
2756
2757/* double-rcext and an agbno tracepoint class */
2758DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2759 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2760 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2761 xfs_agblock_t agbno),
2762 TP_ARGS(mp, agno, i1, i2, agbno),
2763 TP_STRUCT__entry(
2764 __field(dev_t, dev)
2765 __field(xfs_agnumber_t, agno)
2766 __field(xfs_agblock_t, i1_startblock)
2767 __field(xfs_extlen_t, i1_blockcount)
2768 __field(xfs_nlink_t, i1_refcount)
2769 __field(xfs_agblock_t, i2_startblock)
2770 __field(xfs_extlen_t, i2_blockcount)
2771 __field(xfs_nlink_t, i2_refcount)
2772 __field(xfs_agblock_t, agbno)
2773 ),
2774 TP_fast_assign(
2775 __entry->dev = mp->m_super->s_dev;
2776 __entry->agno = agno;
2777 __entry->i1_startblock = i1->rc_startblock;
2778 __entry->i1_blockcount = i1->rc_blockcount;
2779 __entry->i1_refcount = i1->rc_refcount;
2780 __entry->i2_startblock = i2->rc_startblock;
2781 __entry->i2_blockcount = i2->rc_blockcount;
2782 __entry->i2_refcount = i2->rc_refcount;
2783 __entry->agbno = agbno;
2784 ),
2785 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002786 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002787 MAJOR(__entry->dev), MINOR(__entry->dev),
2788 __entry->agno,
2789 __entry->i1_startblock,
2790 __entry->i1_blockcount,
2791 __entry->i1_refcount,
2792 __entry->i2_startblock,
2793 __entry->i2_blockcount,
2794 __entry->i2_refcount,
2795 __entry->agbno)
2796)
2797
2798#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2799DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2800 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2801 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2802 xfs_agblock_t agbno), \
2803 TP_ARGS(mp, agno, i1, i2, agbno))
2804
2805/* triple-rcext tracepoint class */
2806DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2807 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2808 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2809 struct xfs_refcount_irec *i3),
2810 TP_ARGS(mp, agno, i1, i2, i3),
2811 TP_STRUCT__entry(
2812 __field(dev_t, dev)
2813 __field(xfs_agnumber_t, agno)
2814 __field(xfs_agblock_t, i1_startblock)
2815 __field(xfs_extlen_t, i1_blockcount)
2816 __field(xfs_nlink_t, i1_refcount)
2817 __field(xfs_agblock_t, i2_startblock)
2818 __field(xfs_extlen_t, i2_blockcount)
2819 __field(xfs_nlink_t, i2_refcount)
2820 __field(xfs_agblock_t, i3_startblock)
2821 __field(xfs_extlen_t, i3_blockcount)
2822 __field(xfs_nlink_t, i3_refcount)
2823 ),
2824 TP_fast_assign(
2825 __entry->dev = mp->m_super->s_dev;
2826 __entry->agno = agno;
2827 __entry->i1_startblock = i1->rc_startblock;
2828 __entry->i1_blockcount = i1->rc_blockcount;
2829 __entry->i1_refcount = i1->rc_refcount;
2830 __entry->i2_startblock = i2->rc_startblock;
2831 __entry->i2_blockcount = i2->rc_blockcount;
2832 __entry->i2_refcount = i2->rc_refcount;
2833 __entry->i3_startblock = i3->rc_startblock;
2834 __entry->i3_blockcount = i3->rc_blockcount;
2835 __entry->i3_refcount = i3->rc_refcount;
2836 ),
2837 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2838 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002839 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002840 MAJOR(__entry->dev), MINOR(__entry->dev),
2841 __entry->agno,
2842 __entry->i1_startblock,
2843 __entry->i1_blockcount,
2844 __entry->i1_refcount,
2845 __entry->i2_startblock,
2846 __entry->i2_blockcount,
2847 __entry->i2_refcount,
2848 __entry->i3_startblock,
2849 __entry->i3_blockcount,
2850 __entry->i3_refcount)
2851);
2852
2853#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2854DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2855 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2856 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2857 struct xfs_refcount_irec *i3), \
2858 TP_ARGS(mp, agno, i1, i2, i3))
2859
2860/* refcount btree tracepoints */
2861DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2862DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2863DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2864DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2865DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2866DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2867DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2868DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2869DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2870DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2871
2872/* refcount adjustment tracepoints */
2873DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2874DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002875DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2876DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002877DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2878DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002879DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002880DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2881DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2882DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2883DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2884DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2885DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002886DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002887DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2888DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2889DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2890DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2891DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2892DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2893DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2894
2895/* reflink helpers */
2896DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2897DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2898DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002899#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2900DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2901DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002902
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002903TRACE_EVENT(xfs_refcount_finish_one_leftover,
2904 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2905 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2906 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2907 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2908 TP_STRUCT__entry(
2909 __field(dev_t, dev)
2910 __field(xfs_agnumber_t, agno)
2911 __field(int, type)
2912 __field(xfs_agblock_t, agbno)
2913 __field(xfs_extlen_t, len)
2914 __field(xfs_agblock_t, new_agbno)
2915 __field(xfs_extlen_t, new_len)
2916 ),
2917 TP_fast_assign(
2918 __entry->dev = mp->m_super->s_dev;
2919 __entry->agno = agno;
2920 __entry->type = type;
2921 __entry->agbno = agbno;
2922 __entry->len = len;
2923 __entry->new_agbno = new_agbno;
2924 __entry->new_len = new_len;
2925 ),
2926 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2927 MAJOR(__entry->dev), MINOR(__entry->dev),
2928 __entry->type,
2929 __entry->agno,
2930 __entry->agbno,
2931 __entry->len,
2932 __entry->new_agbno,
2933 __entry->new_len)
2934);
2935
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002936/* simple inode-based error/%ip tracepoint class */
2937DECLARE_EVENT_CLASS(xfs_inode_error_class,
2938 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2939 TP_ARGS(ip, error, caller_ip),
2940 TP_STRUCT__entry(
2941 __field(dev_t, dev)
2942 __field(xfs_ino_t, ino)
2943 __field(int, error)
2944 __field(unsigned long, caller_ip)
2945 ),
2946 TP_fast_assign(
2947 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2948 __entry->ino = ip->i_ino;
2949 __entry->error = error;
2950 __entry->caller_ip = caller_ip;
2951 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002952 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002953 MAJOR(__entry->dev), MINOR(__entry->dev),
2954 __entry->ino,
2955 __entry->error,
2956 (char *)__entry->caller_ip)
2957);
2958
2959#define DEFINE_INODE_ERROR_EVENT(name) \
2960DEFINE_EVENT(xfs_inode_error_class, name, \
2961 TP_PROTO(struct xfs_inode *ip, int error, \
2962 unsigned long caller_ip), \
2963 TP_ARGS(ip, error, caller_ip))
2964
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002965/* reflink tracepoint classes */
2966
2967/* two-file io tracepoint class */
2968DECLARE_EVENT_CLASS(xfs_double_io_class,
2969 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2970 struct xfs_inode *dest, xfs_off_t doffset),
2971 TP_ARGS(src, soffset, len, dest, doffset),
2972 TP_STRUCT__entry(
2973 __field(dev_t, dev)
2974 __field(xfs_ino_t, src_ino)
2975 __field(loff_t, src_isize)
2976 __field(loff_t, src_disize)
2977 __field(loff_t, src_offset)
2978 __field(size_t, len)
2979 __field(xfs_ino_t, dest_ino)
2980 __field(loff_t, dest_isize)
2981 __field(loff_t, dest_disize)
2982 __field(loff_t, dest_offset)
2983 ),
2984 TP_fast_assign(
2985 __entry->dev = VFS_I(src)->i_sb->s_dev;
2986 __entry->src_ino = src->i_ino;
2987 __entry->src_isize = VFS_I(src)->i_size;
2988 __entry->src_disize = src->i_d.di_size;
2989 __entry->src_offset = soffset;
2990 __entry->len = len;
2991 __entry->dest_ino = dest->i_ino;
2992 __entry->dest_isize = VFS_I(dest)->i_size;
2993 __entry->dest_disize = dest->i_d.di_size;
2994 __entry->dest_offset = doffset;
2995 ),
2996 TP_printk("dev %d:%d count %zd "
2997 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
2998 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
2999 MAJOR(__entry->dev), MINOR(__entry->dev),
3000 __entry->len,
3001 __entry->src_ino,
3002 __entry->src_isize,
3003 __entry->src_disize,
3004 __entry->src_offset,
3005 __entry->dest_ino,
3006 __entry->dest_isize,
3007 __entry->dest_disize,
3008 __entry->dest_offset)
3009)
3010
3011#define DEFINE_DOUBLE_IO_EVENT(name) \
3012DEFINE_EVENT(xfs_double_io_class, name, \
3013 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3014 struct xfs_inode *dest, xfs_off_t doffset), \
3015 TP_ARGS(src, soffset, len, dest, doffset))
3016
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003017/* inode/irec events */
3018DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3019 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3020 TP_ARGS(ip, irec),
3021 TP_STRUCT__entry(
3022 __field(dev_t, dev)
3023 __field(xfs_ino_t, ino)
3024 __field(xfs_fileoff_t, lblk)
3025 __field(xfs_extlen_t, len)
3026 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003027 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003028 ),
3029 TP_fast_assign(
3030 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3031 __entry->ino = ip->i_ino;
3032 __entry->lblk = irec->br_startoff;
3033 __entry->len = irec->br_blockcount;
3034 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003035 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003036 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003037 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 -07003038 MAJOR(__entry->dev), MINOR(__entry->dev),
3039 __entry->ino,
3040 __entry->lblk,
3041 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003042 __entry->pblk,
3043 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003044);
3045#define DEFINE_INODE_IREC_EVENT(name) \
3046DEFINE_EVENT(xfs_inode_irec_class, name, \
3047 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3048 TP_ARGS(ip, irec))
3049
3050/* refcount/reflink tracepoint definitions */
3051
3052/* reflink tracepoints */
3053DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3054DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3055DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08003056DEFINE_IMAP_EVENT(xfs_reflink_remap_imap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003057TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3058 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3059 xfs_filblks_t len, struct xfs_inode *dest,
3060 xfs_fileoff_t doffset),
3061 TP_ARGS(src, soffset, len, dest, doffset),
3062 TP_STRUCT__entry(
3063 __field(dev_t, dev)
3064 __field(xfs_ino_t, src_ino)
3065 __field(xfs_fileoff_t, src_lblk)
3066 __field(xfs_filblks_t, len)
3067 __field(xfs_ino_t, dest_ino)
3068 __field(xfs_fileoff_t, dest_lblk)
3069 ),
3070 TP_fast_assign(
3071 __entry->dev = VFS_I(src)->i_sb->s_dev;
3072 __entry->src_ino = src->i_ino;
3073 __entry->src_lblk = soffset;
3074 __entry->len = len;
3075 __entry->dest_ino = dest->i_ino;
3076 __entry->dest_lblk = doffset;
3077 ),
3078 TP_printk("dev %d:%d len 0x%llx "
3079 "ino 0x%llx offset 0x%llx blocks -> "
3080 "ino 0x%llx offset 0x%llx blocks",
3081 MAJOR(__entry->dev), MINOR(__entry->dev),
3082 __entry->len,
3083 __entry->src_ino,
3084 __entry->src_lblk,
3085 __entry->dest_ino,
3086 __entry->dest_lblk)
3087);
3088TRACE_EVENT(xfs_reflink_punch_range,
3089 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3090 xfs_extlen_t len),
3091 TP_ARGS(ip, lblk, len),
3092 TP_STRUCT__entry(
3093 __field(dev_t, dev)
3094 __field(xfs_ino_t, ino)
3095 __field(xfs_fileoff_t, lblk)
3096 __field(xfs_extlen_t, len)
3097 ),
3098 TP_fast_assign(
3099 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3100 __entry->ino = ip->i_ino;
3101 __entry->lblk = lblk;
3102 __entry->len = len;
3103 ),
3104 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3105 MAJOR(__entry->dev), MINOR(__entry->dev),
3106 __entry->ino,
3107 __entry->lblk,
3108 __entry->len)
3109);
3110TRACE_EVENT(xfs_reflink_remap,
3111 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3112 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3113 TP_ARGS(ip, lblk, len, new_pblk),
3114 TP_STRUCT__entry(
3115 __field(dev_t, dev)
3116 __field(xfs_ino_t, ino)
3117 __field(xfs_fileoff_t, lblk)
3118 __field(xfs_extlen_t, len)
3119 __field(xfs_fsblock_t, new_pblk)
3120 ),
3121 TP_fast_assign(
3122 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3123 __entry->ino = ip->i_ino;
3124 __entry->lblk = lblk;
3125 __entry->len = len;
3126 __entry->new_pblk = new_pblk;
3127 ),
3128 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3129 MAJOR(__entry->dev), MINOR(__entry->dev),
3130 __entry->ino,
3131 __entry->lblk,
3132 __entry->len,
3133 __entry->new_pblk)
3134);
3135DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3136DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3137DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3138DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003139DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3140DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3141
3142/* dedupe tracepoints */
3143DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3144DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3145
3146/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003147TRACE_EVENT(xfs_ioctl_clone,
3148 TP_PROTO(struct inode *src, struct inode *dest),
3149 TP_ARGS(src, dest),
3150 TP_STRUCT__entry(
3151 __field(dev_t, dev)
3152 __field(unsigned long, src_ino)
3153 __field(loff_t, src_isize)
3154 __field(unsigned long, dest_ino)
3155 __field(loff_t, dest_isize)
3156 ),
3157 TP_fast_assign(
3158 __entry->dev = src->i_sb->s_dev;
3159 __entry->src_ino = src->i_ino;
3160 __entry->src_isize = i_size_read(src);
3161 __entry->dest_ino = dest->i_ino;
3162 __entry->dest_isize = i_size_read(dest);
3163 ),
3164 TP_printk("dev %d:%d "
3165 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003166 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003167 MAJOR(__entry->dev), MINOR(__entry->dev),
3168 __entry->src_ino,
3169 __entry->src_isize,
3170 __entry->dest_ino,
3171 __entry->dest_isize)
3172);
3173
3174/* unshare tracepoints */
3175DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003176DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003177
3178/* copy on write */
3179DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003180DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3181DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003182DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003183
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003184DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003185
3186DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3187DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3188DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003189
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003190DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3191DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3192
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003193
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003194DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003195
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003196/* rmap swapext tracepoints */
3197DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3198DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3199DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3200
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003201/* fsmap traces */
3202DECLARE_EVENT_CLASS(xfs_fsmap_class,
3203 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3204 struct xfs_rmap_irec *rmap),
3205 TP_ARGS(mp, keydev, agno, rmap),
3206 TP_STRUCT__entry(
3207 __field(dev_t, dev)
3208 __field(dev_t, keydev)
3209 __field(xfs_agnumber_t, agno)
3210 __field(xfs_fsblock_t, bno)
3211 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003212 __field(uint64_t, owner)
3213 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003214 __field(unsigned int, flags)
3215 ),
3216 TP_fast_assign(
3217 __entry->dev = mp->m_super->s_dev;
3218 __entry->keydev = new_decode_dev(keydev);
3219 __entry->agno = agno;
3220 __entry->bno = rmap->rm_startblock;
3221 __entry->len = rmap->rm_blockcount;
3222 __entry->owner = rmap->rm_owner;
3223 __entry->offset = rmap->rm_offset;
3224 __entry->flags = rmap->rm_flags;
3225 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003226 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 -07003227 MAJOR(__entry->dev), MINOR(__entry->dev),
3228 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3229 __entry->agno,
3230 __entry->bno,
3231 __entry->len,
3232 __entry->owner,
3233 __entry->offset,
3234 __entry->flags)
3235)
3236#define DEFINE_FSMAP_EVENT(name) \
3237DEFINE_EVENT(xfs_fsmap_class, name, \
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))
3241DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3242DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3243DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3244
3245DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3246 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3247 TP_ARGS(mp, fsmap),
3248 TP_STRUCT__entry(
3249 __field(dev_t, dev)
3250 __field(dev_t, keydev)
3251 __field(xfs_daddr_t, block)
3252 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003253 __field(uint64_t, owner)
3254 __field(uint64_t, offset)
3255 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003256 ),
3257 TP_fast_assign(
3258 __entry->dev = mp->m_super->s_dev;
3259 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3260 __entry->block = fsmap->fmr_physical;
3261 __entry->len = fsmap->fmr_length;
3262 __entry->owner = fsmap->fmr_owner;
3263 __entry->offset = fsmap->fmr_offset;
3264 __entry->flags = fsmap->fmr_flags;
3265 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003266 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 -07003267 MAJOR(__entry->dev), MINOR(__entry->dev),
3268 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3269 __entry->block,
3270 __entry->len,
3271 __entry->owner,
3272 __entry->offset,
3273 __entry->flags)
3274)
3275#define DEFINE_GETFSMAP_EVENT(name) \
3276DEFINE_EVENT(xfs_getfsmap_class, name, \
3277 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3278 TP_ARGS(mp, fsmap))
3279DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3280DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3281DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3282
Darrick J. Wongb872af22018-01-08 10:51:26 -08003283TRACE_EVENT(xfs_trans_resv_calc,
3284 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3285 struct xfs_trans_res *res),
3286 TP_ARGS(mp, type, res),
3287 TP_STRUCT__entry(
3288 __field(dev_t, dev)
3289 __field(int, type)
3290 __field(uint, logres)
3291 __field(int, logcount)
3292 __field(int, logflags)
3293 ),
3294 TP_fast_assign(
3295 __entry->dev = mp->m_super->s_dev;
3296 __entry->type = type;
3297 __entry->logres = res->tr_logres;
3298 __entry->logcount = res->tr_logcount;
3299 __entry->logflags = res->tr_logflags;
3300 ),
3301 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3302 MAJOR(__entry->dev), MINOR(__entry->dev),
3303 __entry->type,
3304 __entry->logres,
3305 __entry->logcount,
3306 __entry->logflags)
3307);
3308
Dave Chinnerba187812018-05-09 07:47:57 -07003309DECLARE_EVENT_CLASS(xfs_trans_class,
3310 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3311 TP_ARGS(tp, caller_ip),
3312 TP_STRUCT__entry(
3313 __field(dev_t, dev)
3314 __field(uint32_t, tid)
3315 __field(uint32_t, flags)
3316 __field(unsigned long, caller_ip)
3317 ),
3318 TP_fast_assign(
3319 __entry->dev = tp->t_mountp->m_super->s_dev;
3320 __entry->tid = 0;
3321 if (tp->t_ticket)
3322 __entry->tid = tp->t_ticket->t_tid;
3323 __entry->flags = tp->t_flags;
3324 __entry->caller_ip = caller_ip;
3325 ),
3326 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3327 MAJOR(__entry->dev), MINOR(__entry->dev),
3328 __entry->tid,
3329 __entry->flags,
3330 (char *)__entry->caller_ip)
3331)
3332
3333#define DEFINE_TRANS_EVENT(name) \
3334DEFINE_EVENT(xfs_trans_class, name, \
3335 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3336 TP_ARGS(tp, caller_ip))
3337DEFINE_TRANS_EVENT(xfs_trans_alloc);
3338DEFINE_TRANS_EVENT(xfs_trans_cancel);
3339DEFINE_TRANS_EVENT(xfs_trans_commit);
3340DEFINE_TRANS_EVENT(xfs_trans_dup);
3341DEFINE_TRANS_EVENT(xfs_trans_free);
3342DEFINE_TRANS_EVENT(xfs_trans_roll);
3343DEFINE_TRANS_EVENT(xfs_trans_add_item);
Christoph Hellwig195cd832019-06-28 19:27:31 -07003344DEFINE_TRANS_EVENT(xfs_trans_commit_items);
Dave Chinnerba187812018-05-09 07:47:57 -07003345DEFINE_TRANS_EVENT(xfs_trans_free_items);
3346
Darrick J. Wong9a4a5112019-02-07 10:37:14 -08003347TRACE_EVENT(xfs_iunlink_update_bucket,
3348 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3349 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3350 TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3351 TP_STRUCT__entry(
3352 __field(dev_t, dev)
3353 __field(xfs_agnumber_t, agno)
3354 __field(unsigned int, bucket)
3355 __field(xfs_agino_t, old_ptr)
3356 __field(xfs_agino_t, new_ptr)
3357 ),
3358 TP_fast_assign(
3359 __entry->dev = mp->m_super->s_dev;
3360 __entry->agno = agno;
3361 __entry->bucket = bucket;
3362 __entry->old_ptr = old_ptr;
3363 __entry->new_ptr = new_ptr;
3364 ),
3365 TP_printk("dev %d:%d agno %u bucket %u old 0x%x new 0x%x",
3366 MAJOR(__entry->dev), MINOR(__entry->dev),
3367 __entry->agno,
3368 __entry->bucket,
3369 __entry->old_ptr,
3370 __entry->new_ptr)
3371);
3372
Darrick J. Wongf2fc16a2019-02-07 10:37:15 -08003373TRACE_EVENT(xfs_iunlink_update_dinode,
3374 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3375 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3376 TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3377 TP_STRUCT__entry(
3378 __field(dev_t, dev)
3379 __field(xfs_agnumber_t, agno)
3380 __field(xfs_agino_t, agino)
3381 __field(xfs_agino_t, old_ptr)
3382 __field(xfs_agino_t, new_ptr)
3383 ),
3384 TP_fast_assign(
3385 __entry->dev = mp->m_super->s_dev;
3386 __entry->agno = agno;
3387 __entry->agino = agino;
3388 __entry->old_ptr = old_ptr;
3389 __entry->new_ptr = new_ptr;
3390 ),
3391 TP_printk("dev %d:%d agno %u agino 0x%x old 0x%x new 0x%x",
3392 MAJOR(__entry->dev), MINOR(__entry->dev),
3393 __entry->agno,
3394 __entry->agino,
3395 __entry->old_ptr,
3396 __entry->new_ptr)
3397);
3398
Darrick J. Wong4664c662019-02-07 10:37:16 -08003399DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3400 TP_PROTO(struct xfs_inode *ip),
3401 TP_ARGS(ip),
3402 TP_STRUCT__entry(
3403 __field(dev_t, dev)
3404 __field(xfs_agnumber_t, agno)
3405 __field(xfs_agino_t, agino)
3406 ),
3407 TP_fast_assign(
3408 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3409 __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3410 __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3411 ),
3412 TP_printk("dev %d:%d agno %u agino %u",
3413 MAJOR(__entry->dev), MINOR(__entry->dev),
3414 __entry->agno, __entry->agino)
3415)
3416
3417#define DEFINE_AGINODE_EVENT(name) \
3418DEFINE_EVENT(xfs_ag_inode_class, name, \
3419 TP_PROTO(struct xfs_inode *ip), \
3420 TP_ARGS(ip))
3421DEFINE_AGINODE_EVENT(xfs_iunlink);
3422DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
Darrick J. Wong9b247172019-02-07 10:37:16 -08003423DEFINE_AG_EVENT(xfs_iunlink_map_prev_fallback);
Darrick J. Wong4664c662019-02-07 10:37:16 -08003424
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003425DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3426 TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3427 TP_ARGS(mp, flags),
3428 TP_STRUCT__entry(
3429 __field(dev_t, dev)
3430 __field(unsigned int, flags)
3431 ),
3432 TP_fast_assign(
3433 __entry->dev = mp->m_super->s_dev;
3434 __entry->flags = flags;
3435 ),
3436 TP_printk("dev %d:%d flags 0x%x",
3437 MAJOR(__entry->dev), MINOR(__entry->dev),
3438 __entry->flags)
3439);
3440#define DEFINE_FS_CORRUPT_EVENT(name) \
3441DEFINE_EVENT(xfs_fs_corrupt_class, name, \
3442 TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3443 TP_ARGS(mp, flags))
3444DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3445DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003446DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003447DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3448DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003449DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003450
3451DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3452 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3453 TP_ARGS(mp, agno, flags),
3454 TP_STRUCT__entry(
3455 __field(dev_t, dev)
3456 __field(xfs_agnumber_t, agno)
3457 __field(unsigned int, flags)
3458 ),
3459 TP_fast_assign(
3460 __entry->dev = mp->m_super->s_dev;
3461 __entry->agno = agno;
3462 __entry->flags = flags;
3463 ),
3464 TP_printk("dev %d:%d agno %u flags 0x%x",
3465 MAJOR(__entry->dev), MINOR(__entry->dev),
3466 __entry->agno, __entry->flags)
3467);
3468#define DEFINE_AG_CORRUPT_EVENT(name) \
3469DEFINE_EVENT(xfs_ag_corrupt_class, name, \
3470 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3471 unsigned int flags), \
3472 TP_ARGS(mp, agno, flags))
3473DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3474DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003475DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003476
3477DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3478 TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3479 TP_ARGS(ip, flags),
3480 TP_STRUCT__entry(
3481 __field(dev_t, dev)
3482 __field(xfs_ino_t, ino)
3483 __field(unsigned int, flags)
3484 ),
3485 TP_fast_assign(
3486 __entry->dev = ip->i_mount->m_super->s_dev;
3487 __entry->ino = ip->i_ino;
3488 __entry->flags = flags;
3489 ),
3490 TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3491 MAJOR(__entry->dev), MINOR(__entry->dev),
3492 __entry->ino, __entry->flags)
3493);
3494#define DEFINE_INODE_CORRUPT_EVENT(name) \
3495DEFINE_EVENT(xfs_inode_corrupt_class, name, \
3496 TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3497 TP_ARGS(ip, flags))
3498DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3499DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3500
Darrick J. Wonga2114322019-07-02 09:39:38 -07003501TRACE_EVENT(xfs_iwalk_ag,
3502 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3503 xfs_agino_t startino),
3504 TP_ARGS(mp, agno, startino),
3505 TP_STRUCT__entry(
3506 __field(dev_t, dev)
3507 __field(xfs_agnumber_t, agno)
3508 __field(xfs_agino_t, startino)
3509 ),
3510 TP_fast_assign(
3511 __entry->dev = mp->m_super->s_dev;
3512 __entry->agno = agno;
3513 __entry->startino = startino;
3514 ),
3515 TP_printk("dev %d:%d agno %d startino %u",
3516 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3517 __entry->startino)
3518)
3519
3520TRACE_EVENT(xfs_iwalk_ag_rec,
3521 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3522 struct xfs_inobt_rec_incore *irec),
3523 TP_ARGS(mp, agno, irec),
3524 TP_STRUCT__entry(
3525 __field(dev_t, dev)
3526 __field(xfs_agnumber_t, agno)
3527 __field(xfs_agino_t, startino)
3528 __field(uint64_t, freemask)
3529 ),
3530 TP_fast_assign(
3531 __entry->dev = mp->m_super->s_dev;
3532 __entry->agno = agno;
3533 __entry->startino = irec->ir_startino;
3534 __entry->freemask = irec->ir_free;
3535 ),
3536 TP_printk("dev %d:%d agno %d startino %u freemask 0x%llx",
3537 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3538 __entry->startino, __entry->freemask)
3539)
3540
Darrick J. Wong40786712019-07-03 07:33:26 -07003541TRACE_EVENT(xfs_pwork_init,
3542 TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
3543 TP_ARGS(mp, nr_threads, pid),
3544 TP_STRUCT__entry(
3545 __field(dev_t, dev)
3546 __field(unsigned int, nr_threads)
3547 __field(pid_t, pid)
3548 ),
3549 TP_fast_assign(
3550 __entry->dev = mp->m_super->s_dev;
3551 __entry->nr_threads = nr_threads;
3552 __entry->pid = pid;
3553 ),
3554 TP_printk("dev %d:%d nr_threads %u pid %u",
3555 MAJOR(__entry->dev), MINOR(__entry->dev),
3556 __entry->nr_threads, __entry->pid)
3557)
3558
Dave Chinner0ad95682019-08-26 12:08:10 -07003559DECLARE_EVENT_CLASS(xfs_kmem_class,
3560 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
3561 TP_ARGS(size, flags, caller_ip),
3562 TP_STRUCT__entry(
3563 __field(ssize_t, size)
3564 __field(int, flags)
3565 __field(unsigned long, caller_ip)
3566 ),
3567 TP_fast_assign(
3568 __entry->size = size;
3569 __entry->flags = flags;
3570 __entry->caller_ip = caller_ip;
3571 ),
3572 TP_printk("size %zd flags 0x%x caller %pS",
3573 __entry->size,
3574 __entry->flags,
3575 (char *)__entry->caller_ip)
3576)
3577
3578#define DEFINE_KMEM_EVENT(name) \
3579DEFINE_EVENT(xfs_kmem_class, name, \
3580 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
3581 TP_ARGS(size, flags, caller_ip))
3582DEFINE_KMEM_EVENT(kmem_alloc);
Dave Chinnerf8f9ee42019-08-26 12:08:39 -07003583DEFINE_KMEM_EVENT(kmem_alloc_io);
Dave Chinner0ad95682019-08-26 12:08:10 -07003584DEFINE_KMEM_EVENT(kmem_alloc_large);
3585DEFINE_KMEM_EVENT(kmem_realloc);
3586DEFINE_KMEM_EVENT(kmem_zone_alloc);
3587
Darrick J. Wong13eaec42019-12-11 13:19:06 -08003588TRACE_EVENT(xfs_check_new_dalign,
3589 TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
3590 TP_ARGS(mp, new_dalign, calc_rootino),
3591 TP_STRUCT__entry(
3592 __field(dev_t, dev)
3593 __field(int, new_dalign)
3594 __field(xfs_ino_t, sb_rootino)
3595 __field(xfs_ino_t, calc_rootino)
3596 ),
3597 TP_fast_assign(
3598 __entry->dev = mp->m_super->s_dev;
3599 __entry->new_dalign = new_dalign;
3600 __entry->sb_rootino = mp->m_sb.sb_rootino;
3601 __entry->calc_rootino = calc_rootino;
3602 ),
3603 TP_printk("dev %d:%d new_dalign %d sb_rootino %llu calc_rootino %llu",
3604 MAJOR(__entry->dev), MINOR(__entry->dev),
3605 __entry->new_dalign, __entry->sb_rootino,
3606 __entry->calc_rootino)
3607)
3608
Darrick J. Wonge06536a2020-03-11 10:40:26 -07003609TRACE_EVENT(xfs_btree_commit_afakeroot,
3610 TP_PROTO(struct xfs_btree_cur *cur),
3611 TP_ARGS(cur),
3612 TP_STRUCT__entry(
3613 __field(dev_t, dev)
3614 __field(xfs_btnum_t, btnum)
3615 __field(xfs_agnumber_t, agno)
3616 __field(xfs_agblock_t, agbno)
3617 __field(unsigned int, levels)
3618 __field(unsigned int, blocks)
3619 ),
3620 TP_fast_assign(
3621 __entry->dev = cur->bc_mp->m_super->s_dev;
3622 __entry->btnum = cur->bc_btnum;
3623 __entry->agno = cur->bc_ag.agno;
3624 __entry->agbno = cur->bc_ag.afake->af_root;
3625 __entry->levels = cur->bc_ag.afake->af_levels;
3626 __entry->blocks = cur->bc_ag.afake->af_blocks;
3627 ),
3628 TP_printk("dev %d:%d btree %s ag %u levels %u blocks %u root %u",
3629 MAJOR(__entry->dev), MINOR(__entry->dev),
3630 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3631 __entry->agno,
3632 __entry->levels,
3633 __entry->blocks,
3634 __entry->agbno)
3635)
3636
Darrick J. Wong349e1c02020-03-11 10:42:34 -07003637TRACE_EVENT(xfs_btree_commit_ifakeroot,
3638 TP_PROTO(struct xfs_btree_cur *cur),
3639 TP_ARGS(cur),
3640 TP_STRUCT__entry(
3641 __field(dev_t, dev)
3642 __field(xfs_btnum_t, btnum)
3643 __field(xfs_agnumber_t, agno)
3644 __field(xfs_agino_t, agino)
3645 __field(unsigned int, levels)
3646 __field(unsigned int, blocks)
3647 __field(int, whichfork)
3648 ),
3649 TP_fast_assign(
3650 __entry->dev = cur->bc_mp->m_super->s_dev;
3651 __entry->btnum = cur->bc_btnum;
3652 __entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
3653 cur->bc_ino.ip->i_ino);
3654 __entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
3655 cur->bc_ino.ip->i_ino);
3656 __entry->levels = cur->bc_ino.ifake->if_levels;
3657 __entry->blocks = cur->bc_ino.ifake->if_blocks;
3658 __entry->whichfork = cur->bc_ino.whichfork;
3659 ),
3660 TP_printk("dev %d:%d btree %s ag %u agino %u whichfork %s levels %u blocks %u",
3661 MAJOR(__entry->dev), MINOR(__entry->dev),
3662 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3663 __entry->agno,
3664 __entry->agino,
3665 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
3666 __entry->levels,
3667 __entry->blocks)
3668)
3669
Darrick J. Wong60e3d702020-03-11 10:51:50 -07003670TRACE_EVENT(xfs_btree_bload_level_geometry,
3671 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3672 uint64_t nr_this_level, unsigned int nr_per_block,
3673 unsigned int desired_npb, uint64_t blocks,
3674 uint64_t blocks_with_extra),
3675 TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
3676 blocks_with_extra),
3677 TP_STRUCT__entry(
3678 __field(dev_t, dev)
3679 __field(xfs_btnum_t, btnum)
3680 __field(unsigned int, level)
3681 __field(unsigned int, nlevels)
3682 __field(uint64_t, nr_this_level)
3683 __field(unsigned int, nr_per_block)
3684 __field(unsigned int, desired_npb)
3685 __field(unsigned long long, blocks)
3686 __field(unsigned long long, blocks_with_extra)
3687 ),
3688 TP_fast_assign(
3689 __entry->dev = cur->bc_mp->m_super->s_dev;
3690 __entry->btnum = cur->bc_btnum;
3691 __entry->level = level;
3692 __entry->nlevels = cur->bc_nlevels;
3693 __entry->nr_this_level = nr_this_level;
3694 __entry->nr_per_block = nr_per_block;
3695 __entry->desired_npb = desired_npb;
3696 __entry->blocks = blocks;
3697 __entry->blocks_with_extra = blocks_with_extra;
3698 ),
3699 TP_printk("dev %d:%d btree %s level %u/%u nr_this_level %llu nr_per_block %u desired_npb %u blocks %llu blocks_with_extra %llu",
3700 MAJOR(__entry->dev), MINOR(__entry->dev),
3701 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3702 __entry->level,
3703 __entry->nlevels,
3704 __entry->nr_this_level,
3705 __entry->nr_per_block,
3706 __entry->desired_npb,
3707 __entry->blocks,
3708 __entry->blocks_with_extra)
3709)
3710
3711TRACE_EVENT(xfs_btree_bload_block,
3712 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3713 uint64_t block_idx, uint64_t nr_blocks,
3714 union xfs_btree_ptr *ptr, unsigned int nr_records),
3715 TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
3716 TP_STRUCT__entry(
3717 __field(dev_t, dev)
3718 __field(xfs_btnum_t, btnum)
3719 __field(unsigned int, level)
3720 __field(unsigned long long, block_idx)
3721 __field(unsigned long long, nr_blocks)
3722 __field(xfs_agnumber_t, agno)
3723 __field(xfs_agblock_t, agbno)
3724 __field(unsigned int, nr_records)
3725 ),
3726 TP_fast_assign(
3727 __entry->dev = cur->bc_mp->m_super->s_dev;
3728 __entry->btnum = cur->bc_btnum;
3729 __entry->level = level;
3730 __entry->block_idx = block_idx;
3731 __entry->nr_blocks = nr_blocks;
3732 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
3733 xfs_fsblock_t fsb = be64_to_cpu(ptr->l);
3734
3735 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
3736 __entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
3737 } else {
3738 __entry->agno = cur->bc_ag.agno;
3739 __entry->agbno = be32_to_cpu(ptr->s);
3740 }
3741 __entry->nr_records = nr_records;
3742 ),
3743 TP_printk("dev %d:%d btree %s level %u block %llu/%llu fsb (%u/%u) recs %u",
3744 MAJOR(__entry->dev), MINOR(__entry->dev),
3745 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3746 __entry->level,
3747 __entry->block_idx,
3748 __entry->nr_blocks,
3749 __entry->agno,
3750 __entry->agbno,
3751 __entry->nr_records)
3752)
3753
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003754#endif /* _TRACE_XFS_H */
3755
3756#undef TRACE_INCLUDE_PATH
3757#define TRACE_INCLUDE_PATH .
3758#define TRACE_INCLUDE_FILE xfs_trace
3759#include <trace/define_trace.h>