blob: 66c2d64c3354a596143c2f1f4e620ea582cc8554 [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 Chinner956f6da2021-06-18 11:57:05 -070027struct xlog_in_core;
Dave Chinner9abbc532010-04-13 15:06:46 +100028struct xfs_buf_log_format;
29struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050030struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100031struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070032struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070033struct xfs_fsmap;
34struct xfs_rmap_irec;
Dave Chinner0ad95682019-08-26 12:08:10 -070035struct xfs_icreate_log;
36struct xfs_owner_info;
37struct xfs_trans_res;
38struct xfs_inobt_rec_incore;
Darrick J. Wong60e3d702020-03-11 10:51:50 -070039union xfs_btree_ptr;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -070040struct xfs_dqtrx;
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -070041struct xfs_icwalk;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000042
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080043#define XFS_ATTR_FILTER_FLAGS \
44 { XFS_ATTR_ROOT, "ROOT" }, \
Christoph Hellwig254f8002020-02-26 17:30:43 -080045 { XFS_ATTR_SECURE, "SECURE" }, \
46 { XFS_ATTR_INCOMPLETE, "INCOMPLETE" }
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080047
Christoph Hellwigea9a4882009-12-21 14:03:03 +000048DECLARE_EVENT_CLASS(xfs_attr_list_class,
49 TP_PROTO(struct xfs_attr_list_context *ctx),
50 TP_ARGS(ctx),
51 TP_STRUCT__entry(
52 __field(dev_t, dev)
53 __field(xfs_ino_t, ino)
54 __field(u32, hashval)
55 __field(u32, blkno)
56 __field(u32, offset)
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080057 __field(void *, buffer)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000058 __field(int, bufsize)
59 __field(int, count)
60 __field(int, firstu)
61 __field(int, dupcnt)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080062 __field(unsigned int, attr_filter)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000063 ),
64 TP_fast_assign(
65 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
66 __entry->ino = ctx->dp->i_ino;
Christoph Hellwige3a19cd2020-02-26 17:30:43 -080067 __entry->hashval = ctx->cursor.hashval;
68 __entry->blkno = ctx->cursor.blkno;
69 __entry->offset = ctx->cursor.offset;
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080070 __entry->buffer = ctx->buffer;
Christoph Hellwigea9a4882009-12-21 14:03:03 +000071 __entry->bufsize = ctx->bufsize;
72 __entry->count = ctx->count;
73 __entry->firstu = ctx->firstu;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080074 __entry->attr_filter = ctx->attr_filter;
Christoph Hellwigea9a4882009-12-21 14:03:03 +000075 ),
76 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 -080077 "buffer %p size %u count %u firstu %u filter %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +000078 MAJOR(__entry->dev), MINOR(__entry->dev),
79 __entry->ino,
80 __entry->hashval,
81 __entry->blkno,
82 __entry->offset,
83 __entry->dupcnt,
Christoph Hellwiga9c8c692020-02-26 17:30:37 -080084 __entry->buffer,
Christoph Hellwigea9a4882009-12-21 14:03:03 +000085 __entry->bufsize,
86 __entry->count,
87 __entry->firstu,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -080088 __print_flags(__entry->attr_filter, "|",
89 XFS_ATTR_FILTER_FLAGS)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000090 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000091)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000092
93#define DEFINE_ATTR_LIST_EVENT(name) \
94DEFINE_EVENT(xfs_attr_list_class, name, \
95 TP_PROTO(struct xfs_attr_list_context *ctx), \
96 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000097DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
101DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
102DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
103DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
104DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +1100105DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
106DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000107
Darrick J. Wong63370322020-11-29 16:33:39 -0800108TRACE_EVENT(xlog_intent_recovery_failed,
109 TP_PROTO(struct xfs_mount *mp, int error, void *function),
110 TP_ARGS(mp, error, function),
111 TP_STRUCT__entry(
112 __field(dev_t, dev)
113 __field(int, error)
114 __field(void *, function)
115 ),
116 TP_fast_assign(
117 __entry->dev = mp->m_super->s_dev;
118 __entry->error = error;
119 __entry->function = function;
120 ),
121 TP_printk("dev %d:%d error %d function %pS",
122 MAJOR(__entry->dev), MINOR(__entry->dev),
123 __entry->error, __entry->function)
124);
125
Li Zefanf8adb4d2010-05-24 08:25:57 +0000126DECLARE_EVENT_CLASS(xfs_perag_class,
127 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
128 unsigned long caller_ip),
129 TP_ARGS(mp, agno, refcount, caller_ip),
130 TP_STRUCT__entry(
131 __field(dev_t, dev)
132 __field(xfs_agnumber_t, agno)
133 __field(int, refcount)
134 __field(unsigned long, caller_ip)
135 ),
136 TP_fast_assign(
137 __entry->dev = mp->m_super->s_dev;
138 __entry->agno = agno;
139 __entry->refcount = refcount;
140 __entry->caller_ip = caller_ip;
141 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700142 TP_printk("dev %d:%d agno 0x%x refcount %d caller %pS",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000143 MAJOR(__entry->dev), MINOR(__entry->dev),
144 __entry->agno,
145 __entry->refcount,
146 (char *)__entry->caller_ip)
147);
148
149#define DEFINE_PERAG_REF_EVENT(name) \
150DEFINE_EVENT(xfs_perag_class, name, \
151 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
152 unsigned long caller_ip), \
153 TP_ARGS(mp, agno, refcount, caller_ip))
154DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000155DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000156DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Darrick J. Wongc076ae72021-05-31 11:32:02 -0700157DEFINE_PERAG_REF_EVENT(xfs_perag_set_inode_tag);
158DEFINE_PERAG_REF_EVENT(xfs_perag_clear_inode_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000159
Darrick J. Wong40b1de0072021-08-06 11:05:43 -0700160TRACE_EVENT(xfs_inodegc_worker,
161 TP_PROTO(struct xfs_mount *mp, unsigned int shrinker_hits),
162 TP_ARGS(mp, shrinker_hits),
163 TP_STRUCT__entry(
164 __field(dev_t, dev)
165 __field(unsigned int, shrinker_hits)
166 ),
167 TP_fast_assign(
168 __entry->dev = mp->m_super->s_dev;
169 __entry->shrinker_hits = shrinker_hits;
170 ),
171 TP_printk("dev %d:%d shrinker_hits %u",
172 MAJOR(__entry->dev), MINOR(__entry->dev),
173 __entry->shrinker_hits)
174);
175
Dave Chinnerab23a772021-08-06 11:05:39 -0700176DECLARE_EVENT_CLASS(xfs_fs_class,
177 TP_PROTO(struct xfs_mount *mp, void *caller_ip),
178 TP_ARGS(mp, caller_ip),
179 TP_STRUCT__entry(
180 __field(dev_t, dev)
181 __field(unsigned long long, mflags)
182 __field(unsigned long, opstate)
183 __field(unsigned long, sbflags)
184 __field(void *, caller_ip)
185 ),
186 TP_fast_assign(
187 if (mp) {
188 __entry->dev = mp->m_super->s_dev;
189 __entry->mflags = mp->m_flags;
190 __entry->opstate = mp->m_opstate;
191 __entry->sbflags = mp->m_super->s_flags;
192 }
193 __entry->caller_ip = caller_ip;
194 ),
195 TP_printk("dev %d:%d m_flags 0x%llx opstate (%s) s_flags 0x%lx caller %pS",
196 MAJOR(__entry->dev), MINOR(__entry->dev),
197 __entry->mflags,
198 __print_flags(__entry->opstate, "|", XFS_OPSTATE_STRINGS),
199 __entry->sbflags,
200 __entry->caller_ip)
201);
202
203#define DEFINE_FS_EVENT(name) \
204DEFINE_EVENT(xfs_fs_class, name, \
205 TP_PROTO(struct xfs_mount *mp, void *caller_ip), \
206 TP_ARGS(mp, caller_ip))
207DEFINE_FS_EVENT(xfs_inodegc_flush);
208DEFINE_FS_EVENT(xfs_inodegc_start);
209DEFINE_FS_EVENT(xfs_inodegc_stop);
Dave Chinnerab23a772021-08-06 11:05:39 -0700210DEFINE_FS_EVENT(xfs_inodegc_queue);
211DEFINE_FS_EVENT(xfs_inodegc_throttle);
212DEFINE_FS_EVENT(xfs_fs_sync_fs);
Darrick J. Wong6f649092021-08-06 11:05:42 -0700213DEFINE_FS_EVENT(xfs_blockgc_start);
214DEFINE_FS_EVENT(xfs_blockgc_stop);
215DEFINE_FS_EVENT(xfs_blockgc_worker);
Darrick J. Wonge8d04c22021-08-06 11:05:42 -0700216DEFINE_FS_EVENT(xfs_blockgc_flush_all);
Dave Chinnerab23a772021-08-06 11:05:39 -0700217
Darrick J. Wong40b1de0072021-08-06 11:05:43 -0700218TRACE_EVENT(xfs_inodegc_shrinker_scan,
219 TP_PROTO(struct xfs_mount *mp, struct shrink_control *sc,
220 void *caller_ip),
221 TP_ARGS(mp, sc, caller_ip),
222 TP_STRUCT__entry(
223 __field(dev_t, dev)
224 __field(unsigned long, nr_to_scan)
225 __field(void *, caller_ip)
226 ),
227 TP_fast_assign(
228 __entry->dev = mp->m_super->s_dev;
229 __entry->nr_to_scan = sc->nr_to_scan;
230 __entry->caller_ip = caller_ip;
231 ),
232 TP_printk("dev %d:%d nr_to_scan %lu caller %pS",
233 MAJOR(__entry->dev), MINOR(__entry->dev),
234 __entry->nr_to_scan,
235 __entry->caller_ip)
236);
237
Dave Chinnerd1230312013-11-01 15:27:19 +1100238DECLARE_EVENT_CLASS(xfs_ag_class,
239 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
240 TP_ARGS(mp, agno),
241 TP_STRUCT__entry(
242 __field(dev_t, dev)
243 __field(xfs_agnumber_t, agno)
244 ),
245 TP_fast_assign(
246 __entry->dev = mp->m_super->s_dev;
247 __entry->agno = agno;
248 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700249 TP_printk("dev %d:%d agno 0x%x",
Dave Chinnerd1230312013-11-01 15:27:19 +1100250 MAJOR(__entry->dev), MINOR(__entry->dev),
251 __entry->agno)
252);
253#define DEFINE_AG_EVENT(name) \
254DEFINE_EVENT(xfs_ag_class, name, \
255 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
256 TP_ARGS(mp, agno))
257
258DEFINE_AG_EVENT(xfs_read_agf);
259DEFINE_AG_EVENT(xfs_alloc_read_agf);
260DEFINE_AG_EVENT(xfs_read_agi);
261DEFINE_AG_EVENT(xfs_ialloc_read_agi);
262
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000263TRACE_EVENT(xfs_attr_list_node_descend,
264 TP_PROTO(struct xfs_attr_list_context *ctx,
265 struct xfs_da_node_entry *btree),
266 TP_ARGS(ctx, btree),
267 TP_STRUCT__entry(
268 __field(dev_t, dev)
269 __field(xfs_ino_t, ino)
270 __field(u32, hashval)
271 __field(u32, blkno)
272 __field(u32, offset)
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800273 __field(void *, buffer)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000274 __field(int, bufsize)
275 __field(int, count)
276 __field(int, firstu)
277 __field(int, dupcnt)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800278 __field(unsigned int, attr_filter)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000279 __field(u32, bt_hashval)
280 __field(u32, bt_before)
281 ),
282 TP_fast_assign(
283 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
284 __entry->ino = ctx->dp->i_ino;
Christoph Hellwige3a19cd2020-02-26 17:30:43 -0800285 __entry->hashval = ctx->cursor.hashval;
286 __entry->blkno = ctx->cursor.blkno;
287 __entry->offset = ctx->cursor.offset;
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800288 __entry->buffer = ctx->buffer;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000289 __entry->bufsize = ctx->bufsize;
290 __entry->count = ctx->count;
291 __entry->firstu = ctx->firstu;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800292 __entry->attr_filter = ctx->attr_filter;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000293 __entry->bt_hashval = be32_to_cpu(btree->hashval);
294 __entry->bt_before = be32_to_cpu(btree->before);
295 ),
296 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 -0800297 "buffer %p size %u count %u firstu %u filter %s "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000298 "node hashval %u, node before %u",
299 MAJOR(__entry->dev), MINOR(__entry->dev),
300 __entry->ino,
301 __entry->hashval,
302 __entry->blkno,
303 __entry->offset,
304 __entry->dupcnt,
Christoph Hellwiga9c8c692020-02-26 17:30:37 -0800305 __entry->buffer,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000306 __entry->bufsize,
307 __entry->count,
308 __entry->firstu,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -0800309 __print_flags(__entry->attr_filter, "|",
310 XFS_ATTR_FILTER_FLAGS),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000311 __entry->bt_hashval,
312 __entry->bt_before)
313);
314
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000315DECLARE_EVENT_CLASS(xfs_bmap_class,
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700316 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000317 unsigned long caller_ip),
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700318 TP_ARGS(ip, cur, state, caller_ip),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000319 TP_STRUCT__entry(
320 __field(dev_t, dev)
321 __field(xfs_ino_t, ino)
Peter Zijlstra04ae87a2019-10-24 22:26:59 +0200322 __field(void *, leaf)
323 __field(int, pos)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000324 __field(xfs_fileoff_t, startoff)
325 __field(xfs_fsblock_t, startblock)
326 __field(xfs_filblks_t, blockcount)
327 __field(xfs_exntst_t, state)
328 __field(int, bmap_state)
329 __field(unsigned long, caller_ip)
330 ),
331 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700332 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000333 struct xfs_bmbt_irec r;
334
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700335 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700336 xfs_iext_get_extent(ifp, cur, &r);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000337 __entry->dev = VFS_I(ip)->i_sb->s_dev;
338 __entry->ino = ip->i_ino;
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700339 __entry->leaf = cur->leaf;
340 __entry->pos = cur->pos;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000341 __entry->startoff = r.br_startoff;
342 __entry->startblock = r.br_startblock;
343 __entry->blockcount = r.br_blockcount;
344 __entry->state = r.br_state;
345 __entry->bmap_state = state;
346 __entry->caller_ip = caller_ip;
347 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800348 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800349 "offset %lld block %lld count %lld flag %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000350 MAJOR(__entry->dev), MINOR(__entry->dev),
351 __entry->ino,
352 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700353 __entry->leaf,
354 __entry->pos,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000355 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700356 (int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000357 __entry->blockcount,
358 __entry->state,
359 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000360)
361
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000362#define DEFINE_BMAP_EVENT(name) \
363DEFINE_EVENT(xfs_bmap_class, name, \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700364 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000365 unsigned long caller_ip), \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700366 TP_ARGS(ip, cur, state, caller_ip))
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700367DEFINE_BMAP_EVENT(xfs_iext_insert);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000368DEFINE_BMAP_EVENT(xfs_iext_remove);
369DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
370DEFINE_BMAP_EVENT(xfs_bmap_post_update);
Christoph Hellwige8e0e172017-10-19 11:06:29 -0700371DEFINE_BMAP_EVENT(xfs_read_extent);
372DEFINE_BMAP_EVENT(xfs_write_extent);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000373
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000374DECLARE_EVENT_CLASS(xfs_buf_class,
375 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
376 TP_ARGS(bp, caller_ip),
377 TP_STRUCT__entry(
378 __field(dev_t, dev)
379 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000380 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000381 __field(int, hold)
382 __field(int, pincount)
383 __field(unsigned, lockval)
384 __field(unsigned, flags)
385 __field(unsigned long, caller_ip)
386 ),
387 TP_fast_assign(
388 __entry->dev = bp->b_target->bt_dev;
Dave Chinnerd61fa8c2018-11-19 13:31:07 -0800389 if (bp->b_bn == XFS_BUF_DADDR_NULL)
390 __entry->bno = bp->b_maps[0].bm_bn;
391 else
392 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000393 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000394 __entry->hold = atomic_read(&bp->b_hold);
395 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200396 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000397 __entry->flags = bp->b_flags;
398 __entry->caller_ip = caller_ip;
399 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000400 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800401 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000402 MAJOR(__entry->dev), MINOR(__entry->dev),
403 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000404 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000405 __entry->hold,
406 __entry->pincount,
407 __entry->lockval,
408 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
409 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000410)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000411
412#define DEFINE_BUF_EVENT(name) \
413DEFINE_EVENT(xfs_buf_class, name, \
414 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
415 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000416DEFINE_BUF_EVENT(xfs_buf_init);
417DEFINE_BUF_EVENT(xfs_buf_free);
418DEFINE_BUF_EVENT(xfs_buf_hold);
419DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000420DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000421DEFINE_BUF_EVENT(xfs_buf_submit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000422DEFINE_BUF_EVENT(xfs_buf_lock);
423DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000424DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200425DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000426DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000427DEFINE_BUF_EVENT(xfs_buf_iowait);
428DEFINE_BUF_EVENT(xfs_buf_iowait_done);
429DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000430DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000431DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700432DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000433DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000434DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig664ffb82020-09-01 10:55:29 -0700435DEFINE_BUF_EVENT(xfs_buf_iodone_async);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000436DEFINE_BUF_EVENT(xfs_buf_error_relse);
Brian Foster10fb9ac2021-01-22 16:48:19 -0800437DEFINE_BUF_EVENT(xfs_buf_drain_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000438DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
439
440/* not really buffer traces, but the buf provides useful information */
441DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000442DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000443
444/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000445DECLARE_EVENT_CLASS(xfs_buf_flags_class,
446 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
447 TP_ARGS(bp, flags, caller_ip),
448 TP_STRUCT__entry(
449 __field(dev_t, dev)
450 __field(xfs_daddr_t, bno)
451 __field(size_t, buffer_length)
452 __field(int, hold)
453 __field(int, pincount)
454 __field(unsigned, lockval)
455 __field(unsigned, flags)
456 __field(unsigned long, caller_ip)
457 ),
458 TP_fast_assign(
459 __entry->dev = bp->b_target->bt_dev;
460 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000461 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000462 __entry->flags = flags;
463 __entry->hold = atomic_read(&bp->b_hold);
464 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200465 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000466 __entry->caller_ip = caller_ip;
467 ),
468 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800469 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000470 MAJOR(__entry->dev), MINOR(__entry->dev),
471 (unsigned long long)__entry->bno,
472 __entry->buffer_length,
473 __entry->hold,
474 __entry->pincount,
475 __entry->lockval,
476 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
477 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000478)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000479
480#define DEFINE_BUF_FLAGS_EVENT(name) \
481DEFINE_EVENT(xfs_buf_flags_class, name, \
482 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
483 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000484DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
485DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
486DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
487
488TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800489 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000490 TP_ARGS(bp, error, caller_ip),
491 TP_STRUCT__entry(
492 __field(dev_t, dev)
493 __field(xfs_daddr_t, bno)
494 __field(size_t, buffer_length)
495 __field(unsigned, flags)
496 __field(int, hold)
497 __field(int, pincount)
498 __field(unsigned, lockval)
499 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800500 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000501 ),
502 TP_fast_assign(
503 __entry->dev = bp->b_target->bt_dev;
504 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000505 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000506 __entry->hold = atomic_read(&bp->b_hold);
507 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200508 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000509 __entry->error = error;
510 __entry->flags = bp->b_flags;
511 __entry->caller_ip = caller_ip;
512 ),
513 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800514 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000515 MAJOR(__entry->dev), MINOR(__entry->dev),
516 (unsigned long long)__entry->bno,
517 __entry->buffer_length,
518 __entry->hold,
519 __entry->pincount,
520 __entry->lockval,
521 __entry->error,
522 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
523 (void *)__entry->caller_ip)
524);
525
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000526DECLARE_EVENT_CLASS(xfs_buf_item_class,
527 TP_PROTO(struct xfs_buf_log_item *bip),
528 TP_ARGS(bip),
529 TP_STRUCT__entry(
530 __field(dev_t, dev)
531 __field(xfs_daddr_t, buf_bno)
532 __field(size_t, buf_len)
533 __field(int, buf_hold)
534 __field(int, buf_pincount)
535 __field(int, buf_lockval)
536 __field(unsigned, buf_flags)
537 __field(unsigned, bli_recur)
538 __field(int, bli_refcount)
539 __field(unsigned, bli_flags)
Dave Chinner22525c12018-05-09 07:47:34 -0700540 __field(unsigned long, li_flags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000541 ),
542 TP_fast_assign(
543 __entry->dev = bip->bli_buf->b_target->bt_dev;
544 __entry->bli_flags = bip->bli_flags;
545 __entry->bli_recur = bip->bli_recur;
546 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
547 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000548 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000549 __entry->buf_flags = bip->bli_buf->b_flags;
550 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
551 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200552 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000553 __entry->li_flags = bip->bli_item.li_flags;
554 ),
555 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
556 "lock %d flags %s recur %d refcount %d bliflags %s "
Dave Chinnere6631f82018-05-09 07:49:37 -0700557 "liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000558 MAJOR(__entry->dev), MINOR(__entry->dev),
559 (unsigned long long)__entry->buf_bno,
560 __entry->buf_len,
561 __entry->buf_hold,
562 __entry->buf_pincount,
563 __entry->buf_lockval,
564 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
565 __entry->bli_recur,
566 __entry->bli_refcount,
567 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000568 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000569)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000570
571#define DEFINE_BUF_ITEM_EVENT(name) \
572DEFINE_EVENT(xfs_buf_item_class, name, \
573 TP_PROTO(struct xfs_buf_log_item *bip), \
574 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000575DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000576DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000577DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
578DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
579DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000580DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000581DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
582DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
583DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwigddf92052019-06-28 19:27:32 -0700584DEFINE_BUF_ITEM_EVENT(xfs_buf_item_release);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000585DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
586DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
587DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
588DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
589DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
590DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
591DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
592DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
593DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
594DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
595DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
596DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
597DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
598DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
599
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000600DECLARE_EVENT_CLASS(xfs_filestream_class,
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700601 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno),
602 TP_ARGS(mp, ino, agno),
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000603 TP_STRUCT__entry(
604 __field(dev_t, dev)
605 __field(xfs_ino_t, ino)
606 __field(xfs_agnumber_t, agno)
607 __field(int, streams)
608 ),
609 TP_fast_assign(
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700610 __entry->dev = mp->m_super->s_dev;
611 __entry->ino = ino;
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000612 __entry->agno = agno;
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700613 __entry->streams = xfs_filestream_peek_ag(mp, agno);
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000614 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700615 TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d",
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000616 MAJOR(__entry->dev), MINOR(__entry->dev),
617 __entry->ino,
618 __entry->agno,
619 __entry->streams)
620)
621#define DEFINE_FILESTREAM_EVENT(name) \
622DEFINE_EVENT(xfs_filestream_class, name, \
Christoph Hellwig7fcd3ef2018-04-09 10:23:39 -0700623 TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino, xfs_agnumber_t agno), \
624 TP_ARGS(mp, ino, agno))
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000625DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
626DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
627DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
628
629TRACE_EVENT(xfs_filestream_pick,
630 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
631 xfs_extlen_t free, int nscan),
632 TP_ARGS(ip, agno, free, nscan),
633 TP_STRUCT__entry(
634 __field(dev_t, dev)
635 __field(xfs_ino_t, ino)
636 __field(xfs_agnumber_t, agno)
637 __field(int, streams)
638 __field(xfs_extlen_t, free)
639 __field(int, nscan)
640 ),
641 TP_fast_assign(
642 __entry->dev = VFS_I(ip)->i_sb->s_dev;
643 __entry->ino = ip->i_ino;
644 __entry->agno = agno;
645 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
646 __entry->free = free;
647 __entry->nscan = nscan;
648 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700649 TP_printk("dev %d:%d ino 0x%llx agno 0x%x streams %d free %d nscan %d",
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000650 MAJOR(__entry->dev), MINOR(__entry->dev),
651 __entry->ino,
652 __entry->agno,
653 __entry->streams,
654 __entry->free,
655 __entry->nscan)
656);
657
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000658DECLARE_EVENT_CLASS(xfs_lock_class,
659 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
660 unsigned long caller_ip),
661 TP_ARGS(ip, lock_flags, caller_ip),
662 TP_STRUCT__entry(
663 __field(dev_t, dev)
664 __field(xfs_ino_t, ino)
665 __field(int, lock_flags)
666 __field(unsigned long, caller_ip)
667 ),
668 TP_fast_assign(
669 __entry->dev = VFS_I(ip)->i_sb->s_dev;
670 __entry->ino = ip->i_ino;
671 __entry->lock_flags = lock_flags;
672 __entry->caller_ip = caller_ip;
673 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800674 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000675 MAJOR(__entry->dev), MINOR(__entry->dev),
676 __entry->ino,
677 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
678 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000679)
680
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000681#define DEFINE_LOCK_EVENT(name) \
682DEFINE_EVENT(xfs_lock_class, name, \
683 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
684 unsigned long caller_ip), \
685 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000686DEFINE_LOCK_EVENT(xfs_ilock);
687DEFINE_LOCK_EVENT(xfs_ilock_nowait);
688DEFINE_LOCK_EVENT(xfs_ilock_demote);
689DEFINE_LOCK_EVENT(xfs_iunlock);
690
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000691DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000692 TP_PROTO(struct xfs_inode *ip),
693 TP_ARGS(ip),
694 TP_STRUCT__entry(
695 __field(dev_t, dev)
696 __field(xfs_ino_t, ino)
Dave Chinnerab23a772021-08-06 11:05:39 -0700697 __field(unsigned long, iflags)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000698 ),
699 TP_fast_assign(
700 __entry->dev = VFS_I(ip)->i_sb->s_dev;
701 __entry->ino = ip->i_ino;
Dave Chinnerab23a772021-08-06 11:05:39 -0700702 __entry->iflags = ip->i_flags;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000703 ),
Dave Chinnerab23a772021-08-06 11:05:39 -0700704 TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000705 MAJOR(__entry->dev), MINOR(__entry->dev),
Dave Chinnerab23a772021-08-06 11:05:39 -0700706 __entry->ino,
707 __entry->iflags)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000708)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000709
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000710#define DEFINE_INODE_EVENT(name) \
711DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000712 TP_PROTO(struct xfs_inode *ip), \
713 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000714DEFINE_INODE_EVENT(xfs_iget_skip);
Darrick J. Wongff7bebe2021-06-18 11:57:05 -0700715DEFINE_INODE_EVENT(xfs_iget_recycle);
716DEFINE_INODE_EVENT(xfs_iget_recycle_fail);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000717DEFINE_INODE_EVENT(xfs_iget_hit);
718DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000719
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000720DEFINE_INODE_EVENT(xfs_getattr);
721DEFINE_INODE_EVENT(xfs_setattr);
722DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500723DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000724DEFINE_INODE_EVENT(xfs_alloc_file_space);
725DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000726DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100727DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100728DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000729DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000730#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200731DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000732#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000733DEFINE_INODE_EVENT(xfs_vm_bmap);
734DEFINE_INODE_EVENT(xfs_file_ioctl);
735DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
736DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000737DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000738DEFINE_INODE_EVENT(xfs_file_fsync);
739DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400740DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000741
742DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
743DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
744
Brian Foster27b52862012-11-06 09:50:38 -0500745DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
746DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500747DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700748DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
749DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
750DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Dave Chinnerab23a772021-08-06 11:05:39 -0700751DEFINE_INODE_EVENT(xfs_inode_set_reclaimable);
752DEFINE_INODE_EVENT(xfs_inode_reclaiming);
753DEFINE_INODE_EVENT(xfs_inode_set_need_inactive);
754DEFINE_INODE_EVENT(xfs_inode_inactivating);
Brian Foster27b52862012-11-06 09:50:38 -0500755
Darrick J. Wong85f8dff2018-12-18 14:32:29 -0800756/*
757 * ftrace's __print_symbolic requires that all enum values be wrapped in the
758 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
759 * ring buffer. Somehow this was only worth mentioning in the ftrace sample
760 * code.
761 */
762TRACE_DEFINE_ENUM(PE_SIZE_PTE);
763TRACE_DEFINE_ENUM(PE_SIZE_PMD);
764TRACE_DEFINE_ENUM(PE_SIZE_PUD);
765
Christoph Hellwigd522d562017-08-29 10:08:41 -0700766TRACE_EVENT(xfs_filemap_fault,
767 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
768 bool write_fault),
769 TP_ARGS(ip, pe_size, write_fault),
770 TP_STRUCT__entry(
771 __field(dev_t, dev)
772 __field(xfs_ino_t, ino)
773 __field(enum page_entry_size, pe_size)
774 __field(bool, write_fault)
775 ),
776 TP_fast_assign(
777 __entry->dev = VFS_I(ip)->i_sb->s_dev;
778 __entry->ino = ip->i_ino;
779 __entry->pe_size = pe_size;
780 __entry->write_fault = write_fault;
781 ),
782 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
783 MAJOR(__entry->dev), MINOR(__entry->dev),
784 __entry->ino,
785 __print_symbolic(__entry->pe_size,
786 { PE_SIZE_PTE, "PTE" },
787 { PE_SIZE_PMD, "PMD" },
788 { PE_SIZE_PUD, "PUD" }),
789 __entry->write_fault)
790)
791
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000792DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000793 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
794 TP_ARGS(ip, caller_ip),
795 TP_STRUCT__entry(
796 __field(dev_t, dev)
797 __field(xfs_ino_t, ino)
798 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100799 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000800 __field(unsigned long, caller_ip)
801 ),
802 TP_fast_assign(
803 __entry->dev = VFS_I(ip)->i_sb->s_dev;
804 __entry->ino = ip->i_ino;
805 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100806 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000807 __entry->caller_ip = caller_ip;
808 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800809 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000810 MAJOR(__entry->dev), MINOR(__entry->dev),
811 __entry->ino,
812 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100813 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000814 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000815)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000816
Brian Foster19cb7e32013-03-18 10:51:48 -0400817TRACE_EVENT(xfs_iomap_prealloc_size,
818 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
819 unsigned int writeio_blocks),
820 TP_ARGS(ip, blocks, shift, writeio_blocks),
821 TP_STRUCT__entry(
822 __field(dev_t, dev)
823 __field(xfs_ino_t, ino)
824 __field(xfs_fsblock_t, blocks)
825 __field(int, shift)
826 __field(unsigned int, writeio_blocks)
827 ),
828 TP_fast_assign(
829 __entry->dev = VFS_I(ip)->i_sb->s_dev;
830 __entry->ino = ip->i_ino;
831 __entry->blocks = blocks;
832 __entry->shift = shift;
833 __entry->writeio_blocks = writeio_blocks;
834 ),
835 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
Christoph Hellwig5da8a072019-10-28 08:41:44 -0700836 "m_allocsize_blocks %u",
Brian Foster19cb7e32013-03-18 10:51:48 -0400837 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
838 __entry->blocks, __entry->shift, __entry->writeio_blocks)
839)
840
Brian Foster56d11152015-05-29 09:18:32 +1000841TRACE_EVENT(xfs_irec_merge_pre,
842 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
843 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
844 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
845 TP_STRUCT__entry(
846 __field(dev_t, dev)
847 __field(xfs_agnumber_t, agno)
848 __field(xfs_agino_t, agino)
849 __field(uint16_t, holemask)
850 __field(xfs_agino_t, nagino)
851 __field(uint16_t, nholemask)
852 ),
853 TP_fast_assign(
854 __entry->dev = mp->m_super->s_dev;
855 __entry->agno = agno;
856 __entry->agino = agino;
857 __entry->holemask = holemask;
858 __entry->nagino = nagino;
859 __entry->nholemask = holemask;
860 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700861 TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x new_agino 0x%x new_holemask 0x%x",
Darrick J. Wongaf6265a2021-08-17 09:20:27 -0700862 MAJOR(__entry->dev), MINOR(__entry->dev),
863 __entry->agno,
864 __entry->agino,
865 __entry->holemask,
866 __entry->nagino,
Brian Foster56d11152015-05-29 09:18:32 +1000867 __entry->nholemask)
868)
869
870TRACE_EVENT(xfs_irec_merge_post,
871 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
872 uint16_t holemask),
873 TP_ARGS(mp, agno, agino, holemask),
874 TP_STRUCT__entry(
875 __field(dev_t, dev)
876 __field(xfs_agnumber_t, agno)
877 __field(xfs_agino_t, agino)
878 __field(uint16_t, holemask)
879 ),
880 TP_fast_assign(
881 __entry->dev = mp->m_super->s_dev;
882 __entry->agno = agno;
883 __entry->agino = agino;
884 __entry->holemask = holemask;
885 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -0700886 TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x",
Darrick J. Wongaf6265a2021-08-17 09:20:27 -0700887 MAJOR(__entry->dev),
888 MINOR(__entry->dev),
889 __entry->agno,
890 __entry->agino,
Brian Foster56d11152015-05-29 09:18:32 +1000891 __entry->holemask)
892)
893
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000894#define DEFINE_IREF_EVENT(name) \
895DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000896 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
897 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000898DEFINE_IREF_EVENT(xfs_irele);
899DEFINE_IREF_EVENT(xfs_inode_pin);
900DEFINE_IREF_EVENT(xfs_inode_unpin);
901DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100902
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000903DECLARE_EVENT_CLASS(xfs_namespace_class,
904 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
905 TP_ARGS(dp, name),
906 TP_STRUCT__entry(
907 __field(dev_t, dev)
908 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000909 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000910 __dynamic_array(char, name, name->len)
911 ),
912 TP_fast_assign(
913 __entry->dev = VFS_I(dp)->i_sb->s_dev;
914 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000915 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000916 memcpy(__get_str(name), name->name, name->len);
917 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000918 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000919 MAJOR(__entry->dev), MINOR(__entry->dev),
920 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000921 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000922 __get_str(name))
923)
924
925#define DEFINE_NAMESPACE_EVENT(name) \
926DEFINE_EVENT(xfs_namespace_class, name, \
927 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
928 TP_ARGS(dp, name))
929DEFINE_NAMESPACE_EVENT(xfs_remove);
930DEFINE_NAMESPACE_EVENT(xfs_link);
931DEFINE_NAMESPACE_EVENT(xfs_lookup);
932DEFINE_NAMESPACE_EVENT(xfs_create);
933DEFINE_NAMESPACE_EVENT(xfs_symlink);
934
935TRACE_EVENT(xfs_rename,
936 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
937 struct xfs_name *src_name, struct xfs_name *target_name),
938 TP_ARGS(src_dp, target_dp, src_name, target_name),
939 TP_STRUCT__entry(
940 __field(dev_t, dev)
941 __field(xfs_ino_t, src_dp_ino)
942 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000943 __field(int, src_namelen)
944 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000945 __dynamic_array(char, src_name, src_name->len)
946 __dynamic_array(char, target_name, target_name->len)
947 ),
948 TP_fast_assign(
949 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
950 __entry->src_dp_ino = src_dp->i_ino;
951 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000952 __entry->src_namelen = src_name->len;
953 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000954 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000955 memcpy(__get_str(target_name), target_name->name,
956 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000957 ),
958 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000959 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000960 MAJOR(__entry->dev), MINOR(__entry->dev),
961 __entry->src_dp_ino,
962 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000963 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000964 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000965 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000966 __get_str(target_name))
967)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000968
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000969DECLARE_EVENT_CLASS(xfs_dquot_class,
970 TP_PROTO(struct xfs_dquot *dqp),
971 TP_ARGS(dqp),
972 TP_STRUCT__entry(
973 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000974 __field(u32, id)
Darrick J. Wong1a7ed272020-07-15 17:53:43 -0700975 __field(xfs_dqtype_t, type)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000976 __field(unsigned, flags)
977 __field(unsigned, nrefs)
978 __field(unsigned long long, res_bcount)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700979 __field(unsigned long long, res_rtbcount)
980 __field(unsigned long long, res_icount)
981
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000982 __field(unsigned long long, bcount)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700983 __field(unsigned long long, rtbcount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000984 __field(unsigned long long, icount)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700985
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000986 __field(unsigned long long, blk_hardlimit)
987 __field(unsigned long long, blk_softlimit)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700988 __field(unsigned long long, rtb_hardlimit)
989 __field(unsigned long long, rtb_softlimit)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000990 __field(unsigned long long, ino_hardlimit)
991 __field(unsigned long long, ino_softlimit)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700992 ),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000993 TP_fast_assign(
994 __entry->dev = dqp->q_mount->m_super->s_dev;
Darrick J. Wongc51df732020-07-14 10:37:30 -0700995 __entry->id = dqp->q_id;
Darrick J. Wong1a7ed272020-07-15 17:53:43 -0700996 __entry->type = dqp->q_type;
997 __entry->flags = dqp->q_flags;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000998 __entry->nrefs = dqp->q_nrefs;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -0700999
Darrick J. Wong784e80f2020-07-14 10:37:30 -07001000 __entry->res_bcount = dqp->q_blk.reserved;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001001 __entry->res_rtbcount = dqp->q_rtb.reserved;
1002 __entry->res_icount = dqp->q_ino.reserved;
1003
Darrick J. Wongbe37d402020-07-14 10:37:31 -07001004 __entry->bcount = dqp->q_blk.count;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001005 __entry->rtbcount = dqp->q_rtb.count;
Darrick J. Wongbe37d402020-07-14 10:37:31 -07001006 __entry->icount = dqp->q_ino.count;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001007
Darrick J. Wongd3537cf2020-07-14 10:37:31 -07001008 __entry->blk_hardlimit = dqp->q_blk.hardlimit;
1009 __entry->blk_softlimit = dqp->q_blk.softlimit;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001010 __entry->rtb_hardlimit = dqp->q_rtb.hardlimit;
1011 __entry->rtb_softlimit = dqp->q_rtb.softlimit;
Darrick J. Wongd3537cf2020-07-14 10:37:31 -07001012 __entry->ino_hardlimit = dqp->q_ino.hardlimit;
1013 __entry->ino_softlimit = dqp->q_ino.softlimit;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001014 ),
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001015 TP_printk("dev %d:%d id 0x%x type %s flags %s nrefs %u "
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001016 "res_bc 0x%llx res_rtbc 0x%llx res_ic 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +00001017 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001018 "rtbcnt 0x%llx rtbhardlimit 0x%llx rtbsoftlimit 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +00001019 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001020 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +00001021 __entry->id,
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001022 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
Darrick J. Wong985a78f2020-07-14 10:37:13 -07001023 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001024 __entry->nrefs,
1025 __entry->res_bcount,
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001026 __entry->res_rtbcount,
1027 __entry->res_icount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001028 __entry->bcount,
1029 __entry->blk_hardlimit,
1030 __entry->blk_softlimit,
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001031 __entry->rtbcount,
1032 __entry->rtb_hardlimit,
1033 __entry->rtb_softlimit,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001034 __entry->icount,
1035 __entry->ino_hardlimit,
1036 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001037)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001038
1039#define DEFINE_DQUOT_EVENT(name) \
1040DEFINE_EVENT(xfs_dquot_class, name, \
1041 TP_PROTO(struct xfs_dquot *dqp), \
1042 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001043DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001044DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
1045DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +00001046DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
1047DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001048DEFINE_DQUOT_EVENT(xfs_dqattach_found);
1049DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001050DEFINE_DQUOT_EVENT(xfs_dqalloc);
1051DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
1052DEFINE_DQUOT_EVENT(xfs_dqread);
1053DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001054DEFINE_DQUOT_EVENT(xfs_dqget_hit);
1055DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +00001056DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
1057DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001058DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001059DEFINE_DQUOT_EVENT(xfs_dqput_free);
1060DEFINE_DQUOT_EVENT(xfs_dqrele);
1061DEFINE_DQUOT_EVENT(xfs_dqflush);
1062DEFINE_DQUOT_EVENT(xfs_dqflush_force);
1063DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001064DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_before);
1065DEFINE_DQUOT_EVENT(xfs_trans_apply_dquot_deltas_after);
1066
1067#define XFS_QMOPT_FLAGS \
1068 { XFS_QMOPT_UQUOTA, "UQUOTA" }, \
1069 { XFS_QMOPT_PQUOTA, "PQUOTA" }, \
1070 { XFS_QMOPT_FORCE_RES, "FORCE_RES" }, \
1071 { XFS_QMOPT_SBVERSION, "SBVERSION" }, \
1072 { XFS_QMOPT_GQUOTA, "GQUOTA" }, \
1073 { XFS_QMOPT_INHERIT, "INHERIT" }, \
1074 { XFS_QMOPT_RES_REGBLKS, "RES_REGBLKS" }, \
1075 { XFS_QMOPT_RES_RTBLKS, "RES_RTBLKS" }, \
1076 { XFS_QMOPT_BCOUNT, "BCOUNT" }, \
1077 { XFS_QMOPT_ICOUNT, "ICOUNT" }, \
1078 { XFS_QMOPT_RTBCOUNT, "RTBCOUNT" }, \
1079 { XFS_QMOPT_DELBCOUNT, "DELBCOUNT" }, \
1080 { XFS_QMOPT_DELRTBCOUNT, "DELRTBCOUNT" }, \
1081 { XFS_QMOPT_RES_INOS, "RES_INOS" }
1082
1083TRACE_EVENT(xfs_trans_mod_dquot,
1084 TP_PROTO(struct xfs_trans *tp, struct xfs_dquot *dqp,
1085 unsigned int field, int64_t delta),
1086 TP_ARGS(tp, dqp, field, delta),
1087 TP_STRUCT__entry(
1088 __field(dev_t, dev)
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001089 __field(xfs_dqtype_t, type)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001090 __field(unsigned int, flags)
1091 __field(unsigned int, dqid)
1092 __field(unsigned int, field)
1093 __field(int64_t, delta)
1094 ),
1095 TP_fast_assign(
1096 __entry->dev = tp->t_mountp->m_super->s_dev;
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001097 __entry->type = dqp->q_type;
1098 __entry->flags = dqp->q_flags;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001099 __entry->dqid = dqp->q_id;
1100 __entry->field = field;
1101 __entry->delta = delta;
1102 ),
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001103 TP_printk("dev %d:%d dquot id 0x%x type %s flags %s field %s delta %lld",
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001104 MAJOR(__entry->dev), MINOR(__entry->dev),
1105 __entry->dqid,
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001106 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001107 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1108 __print_flags(__entry->field, "|", XFS_QMOPT_FLAGS),
1109 __entry->delta)
1110);
1111
1112DECLARE_EVENT_CLASS(xfs_dqtrx_class,
1113 TP_PROTO(struct xfs_dqtrx *qtrx),
1114 TP_ARGS(qtrx),
1115 TP_STRUCT__entry(
1116 __field(dev_t, dev)
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001117 __field(xfs_dqtype_t, type)
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001118 __field(unsigned int, flags)
1119 __field(u32, dqid)
1120
1121 __field(uint64_t, blk_res)
1122 __field(int64_t, bcount_delta)
1123 __field(int64_t, delbcnt_delta)
1124
1125 __field(uint64_t, rtblk_res)
1126 __field(uint64_t, rtblk_res_used)
1127 __field(int64_t, rtbcount_delta)
1128 __field(int64_t, delrtb_delta)
1129
1130 __field(uint64_t, ino_res)
1131 __field(uint64_t, ino_res_used)
1132 __field(int64_t, icount_delta)
1133 ),
1134 TP_fast_assign(
1135 __entry->dev = qtrx->qt_dquot->q_mount->m_super->s_dev;
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001136 __entry->type = qtrx->qt_dquot->q_type;
1137 __entry->flags = qtrx->qt_dquot->q_flags;
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001138 __entry->dqid = qtrx->qt_dquot->q_id;
1139
1140 __entry->blk_res = qtrx->qt_blk_res;
1141 __entry->bcount_delta = qtrx->qt_bcount_delta;
1142 __entry->delbcnt_delta = qtrx->qt_delbcnt_delta;
1143
1144 __entry->rtblk_res = qtrx->qt_rtblk_res;
1145 __entry->rtblk_res_used = qtrx->qt_rtblk_res_used;
1146 __entry->rtbcount_delta = qtrx->qt_rtbcount_delta;
1147 __entry->delrtb_delta = qtrx->qt_delrtb_delta;
1148
1149 __entry->ino_res = qtrx->qt_ino_res;
1150 __entry->ino_res_used = qtrx->qt_ino_res_used;
1151 __entry->icount_delta = qtrx->qt_icount_delta;
1152 ),
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001153 TP_printk("dev %d:%d dquot id 0x%x type %s flags %s"
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001154 "blk_res %llu bcount_delta %lld delbcnt_delta %lld "
1155 "rtblk_res %llu rtblk_res_used %llu rtbcount_delta %lld delrtb_delta %lld "
1156 "ino_res %llu ino_res_used %llu icount_delta %lld",
1157 MAJOR(__entry->dev), MINOR(__entry->dev),
1158 __entry->dqid,
Darrick J. Wong1a7ed272020-07-15 17:53:43 -07001159 __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
Darrick J. Wong2cb91ba2020-07-14 10:37:35 -07001160 __print_flags(__entry->flags, "|", XFS_DQFLAG_STRINGS),
1161
1162 __entry->blk_res,
1163 __entry->bcount_delta,
1164 __entry->delbcnt_delta,
1165
1166 __entry->rtblk_res,
1167 __entry->rtblk_res_used,
1168 __entry->rtbcount_delta,
1169 __entry->delrtb_delta,
1170
1171 __entry->ino_res,
1172 __entry->ino_res_used,
1173 __entry->icount_delta)
1174)
1175
1176#define DEFINE_DQTRX_EVENT(name) \
1177DEFINE_EVENT(xfs_dqtrx_class, name, \
1178 TP_PROTO(struct xfs_dqtrx *qtrx), \
1179 TP_ARGS(qtrx))
1180DEFINE_DQTRX_EVENT(xfs_trans_apply_dquot_deltas);
1181DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_before);
1182DEFINE_DQTRX_EVENT(xfs_trans_mod_dquot_after);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001183
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001184DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001185 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001186 TP_ARGS(log, tic),
1187 TP_STRUCT__entry(
1188 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001189 __field(char, ocnt)
1190 __field(char, cnt)
1191 __field(int, curr_res)
1192 __field(int, unit_res)
1193 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +11001194 __field(int, reserveq)
1195 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001196 __field(int, grant_reserve_cycle)
1197 __field(int, grant_reserve_bytes)
1198 __field(int, grant_write_cycle)
1199 __field(int, grant_write_bytes)
1200 __field(int, curr_cycle)
1201 __field(int, curr_block)
1202 __field(xfs_lsn_t, tail_lsn)
1203 ),
1204 TP_fast_assign(
1205 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001206 __entry->ocnt = tic->t_ocnt;
1207 __entry->cnt = tic->t_cnt;
1208 __entry->curr_res = tic->t_curr_res;
1209 __entry->unit_res = tic->t_unit_res;
1210 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +00001211 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
1212 __entry->writeq = list_empty(&log->l_write_head.waiters);
1213 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +11001214 &__entry->grant_reserve_cycle,
1215 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +00001216 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +11001217 &__entry->grant_write_cycle,
1218 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001219 __entry->curr_cycle = log->l_curr_cycle;
1220 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +11001221 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001222 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +10001223 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +11001224 "t_unit_res %u t_flags %s reserveq %s "
1225 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001226 "grant_reserve_bytes %d grant_write_cycle %d "
1227 "grant_write_bytes %d curr_cycle %d curr_block %d "
1228 "tail_cycle %d tail_block %d",
1229 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001230 __entry->ocnt,
1231 __entry->cnt,
1232 __entry->curr_res,
1233 __entry->unit_res,
1234 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +11001235 __entry->reserveq ? "empty" : "active",
1236 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001237 __entry->grant_reserve_cycle,
1238 __entry->grant_reserve_bytes,
1239 __entry->grant_write_cycle,
1240 __entry->grant_write_bytes,
1241 __entry->curr_cycle,
1242 __entry->curr_block,
1243 CYCLE_LSN(__entry->tail_lsn),
1244 BLOCK_LSN(__entry->tail_lsn)
1245 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001246)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001247
1248#define DEFINE_LOGGRANT_EVENT(name) \
1249DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001250 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001251 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001252DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001253DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1254DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001255DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001256DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1257DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1258DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1259DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig8b41e3f2020-03-25 18:18:23 -07001260DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant);
1261DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_exit);
1262DEFINE_LOGGRANT_EVENT(xfs_log_ticket_regrant_sub);
1263DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant);
1264DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_sub);
1265DEFINE_LOGGRANT_EVENT(xfs_log_ticket_ungrant_exit);
Dave Chinner0e7ab7e2020-03-24 20:10:27 -07001266DEFINE_LOGGRANT_EVENT(xfs_log_cil_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001267
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001268DECLARE_EVENT_CLASS(xfs_log_item_class,
1269 TP_PROTO(struct xfs_log_item *lip),
1270 TP_ARGS(lip),
1271 TP_STRUCT__entry(
1272 __field(dev_t, dev)
1273 __field(void *, lip)
1274 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001275 __field(unsigned long, flags)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001276 __field(xfs_lsn_t, lsn)
1277 ),
1278 TP_fast_assign(
1279 __entry->dev = lip->li_mountp->m_super->s_dev;
1280 __entry->lip = lip;
1281 __entry->type = lip->li_type;
1282 __entry->flags = lip->li_flags;
1283 __entry->lsn = lip->li_lsn;
1284 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001285 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001286 MAJOR(__entry->dev), MINOR(__entry->dev),
1287 __entry->lip,
1288 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1289 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1290 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1291)
1292
Dave Chinner14c26c62012-04-24 16:33:31 +10001293TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001294 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1295 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001296 TP_STRUCT__entry(
1297 __field(dev_t, dev)
1298 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001299 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001300 ),
1301 TP_fast_assign(
1302 __entry->dev = mp->m_super->s_dev;
1303 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001304 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001305 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001306 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001307 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001308 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001309)
1310
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001311#define DEFINE_LOG_ITEM_EVENT(name) \
1312DEFINE_EVENT(xfs_log_item_class, name, \
1313 TP_PROTO(struct xfs_log_item *lip), \
1314 TP_ARGS(lip))
1315DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001316DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1317DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001318DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001319
Dave Chinner750b9c92013-11-01 15:27:18 +11001320DECLARE_EVENT_CLASS(xfs_ail_class,
1321 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1322 TP_ARGS(lip, old_lsn, new_lsn),
1323 TP_STRUCT__entry(
1324 __field(dev_t, dev)
1325 __field(void *, lip)
1326 __field(uint, type)
Dave Chinner22525c12018-05-09 07:47:34 -07001327 __field(unsigned long, flags)
Dave Chinner750b9c92013-11-01 15:27:18 +11001328 __field(xfs_lsn_t, old_lsn)
1329 __field(xfs_lsn_t, new_lsn)
1330 ),
1331 TP_fast_assign(
1332 __entry->dev = lip->li_mountp->m_super->s_dev;
1333 __entry->lip = lip;
1334 __entry->type = lip->li_type;
1335 __entry->flags = lip->li_flags;
1336 __entry->old_lsn = old_lsn;
1337 __entry->new_lsn = new_lsn;
1338 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001339 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 +11001340 MAJOR(__entry->dev), MINOR(__entry->dev),
1341 __entry->lip,
1342 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1343 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1344 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1345 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1346)
1347
1348#define DEFINE_AIL_EVENT(name) \
1349DEFINE_EVENT(xfs_ail_class, name, \
1350 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1351 TP_ARGS(lip, old_lsn, new_lsn))
1352DEFINE_AIL_EVENT(xfs_ail_insert);
1353DEFINE_AIL_EVENT(xfs_ail_move);
1354DEFINE_AIL_EVENT(xfs_ail_delete);
1355
1356TRACE_EVENT(xfs_log_assign_tail_lsn,
1357 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1358 TP_ARGS(log, new_lsn),
1359 TP_STRUCT__entry(
1360 __field(dev_t, dev)
1361 __field(xfs_lsn_t, new_lsn)
1362 __field(xfs_lsn_t, old_lsn)
1363 __field(xfs_lsn_t, last_sync_lsn)
1364 ),
1365 TP_fast_assign(
1366 __entry->dev = log->l_mp->m_super->s_dev;
1367 __entry->new_lsn = new_lsn;
1368 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1369 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1370 ),
1371 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1372 MAJOR(__entry->dev), MINOR(__entry->dev),
1373 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1374 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1375 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1376)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001377
Li Zefanf8adb4d2010-05-24 08:25:57 +00001378DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3e40b132021-01-23 10:06:29 -08001379 TP_PROTO(struct kiocb *iocb, struct iov_iter *iter),
1380 TP_ARGS(iocb, iter),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001381 TP_STRUCT__entry(
1382 __field(dev_t, dev)
1383 __field(xfs_ino_t, ino)
1384 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001385 __field(loff_t, offset)
1386 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001387 ),
1388 TP_fast_assign(
Christoph Hellwig3e40b132021-01-23 10:06:29 -08001389 __entry->dev = file_inode(iocb->ki_filp)->i_sb->s_dev;
1390 __entry->ino = XFS_I(file_inode(iocb->ki_filp))->i_ino;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001391 __entry->size = XFS_I(file_inode(iocb->ki_filp))->i_disk_size;
Christoph Hellwig3e40b132021-01-23 10:06:29 -08001392 __entry->offset = iocb->ki_pos;
1393 __entry->count = iov_iter_count(iter);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001394 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001395 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001396 MAJOR(__entry->dev), MINOR(__entry->dev),
1397 __entry->ino,
1398 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001399 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001400 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001401)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001402
1403#define DEFINE_RW_EVENT(name) \
1404DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3e40b132021-01-23 10:06:29 -08001405 TP_PROTO(struct kiocb *iocb, struct iov_iter *iter), \
1406 TP_ARGS(iocb, iter))
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001407DEFINE_RW_EVENT(xfs_file_buffered_read);
1408DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001409DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001410DEFINE_RW_EVENT(xfs_file_buffered_write);
1411DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001412DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig896f72d2021-01-23 10:06:30 -08001413DEFINE_RW_EVENT(xfs_reflink_bounce_dio_write);
1414
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001415
Christoph Hellwiga206c812010-12-10 08:42:20 +00001416DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001417 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001418 int whichfork, struct xfs_bmbt_irec *irec),
1419 TP_ARGS(ip, offset, count, whichfork, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001420 TP_STRUCT__entry(
1421 __field(dev_t, dev)
1422 __field(xfs_ino_t, ino)
1423 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001424 __field(loff_t, offset)
1425 __field(size_t, count)
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001426 __field(int, whichfork)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001427 __field(xfs_fileoff_t, startoff)
1428 __field(xfs_fsblock_t, startblock)
1429 __field(xfs_filblks_t, blockcount)
1430 ),
1431 TP_fast_assign(
1432 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1433 __entry->ino = ip->i_ino;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001434 __entry->size = ip->i_disk_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001435 __entry->offset = offset;
1436 __entry->count = count;
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001437 __entry->whichfork = whichfork;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001438 __entry->startoff = irec ? irec->br_startoff : 0;
1439 __entry->startblock = irec ? irec->br_startblock : 0;
1440 __entry->blockcount = irec ? irec->br_blockcount : 0;
1441 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001442 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001443 "fork %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001444 MAJOR(__entry->dev), MINOR(__entry->dev),
1445 __entry->ino,
1446 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001447 __entry->offset,
1448 __entry->count,
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001449 __entry->whichfork == XFS_COW_FORK ? "cow" : "data",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001450 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001451 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001452 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001453)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001454
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001455#define DEFINE_IMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001456DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001457 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwigbe225fe2019-02-15 08:02:46 -08001458 int whichfork, struct xfs_bmbt_irec *irec), \
1459 TP_ARGS(ip, offset, count, whichfork, irec))
1460DEFINE_IMAP_EVENT(xfs_map_blocks_found);
1461DEFINE_IMAP_EVENT(xfs_map_blocks_alloc);
1462DEFINE_IMAP_EVENT(xfs_iomap_alloc);
1463DEFINE_IMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001464
Li Zefanf8adb4d2010-05-24 08:25:57 +00001465DECLARE_EVENT_CLASS(xfs_simple_io_class,
1466 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1467 TP_ARGS(ip, offset, count),
1468 TP_STRUCT__entry(
1469 __field(dev_t, dev)
1470 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001471 __field(loff_t, isize)
1472 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001473 __field(loff_t, offset)
1474 __field(size_t, count)
1475 ),
1476 TP_fast_assign(
1477 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1478 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001479 __entry->isize = VFS_I(ip)->i_size;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001480 __entry->disize = ip->i_disk_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001481 __entry->offset = offset;
1482 __entry->count = count;
1483 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001484 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001485 "offset 0x%llx count %zd",
1486 MAJOR(__entry->dev), MINOR(__entry->dev),
1487 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001488 __entry->isize,
1489 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001490 __entry->offset,
1491 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001492);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001493
1494#define DEFINE_SIMPLE_IO_EVENT(name) \
1495DEFINE_EVENT(xfs_simple_io_class, name, \
1496 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1497 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001498DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1499DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001500DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001501DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001502DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1503DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1504DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001505
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001506DECLARE_EVENT_CLASS(xfs_itrunc_class,
1507 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1508 TP_ARGS(ip, new_size),
1509 TP_STRUCT__entry(
1510 __field(dev_t, dev)
1511 __field(xfs_ino_t, ino)
1512 __field(xfs_fsize_t, size)
1513 __field(xfs_fsize_t, new_size)
1514 ),
1515 TP_fast_assign(
1516 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1517 __entry->ino = ip->i_ino;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001518 __entry->size = ip->i_disk_size;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001519 __entry->new_size = new_size;
1520 ),
1521 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1522 MAJOR(__entry->dev), MINOR(__entry->dev),
1523 __entry->ino,
1524 __entry->size,
1525 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001526)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001527
1528#define DEFINE_ITRUNC_EVENT(name) \
1529DEFINE_EVENT(xfs_itrunc_class, name, \
1530 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1531 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001532DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1533DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001534
1535TRACE_EVENT(xfs_pagecache_inval,
1536 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1537 TP_ARGS(ip, start, finish),
1538 TP_STRUCT__entry(
1539 __field(dev_t, dev)
1540 __field(xfs_ino_t, ino)
1541 __field(xfs_fsize_t, size)
1542 __field(xfs_off_t, start)
1543 __field(xfs_off_t, finish)
1544 ),
1545 TP_fast_assign(
1546 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1547 __entry->ino = ip->i_ino;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001548 __entry->size = ip->i_disk_size;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001549 __entry->start = start;
1550 __entry->finish = finish;
1551 ),
1552 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1553 MAJOR(__entry->dev), MINOR(__entry->dev),
1554 __entry->ino,
1555 __entry->size,
1556 __entry->start,
1557 __entry->finish)
1558);
1559
1560TRACE_EVENT(xfs_bunmap,
1561 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1562 int flags, unsigned long caller_ip),
1563 TP_ARGS(ip, bno, len, flags, caller_ip),
1564 TP_STRUCT__entry(
1565 __field(dev_t, dev)
1566 __field(xfs_ino_t, ino)
1567 __field(xfs_fsize_t, size)
1568 __field(xfs_fileoff_t, bno)
1569 __field(xfs_filblks_t, len)
1570 __field(unsigned long, caller_ip)
1571 __field(int, flags)
1572 ),
1573 TP_fast_assign(
1574 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1575 __entry->ino = ip->i_ino;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07001576 __entry->size = ip->i_disk_size;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001577 __entry->bno = bno;
1578 __entry->len = len;
1579 __entry->caller_ip = caller_ip;
1580 __entry->flags = flags;
1581 ),
1582 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 -08001583 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001584 MAJOR(__entry->dev), MINOR(__entry->dev),
1585 __entry->ino,
1586 __entry->size,
1587 __entry->bno,
1588 __entry->len,
1589 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1590 (void *)__entry->caller_ip)
1591
1592);
1593
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001594DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001595 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1596 xfs_agblock_t agbno, xfs_extlen_t len),
1597 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001598 TP_STRUCT__entry(
1599 __field(dev_t, dev)
1600 __field(xfs_agnumber_t, agno)
1601 __field(xfs_agblock_t, agbno)
1602 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001603 ),
1604 TP_fast_assign(
1605 __entry->dev = mp->m_super->s_dev;
1606 __entry->agno = agno;
1607 __entry->agbno = agbno;
1608 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001609 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07001610 TP_printk("dev %d:%d agno 0x%x agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001611 MAJOR(__entry->dev), MINOR(__entry->dev),
1612 __entry->agno,
1613 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001614 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001615);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001616#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001617DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001618 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1619 xfs_agblock_t agbno, xfs_extlen_t len), \
1620 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001621DEFINE_BUSY_EVENT(xfs_extent_busy);
1622DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1623DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1624DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1625DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001626
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001627TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001628 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1629 xfs_agblock_t agbno, xfs_extlen_t len,
1630 xfs_agblock_t tbno, xfs_extlen_t tlen),
1631 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1632 TP_STRUCT__entry(
1633 __field(dev_t, dev)
1634 __field(xfs_agnumber_t, agno)
1635 __field(xfs_agblock_t, agbno)
1636 __field(xfs_extlen_t, len)
1637 __field(xfs_agblock_t, tbno)
1638 __field(xfs_extlen_t, tlen)
1639 ),
1640 TP_fast_assign(
1641 __entry->dev = mp->m_super->s_dev;
1642 __entry->agno = agno;
1643 __entry->agbno = agbno;
1644 __entry->len = len;
1645 __entry->tbno = tbno;
1646 __entry->tlen = tlen;
1647 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07001648 TP_printk("dev %d:%d agno 0x%x agbno %u len %u tbno %u tlen %u",
Christoph Hellwige26f0502011-04-24 19:06:15 +00001649 MAJOR(__entry->dev), MINOR(__entry->dev),
1650 __entry->agno,
1651 __entry->agbno,
1652 __entry->len,
1653 __entry->tbno,
1654 __entry->tlen)
1655);
1656
Brian Fostera27ba262018-03-15 10:51:58 -07001657DECLARE_EVENT_CLASS(xfs_agf_class,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001658 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1659 unsigned long caller_ip),
1660 TP_ARGS(mp, agf, flags, caller_ip),
1661 TP_STRUCT__entry(
1662 __field(dev_t, dev)
1663 __field(xfs_agnumber_t, agno)
1664 __field(int, flags)
1665 __field(__u32, length)
1666 __field(__u32, bno_root)
1667 __field(__u32, cnt_root)
1668 __field(__u32, bno_level)
1669 __field(__u32, cnt_level)
1670 __field(__u32, flfirst)
1671 __field(__u32, fllast)
1672 __field(__u32, flcount)
1673 __field(__u32, freeblks)
1674 __field(__u32, longest)
1675 __field(unsigned long, caller_ip)
1676 ),
1677 TP_fast_assign(
1678 __entry->dev = mp->m_super->s_dev;
1679 __entry->agno = be32_to_cpu(agf->agf_seqno),
1680 __entry->flags = flags;
1681 __entry->length = be32_to_cpu(agf->agf_length),
1682 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1683 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1684 __entry->bno_level =
1685 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1686 __entry->cnt_level =
1687 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1688 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1689 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1690 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1691 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1692 __entry->longest = be32_to_cpu(agf->agf_longest);
1693 __entry->caller_ip = caller_ip;
1694 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07001695 TP_printk("dev %d:%d agno 0x%x flags %s length %u roots b %u c %u "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001696 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001697 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001698 MAJOR(__entry->dev), MINOR(__entry->dev),
1699 __entry->agno,
1700 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1701 __entry->length,
1702 __entry->bno_root,
1703 __entry->cnt_root,
1704 __entry->bno_level,
1705 __entry->cnt_level,
1706 __entry->flfirst,
1707 __entry->fllast,
1708 __entry->flcount,
1709 __entry->freeblks,
1710 __entry->longest,
1711 (void *)__entry->caller_ip)
1712);
Brian Fostera27ba262018-03-15 10:51:58 -07001713#define DEFINE_AGF_EVENT(name) \
1714DEFINE_EVENT(xfs_agf_class, name, \
1715 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags, \
1716 unsigned long caller_ip), \
1717 TP_ARGS(mp, agf, flags, caller_ip))
1718DEFINE_AGF_EVENT(xfs_agf);
1719DEFINE_AGF_EVENT(xfs_agfl_reset);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001720
1721TRACE_EVENT(xfs_free_extent,
1722 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001723 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1724 int haveright),
1725 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001726 TP_STRUCT__entry(
1727 __field(dev_t, dev)
1728 __field(xfs_agnumber_t, agno)
1729 __field(xfs_agblock_t, agbno)
1730 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001731 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001732 __field(int, haveleft)
1733 __field(int, haveright)
1734 ),
1735 TP_fast_assign(
1736 __entry->dev = mp->m_super->s_dev;
1737 __entry->agno = agno;
1738 __entry->agbno = agbno;
1739 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001740 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001741 __entry->haveleft = haveleft;
1742 __entry->haveright = haveright;
1743 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07001744 TP_printk("dev %d:%d agno 0x%x agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001745 MAJOR(__entry->dev), MINOR(__entry->dev),
1746 __entry->agno,
1747 __entry->agbno,
1748 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001749 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001750 __entry->haveleft ?
1751 (__entry->haveright ? "both" : "left") :
1752 (__entry->haveright ? "right" : "none"))
1753
1754);
1755
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001756DECLARE_EVENT_CLASS(xfs_alloc_class,
1757 TP_PROTO(struct xfs_alloc_arg *args),
1758 TP_ARGS(args),
1759 TP_STRUCT__entry(
1760 __field(dev_t, dev)
1761 __field(xfs_agnumber_t, agno)
1762 __field(xfs_agblock_t, agbno)
1763 __field(xfs_extlen_t, minlen)
1764 __field(xfs_extlen_t, maxlen)
1765 __field(xfs_extlen_t, mod)
1766 __field(xfs_extlen_t, prod)
1767 __field(xfs_extlen_t, minleft)
1768 __field(xfs_extlen_t, total)
1769 __field(xfs_extlen_t, alignment)
1770 __field(xfs_extlen_t, minalignslop)
1771 __field(xfs_extlen_t, len)
1772 __field(short, type)
1773 __field(short, otype)
1774 __field(char, wasdel)
1775 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001776 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001777 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001778 __field(xfs_fsblock_t, firstblock)
1779 ),
1780 TP_fast_assign(
1781 __entry->dev = args->mp->m_super->s_dev;
1782 __entry->agno = args->agno;
1783 __entry->agbno = args->agbno;
1784 __entry->minlen = args->minlen;
1785 __entry->maxlen = args->maxlen;
1786 __entry->mod = args->mod;
1787 __entry->prod = args->prod;
1788 __entry->minleft = args->minleft;
1789 __entry->total = args->total;
1790 __entry->alignment = args->alignment;
1791 __entry->minalignslop = args->minalignslop;
1792 __entry->len = args->len;
1793 __entry->type = args->type;
1794 __entry->otype = args->otype;
1795 __entry->wasdel = args->wasdel;
1796 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001797 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001798 __entry->datatype = args->datatype;
Brian Foster64396ff2018-07-11 22:26:30 -07001799 __entry->firstblock = args->tp->t_firstblock;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001800 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07001801 TP_printk("dev %d:%d agno 0x%x agbno %u minlen %u maxlen %u mod %u "
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001802 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001803 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001804 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001805 MAJOR(__entry->dev), MINOR(__entry->dev),
1806 __entry->agno,
1807 __entry->agbno,
1808 __entry->minlen,
1809 __entry->maxlen,
1810 __entry->mod,
1811 __entry->prod,
1812 __entry->minleft,
1813 __entry->total,
1814 __entry->alignment,
1815 __entry->minalignslop,
1816 __entry->len,
1817 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1818 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1819 __entry->wasdel,
1820 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001821 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001822 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001823 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001824)
1825
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001826#define DEFINE_ALLOC_EVENT(name) \
1827DEFINE_EVENT(xfs_alloc_class, name, \
1828 TP_PROTO(struct xfs_alloc_arg *args), \
1829 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001830DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001831DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001832DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1833DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1834DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
Brian Fosterd2968822019-10-13 17:10:35 -07001835DEFINE_ALLOC_EVENT(xfs_alloc_cur);
Brian Fosterfec0afd2019-10-13 17:10:33 -07001836DEFINE_ALLOC_EVENT(xfs_alloc_cur_right);
1837DEFINE_ALLOC_EVENT(xfs_alloc_cur_left);
Brian Fosterdc8e69b2019-10-13 17:10:36 -07001838DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup);
1839DEFINE_ALLOC_EVENT(xfs_alloc_cur_lookup_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001840DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001841DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1842DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001843DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1844DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1845DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1846DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1847DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001848DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001849DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1850DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1851DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1852DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1853DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1854DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1855DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1856DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1857DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1858
Brian Foster396bbf32019-10-13 17:10:33 -07001859TRACE_EVENT(xfs_alloc_cur_check,
1860 TP_PROTO(struct xfs_mount *mp, xfs_btnum_t btnum, xfs_agblock_t bno,
1861 xfs_extlen_t len, xfs_extlen_t diff, bool new),
1862 TP_ARGS(mp, btnum, bno, len, diff, new),
1863 TP_STRUCT__entry(
1864 __field(dev_t, dev)
1865 __field(xfs_btnum_t, btnum)
1866 __field(xfs_agblock_t, bno)
1867 __field(xfs_extlen_t, len)
1868 __field(xfs_extlen_t, diff)
1869 __field(bool, new)
1870 ),
1871 TP_fast_assign(
1872 __entry->dev = mp->m_super->s_dev;
1873 __entry->btnum = btnum;
1874 __entry->bno = bno;
1875 __entry->len = len;
1876 __entry->diff = diff;
1877 __entry->new = new;
1878 ),
1879 TP_printk("dev %d:%d btree %s bno 0x%x len 0x%x diff 0x%x new %d",
1880 MAJOR(__entry->dev), MINOR(__entry->dev),
1881 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
1882 __entry->bno, __entry->len, __entry->diff, __entry->new)
1883)
1884
Dave Chinner5a5881c2012-03-22 05:15:13 +00001885DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001886 TP_PROTO(struct xfs_da_args *args),
1887 TP_ARGS(args),
1888 TP_STRUCT__entry(
1889 __field(dev_t, dev)
1890 __field(xfs_ino_t, ino)
1891 __dynamic_array(char, name, args->namelen)
1892 __field(int, namelen)
1893 __field(xfs_dahash_t, hashval)
1894 __field(xfs_ino_t, inumber)
1895 __field(int, op_flags)
1896 ),
1897 TP_fast_assign(
1898 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1899 __entry->ino = args->dp->i_ino;
1900 if (args->namelen)
1901 memcpy(__get_str(name), args->name, args->namelen);
1902 __entry->namelen = args->namelen;
1903 __entry->hashval = args->hashval;
1904 __entry->inumber = args->inumber;
1905 __entry->op_flags = args->op_flags;
1906 ),
1907 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1908 "inumber 0x%llx op_flags %s",
1909 MAJOR(__entry->dev), MINOR(__entry->dev),
1910 __entry->ino,
1911 __entry->namelen,
1912 __entry->namelen ? __get_str(name) : NULL,
1913 __entry->namelen,
1914 __entry->hashval,
1915 __entry->inumber,
1916 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001917)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001918
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001919#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001920DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001921 TP_PROTO(struct xfs_da_args *args), \
1922 TP_ARGS(args))
1923DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1924DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1925DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1926DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1927DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1928DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1929DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1930DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1931DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1932DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1933DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1934DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1935DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1936DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1937DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1938DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1939DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1940DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1941DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1942DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1943DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1944DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1945DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1946DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1947DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1948
Dave Chinneree732592012-11-12 22:53:53 +11001949DECLARE_EVENT_CLASS(xfs_attr_class,
1950 TP_PROTO(struct xfs_da_args *args),
1951 TP_ARGS(args),
1952 TP_STRUCT__entry(
1953 __field(dev_t, dev)
1954 __field(xfs_ino_t, ino)
1955 __dynamic_array(char, name, args->namelen)
1956 __field(int, namelen)
1957 __field(int, valuelen)
1958 __field(xfs_dahash_t, hashval)
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001959 __field(unsigned int, attr_filter)
1960 __field(unsigned int, attr_flags)
Dave Chinneree732592012-11-12 22:53:53 +11001961 __field(int, op_flags)
1962 ),
1963 TP_fast_assign(
1964 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1965 __entry->ino = args->dp->i_ino;
1966 if (args->namelen)
1967 memcpy(__get_str(name), args->name, args->namelen);
1968 __entry->namelen = args->namelen;
1969 __entry->valuelen = args->valuelen;
1970 __entry->hashval = args->hashval;
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001971 __entry->attr_filter = args->attr_filter;
1972 __entry->attr_flags = args->attr_flags;
Dave Chinneree732592012-11-12 22:53:53 +11001973 __entry->op_flags = args->op_flags;
1974 ),
1975 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001976 "hashval 0x%x filter %s flags %s op_flags %s",
Dave Chinneree732592012-11-12 22:53:53 +11001977 MAJOR(__entry->dev), MINOR(__entry->dev),
1978 __entry->ino,
1979 __entry->namelen,
1980 __entry->namelen ? __get_str(name) : NULL,
1981 __entry->namelen,
1982 __entry->valuelen,
1983 __entry->hashval,
Christoph Hellwigd5f0f492020-02-26 17:30:42 -08001984 __print_flags(__entry->attr_filter, "|",
1985 XFS_ATTR_FILTER_FLAGS),
1986 __print_flags(__entry->attr_flags, "|",
1987 { XATTR_CREATE, "CREATE" },
1988 { XATTR_REPLACE, "REPLACE" }),
Dave Chinneree732592012-11-12 22:53:53 +11001989 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1990)
1991
Dave Chinner5a5881c2012-03-22 05:15:13 +00001992#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001993DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001994 TP_PROTO(struct xfs_da_args *args), \
1995 TP_ARGS(args))
1996DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1997DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1998DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1999DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
2000DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002001DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
2002
2003DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
2004DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
2005DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11002006DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002007DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11002008DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
2009DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002010DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
2011DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11002012DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002013DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
2014DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
2015DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
2016DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
2017DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
2018DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
2019DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
2020DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
2021DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
2022DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
2023DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11002024DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002025
2026DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11002027DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002028DEFINE_ATTR_EVENT(xfs_attr_node_replace);
2029DEFINE_ATTR_EVENT(xfs_attr_node_removename);
2030
Dave Chinneree732592012-11-12 22:53:53 +11002031DEFINE_ATTR_EVENT(xfs_attr_fillstate);
2032DEFINE_ATTR_EVENT(xfs_attr_refillstate);
2033
2034DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
2035DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
Dave Chinneree732592012-11-12 22:53:53 +11002036
Dave Chinner5a5881c2012-03-22 05:15:13 +00002037#define DEFINE_DA_EVENT(name) \
2038DEFINE_EVENT(xfs_da_class, name, \
2039 TP_PROTO(struct xfs_da_args *args), \
2040 TP_ARGS(args))
2041DEFINE_DA_EVENT(xfs_da_split);
2042DEFINE_DA_EVENT(xfs_da_join);
2043DEFINE_DA_EVENT(xfs_da_link_before);
2044DEFINE_DA_EVENT(xfs_da_link_after);
2045DEFINE_DA_EVENT(xfs_da_unlink_back);
2046DEFINE_DA_EVENT(xfs_da_unlink_forward);
2047DEFINE_DA_EVENT(xfs_da_root_split);
2048DEFINE_DA_EVENT(xfs_da_root_join);
2049DEFINE_DA_EVENT(xfs_da_node_add);
2050DEFINE_DA_EVENT(xfs_da_node_create);
2051DEFINE_DA_EVENT(xfs_da_node_split);
2052DEFINE_DA_EVENT(xfs_da_node_remove);
2053DEFINE_DA_EVENT(xfs_da_node_rebalance);
2054DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11002055DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002056DEFINE_DA_EVENT(xfs_da_swap_lastblock);
2057DEFINE_DA_EVENT(xfs_da_grow_inode);
2058DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11002059DEFINE_DA_EVENT(xfs_da_fixhashpath);
2060DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00002061
Christoph Hellwigea9a4882009-12-21 14:03:03 +00002062DECLARE_EVENT_CLASS(xfs_dir2_space_class,
2063 TP_PROTO(struct xfs_da_args *args, int idx),
2064 TP_ARGS(args, idx),
2065 TP_STRUCT__entry(
2066 __field(dev_t, dev)
2067 __field(xfs_ino_t, ino)
2068 __field(int, op_flags)
2069 __field(int, idx)
2070 ),
2071 TP_fast_assign(
2072 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2073 __entry->ino = args->dp->i_ino;
2074 __entry->op_flags = args->op_flags;
2075 __entry->idx = idx;
2076 ),
2077 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
2078 MAJOR(__entry->dev), MINOR(__entry->dev),
2079 __entry->ino,
2080 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2081 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00002082)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00002083
2084#define DEFINE_DIR2_SPACE_EVENT(name) \
2085DEFINE_EVENT(xfs_dir2_space_class, name, \
2086 TP_PROTO(struct xfs_da_args *args, int idx), \
2087 TP_ARGS(args, idx))
2088DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
2089DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
2090DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
2091DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00002092
2093TRACE_EVENT(xfs_dir2_leafn_moveents,
2094 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
2095 TP_ARGS(args, src_idx, dst_idx, count),
2096 TP_STRUCT__entry(
2097 __field(dev_t, dev)
2098 __field(xfs_ino_t, ino)
2099 __field(int, op_flags)
2100 __field(int, src_idx)
2101 __field(int, dst_idx)
2102 __field(int, count)
2103 ),
2104 TP_fast_assign(
2105 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
2106 __entry->ino = args->dp->i_ino;
2107 __entry->op_flags = args->op_flags;
2108 __entry->src_idx = src_idx;
2109 __entry->dst_idx = dst_idx;
2110 __entry->count = count;
2111 ),
2112 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
2113 "src_idx %d dst_idx %d count %d",
2114 MAJOR(__entry->dev), MINOR(__entry->dev),
2115 __entry->ino,
2116 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
2117 __entry->src_idx,
2118 __entry->dst_idx,
2119 __entry->count)
2120);
2121
Dave Chinner3a85cd92010-01-14 01:33:55 +00002122#define XFS_SWAPEXT_INODES \
2123 { 0, "target" }, \
2124 { 1, "temp" }
2125
Darrick J. Wong0357d212018-12-18 14:32:30 -08002126TRACE_DEFINE_ENUM(XFS_DINODE_FMT_DEV);
2127TRACE_DEFINE_ENUM(XFS_DINODE_FMT_LOCAL);
2128TRACE_DEFINE_ENUM(XFS_DINODE_FMT_EXTENTS);
2129TRACE_DEFINE_ENUM(XFS_DINODE_FMT_BTREE);
2130TRACE_DEFINE_ENUM(XFS_DINODE_FMT_UUID);
Dave Chinner3a85cd92010-01-14 01:33:55 +00002131
2132DECLARE_EVENT_CLASS(xfs_swap_extent_class,
2133 TP_PROTO(struct xfs_inode *ip, int which),
2134 TP_ARGS(ip, which),
2135 TP_STRUCT__entry(
2136 __field(dev_t, dev)
2137 __field(int, which)
2138 __field(xfs_ino_t, ino)
2139 __field(int, format)
2140 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00002141 __field(int, broot_size)
2142 __field(int, fork_off)
2143 ),
2144 TP_fast_assign(
2145 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2146 __entry->which = which;
2147 __entry->ino = ip->i_ino;
Christoph Hellwigf7e67b22020-05-18 10:28:05 -07002148 __entry->format = ip->i_df.if_format;
Christoph Hellwigdaf83962020-05-18 10:27:22 -07002149 __entry->nex = ip->i_df.if_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00002150 __entry->broot_size = ip->i_df.if_broot_bytes;
2151 __entry->fork_off = XFS_IFORK_BOFF(ip);
2152 ),
2153 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00002154 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00002155 MAJOR(__entry->dev), MINOR(__entry->dev),
2156 __entry->ino,
2157 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
2158 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
2159 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00002160 __entry->broot_size,
2161 __entry->fork_off)
2162)
2163
2164#define DEFINE_SWAPEXT_EVENT(name) \
2165DEFINE_EVENT(xfs_swap_extent_class, name, \
2166 TP_PROTO(struct xfs_inode *ip, int which), \
2167 TP_ARGS(ip, which))
2168
2169DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
2170DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
2171
Brian Fostere67d3d42017-08-08 18:21:53 -07002172TRACE_EVENT(xfs_log_recover,
2173 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
2174 TP_ARGS(log, headblk, tailblk),
2175 TP_STRUCT__entry(
2176 __field(dev_t, dev)
2177 __field(xfs_daddr_t, headblk)
2178 __field(xfs_daddr_t, tailblk)
2179 ),
2180 TP_fast_assign(
2181 __entry->dev = log->l_mp->m_super->s_dev;
2182 __entry->headblk = headblk;
2183 __entry->tailblk = tailblk;
2184 ),
2185 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2186 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2187 __entry->tailblk)
2188)
2189
Brian Foster5cd9cee2016-09-26 08:34:52 +10002190TRACE_EVENT(xfs_log_recover_record,
2191 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2192 TP_ARGS(log, rhead, pass),
2193 TP_STRUCT__entry(
2194 __field(dev_t, dev)
2195 __field(xfs_lsn_t, lsn)
2196 __field(int, len)
2197 __field(int, num_logops)
2198 __field(int, pass)
2199 ),
2200 TP_fast_assign(
2201 __entry->dev = log->l_mp->m_super->s_dev;
2202 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2203 __entry->len = be32_to_cpu(rhead->h_len);
2204 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2205 __entry->pass = pass;
2206 ),
2207 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2208 MAJOR(__entry->dev), MINOR(__entry->dev),
2209 __entry->lsn, __entry->len, __entry->num_logops,
2210 __entry->pass)
2211)
2212
Dave Chinner9abbc532010-04-13 15:06:46 +10002213DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002214 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002215 struct xlog_recover_item *item, int pass),
2216 TP_ARGS(log, trans, item, pass),
2217 TP_STRUCT__entry(
2218 __field(dev_t, dev)
2219 __field(unsigned long, item)
2220 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002221 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002222 __field(int, type)
2223 __field(int, pass)
2224 __field(int, count)
2225 __field(int, total)
2226 ),
2227 TP_fast_assign(
2228 __entry->dev = log->l_mp->m_super->s_dev;
2229 __entry->item = (unsigned long)item;
2230 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002231 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002232 __entry->type = ITEM_TYPE(item);
2233 __entry->pass = pass;
2234 __entry->count = item->ri_cnt;
2235 __entry->total = item->ri_total;
2236 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08002237 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10002238 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002239 MAJOR(__entry->dev), MINOR(__entry->dev),
2240 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002241 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002242 __entry->pass,
2243 (void *)__entry->item,
2244 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2245 __entry->count,
2246 __entry->total)
2247)
2248
2249#define DEFINE_LOG_RECOVER_ITEM(name) \
2250DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002251 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002252 struct xlog_recover_item *item, int pass), \
2253 TP_ARGS(log, trans, item, pass))
2254
2255DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2256DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2257DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2258DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2259DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2260
2261DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002262 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002263 TP_ARGS(log, buf_f),
2264 TP_STRUCT__entry(
2265 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002266 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002267 __field(unsigned short, len)
2268 __field(unsigned short, flags)
2269 __field(unsigned short, size)
2270 __field(unsigned int, map_size)
2271 ),
2272 TP_fast_assign(
2273 __entry->dev = log->l_mp->m_super->s_dev;
2274 __entry->blkno = buf_f->blf_blkno;
2275 __entry->len = buf_f->blf_len;
2276 __entry->flags = buf_f->blf_flags;
2277 __entry->size = buf_f->blf_size;
2278 __entry->map_size = buf_f->blf_map_size;
2279 ),
2280 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2281 "map_size %d",
2282 MAJOR(__entry->dev), MINOR(__entry->dev),
2283 __entry->blkno,
2284 __entry->len,
2285 __entry->flags,
2286 __entry->size,
2287 __entry->map_size)
2288)
2289
2290#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2291DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002292 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002293 TP_ARGS(log, buf_f))
2294
2295DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2296DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2297DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2298DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2299DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002300DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002301DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2302DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2303DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2304
2305DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002306 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002307 TP_ARGS(log, in_f),
2308 TP_STRUCT__entry(
2309 __field(dev_t, dev)
2310 __field(xfs_ino_t, ino)
2311 __field(unsigned short, size)
2312 __field(int, fields)
2313 __field(unsigned short, asize)
2314 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002315 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002316 __field(int, len)
2317 __field(int, boffset)
2318 ),
2319 TP_fast_assign(
2320 __entry->dev = log->l_mp->m_super->s_dev;
2321 __entry->ino = in_f->ilf_ino;
2322 __entry->size = in_f->ilf_size;
2323 __entry->fields = in_f->ilf_fields;
2324 __entry->asize = in_f->ilf_asize;
2325 __entry->dsize = in_f->ilf_dsize;
2326 __entry->blkno = in_f->ilf_blkno;
2327 __entry->len = in_f->ilf_len;
2328 __entry->boffset = in_f->ilf_boffset;
2329 ),
2330 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2331 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2332 MAJOR(__entry->dev), MINOR(__entry->dev),
2333 __entry->ino,
2334 __entry->size,
2335 __entry->fields,
2336 __entry->asize,
2337 __entry->dsize,
2338 __entry->blkno,
2339 __entry->len,
2340 __entry->boffset)
2341)
2342#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2343DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002344 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002345 TP_ARGS(log, in_f))
2346
2347DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2348DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2349DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2350
Brian Foster78d57e42015-08-19 09:58:48 +10002351DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2352 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2353 TP_ARGS(log, in_f),
2354 TP_STRUCT__entry(
2355 __field(dev_t, dev)
2356 __field(xfs_agnumber_t, agno)
2357 __field(xfs_agblock_t, agbno)
2358 __field(unsigned int, count)
2359 __field(unsigned int, isize)
2360 __field(xfs_agblock_t, length)
2361 __field(unsigned int, gen)
2362 ),
2363 TP_fast_assign(
2364 __entry->dev = log->l_mp->m_super->s_dev;
2365 __entry->agno = be32_to_cpu(in_f->icl_ag);
2366 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2367 __entry->count = be32_to_cpu(in_f->icl_count);
2368 __entry->isize = be32_to_cpu(in_f->icl_isize);
2369 __entry->length = be32_to_cpu(in_f->icl_length);
2370 __entry->gen = be32_to_cpu(in_f->icl_gen);
2371 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002372 TP_printk("dev %d:%d agno 0x%x agbno %u count %u isize %u length %u "
Brian Foster78d57e42015-08-19 09:58:48 +10002373 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2374 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2375 __entry->length, __entry->gen)
2376)
2377#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2378DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2379 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2380 TP_ARGS(log, in_f))
2381
2382DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2383DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2384
Christoph Hellwiga46db602011-01-07 13:02:04 +00002385DECLARE_EVENT_CLASS(xfs_discard_class,
2386 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2387 xfs_agblock_t agbno, xfs_extlen_t len),
2388 TP_ARGS(mp, agno, agbno, len),
2389 TP_STRUCT__entry(
2390 __field(dev_t, dev)
2391 __field(xfs_agnumber_t, agno)
2392 __field(xfs_agblock_t, agbno)
2393 __field(xfs_extlen_t, len)
2394 ),
2395 TP_fast_assign(
2396 __entry->dev = mp->m_super->s_dev;
2397 __entry->agno = agno;
2398 __entry->agbno = agbno;
2399 __entry->len = len;
2400 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002401 TP_printk("dev %d:%d agno 0x%x agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002402 MAJOR(__entry->dev), MINOR(__entry->dev),
2403 __entry->agno,
2404 __entry->agbno,
2405 __entry->len)
2406)
2407
2408#define DEFINE_DISCARD_EVENT(name) \
2409DEFINE_EVENT(xfs_discard_class, name, \
2410 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2411 xfs_agblock_t agbno, xfs_extlen_t len), \
2412 TP_ARGS(mp, agno, agbno, len))
2413DEFINE_DISCARD_EVENT(xfs_discard_extent);
2414DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2415DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2416DEFINE_DISCARD_EVENT(xfs_discard_busy);
2417
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002418/* btree cursor events */
Darrick J. Wongc4942132018-12-18 14:32:31 -08002419TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
2420TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
2421TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
2422TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
2423TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
2424TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
2425TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
2426
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002427DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2428 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2429 TP_ARGS(cur, level, bp),
2430 TP_STRUCT__entry(
2431 __field(dev_t, dev)
2432 __field(xfs_btnum_t, btnum)
2433 __field(int, level)
2434 __field(int, nlevels)
2435 __field(int, ptr)
2436 __field(xfs_daddr_t, daddr)
2437 ),
2438 TP_fast_assign(
2439 __entry->dev = cur->bc_mp->m_super->s_dev;
2440 __entry->btnum = cur->bc_btnum;
2441 __entry->level = level;
2442 __entry->nlevels = cur->bc_nlevels;
2443 __entry->ptr = cur->bc_ptrs[level];
2444 __entry->daddr = bp ? bp->b_bn : -1;
2445 ),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002446 TP_printk("dev %d:%d btree %s level %d/%d ptr %d daddr 0x%llx",
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002447 MAJOR(__entry->dev), MINOR(__entry->dev),
Darrick J. Wongc4942132018-12-18 14:32:31 -08002448 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002449 __entry->level,
2450 __entry->nlevels,
2451 __entry->ptr,
2452 (unsigned long long)__entry->daddr)
2453)
2454
2455#define DEFINE_BTREE_CUR_EVENT(name) \
2456DEFINE_EVENT(xfs_btree_cur_class, name, \
2457 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2458 TP_ARGS(cur, level, bp))
2459DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002460DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002461
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002462/* deferred ops */
2463struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002464
2465DECLARE_EVENT_CLASS(xfs_defer_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002466 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
2467 TP_ARGS(tp, caller_ip),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002468 TP_STRUCT__entry(
2469 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002470 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002471 __field(char, committed)
Dave Chinnere632a562018-05-09 07:48:52 -07002472 __field(unsigned long, caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002473 ),
2474 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002475 __entry->dev = tp->t_mountp->m_super->s_dev;
2476 __entry->tp = tp;
Dave Chinnere632a562018-05-09 07:48:52 -07002477 __entry->caller_ip = caller_ip;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002478 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002479 TP_printk("dev %d:%d tp %p caller %pS",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002480 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002481 __entry->tp,
Dave Chinnere632a562018-05-09 07:48:52 -07002482 (char *)__entry->caller_ip)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002483)
2484#define DEFINE_DEFER_EVENT(name) \
2485DEFINE_EVENT(xfs_defer_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002486 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
2487 TP_ARGS(tp, caller_ip))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002488
2489DECLARE_EVENT_CLASS(xfs_defer_error_class,
Brian Foster9d9e6232018-08-01 07:20:35 -07002490 TP_PROTO(struct xfs_trans *tp, int error),
2491 TP_ARGS(tp, error),
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002492 TP_STRUCT__entry(
2493 __field(dev_t, dev)
Brian Foster9d9e6232018-08-01 07:20:35 -07002494 __field(struct xfs_trans *, tp)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002495 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002496 __field(int, error)
2497 ),
2498 TP_fast_assign(
Brian Foster9d9e6232018-08-01 07:20:35 -07002499 __entry->dev = tp->t_mountp->m_super->s_dev;
2500 __entry->tp = tp;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002501 __entry->error = error;
2502 ),
Brian Foster9d9e6232018-08-01 07:20:35 -07002503 TP_printk("dev %d:%d tp %p err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002504 MAJOR(__entry->dev), MINOR(__entry->dev),
Brian Foster9d9e6232018-08-01 07:20:35 -07002505 __entry->tp,
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002506 __entry->error)
2507)
2508#define DEFINE_DEFER_ERROR_EVENT(name) \
2509DEFINE_EVENT(xfs_defer_error_class, name, \
Brian Foster9d9e6232018-08-01 07:20:35 -07002510 TP_PROTO(struct xfs_trans *tp, int error), \
2511 TP_ARGS(tp, error))
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002512
2513DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2514 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2515 TP_ARGS(mp, dfp),
2516 TP_STRUCT__entry(
2517 __field(dev_t, dev)
2518 __field(int, type)
2519 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002520 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002521 __field(int, nr)
2522 ),
2523 TP_fast_assign(
2524 __entry->dev = mp ? mp->m_super->s_dev : 0;
Darrick J. Wong02b100f2018-12-12 08:46:22 -08002525 __entry->type = dfp->dfp_type;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002526 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002527 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002528 __entry->nr = dfp->dfp_count;
2529 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002530 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002531 MAJOR(__entry->dev), MINOR(__entry->dev),
2532 __entry->type,
2533 __entry->intent,
2534 __entry->committed,
2535 __entry->nr)
2536)
2537#define DEFINE_DEFER_PENDING_EVENT(name) \
2538DEFINE_EVENT(xfs_defer_pending_class, name, \
2539 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2540 TP_ARGS(mp, dfp))
2541
2542DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2543 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2544 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2545 TP_ARGS(mp, agno, type, agbno, len),
2546 TP_STRUCT__entry(
2547 __field(dev_t, dev)
2548 __field(xfs_agnumber_t, agno)
2549 __field(int, type)
2550 __field(xfs_agblock_t, agbno)
2551 __field(xfs_extlen_t, len)
2552 ),
2553 TP_fast_assign(
2554 __entry->dev = mp->m_super->s_dev;
2555 __entry->agno = agno;
2556 __entry->type = type;
2557 __entry->agbno = agbno;
2558 __entry->len = len;
2559 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002560 TP_printk("dev %d:%d op %d agno 0x%x agbno %u len %u",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002561 MAJOR(__entry->dev), MINOR(__entry->dev),
2562 __entry->type,
2563 __entry->agno,
2564 __entry->agbno,
2565 __entry->len)
2566);
2567#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2568DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2569 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2570 int type, \
2571 xfs_agblock_t bno, \
2572 xfs_extlen_t len), \
2573 TP_ARGS(mp, agno, type, bno, len))
2574
2575DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2576 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2577 int op,
2578 xfs_agblock_t agbno,
2579 xfs_ino_t ino,
2580 int whichfork,
2581 xfs_fileoff_t offset,
2582 xfs_filblks_t len,
2583 xfs_exntst_t state),
2584 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2585 TP_STRUCT__entry(
2586 __field(dev_t, dev)
2587 __field(xfs_agnumber_t, agno)
2588 __field(xfs_ino_t, ino)
2589 __field(xfs_agblock_t, agbno)
2590 __field(int, whichfork)
2591 __field(xfs_fileoff_t, l_loff)
2592 __field(xfs_filblks_t, l_len)
2593 __field(xfs_exntst_t, l_state)
2594 __field(int, op)
2595 ),
2596 TP_fast_assign(
2597 __entry->dev = mp->m_super->s_dev;
2598 __entry->agno = agno;
2599 __entry->ino = ino;
2600 __entry->agbno = agbno;
2601 __entry->whichfork = whichfork;
2602 __entry->l_loff = offset;
2603 __entry->l_len = len;
2604 __entry->l_state = state;
2605 __entry->op = op;
2606 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002607 TP_printk("dev %d:%d op %d agno 0x%x agbno %u owner %lld %s offset %llu len %llu state %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002608 MAJOR(__entry->dev), MINOR(__entry->dev),
2609 __entry->op,
2610 __entry->agno,
2611 __entry->agbno,
2612 __entry->ino,
2613 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2614 __entry->l_loff,
2615 __entry->l_len,
2616 __entry->l_state)
2617);
2618#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2619DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2620 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2621 int op, \
2622 xfs_agblock_t agbno, \
2623 xfs_ino_t ino, \
2624 int whichfork, \
2625 xfs_fileoff_t offset, \
2626 xfs_filblks_t len, \
2627 xfs_exntst_t state), \
2628 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2629
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002630DEFINE_DEFER_EVENT(xfs_defer_cancel);
2631DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2632DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2633DEFINE_DEFER_EVENT(xfs_defer_finish);
2634DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2635
2636DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2637DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002638
Brian Foster1ae093cb2018-08-01 07:20:34 -07002639DEFINE_DEFER_PENDING_EVENT(xfs_defer_create_intent);
2640DEFINE_DEFER_PENDING_EVENT(xfs_defer_cancel_list);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002641DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2642DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
Darrick J. Wong4e919af2020-09-27 16:18:13 -07002643DEFINE_DEFER_PENDING_EVENT(xfs_defer_relog_intent);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002644
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002645#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2646DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2647DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
Brian Fosterf8f28352018-05-07 17:38:47 -07002648DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_defer);
2649DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_agfl_free_deferred);
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002650
Darrick J. Wong673930c2016-08-03 11:33:43 +10002651/* rmap tracepoints */
2652DECLARE_EVENT_CLASS(xfs_rmap_class,
2653 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2654 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
Darrick J. Wong66e32372018-12-12 08:46:23 -08002655 const struct xfs_owner_info *oinfo),
Darrick J. Wong673930c2016-08-03 11:33:43 +10002656 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2657 TP_STRUCT__entry(
2658 __field(dev_t, dev)
2659 __field(xfs_agnumber_t, agno)
2660 __field(xfs_agblock_t, agbno)
2661 __field(xfs_extlen_t, len)
2662 __field(uint64_t, owner)
2663 __field(uint64_t, offset)
2664 __field(unsigned long, flags)
2665 ),
2666 TP_fast_assign(
2667 __entry->dev = mp->m_super->s_dev;
2668 __entry->agno = agno;
2669 __entry->agbno = agbno;
2670 __entry->len = len;
2671 __entry->owner = oinfo->oi_owner;
2672 __entry->offset = oinfo->oi_offset;
2673 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002674 if (unwritten)
2675 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002676 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002677 TP_printk("dev %d:%d agno 0x%x agbno %u len %u owner %lld offset %llu flags 0x%lx",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002678 MAJOR(__entry->dev), MINOR(__entry->dev),
2679 __entry->agno,
2680 __entry->agbno,
2681 __entry->len,
2682 __entry->owner,
2683 __entry->offset,
2684 __entry->flags)
2685);
2686#define DEFINE_RMAP_EVENT(name) \
2687DEFINE_EVENT(xfs_rmap_class, name, \
2688 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2689 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
Darrick J. Wong66e32372018-12-12 08:46:23 -08002690 const struct xfs_owner_info *oinfo), \
Darrick J. Wong673930c2016-08-03 11:33:43 +10002691 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2692
2693/* simple AG-based error/%ip tracepoint class */
2694DECLARE_EVENT_CLASS(xfs_ag_error_class,
2695 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2696 unsigned long caller_ip),
2697 TP_ARGS(mp, agno, error, caller_ip),
2698 TP_STRUCT__entry(
2699 __field(dev_t, dev)
2700 __field(xfs_agnumber_t, agno)
2701 __field(int, error)
2702 __field(unsigned long, caller_ip)
2703 ),
2704 TP_fast_assign(
2705 __entry->dev = mp->m_super->s_dev;
2706 __entry->agno = agno;
2707 __entry->error = error;
2708 __entry->caller_ip = caller_ip;
2709 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002710 TP_printk("dev %d:%d agno 0x%x error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002711 MAJOR(__entry->dev), MINOR(__entry->dev),
2712 __entry->agno,
2713 __entry->error,
2714 (char *)__entry->caller_ip)
2715);
2716
2717#define DEFINE_AG_ERROR_EVENT(name) \
2718DEFINE_EVENT(xfs_ag_error_class, name, \
2719 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2720 unsigned long caller_ip), \
2721 TP_ARGS(mp, agno, error, caller_ip))
2722
2723DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2724DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2725DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2726DEFINE_RMAP_EVENT(xfs_rmap_map);
2727DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2728DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002729DEFINE_RMAP_EVENT(xfs_rmap_convert);
2730DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2731DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2732DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002733
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002734DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2735 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2736 xfs_agblock_t agbno, xfs_extlen_t len,
2737 uint64_t owner, uint64_t offset, unsigned int flags),
2738 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2739 TP_STRUCT__entry(
2740 __field(dev_t, dev)
2741 __field(xfs_agnumber_t, agno)
2742 __field(xfs_agblock_t, agbno)
2743 __field(xfs_extlen_t, len)
2744 __field(uint64_t, owner)
2745 __field(uint64_t, offset)
2746 __field(unsigned int, flags)
2747 ),
2748 TP_fast_assign(
2749 __entry->dev = mp->m_super->s_dev;
2750 __entry->agno = agno;
2751 __entry->agbno = agbno;
2752 __entry->len = len;
2753 __entry->owner = owner;
2754 __entry->offset = offset;
2755 __entry->flags = flags;
2756 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002757 TP_printk("dev %d:%d agno 0x%x agbno %u len %u owner %lld offset %llu flags 0x%x",
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002758 MAJOR(__entry->dev), MINOR(__entry->dev),
2759 __entry->agno,
2760 __entry->agbno,
2761 __entry->len,
2762 __entry->owner,
2763 __entry->offset,
2764 __entry->flags)
2765);
2766#define DEFINE_RMAPBT_EVENT(name) \
2767DEFINE_EVENT(xfs_rmapbt_class, name, \
2768 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2769 xfs_agblock_t agbno, xfs_extlen_t len, \
2770 uint64_t owner, uint64_t offset, unsigned int flags), \
2771 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2772
2773#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2774DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2775DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2776
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002777DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2778DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002779DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2780DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2781DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2782DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2783DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2784DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002785
2786DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2787DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2788DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2789DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002790DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2791DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002792DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002793
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002794/* deferred bmbt updates */
2795#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2796DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2797DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2798
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002799/* per-AG reservation */
2800DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2801 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2802 xfs_extlen_t len),
2803 TP_ARGS(pag, resv, len),
2804 TP_STRUCT__entry(
2805 __field(dev_t, dev)
2806 __field(xfs_agnumber_t, agno)
2807 __field(int, resv)
2808 __field(xfs_extlen_t, freeblks)
2809 __field(xfs_extlen_t, flcount)
2810 __field(xfs_extlen_t, reserved)
2811 __field(xfs_extlen_t, asked)
2812 __field(xfs_extlen_t, len)
2813 ),
2814 TP_fast_assign(
2815 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2816
2817 __entry->dev = pag->pag_mount->m_super->s_dev;
2818 __entry->agno = pag->pag_agno;
2819 __entry->resv = resv;
2820 __entry->freeblks = pag->pagf_freeblks;
2821 __entry->flcount = pag->pagf_flcount;
2822 __entry->reserved = r ? r->ar_reserved : 0;
2823 __entry->asked = r ? r->ar_asked : 0;
2824 __entry->len = len;
2825 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002826 TP_printk("dev %d:%d agno 0x%x resv %d freeblks %u flcount %u "
Hou Tao42bf9db2017-04-14 11:43:27 -07002827 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002828 MAJOR(__entry->dev), MINOR(__entry->dev),
2829 __entry->agno,
2830 __entry->resv,
2831 __entry->freeblks,
2832 __entry->flcount,
2833 __entry->reserved,
2834 __entry->asked,
2835 __entry->len)
2836)
2837#define DEFINE_AG_RESV_EVENT(name) \
2838DEFINE_EVENT(xfs_ag_resv_class, name, \
2839 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2840 xfs_extlen_t len), \
2841 TP_ARGS(pag, type, len))
2842
2843/* per-AG reservation tracepoints */
2844DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2845DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2846DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2847DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2848DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2849DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2850
2851DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2852DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2853
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002854/* refcount tracepoint classes */
2855
2856/* reuse the discard trace class for agbno/aglen-based traces */
2857#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2858
2859/* ag btree lookup tracepoint class */
Darrick J. Wong85f8dff2018-12-18 14:32:29 -08002860TRACE_DEFINE_ENUM(XFS_LOOKUP_EQi);
2861TRACE_DEFINE_ENUM(XFS_LOOKUP_LEi);
2862TRACE_DEFINE_ENUM(XFS_LOOKUP_GEi);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002863DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2864 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2865 xfs_agblock_t agbno, xfs_lookup_t dir),
2866 TP_ARGS(mp, agno, agbno, dir),
2867 TP_STRUCT__entry(
2868 __field(dev_t, dev)
2869 __field(xfs_agnumber_t, agno)
2870 __field(xfs_agblock_t, agbno)
2871 __field(xfs_lookup_t, dir)
2872 ),
2873 TP_fast_assign(
2874 __entry->dev = mp->m_super->s_dev;
2875 __entry->agno = agno;
2876 __entry->agbno = agbno;
2877 __entry->dir = dir;
2878 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002879 TP_printk("dev %d:%d agno 0x%x agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002880 MAJOR(__entry->dev), MINOR(__entry->dev),
2881 __entry->agno,
2882 __entry->agbno,
2883 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2884 __entry->dir)
2885)
2886
2887#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2888DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2889 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2890 xfs_agblock_t agbno, xfs_lookup_t dir), \
2891 TP_ARGS(mp, agno, agbno, dir))
2892
2893/* single-rcext tracepoint class */
2894DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2895 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2896 struct xfs_refcount_irec *irec),
2897 TP_ARGS(mp, agno, irec),
2898 TP_STRUCT__entry(
2899 __field(dev_t, dev)
2900 __field(xfs_agnumber_t, agno)
2901 __field(xfs_agblock_t, startblock)
2902 __field(xfs_extlen_t, blockcount)
2903 __field(xfs_nlink_t, refcount)
2904 ),
2905 TP_fast_assign(
2906 __entry->dev = mp->m_super->s_dev;
2907 __entry->agno = agno;
2908 __entry->startblock = irec->rc_startblock;
2909 __entry->blockcount = irec->rc_blockcount;
2910 __entry->refcount = irec->rc_refcount;
2911 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002912 TP_printk("dev %d:%d agno 0x%x agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002913 MAJOR(__entry->dev), MINOR(__entry->dev),
2914 __entry->agno,
2915 __entry->startblock,
2916 __entry->blockcount,
2917 __entry->refcount)
2918)
2919
2920#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2921DEFINE_EVENT(xfs_refcount_extent_class, name, \
2922 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2923 struct xfs_refcount_irec *irec), \
2924 TP_ARGS(mp, agno, irec))
2925
2926/* single-rcext and an agbno tracepoint class */
2927DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2928 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2929 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2930 TP_ARGS(mp, agno, irec, agbno),
2931 TP_STRUCT__entry(
2932 __field(dev_t, dev)
2933 __field(xfs_agnumber_t, agno)
2934 __field(xfs_agblock_t, startblock)
2935 __field(xfs_extlen_t, blockcount)
2936 __field(xfs_nlink_t, refcount)
2937 __field(xfs_agblock_t, agbno)
2938 ),
2939 TP_fast_assign(
2940 __entry->dev = mp->m_super->s_dev;
2941 __entry->agno = agno;
2942 __entry->startblock = irec->rc_startblock;
2943 __entry->blockcount = irec->rc_blockcount;
2944 __entry->refcount = irec->rc_refcount;
2945 __entry->agbno = agbno;
2946 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002947 TP_printk("dev %d:%d agno 0x%x agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002948 MAJOR(__entry->dev), MINOR(__entry->dev),
2949 __entry->agno,
2950 __entry->startblock,
2951 __entry->blockcount,
2952 __entry->refcount,
2953 __entry->agbno)
2954)
2955
2956#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2957DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2958 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2959 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2960 TP_ARGS(mp, agno, irec, agbno))
2961
2962/* double-rcext tracepoint class */
2963DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2964 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2965 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2966 TP_ARGS(mp, agno, i1, i2),
2967 TP_STRUCT__entry(
2968 __field(dev_t, dev)
2969 __field(xfs_agnumber_t, agno)
2970 __field(xfs_agblock_t, i1_startblock)
2971 __field(xfs_extlen_t, i1_blockcount)
2972 __field(xfs_nlink_t, i1_refcount)
2973 __field(xfs_agblock_t, i2_startblock)
2974 __field(xfs_extlen_t, i2_blockcount)
2975 __field(xfs_nlink_t, i2_refcount)
2976 ),
2977 TP_fast_assign(
2978 __entry->dev = mp->m_super->s_dev;
2979 __entry->agno = agno;
2980 __entry->i1_startblock = i1->rc_startblock;
2981 __entry->i1_blockcount = i1->rc_blockcount;
2982 __entry->i1_refcount = i1->rc_refcount;
2983 __entry->i2_startblock = i2->rc_startblock;
2984 __entry->i2_blockcount = i2->rc_blockcount;
2985 __entry->i2_refcount = i2->rc_refcount;
2986 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07002987 TP_printk("dev %d:%d agno 0x%x agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002988 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002989 MAJOR(__entry->dev), MINOR(__entry->dev),
2990 __entry->agno,
2991 __entry->i1_startblock,
2992 __entry->i1_blockcount,
2993 __entry->i1_refcount,
2994 __entry->i2_startblock,
2995 __entry->i2_blockcount,
2996 __entry->i2_refcount)
2997)
2998
2999#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
3000DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
3001 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3002 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
3003 TP_ARGS(mp, agno, i1, i2))
3004
3005/* double-rcext and an agbno tracepoint class */
3006DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
3007 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3008 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3009 xfs_agblock_t agbno),
3010 TP_ARGS(mp, agno, i1, i2, agbno),
3011 TP_STRUCT__entry(
3012 __field(dev_t, dev)
3013 __field(xfs_agnumber_t, agno)
3014 __field(xfs_agblock_t, i1_startblock)
3015 __field(xfs_extlen_t, i1_blockcount)
3016 __field(xfs_nlink_t, i1_refcount)
3017 __field(xfs_agblock_t, i2_startblock)
3018 __field(xfs_extlen_t, i2_blockcount)
3019 __field(xfs_nlink_t, i2_refcount)
3020 __field(xfs_agblock_t, agbno)
3021 ),
3022 TP_fast_assign(
3023 __entry->dev = mp->m_super->s_dev;
3024 __entry->agno = agno;
3025 __entry->i1_startblock = i1->rc_startblock;
3026 __entry->i1_blockcount = i1->rc_blockcount;
3027 __entry->i1_refcount = i1->rc_refcount;
3028 __entry->i2_startblock = i2->rc_startblock;
3029 __entry->i2_blockcount = i2->rc_blockcount;
3030 __entry->i2_refcount = i2->rc_refcount;
3031 __entry->agbno = agbno;
3032 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003033 TP_printk("dev %d:%d agno 0x%x agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07003034 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003035 MAJOR(__entry->dev), MINOR(__entry->dev),
3036 __entry->agno,
3037 __entry->i1_startblock,
3038 __entry->i1_blockcount,
3039 __entry->i1_refcount,
3040 __entry->i2_startblock,
3041 __entry->i2_blockcount,
3042 __entry->i2_refcount,
3043 __entry->agbno)
3044)
3045
3046#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
3047DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
3048 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3049 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3050 xfs_agblock_t agbno), \
3051 TP_ARGS(mp, agno, i1, i2, agbno))
3052
3053/* triple-rcext tracepoint class */
3054DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
3055 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3056 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
3057 struct xfs_refcount_irec *i3),
3058 TP_ARGS(mp, agno, i1, i2, i3),
3059 TP_STRUCT__entry(
3060 __field(dev_t, dev)
3061 __field(xfs_agnumber_t, agno)
3062 __field(xfs_agblock_t, i1_startblock)
3063 __field(xfs_extlen_t, i1_blockcount)
3064 __field(xfs_nlink_t, i1_refcount)
3065 __field(xfs_agblock_t, i2_startblock)
3066 __field(xfs_extlen_t, i2_blockcount)
3067 __field(xfs_nlink_t, i2_refcount)
3068 __field(xfs_agblock_t, i3_startblock)
3069 __field(xfs_extlen_t, i3_blockcount)
3070 __field(xfs_nlink_t, i3_refcount)
3071 ),
3072 TP_fast_assign(
3073 __entry->dev = mp->m_super->s_dev;
3074 __entry->agno = agno;
3075 __entry->i1_startblock = i1->rc_startblock;
3076 __entry->i1_blockcount = i1->rc_blockcount;
3077 __entry->i1_refcount = i1->rc_refcount;
3078 __entry->i2_startblock = i2->rc_startblock;
3079 __entry->i2_blockcount = i2->rc_blockcount;
3080 __entry->i2_refcount = i2->rc_refcount;
3081 __entry->i3_startblock = i3->rc_startblock;
3082 __entry->i3_blockcount = i3->rc_blockcount;
3083 __entry->i3_refcount = i3->rc_refcount;
3084 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003085 TP_printk("dev %d:%d agno 0x%x agbno %u len %u refcount %u -- "
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003086 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07003087 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003088 MAJOR(__entry->dev), MINOR(__entry->dev),
3089 __entry->agno,
3090 __entry->i1_startblock,
3091 __entry->i1_blockcount,
3092 __entry->i1_refcount,
3093 __entry->i2_startblock,
3094 __entry->i2_blockcount,
3095 __entry->i2_refcount,
3096 __entry->i3_startblock,
3097 __entry->i3_blockcount,
3098 __entry->i3_refcount)
3099);
3100
3101#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
3102DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
3103 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3104 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
3105 struct xfs_refcount_irec *i3), \
3106 TP_ARGS(mp, agno, i1, i2, i3))
3107
3108/* refcount btree tracepoints */
3109DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
3110DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
3111DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
3112DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
3113DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
3114DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
3115DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
3116DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
3117DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
3118DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
3119
3120/* refcount adjustment tracepoints */
3121DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
3122DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07003123DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
3124DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003125DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
3126DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07003127DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003128DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
3129DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
3130DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
3131DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
3132DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
3133DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07003134DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003135DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
3136DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
3137DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
3138DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
3139DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
3140DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
3141DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
3142
3143/* reflink helpers */
3144DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
3145DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
3146DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07003147#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
3148DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
3149DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07003150
Darrick J. Wongf997ee22016-10-03 09:11:21 -07003151TRACE_EVENT(xfs_refcount_finish_one_leftover,
3152 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3153 int type, xfs_agblock_t agbno, xfs_extlen_t len,
3154 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
3155 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
3156 TP_STRUCT__entry(
3157 __field(dev_t, dev)
3158 __field(xfs_agnumber_t, agno)
3159 __field(int, type)
3160 __field(xfs_agblock_t, agbno)
3161 __field(xfs_extlen_t, len)
3162 __field(xfs_agblock_t, new_agbno)
3163 __field(xfs_extlen_t, new_len)
3164 ),
3165 TP_fast_assign(
3166 __entry->dev = mp->m_super->s_dev;
3167 __entry->agno = agno;
3168 __entry->type = type;
3169 __entry->agbno = agbno;
3170 __entry->len = len;
3171 __entry->new_agbno = new_agbno;
3172 __entry->new_len = new_len;
3173 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003174 TP_printk("dev %d:%d type %d agno 0x%x agbno %u len %u new_agbno %u new_len %u",
Darrick J. Wongf997ee22016-10-03 09:11:21 -07003175 MAJOR(__entry->dev), MINOR(__entry->dev),
3176 __entry->type,
3177 __entry->agno,
3178 __entry->agbno,
3179 __entry->len,
3180 __entry->new_agbno,
3181 __entry->new_len)
3182);
3183
Darrick J. Wongf65306e2016-10-03 09:11:27 -07003184/* simple inode-based error/%ip tracepoint class */
3185DECLARE_EVENT_CLASS(xfs_inode_error_class,
3186 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3187 TP_ARGS(ip, error, caller_ip),
3188 TP_STRUCT__entry(
3189 __field(dev_t, dev)
3190 __field(xfs_ino_t, ino)
3191 __field(int, error)
3192 __field(unsigned long, caller_ip)
3193 ),
3194 TP_fast_assign(
3195 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3196 __entry->ino = ip->i_ino;
3197 __entry->error = error;
3198 __entry->caller_ip = caller_ip;
3199 ),
Darrick J. Wongaf6265a2021-08-17 09:20:27 -07003200 TP_printk("dev %d:%d ino 0x%llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07003201 MAJOR(__entry->dev), MINOR(__entry->dev),
3202 __entry->ino,
3203 __entry->error,
3204 (char *)__entry->caller_ip)
3205);
3206
3207#define DEFINE_INODE_ERROR_EVENT(name) \
3208DEFINE_EVENT(xfs_inode_error_class, name, \
3209 TP_PROTO(struct xfs_inode *ip, int error, \
3210 unsigned long caller_ip), \
3211 TP_ARGS(ip, error, caller_ip))
3212
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003213/* reflink tracepoint classes */
3214
3215/* two-file io tracepoint class */
3216DECLARE_EVENT_CLASS(xfs_double_io_class,
3217 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3218 struct xfs_inode *dest, xfs_off_t doffset),
3219 TP_ARGS(src, soffset, len, dest, doffset),
3220 TP_STRUCT__entry(
3221 __field(dev_t, dev)
3222 __field(xfs_ino_t, src_ino)
3223 __field(loff_t, src_isize)
3224 __field(loff_t, src_disize)
3225 __field(loff_t, src_offset)
3226 __field(size_t, len)
3227 __field(xfs_ino_t, dest_ino)
3228 __field(loff_t, dest_isize)
3229 __field(loff_t, dest_disize)
3230 __field(loff_t, dest_offset)
3231 ),
3232 TP_fast_assign(
3233 __entry->dev = VFS_I(src)->i_sb->s_dev;
3234 __entry->src_ino = src->i_ino;
3235 __entry->src_isize = VFS_I(src)->i_size;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07003236 __entry->src_disize = src->i_disk_size;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003237 __entry->src_offset = soffset;
3238 __entry->len = len;
3239 __entry->dest_ino = dest->i_ino;
3240 __entry->dest_isize = VFS_I(dest)->i_size;
Christoph Hellwig13d2c102021-03-29 11:11:40 -07003241 __entry->dest_disize = dest->i_disk_size;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003242 __entry->dest_offset = doffset;
3243 ),
3244 TP_printk("dev %d:%d count %zd "
3245 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3246 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3247 MAJOR(__entry->dev), MINOR(__entry->dev),
3248 __entry->len,
3249 __entry->src_ino,
3250 __entry->src_isize,
3251 __entry->src_disize,
3252 __entry->src_offset,
3253 __entry->dest_ino,
3254 __entry->dest_isize,
3255 __entry->dest_disize,
3256 __entry->dest_offset)
3257)
3258
3259#define DEFINE_DOUBLE_IO_EVENT(name) \
3260DEFINE_EVENT(xfs_double_io_class, name, \
3261 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3262 struct xfs_inode *dest, xfs_off_t doffset), \
3263 TP_ARGS(src, soffset, len, dest, doffset))
3264
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003265/* inode/irec events */
3266DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3267 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3268 TP_ARGS(ip, irec),
3269 TP_STRUCT__entry(
3270 __field(dev_t, dev)
3271 __field(xfs_ino_t, ino)
3272 __field(xfs_fileoff_t, lblk)
3273 __field(xfs_extlen_t, len)
3274 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003275 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003276 ),
3277 TP_fast_assign(
3278 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3279 __entry->ino = ip->i_ino;
3280 __entry->lblk = irec->br_startoff;
3281 __entry->len = irec->br_blockcount;
3282 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003283 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003284 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003285 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 -07003286 MAJOR(__entry->dev), MINOR(__entry->dev),
3287 __entry->ino,
3288 __entry->lblk,
3289 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003290 __entry->pblk,
3291 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003292);
3293#define DEFINE_INODE_IREC_EVENT(name) \
3294DEFINE_EVENT(xfs_inode_irec_class, name, \
3295 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3296 TP_ARGS(ip, irec))
3297
3298/* refcount/reflink tracepoint definitions */
3299
3300/* reflink tracepoints */
3301DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3302DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3303DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
Darrick J. Wong00fd1d52020-06-29 14:47:18 -07003304TRACE_EVENT(xfs_reflink_remap_blocks,
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003305 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3306 xfs_filblks_t len, struct xfs_inode *dest,
3307 xfs_fileoff_t doffset),
3308 TP_ARGS(src, soffset, len, dest, doffset),
3309 TP_STRUCT__entry(
3310 __field(dev_t, dev)
3311 __field(xfs_ino_t, src_ino)
3312 __field(xfs_fileoff_t, src_lblk)
3313 __field(xfs_filblks_t, len)
3314 __field(xfs_ino_t, dest_ino)
3315 __field(xfs_fileoff_t, dest_lblk)
3316 ),
3317 TP_fast_assign(
3318 __entry->dev = VFS_I(src)->i_sb->s_dev;
3319 __entry->src_ino = src->i_ino;
3320 __entry->src_lblk = soffset;
3321 __entry->len = len;
3322 __entry->dest_ino = dest->i_ino;
3323 __entry->dest_lblk = doffset;
3324 ),
3325 TP_printk("dev %d:%d len 0x%llx "
3326 "ino 0x%llx offset 0x%llx blocks -> "
3327 "ino 0x%llx offset 0x%llx blocks",
3328 MAJOR(__entry->dev), MINOR(__entry->dev),
3329 __entry->len,
3330 __entry->src_ino,
3331 __entry->src_lblk,
3332 __entry->dest_ino,
3333 __entry->dest_lblk)
3334);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003335DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3336DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3337DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3338DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003339DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3340DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
Darrick J. Wong00fd1d52020-06-29 14:47:18 -07003341DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_src);
3342DEFINE_INODE_IREC_EVENT(xfs_reflink_remap_extent_dest);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003343
3344/* dedupe tracepoints */
3345DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3346DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3347
3348/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003349TRACE_EVENT(xfs_ioctl_clone,
3350 TP_PROTO(struct inode *src, struct inode *dest),
3351 TP_ARGS(src, dest),
3352 TP_STRUCT__entry(
3353 __field(dev_t, dev)
3354 __field(unsigned long, src_ino)
3355 __field(loff_t, src_isize)
3356 __field(unsigned long, dest_ino)
3357 __field(loff_t, dest_isize)
3358 ),
3359 TP_fast_assign(
3360 __entry->dev = src->i_sb->s_dev;
3361 __entry->src_ino = src->i_ino;
3362 __entry->src_isize = i_size_read(src);
3363 __entry->dest_ino = dest->i_ino;
3364 __entry->dest_isize = i_size_read(dest);
3365 ),
3366 TP_printk("dev %d:%d "
3367 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003368 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003369 MAJOR(__entry->dev), MINOR(__entry->dev),
3370 __entry->src_ino,
3371 __entry->src_isize,
3372 __entry->dest_ino,
3373 __entry->dest_isize)
3374);
3375
3376/* unshare tracepoints */
3377DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003378DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003379
3380/* copy on write */
3381DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003382DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3383DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003384DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003385
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003386DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3387DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3388DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003389
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003390DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3391DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3392
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003393
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003394DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003395
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003396/* rmap swapext tracepoints */
3397DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3398DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3399DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3400
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003401/* fsmap traces */
3402DECLARE_EVENT_CLASS(xfs_fsmap_class,
3403 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
Darrick J. Wong159eb692021-08-10 17:02:16 -07003404 const struct xfs_rmap_irec *rmap),
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003405 TP_ARGS(mp, keydev, agno, rmap),
3406 TP_STRUCT__entry(
3407 __field(dev_t, dev)
3408 __field(dev_t, keydev)
3409 __field(xfs_agnumber_t, agno)
3410 __field(xfs_fsblock_t, bno)
3411 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003412 __field(uint64_t, owner)
3413 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003414 __field(unsigned int, flags)
3415 ),
3416 TP_fast_assign(
3417 __entry->dev = mp->m_super->s_dev;
3418 __entry->keydev = new_decode_dev(keydev);
3419 __entry->agno = agno;
3420 __entry->bno = rmap->rm_startblock;
3421 __entry->len = rmap->rm_blockcount;
3422 __entry->owner = rmap->rm_owner;
3423 __entry->offset = rmap->rm_offset;
3424 __entry->flags = rmap->rm_flags;
3425 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003426 TP_printk("dev %d:%d keydev %d:%d agno 0x%x bno %llu len %llu owner %lld offset %llu flags 0x%x",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003427 MAJOR(__entry->dev), MINOR(__entry->dev),
3428 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3429 __entry->agno,
3430 __entry->bno,
3431 __entry->len,
3432 __entry->owner,
3433 __entry->offset,
3434 __entry->flags)
3435)
3436#define DEFINE_FSMAP_EVENT(name) \
3437DEFINE_EVENT(xfs_fsmap_class, name, \
3438 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
Darrick J. Wong159eb692021-08-10 17:02:16 -07003439 const struct xfs_rmap_irec *rmap), \
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003440 TP_ARGS(mp, keydev, agno, rmap))
3441DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3442DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3443DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3444
3445DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3446 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3447 TP_ARGS(mp, fsmap),
3448 TP_STRUCT__entry(
3449 __field(dev_t, dev)
3450 __field(dev_t, keydev)
3451 __field(xfs_daddr_t, block)
3452 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003453 __field(uint64_t, owner)
3454 __field(uint64_t, offset)
3455 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003456 ),
3457 TP_fast_assign(
3458 __entry->dev = mp->m_super->s_dev;
3459 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3460 __entry->block = fsmap->fmr_physical;
3461 __entry->len = fsmap->fmr_length;
3462 __entry->owner = fsmap->fmr_owner;
3463 __entry->offset = fsmap->fmr_offset;
3464 __entry->flags = fsmap->fmr_flags;
3465 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003466 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 -07003467 MAJOR(__entry->dev), MINOR(__entry->dev),
3468 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3469 __entry->block,
3470 __entry->len,
3471 __entry->owner,
3472 __entry->offset,
3473 __entry->flags)
3474)
3475#define DEFINE_GETFSMAP_EVENT(name) \
3476DEFINE_EVENT(xfs_getfsmap_class, name, \
3477 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3478 TP_ARGS(mp, fsmap))
3479DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3480DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3481DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3482
Darrick J. Wongb872af22018-01-08 10:51:26 -08003483TRACE_EVENT(xfs_trans_resv_calc,
3484 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3485 struct xfs_trans_res *res),
3486 TP_ARGS(mp, type, res),
3487 TP_STRUCT__entry(
3488 __field(dev_t, dev)
3489 __field(int, type)
3490 __field(uint, logres)
3491 __field(int, logcount)
3492 __field(int, logflags)
3493 ),
3494 TP_fast_assign(
3495 __entry->dev = mp->m_super->s_dev;
3496 __entry->type = type;
3497 __entry->logres = res->tr_logres;
3498 __entry->logcount = res->tr_logcount;
3499 __entry->logflags = res->tr_logflags;
3500 ),
3501 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3502 MAJOR(__entry->dev), MINOR(__entry->dev),
3503 __entry->type,
3504 __entry->logres,
3505 __entry->logcount,
3506 __entry->logflags)
3507);
3508
Dave Chinnerba187812018-05-09 07:47:57 -07003509DECLARE_EVENT_CLASS(xfs_trans_class,
3510 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip),
3511 TP_ARGS(tp, caller_ip),
3512 TP_STRUCT__entry(
3513 __field(dev_t, dev)
3514 __field(uint32_t, tid)
3515 __field(uint32_t, flags)
3516 __field(unsigned long, caller_ip)
3517 ),
3518 TP_fast_assign(
3519 __entry->dev = tp->t_mountp->m_super->s_dev;
3520 __entry->tid = 0;
3521 if (tp->t_ticket)
3522 __entry->tid = tp->t_ticket->t_tid;
3523 __entry->flags = tp->t_flags;
3524 __entry->caller_ip = caller_ip;
3525 ),
3526 TP_printk("dev %d:%d trans %x flags 0x%x caller %pS",
3527 MAJOR(__entry->dev), MINOR(__entry->dev),
3528 __entry->tid,
3529 __entry->flags,
3530 (char *)__entry->caller_ip)
3531)
3532
3533#define DEFINE_TRANS_EVENT(name) \
3534DEFINE_EVENT(xfs_trans_class, name, \
3535 TP_PROTO(struct xfs_trans *tp, unsigned long caller_ip), \
3536 TP_ARGS(tp, caller_ip))
3537DEFINE_TRANS_EVENT(xfs_trans_alloc);
3538DEFINE_TRANS_EVENT(xfs_trans_cancel);
3539DEFINE_TRANS_EVENT(xfs_trans_commit);
3540DEFINE_TRANS_EVENT(xfs_trans_dup);
3541DEFINE_TRANS_EVENT(xfs_trans_free);
3542DEFINE_TRANS_EVENT(xfs_trans_roll);
3543DEFINE_TRANS_EVENT(xfs_trans_add_item);
Christoph Hellwig195cd832019-06-28 19:27:31 -07003544DEFINE_TRANS_EVENT(xfs_trans_commit_items);
Dave Chinnerba187812018-05-09 07:47:57 -07003545DEFINE_TRANS_EVENT(xfs_trans_free_items);
3546
Darrick J. Wong9a4a5112019-02-07 10:37:14 -08003547TRACE_EVENT(xfs_iunlink_update_bucket,
3548 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int bucket,
3549 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3550 TP_ARGS(mp, agno, bucket, old_ptr, new_ptr),
3551 TP_STRUCT__entry(
3552 __field(dev_t, dev)
3553 __field(xfs_agnumber_t, agno)
3554 __field(unsigned int, bucket)
3555 __field(xfs_agino_t, old_ptr)
3556 __field(xfs_agino_t, new_ptr)
3557 ),
3558 TP_fast_assign(
3559 __entry->dev = mp->m_super->s_dev;
3560 __entry->agno = agno;
3561 __entry->bucket = bucket;
3562 __entry->old_ptr = old_ptr;
3563 __entry->new_ptr = new_ptr;
3564 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003565 TP_printk("dev %d:%d agno 0x%x bucket %u old 0x%x new 0x%x",
Darrick J. Wong9a4a5112019-02-07 10:37:14 -08003566 MAJOR(__entry->dev), MINOR(__entry->dev),
3567 __entry->agno,
3568 __entry->bucket,
3569 __entry->old_ptr,
3570 __entry->new_ptr)
3571);
3572
Darrick J. Wongf2fc16a2019-02-07 10:37:15 -08003573TRACE_EVENT(xfs_iunlink_update_dinode,
3574 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
3575 xfs_agino_t old_ptr, xfs_agino_t new_ptr),
3576 TP_ARGS(mp, agno, agino, old_ptr, new_ptr),
3577 TP_STRUCT__entry(
3578 __field(dev_t, dev)
3579 __field(xfs_agnumber_t, agno)
3580 __field(xfs_agino_t, agino)
3581 __field(xfs_agino_t, old_ptr)
3582 __field(xfs_agino_t, new_ptr)
3583 ),
3584 TP_fast_assign(
3585 __entry->dev = mp->m_super->s_dev;
3586 __entry->agno = agno;
3587 __entry->agino = agino;
3588 __entry->old_ptr = old_ptr;
3589 __entry->new_ptr = new_ptr;
3590 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003591 TP_printk("dev %d:%d agno 0x%x agino 0x%x old 0x%x new 0x%x",
Darrick J. Wongf2fc16a2019-02-07 10:37:15 -08003592 MAJOR(__entry->dev), MINOR(__entry->dev),
3593 __entry->agno,
3594 __entry->agino,
3595 __entry->old_ptr,
3596 __entry->new_ptr)
3597);
3598
Darrick J. Wong4664c662019-02-07 10:37:16 -08003599DECLARE_EVENT_CLASS(xfs_ag_inode_class,
3600 TP_PROTO(struct xfs_inode *ip),
3601 TP_ARGS(ip),
3602 TP_STRUCT__entry(
3603 __field(dev_t, dev)
3604 __field(xfs_agnumber_t, agno)
3605 __field(xfs_agino_t, agino)
3606 ),
3607 TP_fast_assign(
3608 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3609 __entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3610 __entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3611 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003612 TP_printk("dev %d:%d agno 0x%x agino 0x%x",
Darrick J. Wong4664c662019-02-07 10:37:16 -08003613 MAJOR(__entry->dev), MINOR(__entry->dev),
3614 __entry->agno, __entry->agino)
3615)
3616
3617#define DEFINE_AGINODE_EVENT(name) \
3618DEFINE_EVENT(xfs_ag_inode_class, name, \
3619 TP_PROTO(struct xfs_inode *ip), \
3620 TP_ARGS(ip))
3621DEFINE_AGINODE_EVENT(xfs_iunlink);
3622DEFINE_AGINODE_EVENT(xfs_iunlink_remove);
Darrick J. Wong9b247172019-02-07 10:37:16 -08003623DEFINE_AG_EVENT(xfs_iunlink_map_prev_fallback);
Darrick J. Wong4664c662019-02-07 10:37:16 -08003624
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003625DECLARE_EVENT_CLASS(xfs_fs_corrupt_class,
3626 TP_PROTO(struct xfs_mount *mp, unsigned int flags),
3627 TP_ARGS(mp, flags),
3628 TP_STRUCT__entry(
3629 __field(dev_t, dev)
3630 __field(unsigned int, flags)
3631 ),
3632 TP_fast_assign(
3633 __entry->dev = mp->m_super->s_dev;
3634 __entry->flags = flags;
3635 ),
3636 TP_printk("dev %d:%d flags 0x%x",
3637 MAJOR(__entry->dev), MINOR(__entry->dev),
3638 __entry->flags)
3639);
3640#define DEFINE_FS_CORRUPT_EVENT(name) \
3641DEFINE_EVENT(xfs_fs_corrupt_class, name, \
3642 TP_PROTO(struct xfs_mount *mp, unsigned int flags), \
3643 TP_ARGS(mp, flags))
3644DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_sick);
3645DEFINE_FS_CORRUPT_EVENT(xfs_fs_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003646DEFINE_FS_CORRUPT_EVENT(xfs_fs_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003647DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_sick);
3648DEFINE_FS_CORRUPT_EVENT(xfs_rt_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003649DEFINE_FS_CORRUPT_EVENT(xfs_rt_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003650
3651DECLARE_EVENT_CLASS(xfs_ag_corrupt_class,
3652 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int flags),
3653 TP_ARGS(mp, agno, flags),
3654 TP_STRUCT__entry(
3655 __field(dev_t, dev)
3656 __field(xfs_agnumber_t, agno)
3657 __field(unsigned int, flags)
3658 ),
3659 TP_fast_assign(
3660 __entry->dev = mp->m_super->s_dev;
3661 __entry->agno = agno;
3662 __entry->flags = flags;
3663 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003664 TP_printk("dev %d:%d agno 0x%x flags 0x%x",
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003665 MAJOR(__entry->dev), MINOR(__entry->dev),
3666 __entry->agno, __entry->flags)
3667);
3668#define DEFINE_AG_CORRUPT_EVENT(name) \
3669DEFINE_EVENT(xfs_ag_corrupt_class, name, \
3670 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
3671 unsigned int flags), \
3672 TP_ARGS(mp, agno, flags))
3673DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_sick);
3674DEFINE_AG_CORRUPT_EVENT(xfs_ag_mark_healthy);
Darrick J. Wong519841c2019-04-12 07:41:16 -07003675DEFINE_AG_CORRUPT_EVENT(xfs_ag_unfixed_corruption);
Darrick J. Wong6772c1f2019-04-12 07:40:25 -07003676
3677DECLARE_EVENT_CLASS(xfs_inode_corrupt_class,
3678 TP_PROTO(struct xfs_inode *ip, unsigned int flags),
3679 TP_ARGS(ip, flags),
3680 TP_STRUCT__entry(
3681 __field(dev_t, dev)
3682 __field(xfs_ino_t, ino)
3683 __field(unsigned int, flags)
3684 ),
3685 TP_fast_assign(
3686 __entry->dev = ip->i_mount->m_super->s_dev;
3687 __entry->ino = ip->i_ino;
3688 __entry->flags = flags;
3689 ),
3690 TP_printk("dev %d:%d ino 0x%llx flags 0x%x",
3691 MAJOR(__entry->dev), MINOR(__entry->dev),
3692 __entry->ino, __entry->flags)
3693);
3694#define DEFINE_INODE_CORRUPT_EVENT(name) \
3695DEFINE_EVENT(xfs_inode_corrupt_class, name, \
3696 TP_PROTO(struct xfs_inode *ip, unsigned int flags), \
3697 TP_ARGS(ip, flags))
3698DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_sick);
3699DEFINE_INODE_CORRUPT_EVENT(xfs_inode_mark_healthy);
3700
Darrick J. Wonga2114322019-07-02 09:39:38 -07003701TRACE_EVENT(xfs_iwalk_ag,
3702 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3703 xfs_agino_t startino),
3704 TP_ARGS(mp, agno, startino),
3705 TP_STRUCT__entry(
3706 __field(dev_t, dev)
3707 __field(xfs_agnumber_t, agno)
3708 __field(xfs_agino_t, startino)
3709 ),
3710 TP_fast_assign(
3711 __entry->dev = mp->m_super->s_dev;
3712 __entry->agno = agno;
3713 __entry->startino = startino;
3714 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003715 TP_printk("dev %d:%d agno 0x%x startino 0x%x",
Darrick J. Wonga2114322019-07-02 09:39:38 -07003716 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3717 __entry->startino)
3718)
3719
3720TRACE_EVENT(xfs_iwalk_ag_rec,
3721 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
3722 struct xfs_inobt_rec_incore *irec),
3723 TP_ARGS(mp, agno, irec),
3724 TP_STRUCT__entry(
3725 __field(dev_t, dev)
3726 __field(xfs_agnumber_t, agno)
3727 __field(xfs_agino_t, startino)
3728 __field(uint64_t, freemask)
3729 ),
3730 TP_fast_assign(
3731 __entry->dev = mp->m_super->s_dev;
3732 __entry->agno = agno;
3733 __entry->startino = irec->ir_startino;
3734 __entry->freemask = irec->ir_free;
3735 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003736 TP_printk("dev %d:%d agno 0x%x startino 0x%x freemask 0x%llx",
Darrick J. Wonga2114322019-07-02 09:39:38 -07003737 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
3738 __entry->startino, __entry->freemask)
3739)
3740
Darrick J. Wong40786712019-07-03 07:33:26 -07003741TRACE_EVENT(xfs_pwork_init,
3742 TP_PROTO(struct xfs_mount *mp, unsigned int nr_threads, pid_t pid),
3743 TP_ARGS(mp, nr_threads, pid),
3744 TP_STRUCT__entry(
3745 __field(dev_t, dev)
3746 __field(unsigned int, nr_threads)
3747 __field(pid_t, pid)
3748 ),
3749 TP_fast_assign(
3750 __entry->dev = mp->m_super->s_dev;
3751 __entry->nr_threads = nr_threads;
3752 __entry->pid = pid;
3753 ),
3754 TP_printk("dev %d:%d nr_threads %u pid %u",
3755 MAJOR(__entry->dev), MINOR(__entry->dev),
3756 __entry->nr_threads, __entry->pid)
3757)
3758
Dave Chinner0ad95682019-08-26 12:08:10 -07003759DECLARE_EVENT_CLASS(xfs_kmem_class,
3760 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip),
3761 TP_ARGS(size, flags, caller_ip),
3762 TP_STRUCT__entry(
3763 __field(ssize_t, size)
3764 __field(int, flags)
3765 __field(unsigned long, caller_ip)
3766 ),
3767 TP_fast_assign(
3768 __entry->size = size;
3769 __entry->flags = flags;
3770 __entry->caller_ip = caller_ip;
3771 ),
3772 TP_printk("size %zd flags 0x%x caller %pS",
3773 __entry->size,
3774 __entry->flags,
3775 (char *)__entry->caller_ip)
3776)
3777
3778#define DEFINE_KMEM_EVENT(name) \
3779DEFINE_EVENT(xfs_kmem_class, name, \
3780 TP_PROTO(ssize_t size, int flags, unsigned long caller_ip), \
3781 TP_ARGS(size, flags, caller_ip))
3782DEFINE_KMEM_EVENT(kmem_alloc);
Dave Chinner0ad95682019-08-26 12:08:10 -07003783
Darrick J. Wong13eaec42019-12-11 13:19:06 -08003784TRACE_EVENT(xfs_check_new_dalign,
3785 TP_PROTO(struct xfs_mount *mp, int new_dalign, xfs_ino_t calc_rootino),
3786 TP_ARGS(mp, new_dalign, calc_rootino),
3787 TP_STRUCT__entry(
3788 __field(dev_t, dev)
3789 __field(int, new_dalign)
3790 __field(xfs_ino_t, sb_rootino)
3791 __field(xfs_ino_t, calc_rootino)
3792 ),
3793 TP_fast_assign(
3794 __entry->dev = mp->m_super->s_dev;
3795 __entry->new_dalign = new_dalign;
3796 __entry->sb_rootino = mp->m_sb.sb_rootino;
3797 __entry->calc_rootino = calc_rootino;
3798 ),
Darrick J. Wongaf6265a2021-08-17 09:20:27 -07003799 TP_printk("dev %d:%d new_dalign %d sb_rootino 0x%llx calc_rootino 0x%llx",
Darrick J. Wong13eaec42019-12-11 13:19:06 -08003800 MAJOR(__entry->dev), MINOR(__entry->dev),
3801 __entry->new_dalign, __entry->sb_rootino,
3802 __entry->calc_rootino)
3803)
3804
Darrick J. Wonge06536a2020-03-11 10:40:26 -07003805TRACE_EVENT(xfs_btree_commit_afakeroot,
3806 TP_PROTO(struct xfs_btree_cur *cur),
3807 TP_ARGS(cur),
3808 TP_STRUCT__entry(
3809 __field(dev_t, dev)
3810 __field(xfs_btnum_t, btnum)
3811 __field(xfs_agnumber_t, agno)
3812 __field(xfs_agblock_t, agbno)
3813 __field(unsigned int, levels)
3814 __field(unsigned int, blocks)
3815 ),
3816 TP_fast_assign(
3817 __entry->dev = cur->bc_mp->m_super->s_dev;
3818 __entry->btnum = cur->bc_btnum;
Dave Chinner50f02fe2021-06-02 10:48:24 +10003819 __entry->agno = cur->bc_ag.pag->pag_agno;
Darrick J. Wonge06536a2020-03-11 10:40:26 -07003820 __entry->agbno = cur->bc_ag.afake->af_root;
3821 __entry->levels = cur->bc_ag.afake->af_levels;
3822 __entry->blocks = cur->bc_ag.afake->af_blocks;
3823 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003824 TP_printk("dev %d:%d btree %s agno 0x%x levels %u blocks %u root %u",
Darrick J. Wonge06536a2020-03-11 10:40:26 -07003825 MAJOR(__entry->dev), MINOR(__entry->dev),
3826 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3827 __entry->agno,
3828 __entry->levels,
3829 __entry->blocks,
3830 __entry->agbno)
3831)
3832
Darrick J. Wong349e1c02020-03-11 10:42:34 -07003833TRACE_EVENT(xfs_btree_commit_ifakeroot,
3834 TP_PROTO(struct xfs_btree_cur *cur),
3835 TP_ARGS(cur),
3836 TP_STRUCT__entry(
3837 __field(dev_t, dev)
3838 __field(xfs_btnum_t, btnum)
3839 __field(xfs_agnumber_t, agno)
3840 __field(xfs_agino_t, agino)
3841 __field(unsigned int, levels)
3842 __field(unsigned int, blocks)
3843 __field(int, whichfork)
3844 ),
3845 TP_fast_assign(
3846 __entry->dev = cur->bc_mp->m_super->s_dev;
3847 __entry->btnum = cur->bc_btnum;
3848 __entry->agno = XFS_INO_TO_AGNO(cur->bc_mp,
3849 cur->bc_ino.ip->i_ino);
3850 __entry->agino = XFS_INO_TO_AGINO(cur->bc_mp,
3851 cur->bc_ino.ip->i_ino);
3852 __entry->levels = cur->bc_ino.ifake->if_levels;
3853 __entry->blocks = cur->bc_ino.ifake->if_blocks;
3854 __entry->whichfork = cur->bc_ino.whichfork;
3855 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003856 TP_printk("dev %d:%d btree %s agno 0x%x agino 0x%x whichfork %s levels %u blocks %u",
Darrick J. Wong349e1c02020-03-11 10:42:34 -07003857 MAJOR(__entry->dev), MINOR(__entry->dev),
3858 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3859 __entry->agno,
3860 __entry->agino,
3861 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
3862 __entry->levels,
3863 __entry->blocks)
3864)
3865
Darrick J. Wong60e3d702020-03-11 10:51:50 -07003866TRACE_EVENT(xfs_btree_bload_level_geometry,
3867 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3868 uint64_t nr_this_level, unsigned int nr_per_block,
3869 unsigned int desired_npb, uint64_t blocks,
3870 uint64_t blocks_with_extra),
3871 TP_ARGS(cur, level, nr_this_level, nr_per_block, desired_npb, blocks,
3872 blocks_with_extra),
3873 TP_STRUCT__entry(
3874 __field(dev_t, dev)
3875 __field(xfs_btnum_t, btnum)
3876 __field(unsigned int, level)
3877 __field(unsigned int, nlevels)
3878 __field(uint64_t, nr_this_level)
3879 __field(unsigned int, nr_per_block)
3880 __field(unsigned int, desired_npb)
3881 __field(unsigned long long, blocks)
3882 __field(unsigned long long, blocks_with_extra)
3883 ),
3884 TP_fast_assign(
3885 __entry->dev = cur->bc_mp->m_super->s_dev;
3886 __entry->btnum = cur->bc_btnum;
3887 __entry->level = level;
3888 __entry->nlevels = cur->bc_nlevels;
3889 __entry->nr_this_level = nr_this_level;
3890 __entry->nr_per_block = nr_per_block;
3891 __entry->desired_npb = desired_npb;
3892 __entry->blocks = blocks;
3893 __entry->blocks_with_extra = blocks_with_extra;
3894 ),
3895 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",
3896 MAJOR(__entry->dev), MINOR(__entry->dev),
3897 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3898 __entry->level,
3899 __entry->nlevels,
3900 __entry->nr_this_level,
3901 __entry->nr_per_block,
3902 __entry->desired_npb,
3903 __entry->blocks,
3904 __entry->blocks_with_extra)
3905)
3906
3907TRACE_EVENT(xfs_btree_bload_block,
3908 TP_PROTO(struct xfs_btree_cur *cur, unsigned int level,
3909 uint64_t block_idx, uint64_t nr_blocks,
3910 union xfs_btree_ptr *ptr, unsigned int nr_records),
3911 TP_ARGS(cur, level, block_idx, nr_blocks, ptr, nr_records),
3912 TP_STRUCT__entry(
3913 __field(dev_t, dev)
3914 __field(xfs_btnum_t, btnum)
3915 __field(unsigned int, level)
3916 __field(unsigned long long, block_idx)
3917 __field(unsigned long long, nr_blocks)
3918 __field(xfs_agnumber_t, agno)
3919 __field(xfs_agblock_t, agbno)
3920 __field(unsigned int, nr_records)
3921 ),
3922 TP_fast_assign(
3923 __entry->dev = cur->bc_mp->m_super->s_dev;
3924 __entry->btnum = cur->bc_btnum;
3925 __entry->level = level;
3926 __entry->block_idx = block_idx;
3927 __entry->nr_blocks = nr_blocks;
3928 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
3929 xfs_fsblock_t fsb = be64_to_cpu(ptr->l);
3930
3931 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsb);
3932 __entry->agbno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsb);
3933 } else {
Dave Chinner50f02fe2021-06-02 10:48:24 +10003934 __entry->agno = cur->bc_ag.pag->pag_agno;
Darrick J. Wong60e3d702020-03-11 10:51:50 -07003935 __entry->agbno = be32_to_cpu(ptr->s);
3936 }
3937 __entry->nr_records = nr_records;
3938 ),
Darrick J. Wong9febf392021-08-17 09:24:26 -07003939 TP_printk("dev %d:%d btree %s level %u block %llu/%llu agno 0x%x agbno %u recs %u",
Darrick J. Wong60e3d702020-03-11 10:51:50 -07003940 MAJOR(__entry->dev), MINOR(__entry->dev),
3941 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
3942 __entry->level,
3943 __entry->block_idx,
3944 __entry->nr_blocks,
3945 __entry->agno,
3946 __entry->agbno,
3947 __entry->nr_records)
3948)
3949
Darrick J. Wong06dbf822020-08-24 11:58:01 -07003950DECLARE_EVENT_CLASS(xfs_timestamp_range_class,
3951 TP_PROTO(struct xfs_mount *mp, time64_t min, time64_t max),
3952 TP_ARGS(mp, min, max),
3953 TP_STRUCT__entry(
3954 __field(dev_t, dev)
3955 __field(long long, min)
3956 __field(long long, max)
3957 ),
3958 TP_fast_assign(
3959 __entry->dev = mp->m_super->s_dev;
3960 __entry->min = min;
3961 __entry->max = max;
3962 ),
3963 TP_printk("dev %d:%d min %lld max %lld",
3964 MAJOR(__entry->dev), MINOR(__entry->dev),
3965 __entry->min,
3966 __entry->max)
3967)
3968
3969#define DEFINE_TIMESTAMP_RANGE_EVENT(name) \
3970DEFINE_EVENT(xfs_timestamp_range_class, name, \
3971 TP_PROTO(struct xfs_mount *mp, long long min, long long max), \
3972 TP_ARGS(mp, min, max))
3973DEFINE_TIMESTAMP_RANGE_EVENT(xfs_inode_timestamp_range);
3974DEFINE_TIMESTAMP_RANGE_EVENT(xfs_quota_expiry_range);
3975
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -07003976DECLARE_EVENT_CLASS(xfs_icwalk_class,
3977 TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw,
Darrick J. Wong38899f82021-01-22 16:48:38 -08003978 unsigned long caller_ip),
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -07003979 TP_ARGS(mp, icw, caller_ip),
Darrick J. Wong38899f82021-01-22 16:48:38 -08003980 TP_STRUCT__entry(
3981 __field(dev_t, dev)
3982 __field(__u32, flags)
3983 __field(uint32_t, uid)
3984 __field(uint32_t, gid)
3985 __field(prid_t, prid)
3986 __field(__u64, min_file_size)
Darrick J. Wong10be3502021-06-18 11:57:06 -07003987 __field(long, scan_limit)
Darrick J. Wong38899f82021-01-22 16:48:38 -08003988 __field(unsigned long, caller_ip)
3989 ),
3990 TP_fast_assign(
3991 __entry->dev = mp->m_super->s_dev;
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -07003992 __entry->flags = icw ? icw->icw_flags : 0;
3993 __entry->uid = icw ? from_kuid(mp->m_super->s_user_ns,
3994 icw->icw_uid) : 0;
3995 __entry->gid = icw ? from_kgid(mp->m_super->s_user_ns,
3996 icw->icw_gid) : 0;
3997 __entry->prid = icw ? icw->icw_prid : 0;
3998 __entry->min_file_size = icw ? icw->icw_min_file_size : 0;
3999 __entry->scan_limit = icw ? icw->icw_scan_limit : 0;
Darrick J. Wong38899f82021-01-22 16:48:38 -08004000 __entry->caller_ip = caller_ip;
4001 ),
Darrick J. Wong10be3502021-06-18 11:57:06 -07004002 TP_printk("dev %d:%d flags 0x%x uid %u gid %u prid %u minsize %llu scan_limit %ld caller %pS",
Darrick J. Wong38899f82021-01-22 16:48:38 -08004003 MAJOR(__entry->dev), MINOR(__entry->dev),
4004 __entry->flags,
4005 __entry->uid,
4006 __entry->gid,
4007 __entry->prid,
4008 __entry->min_file_size,
Darrick J. Wongf1bc5c52021-05-31 11:32:02 -07004009 __entry->scan_limit,
Darrick J. Wong38899f82021-01-22 16:48:38 -08004010 (char *)__entry->caller_ip)
4011);
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -07004012#define DEFINE_ICWALK_EVENT(name) \
4013DEFINE_EVENT(xfs_icwalk_class, name, \
4014 TP_PROTO(struct xfs_mount *mp, struct xfs_icwalk *icw, \
Darrick J. Wong38899f82021-01-22 16:48:38 -08004015 unsigned long caller_ip), \
Darrick J. Wongb26b2bf2021-06-07 09:34:51 -07004016 TP_ARGS(mp, icw, caller_ip))
4017DEFINE_ICWALK_EVENT(xfs_ioc_free_eofblocks);
4018DEFINE_ICWALK_EVENT(xfs_blockgc_free_space);
Darrick J. Wong38899f82021-01-22 16:48:38 -08004019
Dave Chinner956f6da2021-06-18 11:57:05 -07004020TRACE_DEFINE_ENUM(XLOG_STATE_ACTIVE);
4021TRACE_DEFINE_ENUM(XLOG_STATE_WANT_SYNC);
4022TRACE_DEFINE_ENUM(XLOG_STATE_SYNCING);
4023TRACE_DEFINE_ENUM(XLOG_STATE_DONE_SYNC);
4024TRACE_DEFINE_ENUM(XLOG_STATE_CALLBACK);
4025TRACE_DEFINE_ENUM(XLOG_STATE_DIRTY);
Dave Chinner956f6da2021-06-18 11:57:05 -07004026
4027DECLARE_EVENT_CLASS(xlog_iclog_class,
4028 TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip),
4029 TP_ARGS(iclog, caller_ip),
4030 TP_STRUCT__entry(
4031 __field(dev_t, dev)
4032 __field(uint32_t, state)
4033 __field(int32_t, refcount)
4034 __field(uint32_t, offset)
Dave Chinnerb2ae3a92021-07-27 16:23:50 -07004035 __field(uint32_t, flags)
Dave Chinner956f6da2021-06-18 11:57:05 -07004036 __field(unsigned long long, lsn)
4037 __field(unsigned long, caller_ip)
4038 ),
4039 TP_fast_assign(
4040 __entry->dev = iclog->ic_log->l_mp->m_super->s_dev;
4041 __entry->state = iclog->ic_state;
4042 __entry->refcount = atomic_read(&iclog->ic_refcnt);
4043 __entry->offset = iclog->ic_offset;
Dave Chinnerb2ae3a92021-07-27 16:23:50 -07004044 __entry->flags = iclog->ic_flags;
Dave Chinner956f6da2021-06-18 11:57:05 -07004045 __entry->lsn = be64_to_cpu(iclog->ic_header.h_lsn);
4046 __entry->caller_ip = caller_ip;
4047 ),
Dave Chinnerb2ae3a92021-07-27 16:23:50 -07004048 TP_printk("dev %d:%d state %s refcnt %d offset %u lsn 0x%llx flags %s caller %pS",
Dave Chinner956f6da2021-06-18 11:57:05 -07004049 MAJOR(__entry->dev), MINOR(__entry->dev),
4050 __print_symbolic(__entry->state, XLOG_STATE_STRINGS),
4051 __entry->refcount,
4052 __entry->offset,
4053 __entry->lsn,
Dave Chinnerb2ae3a92021-07-27 16:23:50 -07004054 __print_flags(__entry->flags, "|", XLOG_ICL_STRINGS),
Dave Chinner956f6da2021-06-18 11:57:05 -07004055 (char *)__entry->caller_ip)
4056
4057);
4058
4059#define DEFINE_ICLOG_EVENT(name) \
4060DEFINE_EVENT(xlog_iclog_class, name, \
4061 TP_PROTO(struct xlog_in_core *iclog, unsigned long caller_ip), \
4062 TP_ARGS(iclog, caller_ip))
4063
4064DEFINE_ICLOG_EVENT(xlog_iclog_activate);
4065DEFINE_ICLOG_EVENT(xlog_iclog_clean);
4066DEFINE_ICLOG_EVENT(xlog_iclog_callback);
4067DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_start);
4068DEFINE_ICLOG_EVENT(xlog_iclog_callbacks_done);
4069DEFINE_ICLOG_EVENT(xlog_iclog_force);
4070DEFINE_ICLOG_EVENT(xlog_iclog_force_lsn);
4071DEFINE_ICLOG_EVENT(xlog_iclog_get_space);
4072DEFINE_ICLOG_EVENT(xlog_iclog_release);
4073DEFINE_ICLOG_EVENT(xlog_iclog_switch);
4074DEFINE_ICLOG_EVENT(xlog_iclog_sync);
4075DEFINE_ICLOG_EVENT(xlog_iclog_syncing);
4076DEFINE_ICLOG_EVENT(xlog_iclog_sync_done);
4077DEFINE_ICLOG_EVENT(xlog_iclog_want_sync);
4078DEFINE_ICLOG_EVENT(xlog_iclog_wait_on);
4079DEFINE_ICLOG_EVENT(xlog_iclog_write);
4080
Allison Hendersondf082632021-08-08 08:27:13 -07004081DECLARE_EVENT_CLASS(xfs_das_state_class,
4082 TP_PROTO(int das, struct xfs_inode *ip),
4083 TP_ARGS(das, ip),
4084 TP_STRUCT__entry(
4085 __field(int, das)
4086 __field(xfs_ino_t, ino)
4087 ),
4088 TP_fast_assign(
4089 __entry->das = das;
4090 __entry->ino = ip->i_ino;
4091 ),
4092 TP_printk("state change %d ino 0x%llx",
4093 __entry->das, __entry->ino)
4094)
4095
4096#define DEFINE_DAS_STATE_EVENT(name) \
4097DEFINE_EVENT(xfs_das_state_class, name, \
4098 TP_PROTO(int das, struct xfs_inode *ip), \
4099 TP_ARGS(das, ip))
4100DEFINE_DAS_STATE_EVENT(xfs_attr_sf_addname_return);
4101DEFINE_DAS_STATE_EVENT(xfs_attr_set_iter_return);
4102DEFINE_DAS_STATE_EVENT(xfs_attr_node_addname_return);
4103DEFINE_DAS_STATE_EVENT(xfs_attr_remove_iter_return);
4104DEFINE_DAS_STATE_EVENT(xfs_attr_rmtval_remove_return);
Darrick J. Wong7f89c832021-08-10 17:00:54 -07004105
4106TRACE_EVENT(xfs_force_shutdown,
4107 TP_PROTO(struct xfs_mount *mp, int ptag, int flags, const char *fname,
4108 int line_num),
4109 TP_ARGS(mp, ptag, flags, fname, line_num),
4110 TP_STRUCT__entry(
4111 __field(dev_t, dev)
4112 __field(int, ptag)
4113 __field(int, flags)
4114 __string(fname, fname)
4115 __field(int, line_num)
4116 ),
4117 TP_fast_assign(
4118 __entry->dev = mp->m_super->s_dev;
4119 __entry->ptag = ptag;
4120 __entry->flags = flags;
4121 __assign_str(fname, fname);
4122 __entry->line_num = line_num;
4123 ),
4124 TP_printk("dev %d:%d tag %s flags %s file %s line_num %d",
4125 MAJOR(__entry->dev), MINOR(__entry->dev),
4126 __print_flags(__entry->ptag, "|", XFS_PTAG_STRINGS),
4127 __print_flags(__entry->flags, "|", XFS_SHUTDOWN_STRINGS),
4128 __get_str(fname),
4129 __entry->line_num)
4130);
4131
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00004132#endif /* _TRACE_XFS_H */
4133
4134#undef TRACE_INCLUDE_PATH
4135#define TRACE_INCLUDE_PATH .
4136#define TRACE_INCLUDE_FILE xfs_trace
4137#include <trace/define_trace.h>