blob: 945de08af7ba98a79c85b04080fda404dd750763 [file] [log] [blame]
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM xfs
20
21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22#define _TRACE_XFS_H
23
24#include <linux/tracepoint.h>
25
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000033struct xfs_log_item;
Mark Tinguelyad223e62012-06-14 09:22:15 -050034struct xlog;
Dave Chinner750b9c92013-11-01 15:27:18 +110035struct xlog_ticket;
Dave Chinner9abbc532010-04-13 15:06:46 +100036struct xlog_recover;
37struct xlog_recover_item;
38struct xfs_buf_log_format;
39struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050040struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100041struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070042struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070043struct xfs_fsmap;
44struct xfs_rmap_irec;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000045
Christoph Hellwigea9a4882009-12-21 14:03:03 +000046DECLARE_EVENT_CLASS(xfs_attr_list_class,
47 TP_PROTO(struct xfs_attr_list_context *ctx),
48 TP_ARGS(ctx),
49 TP_STRUCT__entry(
50 __field(dev_t, dev)
51 __field(xfs_ino_t, ino)
52 __field(u32, hashval)
53 __field(u32, blkno)
54 __field(u32, offset)
55 __field(void *, alist)
56 __field(int, bufsize)
57 __field(int, count)
58 __field(int, firstu)
59 __field(int, dupcnt)
60 __field(int, flags)
61 ),
62 TP_fast_assign(
63 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
64 __entry->ino = ctx->dp->i_ino;
65 __entry->hashval = ctx->cursor->hashval;
66 __entry->blkno = ctx->cursor->blkno;
67 __entry->offset = ctx->cursor->offset;
68 __entry->alist = ctx->alist;
69 __entry->bufsize = ctx->bufsize;
70 __entry->count = ctx->count;
71 __entry->firstu = ctx->firstu;
72 __entry->flags = ctx->flags;
73 ),
74 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -080075 "alist %p size %u count %u firstu %u flags %d %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +000076 MAJOR(__entry->dev), MINOR(__entry->dev),
77 __entry->ino,
78 __entry->hashval,
79 __entry->blkno,
80 __entry->offset,
81 __entry->dupcnt,
82 __entry->alist,
83 __entry->bufsize,
84 __entry->count,
85 __entry->firstu,
86 __entry->flags,
87 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
88 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000089)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000090
91#define DEFINE_ATTR_LIST_EVENT(name) \
92DEFINE_EVENT(xfs_attr_list_class, name, \
93 TP_PROTO(struct xfs_attr_list_context *ctx), \
94 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000095DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
101DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
102DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +1100103DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
104DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000105
Li Zefanf8adb4d2010-05-24 08:25:57 +0000106DECLARE_EVENT_CLASS(xfs_perag_class,
107 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
108 unsigned long caller_ip),
109 TP_ARGS(mp, agno, refcount, caller_ip),
110 TP_STRUCT__entry(
111 __field(dev_t, dev)
112 __field(xfs_agnumber_t, agno)
113 __field(int, refcount)
114 __field(unsigned long, caller_ip)
115 ),
116 TP_fast_assign(
117 __entry->dev = mp->m_super->s_dev;
118 __entry->agno = agno;
119 __entry->refcount = refcount;
120 __entry->caller_ip = caller_ip;
121 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800122 TP_printk("dev %d:%d agno %u refcount %d caller %pS",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000123 MAJOR(__entry->dev), MINOR(__entry->dev),
124 __entry->agno,
125 __entry->refcount,
126 (char *)__entry->caller_ip)
127);
128
129#define DEFINE_PERAG_REF_EVENT(name) \
130DEFINE_EVENT(xfs_perag_class, name, \
131 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
132 unsigned long caller_ip), \
133 TP_ARGS(mp, agno, refcount, caller_ip))
134DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000135DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000136DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000137DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
138DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500139DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
140DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700141DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
142DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000143
Dave Chinnerd1230312013-11-01 15:27:19 +1100144DECLARE_EVENT_CLASS(xfs_ag_class,
145 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
146 TP_ARGS(mp, agno),
147 TP_STRUCT__entry(
148 __field(dev_t, dev)
149 __field(xfs_agnumber_t, agno)
150 ),
151 TP_fast_assign(
152 __entry->dev = mp->m_super->s_dev;
153 __entry->agno = agno;
154 ),
155 TP_printk("dev %d:%d agno %u",
156 MAJOR(__entry->dev), MINOR(__entry->dev),
157 __entry->agno)
158);
159#define DEFINE_AG_EVENT(name) \
160DEFINE_EVENT(xfs_ag_class, name, \
161 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
162 TP_ARGS(mp, agno))
163
164DEFINE_AG_EVENT(xfs_read_agf);
165DEFINE_AG_EVENT(xfs_alloc_read_agf);
166DEFINE_AG_EVENT(xfs_read_agi);
167DEFINE_AG_EVENT(xfs_ialloc_read_agi);
168
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000169TRACE_EVENT(xfs_attr_list_node_descend,
170 TP_PROTO(struct xfs_attr_list_context *ctx,
171 struct xfs_da_node_entry *btree),
172 TP_ARGS(ctx, btree),
173 TP_STRUCT__entry(
174 __field(dev_t, dev)
175 __field(xfs_ino_t, ino)
176 __field(u32, hashval)
177 __field(u32, blkno)
178 __field(u32, offset)
179 __field(void *, alist)
180 __field(int, bufsize)
181 __field(int, count)
182 __field(int, firstu)
183 __field(int, dupcnt)
184 __field(int, flags)
185 __field(u32, bt_hashval)
186 __field(u32, bt_before)
187 ),
188 TP_fast_assign(
189 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
190 __entry->ino = ctx->dp->i_ino;
191 __entry->hashval = ctx->cursor->hashval;
192 __entry->blkno = ctx->cursor->blkno;
193 __entry->offset = ctx->cursor->offset;
194 __entry->alist = ctx->alist;
195 __entry->bufsize = ctx->bufsize;
196 __entry->count = ctx->count;
197 __entry->firstu = ctx->firstu;
198 __entry->flags = ctx->flags;
199 __entry->bt_hashval = be32_to_cpu(btree->hashval);
200 __entry->bt_before = be32_to_cpu(btree->before);
201 ),
202 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800203 "alist %p size %u count %u firstu %u flags %d %s "
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000204 "node hashval %u, node before %u",
205 MAJOR(__entry->dev), MINOR(__entry->dev),
206 __entry->ino,
207 __entry->hashval,
208 __entry->blkno,
209 __entry->offset,
210 __entry->dupcnt,
211 __entry->alist,
212 __entry->bufsize,
213 __entry->count,
214 __entry->firstu,
215 __entry->flags,
216 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
217 __entry->bt_hashval,
218 __entry->bt_before)
219);
220
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000221DECLARE_EVENT_CLASS(xfs_bmap_class,
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700222 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000223 unsigned long caller_ip),
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700224 TP_ARGS(ip, cur, state, caller_ip),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000225 TP_STRUCT__entry(
226 __field(dev_t, dev)
227 __field(xfs_ino_t, ino)
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700228 __field(void *, leaf);
229 __field(int, pos);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000230 __field(xfs_fileoff_t, startoff)
231 __field(xfs_fsblock_t, startblock)
232 __field(xfs_filblks_t, blockcount)
233 __field(xfs_exntst_t, state)
234 __field(int, bmap_state)
235 __field(unsigned long, caller_ip)
236 ),
237 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700238 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000239 struct xfs_bmbt_irec r;
240
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700241 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700242 xfs_iext_get_extent(ifp, cur, &r);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000243 __entry->dev = VFS_I(ip)->i_sb->s_dev;
244 __entry->ino = ip->i_ino;
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700245 __entry->leaf = cur->leaf;
246 __entry->pos = cur->pos;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000247 __entry->startoff = r.br_startoff;
248 __entry->startblock = r.br_startblock;
249 __entry->blockcount = r.br_blockcount;
250 __entry->state = r.br_state;
251 __entry->bmap_state = state;
252 __entry->caller_ip = caller_ip;
253 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800254 TP_printk("dev %d:%d ino 0x%llx state %s cur %p/%d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800255 "offset %lld block %lld count %lld flag %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000256 MAJOR(__entry->dev), MINOR(__entry->dev),
257 __entry->ino,
258 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700259 __entry->leaf,
260 __entry->pos,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000261 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700262 (int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000263 __entry->blockcount,
264 __entry->state,
265 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000266)
267
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000268#define DEFINE_BMAP_EVENT(name) \
269DEFINE_EVENT(xfs_bmap_class, name, \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700270 TP_PROTO(struct xfs_inode *ip, struct xfs_iext_cursor *cur, int state, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000271 unsigned long caller_ip), \
Christoph Hellwigb2b17122017-11-03 10:34:43 -0700272 TP_ARGS(ip, cur, state, caller_ip))
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700273DEFINE_BMAP_EVENT(xfs_iext_insert);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000274DEFINE_BMAP_EVENT(xfs_iext_remove);
275DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
276DEFINE_BMAP_EVENT(xfs_bmap_post_update);
Christoph Hellwige8e0e172017-10-19 11:06:29 -0700277DEFINE_BMAP_EVENT(xfs_read_extent);
278DEFINE_BMAP_EVENT(xfs_write_extent);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000279
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000280DECLARE_EVENT_CLASS(xfs_buf_class,
281 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
282 TP_ARGS(bp, caller_ip),
283 TP_STRUCT__entry(
284 __field(dev_t, dev)
285 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000286 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000287 __field(int, hold)
288 __field(int, pincount)
289 __field(unsigned, lockval)
290 __field(unsigned, flags)
291 __field(unsigned long, caller_ip)
292 ),
293 TP_fast_assign(
294 __entry->dev = bp->b_target->bt_dev;
295 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000296 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000297 __entry->hold = atomic_read(&bp->b_hold);
298 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200299 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000300 __entry->flags = bp->b_flags;
301 __entry->caller_ip = caller_ip;
302 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000303 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800304 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000305 MAJOR(__entry->dev), MINOR(__entry->dev),
306 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000307 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000308 __entry->hold,
309 __entry->pincount,
310 __entry->lockval,
311 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
312 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000313)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000314
315#define DEFINE_BUF_EVENT(name) \
316DEFINE_EVENT(xfs_buf_class, name, \
317 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
318 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000319DEFINE_BUF_EVENT(xfs_buf_init);
320DEFINE_BUF_EVENT(xfs_buf_free);
321DEFINE_BUF_EVENT(xfs_buf_hold);
322DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000323DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000324DEFINE_BUF_EVENT(xfs_buf_submit);
325DEFINE_BUF_EVENT(xfs_buf_submit_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000326DEFINE_BUF_EVENT(xfs_buf_lock);
327DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000328DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200329DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000330DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000331DEFINE_BUF_EVENT(xfs_buf_iowait);
332DEFINE_BUF_EVENT(xfs_buf_iowait_done);
333DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000334DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000335DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Brian Foster7912e7f2017-06-14 21:21:45 -0700336DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000337DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000338DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000339DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
340DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100341DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000342DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
343
344/* not really buffer traces, but the buf provides useful information */
345DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000346DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000347
348/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000349DECLARE_EVENT_CLASS(xfs_buf_flags_class,
350 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
351 TP_ARGS(bp, flags, caller_ip),
352 TP_STRUCT__entry(
353 __field(dev_t, dev)
354 __field(xfs_daddr_t, bno)
355 __field(size_t, buffer_length)
356 __field(int, hold)
357 __field(int, pincount)
358 __field(unsigned, lockval)
359 __field(unsigned, flags)
360 __field(unsigned long, caller_ip)
361 ),
362 TP_fast_assign(
363 __entry->dev = bp->b_target->bt_dev;
364 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000365 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000366 __entry->flags = flags;
367 __entry->hold = atomic_read(&bp->b_hold);
368 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200369 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000370 __entry->caller_ip = caller_ip;
371 ),
372 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800373 "lock %d flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000374 MAJOR(__entry->dev), MINOR(__entry->dev),
375 (unsigned long long)__entry->bno,
376 __entry->buffer_length,
377 __entry->hold,
378 __entry->pincount,
379 __entry->lockval,
380 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
381 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000382)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000383
384#define DEFINE_BUF_FLAGS_EVENT(name) \
385DEFINE_EVENT(xfs_buf_flags_class, name, \
386 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
387 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000388DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
389DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
390DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
391
392TRACE_EVENT(xfs_buf_ioerror,
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800393 TP_PROTO(struct xfs_buf *bp, int error, xfs_failaddr_t caller_ip),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000394 TP_ARGS(bp, error, caller_ip),
395 TP_STRUCT__entry(
396 __field(dev_t, dev)
397 __field(xfs_daddr_t, bno)
398 __field(size_t, buffer_length)
399 __field(unsigned, flags)
400 __field(int, hold)
401 __field(int, pincount)
402 __field(unsigned, lockval)
403 __field(int, error)
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800404 __field(xfs_failaddr_t, caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000405 ),
406 TP_fast_assign(
407 __entry->dev = bp->b_target->bt_dev;
408 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000409 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000410 __entry->hold = atomic_read(&bp->b_hold);
411 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200412 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000413 __entry->error = error;
414 __entry->flags = bp->b_flags;
415 __entry->caller_ip = caller_ip;
416 ),
417 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Darrick J. Wong31ca03c2018-01-08 10:51:02 -0800418 "lock %d error %d flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000419 MAJOR(__entry->dev), MINOR(__entry->dev),
420 (unsigned long long)__entry->bno,
421 __entry->buffer_length,
422 __entry->hold,
423 __entry->pincount,
424 __entry->lockval,
425 __entry->error,
426 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
427 (void *)__entry->caller_ip)
428);
429
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000430DECLARE_EVENT_CLASS(xfs_buf_item_class,
431 TP_PROTO(struct xfs_buf_log_item *bip),
432 TP_ARGS(bip),
433 TP_STRUCT__entry(
434 __field(dev_t, dev)
435 __field(xfs_daddr_t, buf_bno)
436 __field(size_t, buf_len)
437 __field(int, buf_hold)
438 __field(int, buf_pincount)
439 __field(int, buf_lockval)
440 __field(unsigned, buf_flags)
441 __field(unsigned, bli_recur)
442 __field(int, bli_refcount)
443 __field(unsigned, bli_flags)
444 __field(void *, li_desc)
445 __field(unsigned, li_flags)
446 ),
447 TP_fast_assign(
448 __entry->dev = bip->bli_buf->b_target->bt_dev;
449 __entry->bli_flags = bip->bli_flags;
450 __entry->bli_recur = bip->bli_recur;
451 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
452 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000453 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000454 __entry->buf_flags = bip->bli_buf->b_flags;
455 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
456 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200457 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000458 __entry->li_desc = bip->bli_item.li_desc;
459 __entry->li_flags = bip->bli_item.li_flags;
460 ),
461 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
462 "lock %d flags %s recur %d refcount %d bliflags %s "
Darrick J. Wong3d170aa2018-01-09 11:43:36 -0800463 "lidesc %p liflags %s",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000464 MAJOR(__entry->dev), MINOR(__entry->dev),
465 (unsigned long long)__entry->buf_bno,
466 __entry->buf_len,
467 __entry->buf_hold,
468 __entry->buf_pincount,
469 __entry->buf_lockval,
470 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
471 __entry->bli_recur,
472 __entry->bli_refcount,
473 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
474 __entry->li_desc,
475 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000476)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000477
478#define DEFINE_BUF_ITEM_EVENT(name) \
479DEFINE_EVENT(xfs_buf_item_class, name, \
480 TP_PROTO(struct xfs_buf_log_item *bip), \
481 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000482DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000483DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000484DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
485DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
486DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000487DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000488DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
489DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
490DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000491DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
492DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
493DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
494DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
495DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
496DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
497DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
498DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
499DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
500DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
501DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
502DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
503DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
504DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
505DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
506DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
507
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000508DECLARE_EVENT_CLASS(xfs_filestream_class,
509 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
510 TP_ARGS(ip, agno),
511 TP_STRUCT__entry(
512 __field(dev_t, dev)
513 __field(xfs_ino_t, ino)
514 __field(xfs_agnumber_t, agno)
515 __field(int, streams)
516 ),
517 TP_fast_assign(
518 __entry->dev = VFS_I(ip)->i_sb->s_dev;
519 __entry->ino = ip->i_ino;
520 __entry->agno = agno;
521 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
522 ),
523 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
524 MAJOR(__entry->dev), MINOR(__entry->dev),
525 __entry->ino,
526 __entry->agno,
527 __entry->streams)
528)
529#define DEFINE_FILESTREAM_EVENT(name) \
530DEFINE_EVENT(xfs_filestream_class, name, \
531 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
532 TP_ARGS(ip, agno))
533DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
534DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
535DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
536
537TRACE_EVENT(xfs_filestream_pick,
538 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
539 xfs_extlen_t free, int nscan),
540 TP_ARGS(ip, agno, free, nscan),
541 TP_STRUCT__entry(
542 __field(dev_t, dev)
543 __field(xfs_ino_t, ino)
544 __field(xfs_agnumber_t, agno)
545 __field(int, streams)
546 __field(xfs_extlen_t, free)
547 __field(int, nscan)
548 ),
549 TP_fast_assign(
550 __entry->dev = VFS_I(ip)->i_sb->s_dev;
551 __entry->ino = ip->i_ino;
552 __entry->agno = agno;
553 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
554 __entry->free = free;
555 __entry->nscan = nscan;
556 ),
557 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
558 MAJOR(__entry->dev), MINOR(__entry->dev),
559 __entry->ino,
560 __entry->agno,
561 __entry->streams,
562 __entry->free,
563 __entry->nscan)
564);
565
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000566DECLARE_EVENT_CLASS(xfs_lock_class,
567 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
568 unsigned long caller_ip),
569 TP_ARGS(ip, lock_flags, caller_ip),
570 TP_STRUCT__entry(
571 __field(dev_t, dev)
572 __field(xfs_ino_t, ino)
573 __field(int, lock_flags)
574 __field(unsigned long, caller_ip)
575 ),
576 TP_fast_assign(
577 __entry->dev = VFS_I(ip)->i_sb->s_dev;
578 __entry->ino = ip->i_ino;
579 __entry->lock_flags = lock_flags;
580 __entry->caller_ip = caller_ip;
581 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800582 TP_printk("dev %d:%d ino 0x%llx flags %s caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000583 MAJOR(__entry->dev), MINOR(__entry->dev),
584 __entry->ino,
585 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
586 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000587)
588
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000589#define DEFINE_LOCK_EVENT(name) \
590DEFINE_EVENT(xfs_lock_class, name, \
591 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
592 unsigned long caller_ip), \
593 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000594DEFINE_LOCK_EVENT(xfs_ilock);
595DEFINE_LOCK_EVENT(xfs_ilock_nowait);
596DEFINE_LOCK_EVENT(xfs_ilock_demote);
597DEFINE_LOCK_EVENT(xfs_iunlock);
598
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000599DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000600 TP_PROTO(struct xfs_inode *ip),
601 TP_ARGS(ip),
602 TP_STRUCT__entry(
603 __field(dev_t, dev)
604 __field(xfs_ino_t, ino)
605 ),
606 TP_fast_assign(
607 __entry->dev = VFS_I(ip)->i_sb->s_dev;
608 __entry->ino = ip->i_ino;
609 ),
610 TP_printk("dev %d:%d ino 0x%llx",
611 MAJOR(__entry->dev), MINOR(__entry->dev),
612 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000613)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000614
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000615#define DEFINE_INODE_EVENT(name) \
616DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000617 TP_PROTO(struct xfs_inode *ip), \
618 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000619DEFINE_INODE_EVENT(xfs_iget_skip);
620DEFINE_INODE_EVENT(xfs_iget_reclaim);
621DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
622DEFINE_INODE_EVENT(xfs_iget_hit);
623DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000624
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000625DEFINE_INODE_EVENT(xfs_getattr);
626DEFINE_INODE_EVENT(xfs_setattr);
627DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500628DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000629DEFINE_INODE_EVENT(xfs_alloc_file_space);
630DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000631DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100632DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100633DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000634DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000635#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200636DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000637#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000638DEFINE_INODE_EVENT(xfs_vm_bmap);
639DEFINE_INODE_EVENT(xfs_file_ioctl);
640DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
641DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000642DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000643DEFINE_INODE_EVENT(xfs_file_fsync);
644DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400645DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000646
647DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
648DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
649
Brian Foster27b52862012-11-06 09:50:38 -0500650DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
651DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500652DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700653DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
654DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
655DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500656
Christoph Hellwigd522d562017-08-29 10:08:41 -0700657TRACE_EVENT(xfs_filemap_fault,
658 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
659 bool write_fault),
660 TP_ARGS(ip, pe_size, write_fault),
661 TP_STRUCT__entry(
662 __field(dev_t, dev)
663 __field(xfs_ino_t, ino)
664 __field(enum page_entry_size, pe_size)
665 __field(bool, write_fault)
666 ),
667 TP_fast_assign(
668 __entry->dev = VFS_I(ip)->i_sb->s_dev;
669 __entry->ino = ip->i_ino;
670 __entry->pe_size = pe_size;
671 __entry->write_fault = write_fault;
672 ),
673 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
674 MAJOR(__entry->dev), MINOR(__entry->dev),
675 __entry->ino,
676 __print_symbolic(__entry->pe_size,
677 { PE_SIZE_PTE, "PTE" },
678 { PE_SIZE_PMD, "PMD" },
679 { PE_SIZE_PUD, "PUD" }),
680 __entry->write_fault)
681)
682
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000683DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000684 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
685 TP_ARGS(ip, caller_ip),
686 TP_STRUCT__entry(
687 __field(dev_t, dev)
688 __field(xfs_ino_t, ino)
689 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100690 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000691 __field(unsigned long, caller_ip)
692 ),
693 TP_fast_assign(
694 __entry->dev = VFS_I(ip)->i_sb->s_dev;
695 __entry->ino = ip->i_ino;
696 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100697 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000698 __entry->caller_ip = caller_ip;
699 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -0800700 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %pS",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000701 MAJOR(__entry->dev), MINOR(__entry->dev),
702 __entry->ino,
703 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100704 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000705 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000706)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000707
Brian Foster19cb7e32013-03-18 10:51:48 -0400708TRACE_EVENT(xfs_iomap_prealloc_size,
709 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
710 unsigned int writeio_blocks),
711 TP_ARGS(ip, blocks, shift, writeio_blocks),
712 TP_STRUCT__entry(
713 __field(dev_t, dev)
714 __field(xfs_ino_t, ino)
715 __field(xfs_fsblock_t, blocks)
716 __field(int, shift)
717 __field(unsigned int, writeio_blocks)
718 ),
719 TP_fast_assign(
720 __entry->dev = VFS_I(ip)->i_sb->s_dev;
721 __entry->ino = ip->i_ino;
722 __entry->blocks = blocks;
723 __entry->shift = shift;
724 __entry->writeio_blocks = writeio_blocks;
725 ),
726 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
727 "m_writeio_blocks %u",
728 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
729 __entry->blocks, __entry->shift, __entry->writeio_blocks)
730)
731
Brian Foster56d11152015-05-29 09:18:32 +1000732TRACE_EVENT(xfs_irec_merge_pre,
733 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
734 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
735 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
736 TP_STRUCT__entry(
737 __field(dev_t, dev)
738 __field(xfs_agnumber_t, agno)
739 __field(xfs_agino_t, agino)
740 __field(uint16_t, holemask)
741 __field(xfs_agino_t, nagino)
742 __field(uint16_t, nholemask)
743 ),
744 TP_fast_assign(
745 __entry->dev = mp->m_super->s_dev;
746 __entry->agno = agno;
747 __entry->agino = agino;
748 __entry->holemask = holemask;
749 __entry->nagino = nagino;
750 __entry->nholemask = holemask;
751 ),
752 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
753 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
754 __entry->agino, __entry->holemask, __entry->nagino,
755 __entry->nholemask)
756)
757
758TRACE_EVENT(xfs_irec_merge_post,
759 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
760 uint16_t holemask),
761 TP_ARGS(mp, agno, agino, holemask),
762 TP_STRUCT__entry(
763 __field(dev_t, dev)
764 __field(xfs_agnumber_t, agno)
765 __field(xfs_agino_t, agino)
766 __field(uint16_t, holemask)
767 ),
768 TP_fast_assign(
769 __entry->dev = mp->m_super->s_dev;
770 __entry->agno = agno;
771 __entry->agino = agino;
772 __entry->holemask = holemask;
773 ),
774 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
775 MINOR(__entry->dev), __entry->agno, __entry->agino,
776 __entry->holemask)
777)
778
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000779#define DEFINE_IREF_EVENT(name) \
780DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000781 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
782 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000783DEFINE_IREF_EVENT(xfs_irele);
784DEFINE_IREF_EVENT(xfs_inode_pin);
785DEFINE_IREF_EVENT(xfs_inode_unpin);
786DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100787
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000788DECLARE_EVENT_CLASS(xfs_namespace_class,
789 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
790 TP_ARGS(dp, name),
791 TP_STRUCT__entry(
792 __field(dev_t, dev)
793 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000794 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000795 __dynamic_array(char, name, name->len)
796 ),
797 TP_fast_assign(
798 __entry->dev = VFS_I(dp)->i_sb->s_dev;
799 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000800 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000801 memcpy(__get_str(name), name->name, name->len);
802 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000803 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000804 MAJOR(__entry->dev), MINOR(__entry->dev),
805 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000806 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000807 __get_str(name))
808)
809
810#define DEFINE_NAMESPACE_EVENT(name) \
811DEFINE_EVENT(xfs_namespace_class, name, \
812 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
813 TP_ARGS(dp, name))
814DEFINE_NAMESPACE_EVENT(xfs_remove);
815DEFINE_NAMESPACE_EVENT(xfs_link);
816DEFINE_NAMESPACE_EVENT(xfs_lookup);
817DEFINE_NAMESPACE_EVENT(xfs_create);
818DEFINE_NAMESPACE_EVENT(xfs_symlink);
819
820TRACE_EVENT(xfs_rename,
821 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
822 struct xfs_name *src_name, struct xfs_name *target_name),
823 TP_ARGS(src_dp, target_dp, src_name, target_name),
824 TP_STRUCT__entry(
825 __field(dev_t, dev)
826 __field(xfs_ino_t, src_dp_ino)
827 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000828 __field(int, src_namelen)
829 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000830 __dynamic_array(char, src_name, src_name->len)
831 __dynamic_array(char, target_name, target_name->len)
832 ),
833 TP_fast_assign(
834 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
835 __entry->src_dp_ino = src_dp->i_ino;
836 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000837 __entry->src_namelen = src_name->len;
838 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000839 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000840 memcpy(__get_str(target_name), target_name->name,
841 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000842 ),
843 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000844 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000845 MAJOR(__entry->dev), MINOR(__entry->dev),
846 __entry->src_dp_ino,
847 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000848 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000849 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000850 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000851 __get_str(target_name))
852)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000853
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000854DECLARE_EVENT_CLASS(xfs_dquot_class,
855 TP_PROTO(struct xfs_dquot *dqp),
856 TP_ARGS(dqp),
857 TP_STRUCT__entry(
858 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000859 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000860 __field(unsigned, flags)
861 __field(unsigned, nrefs)
862 __field(unsigned long long, res_bcount)
863 __field(unsigned long long, bcount)
864 __field(unsigned long long, icount)
865 __field(unsigned long long, blk_hardlimit)
866 __field(unsigned long long, blk_softlimit)
867 __field(unsigned long long, ino_hardlimit)
868 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000869 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000870 TP_fast_assign(
871 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000872 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000873 __entry->flags = dqp->dq_flags;
874 __entry->nrefs = dqp->q_nrefs;
875 __entry->res_bcount = dqp->q_res_bcount;
876 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
877 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
878 __entry->blk_hardlimit =
879 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
880 __entry->blk_softlimit =
881 be64_to_cpu(dqp->q_core.d_blk_softlimit);
882 __entry->ino_hardlimit =
883 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
884 __entry->ino_softlimit =
885 be64_to_cpu(dqp->q_core.d_ino_softlimit);
886 ),
887 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000888 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
889 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000890 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000891 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000892 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
893 __entry->nrefs,
894 __entry->res_bcount,
895 __entry->bcount,
896 __entry->blk_hardlimit,
897 __entry->blk_softlimit,
898 __entry->icount,
899 __entry->ino_hardlimit,
900 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000901)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000902
903#define DEFINE_DQUOT_EVENT(name) \
904DEFINE_EVENT(xfs_dquot_class, name, \
905 TP_PROTO(struct xfs_dquot *dqp), \
906 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000907DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000908DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
909DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000910DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
911DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000912DEFINE_DQUOT_EVENT(xfs_dqattach_found);
913DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000914DEFINE_DQUOT_EVENT(xfs_dqalloc);
915DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
916DEFINE_DQUOT_EVENT(xfs_dqread);
917DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000918DEFINE_DQUOT_EVENT(xfs_dqget_hit);
919DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000920DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
921DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000922DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000923DEFINE_DQUOT_EVENT(xfs_dqput_free);
924DEFINE_DQUOT_EVENT(xfs_dqrele);
925DEFINE_DQUOT_EVENT(xfs_dqflush);
926DEFINE_DQUOT_EVENT(xfs_dqflush_force);
927DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000928
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000929DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500930 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000931 TP_ARGS(log, tic),
932 TP_STRUCT__entry(
933 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000934 __field(char, ocnt)
935 __field(char, cnt)
936 __field(int, curr_res)
937 __field(int, unit_res)
938 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100939 __field(int, reserveq)
940 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000941 __field(int, grant_reserve_cycle)
942 __field(int, grant_reserve_bytes)
943 __field(int, grant_write_cycle)
944 __field(int, grant_write_bytes)
945 __field(int, curr_cycle)
946 __field(int, curr_block)
947 __field(xfs_lsn_t, tail_lsn)
948 ),
949 TP_fast_assign(
950 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000951 __entry->ocnt = tic->t_ocnt;
952 __entry->cnt = tic->t_cnt;
953 __entry->curr_res = tic->t_curr_res;
954 __entry->unit_res = tic->t_unit_res;
955 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000956 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
957 __entry->writeq = list_empty(&log->l_write_head.waiters);
958 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100959 &__entry->grant_reserve_cycle,
960 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000961 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100962 &__entry->grant_write_cycle,
963 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000964 __entry->curr_cycle = log->l_curr_cycle;
965 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100966 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000967 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000968 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100969 "t_unit_res %u t_flags %s reserveq %s "
970 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000971 "grant_reserve_bytes %d grant_write_cycle %d "
972 "grant_write_bytes %d curr_cycle %d curr_block %d "
973 "tail_cycle %d tail_block %d",
974 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000975 __entry->ocnt,
976 __entry->cnt,
977 __entry->curr_res,
978 __entry->unit_res,
979 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100980 __entry->reserveq ? "empty" : "active",
981 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000982 __entry->grant_reserve_cycle,
983 __entry->grant_reserve_bytes,
984 __entry->grant_write_cycle,
985 __entry->grant_write_bytes,
986 __entry->curr_cycle,
987 __entry->curr_block,
988 CYCLE_LSN(__entry->tail_lsn),
989 BLOCK_LSN(__entry->tail_lsn)
990 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000991)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000992
993#define DEFINE_LOGGRANT_EVENT(name) \
994DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500995 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000996 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000997DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
998DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000999DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001000DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1001DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001002DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001003DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1004DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1005DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1006DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001007DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1008DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1009DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1010DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1011DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1012DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1013
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001014DECLARE_EVENT_CLASS(xfs_log_item_class,
1015 TP_PROTO(struct xfs_log_item *lip),
1016 TP_ARGS(lip),
1017 TP_STRUCT__entry(
1018 __field(dev_t, dev)
1019 __field(void *, lip)
1020 __field(uint, type)
1021 __field(uint, flags)
1022 __field(xfs_lsn_t, lsn)
1023 ),
1024 TP_fast_assign(
1025 __entry->dev = lip->li_mountp->m_super->s_dev;
1026 __entry->lip = lip;
1027 __entry->type = lip->li_type;
1028 __entry->flags = lip->li_flags;
1029 __entry->lsn = lip->li_lsn;
1030 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001031 TP_printk("dev %d:%d lip %p lsn %d/%d type %s flags %s",
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001032 MAJOR(__entry->dev), MINOR(__entry->dev),
1033 __entry->lip,
1034 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1035 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1036 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1037)
1038
Dave Chinner14c26c62012-04-24 16:33:31 +10001039TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001040 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1041 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001042 TP_STRUCT__entry(
1043 __field(dev_t, dev)
1044 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001045 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001046 ),
1047 TP_fast_assign(
1048 __entry->dev = mp->m_super->s_dev;
1049 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001050 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001051 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001052 TP_printk("dev %d:%d lsn 0x%llx caller %pS",
Dave Chinner14c26c62012-04-24 16:33:31 +10001053 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001054 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001055)
1056
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001057#define DEFINE_LOG_ITEM_EVENT(name) \
1058DEFINE_EVENT(xfs_log_item_class, name, \
1059 TP_PROTO(struct xfs_log_item *lip), \
1060 TP_ARGS(lip))
1061DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001062DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1063DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001064DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001065
Dave Chinner750b9c92013-11-01 15:27:18 +11001066DECLARE_EVENT_CLASS(xfs_ail_class,
1067 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1068 TP_ARGS(lip, old_lsn, new_lsn),
1069 TP_STRUCT__entry(
1070 __field(dev_t, dev)
1071 __field(void *, lip)
1072 __field(uint, type)
1073 __field(uint, flags)
1074 __field(xfs_lsn_t, old_lsn)
1075 __field(xfs_lsn_t, new_lsn)
1076 ),
1077 TP_fast_assign(
1078 __entry->dev = lip->li_mountp->m_super->s_dev;
1079 __entry->lip = lip;
1080 __entry->type = lip->li_type;
1081 __entry->flags = lip->li_flags;
1082 __entry->old_lsn = old_lsn;
1083 __entry->new_lsn = new_lsn;
1084 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08001085 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 +11001086 MAJOR(__entry->dev), MINOR(__entry->dev),
1087 __entry->lip,
1088 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1089 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1090 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1091 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1092)
1093
1094#define DEFINE_AIL_EVENT(name) \
1095DEFINE_EVENT(xfs_ail_class, name, \
1096 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1097 TP_ARGS(lip, old_lsn, new_lsn))
1098DEFINE_AIL_EVENT(xfs_ail_insert);
1099DEFINE_AIL_EVENT(xfs_ail_move);
1100DEFINE_AIL_EVENT(xfs_ail_delete);
1101
1102TRACE_EVENT(xfs_log_assign_tail_lsn,
1103 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1104 TP_ARGS(log, new_lsn),
1105 TP_STRUCT__entry(
1106 __field(dev_t, dev)
1107 __field(xfs_lsn_t, new_lsn)
1108 __field(xfs_lsn_t, old_lsn)
1109 __field(xfs_lsn_t, last_sync_lsn)
1110 ),
1111 TP_fast_assign(
1112 __entry->dev = log->l_mp->m_super->s_dev;
1113 __entry->new_lsn = new_lsn;
1114 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1115 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1116 ),
1117 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1118 MAJOR(__entry->dev), MINOR(__entry->dev),
1119 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1120 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1121 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1122)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001123
Li Zefanf8adb4d2010-05-24 08:25:57 +00001124DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001125 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1126 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001127 TP_STRUCT__entry(
1128 __field(dev_t, dev)
1129 __field(xfs_ino_t, ino)
1130 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001131 __field(loff_t, offset)
1132 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001133 ),
1134 TP_fast_assign(
1135 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1136 __entry->ino = ip->i_ino;
1137 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001138 __entry->offset = offset;
1139 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001140 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001141 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001142 MAJOR(__entry->dev), MINOR(__entry->dev),
1143 __entry->ino,
1144 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001145 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001146 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001147)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001148
1149#define DEFINE_RW_EVENT(name) \
1150DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001151 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1152 TP_ARGS(ip, count, offset))
1153DEFINE_RW_EVENT(xfs_file_buffered_read);
1154DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001155DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001156DEFINE_RW_EVENT(xfs_file_buffered_write);
1157DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001158DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001159
Li Zefanf8adb4d2010-05-24 08:25:57 +00001160DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001161 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1162 unsigned int len),
1163 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001164 TP_STRUCT__entry(
1165 __field(dev_t, dev)
1166 __field(xfs_ino_t, ino)
1167 __field(pgoff_t, pgoff)
1168 __field(loff_t, size)
1169 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001170 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001171 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001172 __field(int, unwritten)
1173 ),
1174 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001175 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001176
Li Zefanf8adb4d2010-05-24 08:25:57 +00001177 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001178 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001179 __entry->dev = inode->i_sb->s_dev;
1180 __entry->ino = XFS_I(inode)->i_ino;
1181 __entry->pgoff = page_offset(page);
1182 __entry->size = i_size_read(inode);
1183 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001184 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001185 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001186 __entry->unwritten = unwritten;
1187 ),
1188 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001189 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001190 MAJOR(__entry->dev), MINOR(__entry->dev),
1191 __entry->ino,
1192 __entry->pgoff,
1193 __entry->size,
1194 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001195 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001196 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001197 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001198)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001199
1200#define DEFINE_PAGE_EVENT(name) \
1201DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001202 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1203 unsigned int len), \
1204 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001205DEFINE_PAGE_EVENT(xfs_writepage);
1206DEFINE_PAGE_EVENT(xfs_releasepage);
1207DEFINE_PAGE_EVENT(xfs_invalidatepage);
1208
Dave Chinner121e2132016-01-08 11:28:35 +11001209DECLARE_EVENT_CLASS(xfs_readpage_class,
1210 TP_PROTO(struct inode *inode, int nr_pages),
1211 TP_ARGS(inode, nr_pages),
1212 TP_STRUCT__entry(
1213 __field(dev_t, dev)
1214 __field(xfs_ino_t, ino)
1215 __field(int, nr_pages)
1216 ),
1217 TP_fast_assign(
1218 __entry->dev = inode->i_sb->s_dev;
1219 __entry->ino = inode->i_ino;
1220 __entry->nr_pages = nr_pages;
1221 ),
1222 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1223 MAJOR(__entry->dev), MINOR(__entry->dev),
1224 __entry->ino,
1225 __entry->nr_pages)
1226)
1227
1228#define DEFINE_READPAGE_EVENT(name) \
1229DEFINE_EVENT(xfs_readpage_class, name, \
1230 TP_PROTO(struct inode *inode, int nr_pages), \
1231 TP_ARGS(inode, nr_pages))
1232DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1233DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1234
Christoph Hellwiga206c812010-12-10 08:42:20 +00001235DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001236 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001237 int type, struct xfs_bmbt_irec *irec),
1238 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001239 TP_STRUCT__entry(
1240 __field(dev_t, dev)
1241 __field(xfs_ino_t, ino)
1242 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001243 __field(loff_t, offset)
1244 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001245 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001246 __field(xfs_fileoff_t, startoff)
1247 __field(xfs_fsblock_t, startblock)
1248 __field(xfs_filblks_t, blockcount)
1249 ),
1250 TP_fast_assign(
1251 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1252 __entry->ino = ip->i_ino;
1253 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001254 __entry->offset = offset;
1255 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001256 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001257 __entry->startoff = irec ? irec->br_startoff : 0;
1258 __entry->startblock = irec ? irec->br_startblock : 0;
1259 __entry->blockcount = irec ? irec->br_blockcount : 0;
1260 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001261 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1262 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001263 MAJOR(__entry->dev), MINOR(__entry->dev),
1264 __entry->ino,
1265 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001266 __entry->offset,
1267 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001268 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001269 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001270 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001271 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001272)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001273
1274#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001275DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001276 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001277 int type, struct xfs_bmbt_irec *irec), \
1278 TP_ARGS(ip, offset, count, type, irec))
1279DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1280DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1281DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1282DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001283DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001284DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1285DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001286
Li Zefanf8adb4d2010-05-24 08:25:57 +00001287DECLARE_EVENT_CLASS(xfs_simple_io_class,
1288 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1289 TP_ARGS(ip, offset, count),
1290 TP_STRUCT__entry(
1291 __field(dev_t, dev)
1292 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001293 __field(loff_t, isize)
1294 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001295 __field(loff_t, offset)
1296 __field(size_t, count)
1297 ),
1298 TP_fast_assign(
1299 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1300 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001301 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001302 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001303 __entry->offset = offset;
1304 __entry->count = count;
1305 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001306 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001307 "offset 0x%llx count %zd",
1308 MAJOR(__entry->dev), MINOR(__entry->dev),
1309 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001310 __entry->isize,
1311 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001312 __entry->offset,
1313 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001314);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001315
1316#define DEFINE_SIMPLE_IO_EVENT(name) \
1317DEFINE_EVENT(xfs_simple_io_class, name, \
1318 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1319 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001320DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1321DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001322DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001323DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001324DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001325DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1326DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1327DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001328
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001329DECLARE_EVENT_CLASS(xfs_itrunc_class,
1330 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1331 TP_ARGS(ip, new_size),
1332 TP_STRUCT__entry(
1333 __field(dev_t, dev)
1334 __field(xfs_ino_t, ino)
1335 __field(xfs_fsize_t, size)
1336 __field(xfs_fsize_t, new_size)
1337 ),
1338 TP_fast_assign(
1339 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1340 __entry->ino = ip->i_ino;
1341 __entry->size = ip->i_d.di_size;
1342 __entry->new_size = new_size;
1343 ),
1344 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1345 MAJOR(__entry->dev), MINOR(__entry->dev),
1346 __entry->ino,
1347 __entry->size,
1348 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001349)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001350
1351#define DEFINE_ITRUNC_EVENT(name) \
1352DEFINE_EVENT(xfs_itrunc_class, name, \
1353 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1354 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001355DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1356DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001357
1358TRACE_EVENT(xfs_pagecache_inval,
1359 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1360 TP_ARGS(ip, start, finish),
1361 TP_STRUCT__entry(
1362 __field(dev_t, dev)
1363 __field(xfs_ino_t, ino)
1364 __field(xfs_fsize_t, size)
1365 __field(xfs_off_t, start)
1366 __field(xfs_off_t, finish)
1367 ),
1368 TP_fast_assign(
1369 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1370 __entry->ino = ip->i_ino;
1371 __entry->size = ip->i_d.di_size;
1372 __entry->start = start;
1373 __entry->finish = finish;
1374 ),
1375 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1376 MAJOR(__entry->dev), MINOR(__entry->dev),
1377 __entry->ino,
1378 __entry->size,
1379 __entry->start,
1380 __entry->finish)
1381);
1382
1383TRACE_EVENT(xfs_bunmap,
1384 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1385 int flags, unsigned long caller_ip),
1386 TP_ARGS(ip, bno, len, flags, caller_ip),
1387 TP_STRUCT__entry(
1388 __field(dev_t, dev)
1389 __field(xfs_ino_t, ino)
1390 __field(xfs_fsize_t, size)
1391 __field(xfs_fileoff_t, bno)
1392 __field(xfs_filblks_t, len)
1393 __field(unsigned long, caller_ip)
1394 __field(int, flags)
1395 ),
1396 TP_fast_assign(
1397 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1398 __entry->ino = ip->i_ino;
1399 __entry->size = ip->i_d.di_size;
1400 __entry->bno = bno;
1401 __entry->len = len;
1402 __entry->caller_ip = caller_ip;
1403 __entry->flags = flags;
1404 ),
1405 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 -08001406 "flags %s caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001407 MAJOR(__entry->dev), MINOR(__entry->dev),
1408 __entry->ino,
1409 __entry->size,
1410 __entry->bno,
1411 __entry->len,
1412 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1413 (void *)__entry->caller_ip)
1414
1415);
1416
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001417DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001418 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1419 xfs_agblock_t agbno, xfs_extlen_t len),
1420 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001421 TP_STRUCT__entry(
1422 __field(dev_t, dev)
1423 __field(xfs_agnumber_t, agno)
1424 __field(xfs_agblock_t, agbno)
1425 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001426 ),
1427 TP_fast_assign(
1428 __entry->dev = mp->m_super->s_dev;
1429 __entry->agno = agno;
1430 __entry->agbno = agbno;
1431 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001432 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001433 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001434 MAJOR(__entry->dev), MINOR(__entry->dev),
1435 __entry->agno,
1436 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001437 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001438);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001439#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001440DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001441 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1442 xfs_agblock_t agbno, xfs_extlen_t len), \
1443 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001444DEFINE_BUSY_EVENT(xfs_extent_busy);
1445DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1446DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1447DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1448DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001449
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001450TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001451 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1452 xfs_agblock_t agbno, xfs_extlen_t len,
1453 xfs_agblock_t tbno, xfs_extlen_t tlen),
1454 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1455 TP_STRUCT__entry(
1456 __field(dev_t, dev)
1457 __field(xfs_agnumber_t, agno)
1458 __field(xfs_agblock_t, agbno)
1459 __field(xfs_extlen_t, len)
1460 __field(xfs_agblock_t, tbno)
1461 __field(xfs_extlen_t, tlen)
1462 ),
1463 TP_fast_assign(
1464 __entry->dev = mp->m_super->s_dev;
1465 __entry->agno = agno;
1466 __entry->agbno = agbno;
1467 __entry->len = len;
1468 __entry->tbno = tbno;
1469 __entry->tlen = tlen;
1470 ),
1471 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1472 MAJOR(__entry->dev), MINOR(__entry->dev),
1473 __entry->agno,
1474 __entry->agbno,
1475 __entry->len,
1476 __entry->tbno,
1477 __entry->tlen)
1478);
1479
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001480TRACE_EVENT(xfs_agf,
1481 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1482 unsigned long caller_ip),
1483 TP_ARGS(mp, agf, flags, caller_ip),
1484 TP_STRUCT__entry(
1485 __field(dev_t, dev)
1486 __field(xfs_agnumber_t, agno)
1487 __field(int, flags)
1488 __field(__u32, length)
1489 __field(__u32, bno_root)
1490 __field(__u32, cnt_root)
1491 __field(__u32, bno_level)
1492 __field(__u32, cnt_level)
1493 __field(__u32, flfirst)
1494 __field(__u32, fllast)
1495 __field(__u32, flcount)
1496 __field(__u32, freeblks)
1497 __field(__u32, longest)
1498 __field(unsigned long, caller_ip)
1499 ),
1500 TP_fast_assign(
1501 __entry->dev = mp->m_super->s_dev;
1502 __entry->agno = be32_to_cpu(agf->agf_seqno),
1503 __entry->flags = flags;
1504 __entry->length = be32_to_cpu(agf->agf_length),
1505 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1506 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1507 __entry->bno_level =
1508 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1509 __entry->cnt_level =
1510 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1511 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1512 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1513 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1514 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1515 __entry->longest = be32_to_cpu(agf->agf_longest);
1516 __entry->caller_ip = caller_ip;
1517 ),
1518 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1519 "levels b %u c %u flfirst %u fllast %u flcount %u "
Darrick J. Wongaff68a552018-01-09 11:46:05 -08001520 "freeblks %u longest %u caller %pS",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001521 MAJOR(__entry->dev), MINOR(__entry->dev),
1522 __entry->agno,
1523 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1524 __entry->length,
1525 __entry->bno_root,
1526 __entry->cnt_root,
1527 __entry->bno_level,
1528 __entry->cnt_level,
1529 __entry->flfirst,
1530 __entry->fllast,
1531 __entry->flcount,
1532 __entry->freeblks,
1533 __entry->longest,
1534 (void *)__entry->caller_ip)
1535);
1536
1537TRACE_EVENT(xfs_free_extent,
1538 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001539 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1540 int haveright),
1541 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001542 TP_STRUCT__entry(
1543 __field(dev_t, dev)
1544 __field(xfs_agnumber_t, agno)
1545 __field(xfs_agblock_t, agbno)
1546 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001547 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001548 __field(int, haveleft)
1549 __field(int, haveright)
1550 ),
1551 TP_fast_assign(
1552 __entry->dev = mp->m_super->s_dev;
1553 __entry->agno = agno;
1554 __entry->agbno = agbno;
1555 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001556 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001557 __entry->haveleft = haveleft;
1558 __entry->haveright = haveright;
1559 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001560 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001561 MAJOR(__entry->dev), MINOR(__entry->dev),
1562 __entry->agno,
1563 __entry->agbno,
1564 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001565 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001566 __entry->haveleft ?
1567 (__entry->haveright ? "both" : "left") :
1568 (__entry->haveright ? "right" : "none"))
1569
1570);
1571
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001572DECLARE_EVENT_CLASS(xfs_alloc_class,
1573 TP_PROTO(struct xfs_alloc_arg *args),
1574 TP_ARGS(args),
1575 TP_STRUCT__entry(
1576 __field(dev_t, dev)
1577 __field(xfs_agnumber_t, agno)
1578 __field(xfs_agblock_t, agbno)
1579 __field(xfs_extlen_t, minlen)
1580 __field(xfs_extlen_t, maxlen)
1581 __field(xfs_extlen_t, mod)
1582 __field(xfs_extlen_t, prod)
1583 __field(xfs_extlen_t, minleft)
1584 __field(xfs_extlen_t, total)
1585 __field(xfs_extlen_t, alignment)
1586 __field(xfs_extlen_t, minalignslop)
1587 __field(xfs_extlen_t, len)
1588 __field(short, type)
1589 __field(short, otype)
1590 __field(char, wasdel)
1591 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001592 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001593 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001594 __field(xfs_fsblock_t, firstblock)
1595 ),
1596 TP_fast_assign(
1597 __entry->dev = args->mp->m_super->s_dev;
1598 __entry->agno = args->agno;
1599 __entry->agbno = args->agbno;
1600 __entry->minlen = args->minlen;
1601 __entry->maxlen = args->maxlen;
1602 __entry->mod = args->mod;
1603 __entry->prod = args->prod;
1604 __entry->minleft = args->minleft;
1605 __entry->total = args->total;
1606 __entry->alignment = args->alignment;
1607 __entry->minalignslop = args->minalignslop;
1608 __entry->len = args->len;
1609 __entry->type = args->type;
1610 __entry->otype = args->otype;
1611 __entry->wasdel = args->wasdel;
1612 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001613 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001614 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001615 __entry->firstblock = args->firstblock;
1616 ),
1617 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1618 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001619 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001620 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001621 MAJOR(__entry->dev), MINOR(__entry->dev),
1622 __entry->agno,
1623 __entry->agbno,
1624 __entry->minlen,
1625 __entry->maxlen,
1626 __entry->mod,
1627 __entry->prod,
1628 __entry->minleft,
1629 __entry->total,
1630 __entry->alignment,
1631 __entry->minalignslop,
1632 __entry->len,
1633 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1634 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1635 __entry->wasdel,
1636 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001637 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001638 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001639 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001640)
1641
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001642#define DEFINE_ALLOC_EVENT(name) \
1643DEFINE_EVENT(xfs_alloc_class, name, \
1644 TP_PROTO(struct xfs_alloc_arg *args), \
1645 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001646DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001647DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001648DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1649DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1650DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1651DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1652DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1653DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001654DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1655DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001656DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1657DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1658DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1659DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1660DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001661DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001662DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1663DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1664DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1665DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1666DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1667DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1668DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1669DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1670DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1671
Dave Chinner5a5881c2012-03-22 05:15:13 +00001672DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001673 TP_PROTO(struct xfs_da_args *args),
1674 TP_ARGS(args),
1675 TP_STRUCT__entry(
1676 __field(dev_t, dev)
1677 __field(xfs_ino_t, ino)
1678 __dynamic_array(char, name, args->namelen)
1679 __field(int, namelen)
1680 __field(xfs_dahash_t, hashval)
1681 __field(xfs_ino_t, inumber)
1682 __field(int, op_flags)
1683 ),
1684 TP_fast_assign(
1685 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1686 __entry->ino = args->dp->i_ino;
1687 if (args->namelen)
1688 memcpy(__get_str(name), args->name, args->namelen);
1689 __entry->namelen = args->namelen;
1690 __entry->hashval = args->hashval;
1691 __entry->inumber = args->inumber;
1692 __entry->op_flags = args->op_flags;
1693 ),
1694 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1695 "inumber 0x%llx op_flags %s",
1696 MAJOR(__entry->dev), MINOR(__entry->dev),
1697 __entry->ino,
1698 __entry->namelen,
1699 __entry->namelen ? __get_str(name) : NULL,
1700 __entry->namelen,
1701 __entry->hashval,
1702 __entry->inumber,
1703 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001704)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001705
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001706#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001707DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001708 TP_PROTO(struct xfs_da_args *args), \
1709 TP_ARGS(args))
1710DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1711DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1712DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1713DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1714DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1715DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1716DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1717DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1718DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1719DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1720DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1721DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1722DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1723DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1724DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1725DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1726DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1727DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1728DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1729DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1730DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1731DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1732DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1733DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1734DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1735
Dave Chinneree732592012-11-12 22:53:53 +11001736DECLARE_EVENT_CLASS(xfs_attr_class,
1737 TP_PROTO(struct xfs_da_args *args),
1738 TP_ARGS(args),
1739 TP_STRUCT__entry(
1740 __field(dev_t, dev)
1741 __field(xfs_ino_t, ino)
1742 __dynamic_array(char, name, args->namelen)
1743 __field(int, namelen)
1744 __field(int, valuelen)
1745 __field(xfs_dahash_t, hashval)
1746 __field(int, op_flags)
1747 ),
1748 TP_fast_assign(
1749 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1750 __entry->ino = args->dp->i_ino;
1751 if (args->namelen)
1752 memcpy(__get_str(name), args->name, args->namelen);
1753 __entry->namelen = args->namelen;
1754 __entry->valuelen = args->valuelen;
1755 __entry->hashval = args->hashval;
1756 __entry->op_flags = args->op_flags;
1757 ),
1758 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1759 "hashval 0x%x op_flags %s",
1760 MAJOR(__entry->dev), MINOR(__entry->dev),
1761 __entry->ino,
1762 __entry->namelen,
1763 __entry->namelen ? __get_str(name) : NULL,
1764 __entry->namelen,
1765 __entry->valuelen,
1766 __entry->hashval,
1767 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1768)
1769
Dave Chinner5a5881c2012-03-22 05:15:13 +00001770#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001771DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001772 TP_PROTO(struct xfs_da_args *args), \
1773 TP_ARGS(args))
1774DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1775DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1776DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1777DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1778DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001779DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1780
1781DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1782DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1783DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001784DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001785DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1786DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001787DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1788DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001789DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1790DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001791DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001792DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1793DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1794DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1795DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1796DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1797DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1798DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1799DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1800DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1801DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1802DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001803DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001804
1805DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001806DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001807DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1808DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1809
Dave Chinneree732592012-11-12 22:53:53 +11001810DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1811DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1812
1813DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1814DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1815DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1816
Dave Chinner5a5881c2012-03-22 05:15:13 +00001817#define DEFINE_DA_EVENT(name) \
1818DEFINE_EVENT(xfs_da_class, name, \
1819 TP_PROTO(struct xfs_da_args *args), \
1820 TP_ARGS(args))
1821DEFINE_DA_EVENT(xfs_da_split);
1822DEFINE_DA_EVENT(xfs_da_join);
1823DEFINE_DA_EVENT(xfs_da_link_before);
1824DEFINE_DA_EVENT(xfs_da_link_after);
1825DEFINE_DA_EVENT(xfs_da_unlink_back);
1826DEFINE_DA_EVENT(xfs_da_unlink_forward);
1827DEFINE_DA_EVENT(xfs_da_root_split);
1828DEFINE_DA_EVENT(xfs_da_root_join);
1829DEFINE_DA_EVENT(xfs_da_node_add);
1830DEFINE_DA_EVENT(xfs_da_node_create);
1831DEFINE_DA_EVENT(xfs_da_node_split);
1832DEFINE_DA_EVENT(xfs_da_node_remove);
1833DEFINE_DA_EVENT(xfs_da_node_rebalance);
1834DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001835DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001836DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1837DEFINE_DA_EVENT(xfs_da_grow_inode);
1838DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001839DEFINE_DA_EVENT(xfs_da_fixhashpath);
1840DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001841
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001842DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1843 TP_PROTO(struct xfs_da_args *args, int idx),
1844 TP_ARGS(args, idx),
1845 TP_STRUCT__entry(
1846 __field(dev_t, dev)
1847 __field(xfs_ino_t, ino)
1848 __field(int, op_flags)
1849 __field(int, idx)
1850 ),
1851 TP_fast_assign(
1852 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1853 __entry->ino = args->dp->i_ino;
1854 __entry->op_flags = args->op_flags;
1855 __entry->idx = idx;
1856 ),
1857 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1858 MAJOR(__entry->dev), MINOR(__entry->dev),
1859 __entry->ino,
1860 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1861 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001862)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001863
1864#define DEFINE_DIR2_SPACE_EVENT(name) \
1865DEFINE_EVENT(xfs_dir2_space_class, name, \
1866 TP_PROTO(struct xfs_da_args *args, int idx), \
1867 TP_ARGS(args, idx))
1868DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1869DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1870DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1871DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001872
1873TRACE_EVENT(xfs_dir2_leafn_moveents,
1874 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1875 TP_ARGS(args, src_idx, dst_idx, count),
1876 TP_STRUCT__entry(
1877 __field(dev_t, dev)
1878 __field(xfs_ino_t, ino)
1879 __field(int, op_flags)
1880 __field(int, src_idx)
1881 __field(int, dst_idx)
1882 __field(int, count)
1883 ),
1884 TP_fast_assign(
1885 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1886 __entry->ino = args->dp->i_ino;
1887 __entry->op_flags = args->op_flags;
1888 __entry->src_idx = src_idx;
1889 __entry->dst_idx = dst_idx;
1890 __entry->count = count;
1891 ),
1892 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1893 "src_idx %d dst_idx %d count %d",
1894 MAJOR(__entry->dev), MINOR(__entry->dev),
1895 __entry->ino,
1896 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1897 __entry->src_idx,
1898 __entry->dst_idx,
1899 __entry->count)
1900);
1901
Dave Chinner3a85cd92010-01-14 01:33:55 +00001902#define XFS_SWAPEXT_INODES \
1903 { 0, "target" }, \
1904 { 1, "temp" }
1905
1906#define XFS_INODE_FORMAT_STR \
1907 { 0, "invalid" }, \
1908 { 1, "local" }, \
1909 { 2, "extent" }, \
1910 { 3, "btree" }
1911
1912DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1913 TP_PROTO(struct xfs_inode *ip, int which),
1914 TP_ARGS(ip, which),
1915 TP_STRUCT__entry(
1916 __field(dev_t, dev)
1917 __field(int, which)
1918 __field(xfs_ino_t, ino)
1919 __field(int, format)
1920 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001921 __field(int, broot_size)
1922 __field(int, fork_off)
1923 ),
1924 TP_fast_assign(
1925 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1926 __entry->which = which;
1927 __entry->ino = ip->i_ino;
1928 __entry->format = ip->i_d.di_format;
1929 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001930 __entry->broot_size = ip->i_df.if_broot_bytes;
1931 __entry->fork_off = XFS_IFORK_BOFF(ip);
1932 ),
1933 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001934 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001935 MAJOR(__entry->dev), MINOR(__entry->dev),
1936 __entry->ino,
1937 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1938 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1939 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001940 __entry->broot_size,
1941 __entry->fork_off)
1942)
1943
1944#define DEFINE_SWAPEXT_EVENT(name) \
1945DEFINE_EVENT(xfs_swap_extent_class, name, \
1946 TP_PROTO(struct xfs_inode *ip, int which), \
1947 TP_ARGS(ip, which))
1948
1949DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1950DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1951
Brian Fostere67d3d42017-08-08 18:21:53 -07001952TRACE_EVENT(xfs_log_recover,
1953 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1954 TP_ARGS(log, headblk, tailblk),
1955 TP_STRUCT__entry(
1956 __field(dev_t, dev)
1957 __field(xfs_daddr_t, headblk)
1958 __field(xfs_daddr_t, tailblk)
1959 ),
1960 TP_fast_assign(
1961 __entry->dev = log->l_mp->m_super->s_dev;
1962 __entry->headblk = headblk;
1963 __entry->tailblk = tailblk;
1964 ),
1965 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1966 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1967 __entry->tailblk)
1968)
1969
Brian Foster5cd9cee2016-09-26 08:34:52 +10001970TRACE_EVENT(xfs_log_recover_record,
1971 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1972 TP_ARGS(log, rhead, pass),
1973 TP_STRUCT__entry(
1974 __field(dev_t, dev)
1975 __field(xfs_lsn_t, lsn)
1976 __field(int, len)
1977 __field(int, num_logops)
1978 __field(int, pass)
1979 ),
1980 TP_fast_assign(
1981 __entry->dev = log->l_mp->m_super->s_dev;
1982 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1983 __entry->len = be32_to_cpu(rhead->h_len);
1984 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1985 __entry->pass = pass;
1986 ),
1987 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1988 MAJOR(__entry->dev), MINOR(__entry->dev),
1989 __entry->lsn, __entry->len, __entry->num_logops,
1990 __entry->pass)
1991)
1992
Dave Chinner9abbc532010-04-13 15:06:46 +10001993DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001994 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001995 struct xlog_recover_item *item, int pass),
1996 TP_ARGS(log, trans, item, pass),
1997 TP_STRUCT__entry(
1998 __field(dev_t, dev)
1999 __field(unsigned long, item)
2000 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002001 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002002 __field(int, type)
2003 __field(int, pass)
2004 __field(int, count)
2005 __field(int, total)
2006 ),
2007 TP_fast_assign(
2008 __entry->dev = log->l_mp->m_super->s_dev;
2009 __entry->item = (unsigned long)item;
2010 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002011 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002012 __entry->type = ITEM_TYPE(item);
2013 __entry->pass = pass;
2014 __entry->count = item->ri_cnt;
2015 __entry->total = item->ri_total;
2016 ),
Darrick J. Wong3d170aa2018-01-09 11:43:36 -08002017 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item %p, "
Brian Foster5cd9cee2016-09-26 08:34:52 +10002018 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002019 MAJOR(__entry->dev), MINOR(__entry->dev),
2020 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002021 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002022 __entry->pass,
2023 (void *)__entry->item,
2024 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2025 __entry->count,
2026 __entry->total)
2027)
2028
2029#define DEFINE_LOG_RECOVER_ITEM(name) \
2030DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002031 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002032 struct xlog_recover_item *item, int pass), \
2033 TP_ARGS(log, trans, item, pass))
2034
2035DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2036DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2037DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2038DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2039DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2040
2041DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002042 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002043 TP_ARGS(log, buf_f),
2044 TP_STRUCT__entry(
2045 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002046 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002047 __field(unsigned short, len)
2048 __field(unsigned short, flags)
2049 __field(unsigned short, size)
2050 __field(unsigned int, map_size)
2051 ),
2052 TP_fast_assign(
2053 __entry->dev = log->l_mp->m_super->s_dev;
2054 __entry->blkno = buf_f->blf_blkno;
2055 __entry->len = buf_f->blf_len;
2056 __entry->flags = buf_f->blf_flags;
2057 __entry->size = buf_f->blf_size;
2058 __entry->map_size = buf_f->blf_map_size;
2059 ),
2060 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2061 "map_size %d",
2062 MAJOR(__entry->dev), MINOR(__entry->dev),
2063 __entry->blkno,
2064 __entry->len,
2065 __entry->flags,
2066 __entry->size,
2067 __entry->map_size)
2068)
2069
2070#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2071DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002072 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002073 TP_ARGS(log, buf_f))
2074
2075DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2076DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2077DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2078DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2079DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002080DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002081DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2082DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2083DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2084
2085DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002086 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002087 TP_ARGS(log, in_f),
2088 TP_STRUCT__entry(
2089 __field(dev_t, dev)
2090 __field(xfs_ino_t, ino)
2091 __field(unsigned short, size)
2092 __field(int, fields)
2093 __field(unsigned short, asize)
2094 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002095 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002096 __field(int, len)
2097 __field(int, boffset)
2098 ),
2099 TP_fast_assign(
2100 __entry->dev = log->l_mp->m_super->s_dev;
2101 __entry->ino = in_f->ilf_ino;
2102 __entry->size = in_f->ilf_size;
2103 __entry->fields = in_f->ilf_fields;
2104 __entry->asize = in_f->ilf_asize;
2105 __entry->dsize = in_f->ilf_dsize;
2106 __entry->blkno = in_f->ilf_blkno;
2107 __entry->len = in_f->ilf_len;
2108 __entry->boffset = in_f->ilf_boffset;
2109 ),
2110 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2111 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2112 MAJOR(__entry->dev), MINOR(__entry->dev),
2113 __entry->ino,
2114 __entry->size,
2115 __entry->fields,
2116 __entry->asize,
2117 __entry->dsize,
2118 __entry->blkno,
2119 __entry->len,
2120 __entry->boffset)
2121)
2122#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2123DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002124 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002125 TP_ARGS(log, in_f))
2126
2127DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2128DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2129DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2130
Brian Foster78d57e42015-08-19 09:58:48 +10002131DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2132 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2133 TP_ARGS(log, in_f),
2134 TP_STRUCT__entry(
2135 __field(dev_t, dev)
2136 __field(xfs_agnumber_t, agno)
2137 __field(xfs_agblock_t, agbno)
2138 __field(unsigned int, count)
2139 __field(unsigned int, isize)
2140 __field(xfs_agblock_t, length)
2141 __field(unsigned int, gen)
2142 ),
2143 TP_fast_assign(
2144 __entry->dev = log->l_mp->m_super->s_dev;
2145 __entry->agno = be32_to_cpu(in_f->icl_ag);
2146 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2147 __entry->count = be32_to_cpu(in_f->icl_count);
2148 __entry->isize = be32_to_cpu(in_f->icl_isize);
2149 __entry->length = be32_to_cpu(in_f->icl_length);
2150 __entry->gen = be32_to_cpu(in_f->icl_gen);
2151 ),
2152 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2153 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2154 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2155 __entry->length, __entry->gen)
2156)
2157#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2158DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2159 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2160 TP_ARGS(log, in_f))
2161
2162DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2163DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2164
Christoph Hellwiga46db602011-01-07 13:02:04 +00002165DECLARE_EVENT_CLASS(xfs_discard_class,
2166 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2167 xfs_agblock_t agbno, xfs_extlen_t len),
2168 TP_ARGS(mp, agno, agbno, len),
2169 TP_STRUCT__entry(
2170 __field(dev_t, dev)
2171 __field(xfs_agnumber_t, agno)
2172 __field(xfs_agblock_t, agbno)
2173 __field(xfs_extlen_t, len)
2174 ),
2175 TP_fast_assign(
2176 __entry->dev = mp->m_super->s_dev;
2177 __entry->agno = agno;
2178 __entry->agbno = agbno;
2179 __entry->len = len;
2180 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002181 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002182 MAJOR(__entry->dev), MINOR(__entry->dev),
2183 __entry->agno,
2184 __entry->agbno,
2185 __entry->len)
2186)
2187
2188#define DEFINE_DISCARD_EVENT(name) \
2189DEFINE_EVENT(xfs_discard_class, name, \
2190 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2191 xfs_agblock_t agbno, xfs_extlen_t len), \
2192 TP_ARGS(mp, agno, agbno, len))
2193DEFINE_DISCARD_EVENT(xfs_discard_extent);
2194DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2195DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2196DEFINE_DISCARD_EVENT(xfs_discard_busy);
2197
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002198/* btree cursor events */
2199DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2200 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2201 TP_ARGS(cur, level, bp),
2202 TP_STRUCT__entry(
2203 __field(dev_t, dev)
2204 __field(xfs_btnum_t, btnum)
2205 __field(int, level)
2206 __field(int, nlevels)
2207 __field(int, ptr)
2208 __field(xfs_daddr_t, daddr)
2209 ),
2210 TP_fast_assign(
2211 __entry->dev = cur->bc_mp->m_super->s_dev;
2212 __entry->btnum = cur->bc_btnum;
2213 __entry->level = level;
2214 __entry->nlevels = cur->bc_nlevels;
2215 __entry->ptr = cur->bc_ptrs[level];
2216 __entry->daddr = bp ? bp->b_bn : -1;
2217 ),
2218 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2219 MAJOR(__entry->dev), MINOR(__entry->dev),
2220 __entry->btnum,
2221 __entry->level,
2222 __entry->nlevels,
2223 __entry->ptr,
2224 (unsigned long long)__entry->daddr)
2225)
2226
2227#define DEFINE_BTREE_CUR_EVENT(name) \
2228DEFINE_EVENT(xfs_btree_cur_class, name, \
2229 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2230 TP_ARGS(cur, level, bp))
2231DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002232DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002233
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002234/* deferred ops */
2235struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002236struct xfs_defer_ops;
2237
2238DECLARE_EVENT_CLASS(xfs_defer_class,
2239 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2240 TP_ARGS(mp, dop),
2241 TP_STRUCT__entry(
2242 __field(dev_t, dev)
2243 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002244 __field(char, committed)
2245 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002246 ),
2247 TP_fast_assign(
2248 __entry->dev = mp ? mp->m_super->s_dev : 0;
2249 __entry->dop = dop;
2250 __entry->committed = dop->dop_committed;
2251 __entry->low = dop->dop_low;
2252 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002253 TP_printk("dev %d:%d ops %p committed %d low %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002254 MAJOR(__entry->dev), MINOR(__entry->dev),
2255 __entry->dop,
2256 __entry->committed,
2257 __entry->low)
2258)
2259#define DEFINE_DEFER_EVENT(name) \
2260DEFINE_EVENT(xfs_defer_class, name, \
2261 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2262 TP_ARGS(mp, dop))
2263
2264DECLARE_EVENT_CLASS(xfs_defer_error_class,
2265 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2266 TP_ARGS(mp, dop, error),
2267 TP_STRUCT__entry(
2268 __field(dev_t, dev)
2269 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002270 __field(char, committed)
2271 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002272 __field(int, error)
2273 ),
2274 TP_fast_assign(
2275 __entry->dev = mp ? mp->m_super->s_dev : 0;
2276 __entry->dop = dop;
2277 __entry->committed = dop->dop_committed;
2278 __entry->low = dop->dop_low;
2279 __entry->error = error;
2280 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002281 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002282 MAJOR(__entry->dev), MINOR(__entry->dev),
2283 __entry->dop,
2284 __entry->committed,
2285 __entry->low,
2286 __entry->error)
2287)
2288#define DEFINE_DEFER_ERROR_EVENT(name) \
2289DEFINE_EVENT(xfs_defer_error_class, name, \
2290 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2291 TP_ARGS(mp, dop, error))
2292
2293DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2294 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2295 TP_ARGS(mp, dfp),
2296 TP_STRUCT__entry(
2297 __field(dev_t, dev)
2298 __field(int, type)
2299 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002300 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002301 __field(int, nr)
2302 ),
2303 TP_fast_assign(
2304 __entry->dev = mp ? mp->m_super->s_dev : 0;
2305 __entry->type = dfp->dfp_type->type;
2306 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002307 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002308 __entry->nr = dfp->dfp_count;
2309 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002310 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002311 MAJOR(__entry->dev), MINOR(__entry->dev),
2312 __entry->type,
2313 __entry->intent,
2314 __entry->committed,
2315 __entry->nr)
2316)
2317#define DEFINE_DEFER_PENDING_EVENT(name) \
2318DEFINE_EVENT(xfs_defer_pending_class, name, \
2319 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2320 TP_ARGS(mp, dfp))
2321
2322DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2323 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2324 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2325 TP_ARGS(mp, agno, type, agbno, len),
2326 TP_STRUCT__entry(
2327 __field(dev_t, dev)
2328 __field(xfs_agnumber_t, agno)
2329 __field(int, type)
2330 __field(xfs_agblock_t, agbno)
2331 __field(xfs_extlen_t, len)
2332 ),
2333 TP_fast_assign(
2334 __entry->dev = mp->m_super->s_dev;
2335 __entry->agno = agno;
2336 __entry->type = type;
2337 __entry->agbno = agbno;
2338 __entry->len = len;
2339 ),
2340 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2341 MAJOR(__entry->dev), MINOR(__entry->dev),
2342 __entry->type,
2343 __entry->agno,
2344 __entry->agbno,
2345 __entry->len)
2346);
2347#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2348DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2349 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2350 int type, \
2351 xfs_agblock_t bno, \
2352 xfs_extlen_t len), \
2353 TP_ARGS(mp, agno, type, bno, len))
2354
2355DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2356 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2357 int op,
2358 xfs_agblock_t agbno,
2359 xfs_ino_t ino,
2360 int whichfork,
2361 xfs_fileoff_t offset,
2362 xfs_filblks_t len,
2363 xfs_exntst_t state),
2364 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2365 TP_STRUCT__entry(
2366 __field(dev_t, dev)
2367 __field(xfs_agnumber_t, agno)
2368 __field(xfs_ino_t, ino)
2369 __field(xfs_agblock_t, agbno)
2370 __field(int, whichfork)
2371 __field(xfs_fileoff_t, l_loff)
2372 __field(xfs_filblks_t, l_len)
2373 __field(xfs_exntst_t, l_state)
2374 __field(int, op)
2375 ),
2376 TP_fast_assign(
2377 __entry->dev = mp->m_super->s_dev;
2378 __entry->agno = agno;
2379 __entry->ino = ino;
2380 __entry->agbno = agbno;
2381 __entry->whichfork = whichfork;
2382 __entry->l_loff = offset;
2383 __entry->l_len = len;
2384 __entry->l_state = state;
2385 __entry->op = op;
2386 ),
2387 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2388 MAJOR(__entry->dev), MINOR(__entry->dev),
2389 __entry->op,
2390 __entry->agno,
2391 __entry->agbno,
2392 __entry->ino,
2393 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2394 __entry->l_loff,
2395 __entry->l_len,
2396 __entry->l_state)
2397);
2398#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2399DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2400 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2401 int op, \
2402 xfs_agblock_t agbno, \
2403 xfs_ino_t ino, \
2404 int whichfork, \
2405 xfs_fileoff_t offset, \
2406 xfs_filblks_t len, \
2407 xfs_exntst_t state), \
2408 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2409
2410DEFINE_DEFER_EVENT(xfs_defer_init);
2411DEFINE_DEFER_EVENT(xfs_defer_cancel);
2412DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2413DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2414DEFINE_DEFER_EVENT(xfs_defer_finish);
2415DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2416
2417DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2418DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002419
2420DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2421DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002422DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2423DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2424DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2425
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002426#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2427DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2428DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2429
Darrick J. Wong673930c2016-08-03 11:33:43 +10002430/* rmap tracepoints */
2431DECLARE_EVENT_CLASS(xfs_rmap_class,
2432 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2433 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2434 struct xfs_owner_info *oinfo),
2435 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2436 TP_STRUCT__entry(
2437 __field(dev_t, dev)
2438 __field(xfs_agnumber_t, agno)
2439 __field(xfs_agblock_t, agbno)
2440 __field(xfs_extlen_t, len)
2441 __field(uint64_t, owner)
2442 __field(uint64_t, offset)
2443 __field(unsigned long, flags)
2444 ),
2445 TP_fast_assign(
2446 __entry->dev = mp->m_super->s_dev;
2447 __entry->agno = agno;
2448 __entry->agbno = agbno;
2449 __entry->len = len;
2450 __entry->owner = oinfo->oi_owner;
2451 __entry->offset = oinfo->oi_offset;
2452 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002453 if (unwritten)
2454 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002455 ),
2456 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2457 MAJOR(__entry->dev), MINOR(__entry->dev),
2458 __entry->agno,
2459 __entry->agbno,
2460 __entry->len,
2461 __entry->owner,
2462 __entry->offset,
2463 __entry->flags)
2464);
2465#define DEFINE_RMAP_EVENT(name) \
2466DEFINE_EVENT(xfs_rmap_class, name, \
2467 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2468 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2469 struct xfs_owner_info *oinfo), \
2470 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2471
2472/* simple AG-based error/%ip tracepoint class */
2473DECLARE_EVENT_CLASS(xfs_ag_error_class,
2474 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2475 unsigned long caller_ip),
2476 TP_ARGS(mp, agno, error, caller_ip),
2477 TP_STRUCT__entry(
2478 __field(dev_t, dev)
2479 __field(xfs_agnumber_t, agno)
2480 __field(int, error)
2481 __field(unsigned long, caller_ip)
2482 ),
2483 TP_fast_assign(
2484 __entry->dev = mp->m_super->s_dev;
2485 __entry->agno = agno;
2486 __entry->error = error;
2487 __entry->caller_ip = caller_ip;
2488 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002489 TP_printk("dev %d:%d agno %u error %d caller %pS",
Darrick J. Wong673930c2016-08-03 11:33:43 +10002490 MAJOR(__entry->dev), MINOR(__entry->dev),
2491 __entry->agno,
2492 __entry->error,
2493 (char *)__entry->caller_ip)
2494);
2495
2496#define DEFINE_AG_ERROR_EVENT(name) \
2497DEFINE_EVENT(xfs_ag_error_class, name, \
2498 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2499 unsigned long caller_ip), \
2500 TP_ARGS(mp, agno, error, caller_ip))
2501
2502DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2503DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2504DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2505DEFINE_RMAP_EVENT(xfs_rmap_map);
2506DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2507DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002508DEFINE_RMAP_EVENT(xfs_rmap_convert);
2509DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2510DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2511DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002512
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002513DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2514 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2515 xfs_agblock_t agbno, xfs_extlen_t len,
2516 uint64_t owner, uint64_t offset, unsigned int flags),
2517 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2518 TP_STRUCT__entry(
2519 __field(dev_t, dev)
2520 __field(xfs_agnumber_t, agno)
2521 __field(xfs_agblock_t, agbno)
2522 __field(xfs_extlen_t, len)
2523 __field(uint64_t, owner)
2524 __field(uint64_t, offset)
2525 __field(unsigned int, flags)
2526 ),
2527 TP_fast_assign(
2528 __entry->dev = mp->m_super->s_dev;
2529 __entry->agno = agno;
2530 __entry->agbno = agbno;
2531 __entry->len = len;
2532 __entry->owner = owner;
2533 __entry->offset = offset;
2534 __entry->flags = flags;
2535 ),
2536 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2537 MAJOR(__entry->dev), MINOR(__entry->dev),
2538 __entry->agno,
2539 __entry->agbno,
2540 __entry->len,
2541 __entry->owner,
2542 __entry->offset,
2543 __entry->flags)
2544);
2545#define DEFINE_RMAPBT_EVENT(name) \
2546DEFINE_EVENT(xfs_rmapbt_class, name, \
2547 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2548 xfs_agblock_t agbno, xfs_extlen_t len, \
2549 uint64_t owner, uint64_t offset, unsigned int flags), \
2550 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2551
2552#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2553DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2554DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2555
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002556DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2557DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002558DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2559DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2560DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2561DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2562DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2563DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002564
2565DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2566DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2567DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2568DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002569DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2570DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002571DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002572
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002573/* deferred bmbt updates */
2574#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2575DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2576DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2577
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002578/* per-AG reservation */
2579DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2580 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2581 xfs_extlen_t len),
2582 TP_ARGS(pag, resv, len),
2583 TP_STRUCT__entry(
2584 __field(dev_t, dev)
2585 __field(xfs_agnumber_t, agno)
2586 __field(int, resv)
2587 __field(xfs_extlen_t, freeblks)
2588 __field(xfs_extlen_t, flcount)
2589 __field(xfs_extlen_t, reserved)
2590 __field(xfs_extlen_t, asked)
2591 __field(xfs_extlen_t, len)
2592 ),
2593 TP_fast_assign(
2594 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2595
2596 __entry->dev = pag->pag_mount->m_super->s_dev;
2597 __entry->agno = pag->pag_agno;
2598 __entry->resv = resv;
2599 __entry->freeblks = pag->pagf_freeblks;
2600 __entry->flcount = pag->pagf_flcount;
2601 __entry->reserved = r ? r->ar_reserved : 0;
2602 __entry->asked = r ? r->ar_asked : 0;
2603 __entry->len = len;
2604 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002605 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2606 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002607 MAJOR(__entry->dev), MINOR(__entry->dev),
2608 __entry->agno,
2609 __entry->resv,
2610 __entry->freeblks,
2611 __entry->flcount,
2612 __entry->reserved,
2613 __entry->asked,
2614 __entry->len)
2615)
2616#define DEFINE_AG_RESV_EVENT(name) \
2617DEFINE_EVENT(xfs_ag_resv_class, name, \
2618 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2619 xfs_extlen_t len), \
2620 TP_ARGS(pag, type, len))
2621
2622/* per-AG reservation tracepoints */
2623DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2624DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2625DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2626DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2627DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2628DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2629
2630DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2631DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2632
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002633/* refcount tracepoint classes */
2634
2635/* reuse the discard trace class for agbno/aglen-based traces */
2636#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2637
2638/* ag btree lookup tracepoint class */
2639#define XFS_AG_BTREE_CMP_FORMAT_STR \
2640 { XFS_LOOKUP_EQ, "eq" }, \
2641 { XFS_LOOKUP_LE, "le" }, \
2642 { XFS_LOOKUP_GE, "ge" }
2643DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2644 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2645 xfs_agblock_t agbno, xfs_lookup_t dir),
2646 TP_ARGS(mp, agno, agbno, dir),
2647 TP_STRUCT__entry(
2648 __field(dev_t, dev)
2649 __field(xfs_agnumber_t, agno)
2650 __field(xfs_agblock_t, agbno)
2651 __field(xfs_lookup_t, dir)
2652 ),
2653 TP_fast_assign(
2654 __entry->dev = mp->m_super->s_dev;
2655 __entry->agno = agno;
2656 __entry->agbno = agbno;
2657 __entry->dir = dir;
2658 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002659 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002660 MAJOR(__entry->dev), MINOR(__entry->dev),
2661 __entry->agno,
2662 __entry->agbno,
2663 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2664 __entry->dir)
2665)
2666
2667#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2668DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2669 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2670 xfs_agblock_t agbno, xfs_lookup_t dir), \
2671 TP_ARGS(mp, agno, agbno, dir))
2672
2673/* single-rcext tracepoint class */
2674DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2675 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2676 struct xfs_refcount_irec *irec),
2677 TP_ARGS(mp, agno, irec),
2678 TP_STRUCT__entry(
2679 __field(dev_t, dev)
2680 __field(xfs_agnumber_t, agno)
2681 __field(xfs_agblock_t, startblock)
2682 __field(xfs_extlen_t, blockcount)
2683 __field(xfs_nlink_t, refcount)
2684 ),
2685 TP_fast_assign(
2686 __entry->dev = mp->m_super->s_dev;
2687 __entry->agno = agno;
2688 __entry->startblock = irec->rc_startblock;
2689 __entry->blockcount = irec->rc_blockcount;
2690 __entry->refcount = irec->rc_refcount;
2691 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002692 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002693 MAJOR(__entry->dev), MINOR(__entry->dev),
2694 __entry->agno,
2695 __entry->startblock,
2696 __entry->blockcount,
2697 __entry->refcount)
2698)
2699
2700#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2701DEFINE_EVENT(xfs_refcount_extent_class, name, \
2702 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2703 struct xfs_refcount_irec *irec), \
2704 TP_ARGS(mp, agno, irec))
2705
2706/* single-rcext and an agbno tracepoint class */
2707DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2708 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2709 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2710 TP_ARGS(mp, agno, irec, agbno),
2711 TP_STRUCT__entry(
2712 __field(dev_t, dev)
2713 __field(xfs_agnumber_t, agno)
2714 __field(xfs_agblock_t, startblock)
2715 __field(xfs_extlen_t, blockcount)
2716 __field(xfs_nlink_t, refcount)
2717 __field(xfs_agblock_t, agbno)
2718 ),
2719 TP_fast_assign(
2720 __entry->dev = mp->m_super->s_dev;
2721 __entry->agno = agno;
2722 __entry->startblock = irec->rc_startblock;
2723 __entry->blockcount = irec->rc_blockcount;
2724 __entry->refcount = irec->rc_refcount;
2725 __entry->agbno = agbno;
2726 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002727 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002728 MAJOR(__entry->dev), MINOR(__entry->dev),
2729 __entry->agno,
2730 __entry->startblock,
2731 __entry->blockcount,
2732 __entry->refcount,
2733 __entry->agbno)
2734)
2735
2736#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2737DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2738 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2739 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2740 TP_ARGS(mp, agno, irec, agbno))
2741
2742/* double-rcext tracepoint class */
2743DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2744 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2745 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2746 TP_ARGS(mp, agno, i1, i2),
2747 TP_STRUCT__entry(
2748 __field(dev_t, dev)
2749 __field(xfs_agnumber_t, agno)
2750 __field(xfs_agblock_t, i1_startblock)
2751 __field(xfs_extlen_t, i1_blockcount)
2752 __field(xfs_nlink_t, i1_refcount)
2753 __field(xfs_agblock_t, i2_startblock)
2754 __field(xfs_extlen_t, i2_blockcount)
2755 __field(xfs_nlink_t, i2_refcount)
2756 ),
2757 TP_fast_assign(
2758 __entry->dev = mp->m_super->s_dev;
2759 __entry->agno = agno;
2760 __entry->i1_startblock = i1->rc_startblock;
2761 __entry->i1_blockcount = i1->rc_blockcount;
2762 __entry->i1_refcount = i1->rc_refcount;
2763 __entry->i2_startblock = i2->rc_startblock;
2764 __entry->i2_blockcount = i2->rc_blockcount;
2765 __entry->i2_refcount = i2->rc_refcount;
2766 ),
2767 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002768 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002769 MAJOR(__entry->dev), MINOR(__entry->dev),
2770 __entry->agno,
2771 __entry->i1_startblock,
2772 __entry->i1_blockcount,
2773 __entry->i1_refcount,
2774 __entry->i2_startblock,
2775 __entry->i2_blockcount,
2776 __entry->i2_refcount)
2777)
2778
2779#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2780DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2781 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2782 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2783 TP_ARGS(mp, agno, i1, i2))
2784
2785/* double-rcext and an agbno tracepoint class */
2786DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2787 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2788 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2789 xfs_agblock_t agbno),
2790 TP_ARGS(mp, agno, i1, i2, agbno),
2791 TP_STRUCT__entry(
2792 __field(dev_t, dev)
2793 __field(xfs_agnumber_t, agno)
2794 __field(xfs_agblock_t, i1_startblock)
2795 __field(xfs_extlen_t, i1_blockcount)
2796 __field(xfs_nlink_t, i1_refcount)
2797 __field(xfs_agblock_t, i2_startblock)
2798 __field(xfs_extlen_t, i2_blockcount)
2799 __field(xfs_nlink_t, i2_refcount)
2800 __field(xfs_agblock_t, agbno)
2801 ),
2802 TP_fast_assign(
2803 __entry->dev = mp->m_super->s_dev;
2804 __entry->agno = agno;
2805 __entry->i1_startblock = i1->rc_startblock;
2806 __entry->i1_blockcount = i1->rc_blockcount;
2807 __entry->i1_refcount = i1->rc_refcount;
2808 __entry->i2_startblock = i2->rc_startblock;
2809 __entry->i2_blockcount = i2->rc_blockcount;
2810 __entry->i2_refcount = i2->rc_refcount;
2811 __entry->agbno = agbno;
2812 ),
2813 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002814 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002815 MAJOR(__entry->dev), MINOR(__entry->dev),
2816 __entry->agno,
2817 __entry->i1_startblock,
2818 __entry->i1_blockcount,
2819 __entry->i1_refcount,
2820 __entry->i2_startblock,
2821 __entry->i2_blockcount,
2822 __entry->i2_refcount,
2823 __entry->agbno)
2824)
2825
2826#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2827DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2828 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2829 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2830 xfs_agblock_t agbno), \
2831 TP_ARGS(mp, agno, i1, i2, agbno))
2832
2833/* triple-rcext tracepoint class */
2834DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2835 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2836 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2837 struct xfs_refcount_irec *i3),
2838 TP_ARGS(mp, agno, i1, i2, i3),
2839 TP_STRUCT__entry(
2840 __field(dev_t, dev)
2841 __field(xfs_agnumber_t, agno)
2842 __field(xfs_agblock_t, i1_startblock)
2843 __field(xfs_extlen_t, i1_blockcount)
2844 __field(xfs_nlink_t, i1_refcount)
2845 __field(xfs_agblock_t, i2_startblock)
2846 __field(xfs_extlen_t, i2_blockcount)
2847 __field(xfs_nlink_t, i2_refcount)
2848 __field(xfs_agblock_t, i3_startblock)
2849 __field(xfs_extlen_t, i3_blockcount)
2850 __field(xfs_nlink_t, i3_refcount)
2851 ),
2852 TP_fast_assign(
2853 __entry->dev = mp->m_super->s_dev;
2854 __entry->agno = agno;
2855 __entry->i1_startblock = i1->rc_startblock;
2856 __entry->i1_blockcount = i1->rc_blockcount;
2857 __entry->i1_refcount = i1->rc_refcount;
2858 __entry->i2_startblock = i2->rc_startblock;
2859 __entry->i2_blockcount = i2->rc_blockcount;
2860 __entry->i2_refcount = i2->rc_refcount;
2861 __entry->i3_startblock = i3->rc_startblock;
2862 __entry->i3_blockcount = i3->rc_blockcount;
2863 __entry->i3_refcount = i3->rc_refcount;
2864 ),
2865 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2866 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002867 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002868 MAJOR(__entry->dev), MINOR(__entry->dev),
2869 __entry->agno,
2870 __entry->i1_startblock,
2871 __entry->i1_blockcount,
2872 __entry->i1_refcount,
2873 __entry->i2_startblock,
2874 __entry->i2_blockcount,
2875 __entry->i2_refcount,
2876 __entry->i3_startblock,
2877 __entry->i3_blockcount,
2878 __entry->i3_refcount)
2879);
2880
2881#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2882DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2883 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2884 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2885 struct xfs_refcount_irec *i3), \
2886 TP_ARGS(mp, agno, i1, i2, i3))
2887
2888/* refcount btree tracepoints */
2889DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2890DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2891DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2892DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2893DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2894DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2895DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2896DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2897DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2898DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2899
2900/* refcount adjustment tracepoints */
2901DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2902DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002903DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2904DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002905DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2906DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002907DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002908DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2909DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2910DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2911DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2912DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2913DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002914DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002915DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2916DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2917DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2918DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2919DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2920DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2921DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2922
2923/* reflink helpers */
2924DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2925DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2926DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002927#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2928DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2929DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002930
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002931TRACE_EVENT(xfs_refcount_finish_one_leftover,
2932 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2933 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2934 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2935 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2936 TP_STRUCT__entry(
2937 __field(dev_t, dev)
2938 __field(xfs_agnumber_t, agno)
2939 __field(int, type)
2940 __field(xfs_agblock_t, agbno)
2941 __field(xfs_extlen_t, len)
2942 __field(xfs_agblock_t, new_agbno)
2943 __field(xfs_extlen_t, new_len)
2944 ),
2945 TP_fast_assign(
2946 __entry->dev = mp->m_super->s_dev;
2947 __entry->agno = agno;
2948 __entry->type = type;
2949 __entry->agbno = agbno;
2950 __entry->len = len;
2951 __entry->new_agbno = new_agbno;
2952 __entry->new_len = new_len;
2953 ),
2954 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2955 MAJOR(__entry->dev), MINOR(__entry->dev),
2956 __entry->type,
2957 __entry->agno,
2958 __entry->agbno,
2959 __entry->len,
2960 __entry->new_agbno,
2961 __entry->new_len)
2962);
2963
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002964/* simple inode-based error/%ip tracepoint class */
2965DECLARE_EVENT_CLASS(xfs_inode_error_class,
2966 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2967 TP_ARGS(ip, error, caller_ip),
2968 TP_STRUCT__entry(
2969 __field(dev_t, dev)
2970 __field(xfs_ino_t, ino)
2971 __field(int, error)
2972 __field(unsigned long, caller_ip)
2973 ),
2974 TP_fast_assign(
2975 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2976 __entry->ino = ip->i_ino;
2977 __entry->error = error;
2978 __entry->caller_ip = caller_ip;
2979 ),
Darrick J. Wongaff68a552018-01-09 11:46:05 -08002980 TP_printk("dev %d:%d ino %llx error %d caller %pS",
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002981 MAJOR(__entry->dev), MINOR(__entry->dev),
2982 __entry->ino,
2983 __entry->error,
2984 (char *)__entry->caller_ip)
2985);
2986
2987#define DEFINE_INODE_ERROR_EVENT(name) \
2988DEFINE_EVENT(xfs_inode_error_class, name, \
2989 TP_PROTO(struct xfs_inode *ip, int error, \
2990 unsigned long caller_ip), \
2991 TP_ARGS(ip, error, caller_ip))
2992
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002993/* reflink tracepoint classes */
2994
2995/* two-file io tracepoint class */
2996DECLARE_EVENT_CLASS(xfs_double_io_class,
2997 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
2998 struct xfs_inode *dest, xfs_off_t doffset),
2999 TP_ARGS(src, soffset, len, dest, doffset),
3000 TP_STRUCT__entry(
3001 __field(dev_t, dev)
3002 __field(xfs_ino_t, src_ino)
3003 __field(loff_t, src_isize)
3004 __field(loff_t, src_disize)
3005 __field(loff_t, src_offset)
3006 __field(size_t, len)
3007 __field(xfs_ino_t, dest_ino)
3008 __field(loff_t, dest_isize)
3009 __field(loff_t, dest_disize)
3010 __field(loff_t, dest_offset)
3011 ),
3012 TP_fast_assign(
3013 __entry->dev = VFS_I(src)->i_sb->s_dev;
3014 __entry->src_ino = src->i_ino;
3015 __entry->src_isize = VFS_I(src)->i_size;
3016 __entry->src_disize = src->i_d.di_size;
3017 __entry->src_offset = soffset;
3018 __entry->len = len;
3019 __entry->dest_ino = dest->i_ino;
3020 __entry->dest_isize = VFS_I(dest)->i_size;
3021 __entry->dest_disize = dest->i_d.di_size;
3022 __entry->dest_offset = doffset;
3023 ),
3024 TP_printk("dev %d:%d count %zd "
3025 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3026 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3027 MAJOR(__entry->dev), MINOR(__entry->dev),
3028 __entry->len,
3029 __entry->src_ino,
3030 __entry->src_isize,
3031 __entry->src_disize,
3032 __entry->src_offset,
3033 __entry->dest_ino,
3034 __entry->dest_isize,
3035 __entry->dest_disize,
3036 __entry->dest_offset)
3037)
3038
3039#define DEFINE_DOUBLE_IO_EVENT(name) \
3040DEFINE_EVENT(xfs_double_io_class, name, \
3041 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3042 struct xfs_inode *dest, xfs_off_t doffset), \
3043 TP_ARGS(src, soffset, len, dest, doffset))
3044
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003045/* inode/irec events */
3046DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3047 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3048 TP_ARGS(ip, irec),
3049 TP_STRUCT__entry(
3050 __field(dev_t, dev)
3051 __field(xfs_ino_t, ino)
3052 __field(xfs_fileoff_t, lblk)
3053 __field(xfs_extlen_t, len)
3054 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003055 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003056 ),
3057 TP_fast_assign(
3058 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3059 __entry->ino = ip->i_ino;
3060 __entry->lblk = irec->br_startoff;
3061 __entry->len = irec->br_blockcount;
3062 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003063 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003064 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003065 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 -07003066 MAJOR(__entry->dev), MINOR(__entry->dev),
3067 __entry->ino,
3068 __entry->lblk,
3069 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003070 __entry->pblk,
3071 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003072);
3073#define DEFINE_INODE_IREC_EVENT(name) \
3074DEFINE_EVENT(xfs_inode_irec_class, name, \
3075 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3076 TP_ARGS(ip, irec))
3077
3078/* refcount/reflink tracepoint definitions */
3079
3080/* reflink tracepoints */
3081DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3082DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3083DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3084DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3085TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3086 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3087 xfs_filblks_t len, struct xfs_inode *dest,
3088 xfs_fileoff_t doffset),
3089 TP_ARGS(src, soffset, len, dest, doffset),
3090 TP_STRUCT__entry(
3091 __field(dev_t, dev)
3092 __field(xfs_ino_t, src_ino)
3093 __field(xfs_fileoff_t, src_lblk)
3094 __field(xfs_filblks_t, len)
3095 __field(xfs_ino_t, dest_ino)
3096 __field(xfs_fileoff_t, dest_lblk)
3097 ),
3098 TP_fast_assign(
3099 __entry->dev = VFS_I(src)->i_sb->s_dev;
3100 __entry->src_ino = src->i_ino;
3101 __entry->src_lblk = soffset;
3102 __entry->len = len;
3103 __entry->dest_ino = dest->i_ino;
3104 __entry->dest_lblk = doffset;
3105 ),
3106 TP_printk("dev %d:%d len 0x%llx "
3107 "ino 0x%llx offset 0x%llx blocks -> "
3108 "ino 0x%llx offset 0x%llx blocks",
3109 MAJOR(__entry->dev), MINOR(__entry->dev),
3110 __entry->len,
3111 __entry->src_ino,
3112 __entry->src_lblk,
3113 __entry->dest_ino,
3114 __entry->dest_lblk)
3115);
3116TRACE_EVENT(xfs_reflink_punch_range,
3117 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3118 xfs_extlen_t len),
3119 TP_ARGS(ip, lblk, len),
3120 TP_STRUCT__entry(
3121 __field(dev_t, dev)
3122 __field(xfs_ino_t, ino)
3123 __field(xfs_fileoff_t, lblk)
3124 __field(xfs_extlen_t, len)
3125 ),
3126 TP_fast_assign(
3127 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3128 __entry->ino = ip->i_ino;
3129 __entry->lblk = lblk;
3130 __entry->len = len;
3131 ),
3132 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3133 MAJOR(__entry->dev), MINOR(__entry->dev),
3134 __entry->ino,
3135 __entry->lblk,
3136 __entry->len)
3137);
3138TRACE_EVENT(xfs_reflink_remap,
3139 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3140 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3141 TP_ARGS(ip, lblk, len, new_pblk),
3142 TP_STRUCT__entry(
3143 __field(dev_t, dev)
3144 __field(xfs_ino_t, ino)
3145 __field(xfs_fileoff_t, lblk)
3146 __field(xfs_extlen_t, len)
3147 __field(xfs_fsblock_t, new_pblk)
3148 ),
3149 TP_fast_assign(
3150 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3151 __entry->ino = ip->i_ino;
3152 __entry->lblk = lblk;
3153 __entry->len = len;
3154 __entry->new_pblk = new_pblk;
3155 ),
3156 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3157 MAJOR(__entry->dev), MINOR(__entry->dev),
3158 __entry->ino,
3159 __entry->lblk,
3160 __entry->len,
3161 __entry->new_pblk)
3162);
3163DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3164DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3165DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3166DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003167DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3168DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3169
3170/* dedupe tracepoints */
3171DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3172DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3173
3174/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003175TRACE_EVENT(xfs_ioctl_clone,
3176 TP_PROTO(struct inode *src, struct inode *dest),
3177 TP_ARGS(src, dest),
3178 TP_STRUCT__entry(
3179 __field(dev_t, dev)
3180 __field(unsigned long, src_ino)
3181 __field(loff_t, src_isize)
3182 __field(unsigned long, dest_ino)
3183 __field(loff_t, dest_isize)
3184 ),
3185 TP_fast_assign(
3186 __entry->dev = src->i_sb->s_dev;
3187 __entry->src_ino = src->i_ino;
3188 __entry->src_isize = i_size_read(src);
3189 __entry->dest_ino = dest->i_ino;
3190 __entry->dest_isize = i_size_read(dest);
3191 ),
3192 TP_printk("dev %d:%d "
3193 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003194 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003195 MAJOR(__entry->dev), MINOR(__entry->dev),
3196 __entry->src_ino,
3197 __entry->src_isize,
3198 __entry->dest_ino,
3199 __entry->dest_isize)
3200);
3201
3202/* unshare tracepoints */
3203DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003204DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003205
3206/* copy on write */
3207DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003208DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3209DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3210DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003211DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003212
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003213DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003214
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003215DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003216DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3217DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003218
3219DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3220DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3221DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003222
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003223DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3224DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3225
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003226
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003227DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003228
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003229/* rmap swapext tracepoints */
3230DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3231DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3232DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3233
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003234/* fsmap traces */
3235DECLARE_EVENT_CLASS(xfs_fsmap_class,
3236 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3237 struct xfs_rmap_irec *rmap),
3238 TP_ARGS(mp, keydev, agno, rmap),
3239 TP_STRUCT__entry(
3240 __field(dev_t, dev)
3241 __field(dev_t, keydev)
3242 __field(xfs_agnumber_t, agno)
3243 __field(xfs_fsblock_t, bno)
3244 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003245 __field(uint64_t, owner)
3246 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003247 __field(unsigned int, flags)
3248 ),
3249 TP_fast_assign(
3250 __entry->dev = mp->m_super->s_dev;
3251 __entry->keydev = new_decode_dev(keydev);
3252 __entry->agno = agno;
3253 __entry->bno = rmap->rm_startblock;
3254 __entry->len = rmap->rm_blockcount;
3255 __entry->owner = rmap->rm_owner;
3256 __entry->offset = rmap->rm_offset;
3257 __entry->flags = rmap->rm_flags;
3258 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003259 TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld offset %llu flags 0x%x",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003260 MAJOR(__entry->dev), MINOR(__entry->dev),
3261 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3262 __entry->agno,
3263 __entry->bno,
3264 __entry->len,
3265 __entry->owner,
3266 __entry->offset,
3267 __entry->flags)
3268)
3269#define DEFINE_FSMAP_EVENT(name) \
3270DEFINE_EVENT(xfs_fsmap_class, name, \
3271 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3272 struct xfs_rmap_irec *rmap), \
3273 TP_ARGS(mp, keydev, agno, rmap))
3274DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3275DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3276DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3277
3278DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3279 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3280 TP_ARGS(mp, fsmap),
3281 TP_STRUCT__entry(
3282 __field(dev_t, dev)
3283 __field(dev_t, keydev)
3284 __field(xfs_daddr_t, block)
3285 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003286 __field(uint64_t, owner)
3287 __field(uint64_t, offset)
3288 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003289 ),
3290 TP_fast_assign(
3291 __entry->dev = mp->m_super->s_dev;
3292 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3293 __entry->block = fsmap->fmr_physical;
3294 __entry->len = fsmap->fmr_length;
3295 __entry->owner = fsmap->fmr_owner;
3296 __entry->offset = fsmap->fmr_offset;
3297 __entry->flags = fsmap->fmr_flags;
3298 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003299 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 -07003300 MAJOR(__entry->dev), MINOR(__entry->dev),
3301 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3302 __entry->block,
3303 __entry->len,
3304 __entry->owner,
3305 __entry->offset,
3306 __entry->flags)
3307)
3308#define DEFINE_GETFSMAP_EVENT(name) \
3309DEFINE_EVENT(xfs_getfsmap_class, name, \
3310 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3311 TP_ARGS(mp, fsmap))
3312DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3313DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3314DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3315
Darrick J. Wongb872af22018-01-08 10:51:26 -08003316TRACE_EVENT(xfs_trans_resv_calc,
3317 TP_PROTO(struct xfs_mount *mp, unsigned int type,
3318 struct xfs_trans_res *res),
3319 TP_ARGS(mp, type, res),
3320 TP_STRUCT__entry(
3321 __field(dev_t, dev)
3322 __field(int, type)
3323 __field(uint, logres)
3324 __field(int, logcount)
3325 __field(int, logflags)
3326 ),
3327 TP_fast_assign(
3328 __entry->dev = mp->m_super->s_dev;
3329 __entry->type = type;
3330 __entry->logres = res->tr_logres;
3331 __entry->logcount = res->tr_logcount;
3332 __entry->logflags = res->tr_logflags;
3333 ),
3334 TP_printk("dev %d:%d type %d logres %u logcount %d flags 0x%x",
3335 MAJOR(__entry->dev), MINOR(__entry->dev),
3336 __entry->type,
3337 __entry->logres,
3338 __entry->logcount,
3339 __entry->logflags)
3340);
3341
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003342#endif /* _TRACE_XFS_H */
3343
3344#undef TRACE_INCLUDE_PATH
3345#define TRACE_INCLUDE_PATH .
3346#define TRACE_INCLUDE_FILE xfs_trace
3347#include <trace/define_trace.h>