blob: 515ba042d75cfde9d640205b3fc83478df83254c [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 "
75 "alist 0x%p size %u count %u firstu %u flags %d %s",
76 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 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100122 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 "
203 "alist 0x%p size %u count %u firstu %u flags %d %s "
204 "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 ),
Christoph Hellwig6bdcf262017-11-03 10:34:46 -0700254 TP_printk("dev %d:%d ino 0x%llx state %s cur 0x%p/%d "
Scott Wood65dd2972015-03-25 14:56:21 +1100255 "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 "
Scott Wood65dd2972015-03-25 14:56:21 +1100304 "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 "
Scott Wood65dd2972015-03-25 14:56:21 +1100373 "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,
393 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
394 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)
404 __field(unsigned long, caller_ip)
405 ),
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 "
Scott Wood65dd2972015-03-25 14:56:21 +1100418 "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 "
463 "lidesc 0x%p liflags %s",
464 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 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100582 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
Dave Chinner3af49282015-11-03 12:37:02 +1100657DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100658
Christoph Hellwigd522d562017-08-29 10:08:41 -0700659TRACE_EVENT(xfs_filemap_fault,
660 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
661 bool write_fault),
662 TP_ARGS(ip, pe_size, write_fault),
663 TP_STRUCT__entry(
664 __field(dev_t, dev)
665 __field(xfs_ino_t, ino)
666 __field(enum page_entry_size, pe_size)
667 __field(bool, write_fault)
668 ),
669 TP_fast_assign(
670 __entry->dev = VFS_I(ip)->i_sb->s_dev;
671 __entry->ino = ip->i_ino;
672 __entry->pe_size = pe_size;
673 __entry->write_fault = write_fault;
674 ),
675 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
676 MAJOR(__entry->dev), MINOR(__entry->dev),
677 __entry->ino,
678 __print_symbolic(__entry->pe_size,
679 { PE_SIZE_PTE, "PTE" },
680 { PE_SIZE_PMD, "PMD" },
681 { PE_SIZE_PUD, "PUD" }),
682 __entry->write_fault)
683)
684
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000685DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000686 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
687 TP_ARGS(ip, caller_ip),
688 TP_STRUCT__entry(
689 __field(dev_t, dev)
690 __field(xfs_ino_t, ino)
691 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100692 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000693 __field(unsigned long, caller_ip)
694 ),
695 TP_fast_assign(
696 __entry->dev = VFS_I(ip)->i_sb->s_dev;
697 __entry->ino = ip->i_ino;
698 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100699 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000700 __entry->caller_ip = caller_ip;
701 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100702 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000703 MAJOR(__entry->dev), MINOR(__entry->dev),
704 __entry->ino,
705 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100706 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000707 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000708)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000709
Brian Foster19cb7e32013-03-18 10:51:48 -0400710TRACE_EVENT(xfs_iomap_prealloc_size,
711 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
712 unsigned int writeio_blocks),
713 TP_ARGS(ip, blocks, shift, writeio_blocks),
714 TP_STRUCT__entry(
715 __field(dev_t, dev)
716 __field(xfs_ino_t, ino)
717 __field(xfs_fsblock_t, blocks)
718 __field(int, shift)
719 __field(unsigned int, writeio_blocks)
720 ),
721 TP_fast_assign(
722 __entry->dev = VFS_I(ip)->i_sb->s_dev;
723 __entry->ino = ip->i_ino;
724 __entry->blocks = blocks;
725 __entry->shift = shift;
726 __entry->writeio_blocks = writeio_blocks;
727 ),
728 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
729 "m_writeio_blocks %u",
730 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
731 __entry->blocks, __entry->shift, __entry->writeio_blocks)
732)
733
Brian Foster56d11152015-05-29 09:18:32 +1000734TRACE_EVENT(xfs_irec_merge_pre,
735 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
736 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
737 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
738 TP_STRUCT__entry(
739 __field(dev_t, dev)
740 __field(xfs_agnumber_t, agno)
741 __field(xfs_agino_t, agino)
742 __field(uint16_t, holemask)
743 __field(xfs_agino_t, nagino)
744 __field(uint16_t, nholemask)
745 ),
746 TP_fast_assign(
747 __entry->dev = mp->m_super->s_dev;
748 __entry->agno = agno;
749 __entry->agino = agino;
750 __entry->holemask = holemask;
751 __entry->nagino = nagino;
752 __entry->nholemask = holemask;
753 ),
754 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
755 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
756 __entry->agino, __entry->holemask, __entry->nagino,
757 __entry->nholemask)
758)
759
760TRACE_EVENT(xfs_irec_merge_post,
761 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
762 uint16_t holemask),
763 TP_ARGS(mp, agno, agino, holemask),
764 TP_STRUCT__entry(
765 __field(dev_t, dev)
766 __field(xfs_agnumber_t, agno)
767 __field(xfs_agino_t, agino)
768 __field(uint16_t, holemask)
769 ),
770 TP_fast_assign(
771 __entry->dev = mp->m_super->s_dev;
772 __entry->agno = agno;
773 __entry->agino = agino;
774 __entry->holemask = holemask;
775 ),
776 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
777 MINOR(__entry->dev), __entry->agno, __entry->agino,
778 __entry->holemask)
779)
780
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000781#define DEFINE_IREF_EVENT(name) \
782DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000783 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
784 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000785DEFINE_IREF_EVENT(xfs_irele);
786DEFINE_IREF_EVENT(xfs_inode_pin);
787DEFINE_IREF_EVENT(xfs_inode_unpin);
788DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100789
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000790DECLARE_EVENT_CLASS(xfs_namespace_class,
791 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
792 TP_ARGS(dp, name),
793 TP_STRUCT__entry(
794 __field(dev_t, dev)
795 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000796 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000797 __dynamic_array(char, name, name->len)
798 ),
799 TP_fast_assign(
800 __entry->dev = VFS_I(dp)->i_sb->s_dev;
801 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000802 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000803 memcpy(__get_str(name), name->name, name->len);
804 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000805 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000806 MAJOR(__entry->dev), MINOR(__entry->dev),
807 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000808 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000809 __get_str(name))
810)
811
812#define DEFINE_NAMESPACE_EVENT(name) \
813DEFINE_EVENT(xfs_namespace_class, name, \
814 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
815 TP_ARGS(dp, name))
816DEFINE_NAMESPACE_EVENT(xfs_remove);
817DEFINE_NAMESPACE_EVENT(xfs_link);
818DEFINE_NAMESPACE_EVENT(xfs_lookup);
819DEFINE_NAMESPACE_EVENT(xfs_create);
820DEFINE_NAMESPACE_EVENT(xfs_symlink);
821
822TRACE_EVENT(xfs_rename,
823 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
824 struct xfs_name *src_name, struct xfs_name *target_name),
825 TP_ARGS(src_dp, target_dp, src_name, target_name),
826 TP_STRUCT__entry(
827 __field(dev_t, dev)
828 __field(xfs_ino_t, src_dp_ino)
829 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000830 __field(int, src_namelen)
831 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000832 __dynamic_array(char, src_name, src_name->len)
833 __dynamic_array(char, target_name, target_name->len)
834 ),
835 TP_fast_assign(
836 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
837 __entry->src_dp_ino = src_dp->i_ino;
838 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000839 __entry->src_namelen = src_name->len;
840 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000841 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000842 memcpy(__get_str(target_name), target_name->name,
843 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000844 ),
845 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000846 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000847 MAJOR(__entry->dev), MINOR(__entry->dev),
848 __entry->src_dp_ino,
849 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000850 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000851 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000852 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000853 __get_str(target_name))
854)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000855
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000856DECLARE_EVENT_CLASS(xfs_dquot_class,
857 TP_PROTO(struct xfs_dquot *dqp),
858 TP_ARGS(dqp),
859 TP_STRUCT__entry(
860 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000861 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000862 __field(unsigned, flags)
863 __field(unsigned, nrefs)
864 __field(unsigned long long, res_bcount)
865 __field(unsigned long long, bcount)
866 __field(unsigned long long, icount)
867 __field(unsigned long long, blk_hardlimit)
868 __field(unsigned long long, blk_softlimit)
869 __field(unsigned long long, ino_hardlimit)
870 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000871 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000872 TP_fast_assign(
873 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000874 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000875 __entry->flags = dqp->dq_flags;
876 __entry->nrefs = dqp->q_nrefs;
877 __entry->res_bcount = dqp->q_res_bcount;
878 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
879 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
880 __entry->blk_hardlimit =
881 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
882 __entry->blk_softlimit =
883 be64_to_cpu(dqp->q_core.d_blk_softlimit);
884 __entry->ino_hardlimit =
885 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
886 __entry->ino_softlimit =
887 be64_to_cpu(dqp->q_core.d_ino_softlimit);
888 ),
889 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000890 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
891 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000892 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000893 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000894 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
895 __entry->nrefs,
896 __entry->res_bcount,
897 __entry->bcount,
898 __entry->blk_hardlimit,
899 __entry->blk_softlimit,
900 __entry->icount,
901 __entry->ino_hardlimit,
902 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000903)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000904
905#define DEFINE_DQUOT_EVENT(name) \
906DEFINE_EVENT(xfs_dquot_class, name, \
907 TP_PROTO(struct xfs_dquot *dqp), \
908 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000909DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000910DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
911DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000912DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
913DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000914DEFINE_DQUOT_EVENT(xfs_dqattach_found);
915DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000916DEFINE_DQUOT_EVENT(xfs_dqalloc);
917DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
918DEFINE_DQUOT_EVENT(xfs_dqread);
919DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000920DEFINE_DQUOT_EVENT(xfs_dqget_hit);
921DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000922DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
923DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000924DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000925DEFINE_DQUOT_EVENT(xfs_dqput_free);
926DEFINE_DQUOT_EVENT(xfs_dqrele);
927DEFINE_DQUOT_EVENT(xfs_dqflush);
928DEFINE_DQUOT_EVENT(xfs_dqflush_force);
929DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000930
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000931DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500932 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000933 TP_ARGS(log, tic),
934 TP_STRUCT__entry(
935 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000936 __field(char, ocnt)
937 __field(char, cnt)
938 __field(int, curr_res)
939 __field(int, unit_res)
940 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100941 __field(int, reserveq)
942 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000943 __field(int, grant_reserve_cycle)
944 __field(int, grant_reserve_bytes)
945 __field(int, grant_write_cycle)
946 __field(int, grant_write_bytes)
947 __field(int, curr_cycle)
948 __field(int, curr_block)
949 __field(xfs_lsn_t, tail_lsn)
950 ),
951 TP_fast_assign(
952 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000953 __entry->ocnt = tic->t_ocnt;
954 __entry->cnt = tic->t_cnt;
955 __entry->curr_res = tic->t_curr_res;
956 __entry->unit_res = tic->t_unit_res;
957 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000958 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
959 __entry->writeq = list_empty(&log->l_write_head.waiters);
960 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100961 &__entry->grant_reserve_cycle,
962 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000963 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100964 &__entry->grant_write_cycle,
965 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000966 __entry->curr_cycle = log->l_curr_cycle;
967 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100968 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000969 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000970 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100971 "t_unit_res %u t_flags %s reserveq %s "
972 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000973 "grant_reserve_bytes %d grant_write_cycle %d "
974 "grant_write_bytes %d curr_cycle %d curr_block %d "
975 "tail_cycle %d tail_block %d",
976 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000977 __entry->ocnt,
978 __entry->cnt,
979 __entry->curr_res,
980 __entry->unit_res,
981 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100982 __entry->reserveq ? "empty" : "active",
983 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000984 __entry->grant_reserve_cycle,
985 __entry->grant_reserve_bytes,
986 __entry->grant_write_cycle,
987 __entry->grant_write_bytes,
988 __entry->curr_cycle,
989 __entry->curr_block,
990 CYCLE_LSN(__entry->tail_lsn),
991 BLOCK_LSN(__entry->tail_lsn)
992 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000993)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000994
995#define DEFINE_LOGGRANT_EVENT(name) \
996DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -0500997 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000998 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000999DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1000DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001001DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001002DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1003DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001004DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001005DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1006DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1007DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1008DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001009DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1010DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1011DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1012DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1013DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1014DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1015
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001016DECLARE_EVENT_CLASS(xfs_log_item_class,
1017 TP_PROTO(struct xfs_log_item *lip),
1018 TP_ARGS(lip),
1019 TP_STRUCT__entry(
1020 __field(dev_t, dev)
1021 __field(void *, lip)
1022 __field(uint, type)
1023 __field(uint, flags)
1024 __field(xfs_lsn_t, lsn)
1025 ),
1026 TP_fast_assign(
1027 __entry->dev = lip->li_mountp->m_super->s_dev;
1028 __entry->lip = lip;
1029 __entry->type = lip->li_type;
1030 __entry->flags = lip->li_flags;
1031 __entry->lsn = lip->li_lsn;
1032 ),
1033 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1034 MAJOR(__entry->dev), MINOR(__entry->dev),
1035 __entry->lip,
1036 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1037 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1038 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1039)
1040
Dave Chinner14c26c62012-04-24 16:33:31 +10001041TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001042 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1043 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001044 TP_STRUCT__entry(
1045 __field(dev_t, dev)
1046 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001047 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001048 ),
1049 TP_fast_assign(
1050 __entry->dev = mp->m_super->s_dev;
1051 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001052 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001053 ),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001054 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
Dave Chinner14c26c62012-04-24 16:33:31 +10001055 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001056 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001057)
1058
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001059#define DEFINE_LOG_ITEM_EVENT(name) \
1060DEFINE_EVENT(xfs_log_item_class, name, \
1061 TP_PROTO(struct xfs_log_item *lip), \
1062 TP_ARGS(lip))
1063DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001064DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1065DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001066DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001067
Dave Chinner750b9c92013-11-01 15:27:18 +11001068DECLARE_EVENT_CLASS(xfs_ail_class,
1069 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1070 TP_ARGS(lip, old_lsn, new_lsn),
1071 TP_STRUCT__entry(
1072 __field(dev_t, dev)
1073 __field(void *, lip)
1074 __field(uint, type)
1075 __field(uint, flags)
1076 __field(xfs_lsn_t, old_lsn)
1077 __field(xfs_lsn_t, new_lsn)
1078 ),
1079 TP_fast_assign(
1080 __entry->dev = lip->li_mountp->m_super->s_dev;
1081 __entry->lip = lip;
1082 __entry->type = lip->li_type;
1083 __entry->flags = lip->li_flags;
1084 __entry->old_lsn = old_lsn;
1085 __entry->new_lsn = new_lsn;
1086 ),
1087 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1088 MAJOR(__entry->dev), MINOR(__entry->dev),
1089 __entry->lip,
1090 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1091 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1092 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1093 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1094)
1095
1096#define DEFINE_AIL_EVENT(name) \
1097DEFINE_EVENT(xfs_ail_class, name, \
1098 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1099 TP_ARGS(lip, old_lsn, new_lsn))
1100DEFINE_AIL_EVENT(xfs_ail_insert);
1101DEFINE_AIL_EVENT(xfs_ail_move);
1102DEFINE_AIL_EVENT(xfs_ail_delete);
1103
1104TRACE_EVENT(xfs_log_assign_tail_lsn,
1105 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1106 TP_ARGS(log, new_lsn),
1107 TP_STRUCT__entry(
1108 __field(dev_t, dev)
1109 __field(xfs_lsn_t, new_lsn)
1110 __field(xfs_lsn_t, old_lsn)
1111 __field(xfs_lsn_t, last_sync_lsn)
1112 ),
1113 TP_fast_assign(
1114 __entry->dev = log->l_mp->m_super->s_dev;
1115 __entry->new_lsn = new_lsn;
1116 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1117 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1118 ),
1119 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1120 MAJOR(__entry->dev), MINOR(__entry->dev),
1121 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1122 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1123 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1124)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001125
Li Zefanf8adb4d2010-05-24 08:25:57 +00001126DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001127 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1128 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001129 TP_STRUCT__entry(
1130 __field(dev_t, dev)
1131 __field(xfs_ino_t, ino)
1132 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001133 __field(loff_t, offset)
1134 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001135 ),
1136 TP_fast_assign(
1137 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1138 __entry->ino = ip->i_ino;
1139 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001140 __entry->offset = offset;
1141 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001142 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001143 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001144 MAJOR(__entry->dev), MINOR(__entry->dev),
1145 __entry->ino,
1146 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001147 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001148 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001149)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001150
1151#define DEFINE_RW_EVENT(name) \
1152DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001153 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1154 TP_ARGS(ip, count, offset))
1155DEFINE_RW_EVENT(xfs_file_buffered_read);
1156DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001157DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001158DEFINE_RW_EVENT(xfs_file_buffered_write);
1159DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001160DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001161
Li Zefanf8adb4d2010-05-24 08:25:57 +00001162DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001163 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1164 unsigned int len),
1165 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001166 TP_STRUCT__entry(
1167 __field(dev_t, dev)
1168 __field(xfs_ino_t, ino)
1169 __field(pgoff_t, pgoff)
1170 __field(loff_t, size)
1171 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001172 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001173 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001174 __field(int, unwritten)
1175 ),
1176 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001177 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001178
Li Zefanf8adb4d2010-05-24 08:25:57 +00001179 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001180 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001181 __entry->dev = inode->i_sb->s_dev;
1182 __entry->ino = XFS_I(inode)->i_ino;
1183 __entry->pgoff = page_offset(page);
1184 __entry->size = i_size_read(inode);
1185 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001186 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001187 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001188 __entry->unwritten = unwritten;
1189 ),
1190 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001191 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001192 MAJOR(__entry->dev), MINOR(__entry->dev),
1193 __entry->ino,
1194 __entry->pgoff,
1195 __entry->size,
1196 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001197 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001198 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001199 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001200)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001201
1202#define DEFINE_PAGE_EVENT(name) \
1203DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001204 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1205 unsigned int len), \
1206 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001207DEFINE_PAGE_EVENT(xfs_writepage);
1208DEFINE_PAGE_EVENT(xfs_releasepage);
1209DEFINE_PAGE_EVENT(xfs_invalidatepage);
1210
Dave Chinner121e2132016-01-08 11:28:35 +11001211DECLARE_EVENT_CLASS(xfs_readpage_class,
1212 TP_PROTO(struct inode *inode, int nr_pages),
1213 TP_ARGS(inode, nr_pages),
1214 TP_STRUCT__entry(
1215 __field(dev_t, dev)
1216 __field(xfs_ino_t, ino)
1217 __field(int, nr_pages)
1218 ),
1219 TP_fast_assign(
1220 __entry->dev = inode->i_sb->s_dev;
1221 __entry->ino = inode->i_ino;
1222 __entry->nr_pages = nr_pages;
1223 ),
1224 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1225 MAJOR(__entry->dev), MINOR(__entry->dev),
1226 __entry->ino,
1227 __entry->nr_pages)
1228)
1229
1230#define DEFINE_READPAGE_EVENT(name) \
1231DEFINE_EVENT(xfs_readpage_class, name, \
1232 TP_PROTO(struct inode *inode, int nr_pages), \
1233 TP_ARGS(inode, nr_pages))
1234DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1235DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1236
Christoph Hellwiga206c812010-12-10 08:42:20 +00001237DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001238 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001239 int type, struct xfs_bmbt_irec *irec),
1240 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001241 TP_STRUCT__entry(
1242 __field(dev_t, dev)
1243 __field(xfs_ino_t, ino)
1244 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001245 __field(loff_t, offset)
1246 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001247 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001248 __field(xfs_fileoff_t, startoff)
1249 __field(xfs_fsblock_t, startblock)
1250 __field(xfs_filblks_t, blockcount)
1251 ),
1252 TP_fast_assign(
1253 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1254 __entry->ino = ip->i_ino;
1255 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001256 __entry->offset = offset;
1257 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001258 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001259 __entry->startoff = irec ? irec->br_startoff : 0;
1260 __entry->startblock = irec ? irec->br_startblock : 0;
1261 __entry->blockcount = irec ? irec->br_blockcount : 0;
1262 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001263 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1264 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001265 MAJOR(__entry->dev), MINOR(__entry->dev),
1266 __entry->ino,
1267 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001268 __entry->offset,
1269 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001270 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001271 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001272 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001273 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001274)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001275
1276#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001277DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001278 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001279 int type, struct xfs_bmbt_irec *irec), \
1280 TP_ARGS(ip, offset, count, type, irec))
1281DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1282DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1283DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1284DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001285DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001286DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1287DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001288
Li Zefanf8adb4d2010-05-24 08:25:57 +00001289DECLARE_EVENT_CLASS(xfs_simple_io_class,
1290 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1291 TP_ARGS(ip, offset, count),
1292 TP_STRUCT__entry(
1293 __field(dev_t, dev)
1294 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001295 __field(loff_t, isize)
1296 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001297 __field(loff_t, offset)
1298 __field(size_t, count)
1299 ),
1300 TP_fast_assign(
1301 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1302 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001303 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001304 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001305 __entry->offset = offset;
1306 __entry->count = count;
1307 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001308 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001309 "offset 0x%llx count %zd",
1310 MAJOR(__entry->dev), MINOR(__entry->dev),
1311 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001312 __entry->isize,
1313 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001314 __entry->offset,
1315 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001316);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001317
1318#define DEFINE_SIMPLE_IO_EVENT(name) \
1319DEFINE_EVENT(xfs_simple_io_class, name, \
1320 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1321 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001322DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1323DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001324DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001325DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001326DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001327DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1328DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1329DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001330
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001331DECLARE_EVENT_CLASS(xfs_itrunc_class,
1332 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1333 TP_ARGS(ip, new_size),
1334 TP_STRUCT__entry(
1335 __field(dev_t, dev)
1336 __field(xfs_ino_t, ino)
1337 __field(xfs_fsize_t, size)
1338 __field(xfs_fsize_t, new_size)
1339 ),
1340 TP_fast_assign(
1341 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1342 __entry->ino = ip->i_ino;
1343 __entry->size = ip->i_d.di_size;
1344 __entry->new_size = new_size;
1345 ),
1346 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1347 MAJOR(__entry->dev), MINOR(__entry->dev),
1348 __entry->ino,
1349 __entry->size,
1350 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001351)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001352
1353#define DEFINE_ITRUNC_EVENT(name) \
1354DEFINE_EVENT(xfs_itrunc_class, name, \
1355 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1356 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001357DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1358DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001359
1360TRACE_EVENT(xfs_pagecache_inval,
1361 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1362 TP_ARGS(ip, start, finish),
1363 TP_STRUCT__entry(
1364 __field(dev_t, dev)
1365 __field(xfs_ino_t, ino)
1366 __field(xfs_fsize_t, size)
1367 __field(xfs_off_t, start)
1368 __field(xfs_off_t, finish)
1369 ),
1370 TP_fast_assign(
1371 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1372 __entry->ino = ip->i_ino;
1373 __entry->size = ip->i_d.di_size;
1374 __entry->start = start;
1375 __entry->finish = finish;
1376 ),
1377 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1378 MAJOR(__entry->dev), MINOR(__entry->dev),
1379 __entry->ino,
1380 __entry->size,
1381 __entry->start,
1382 __entry->finish)
1383);
1384
1385TRACE_EVENT(xfs_bunmap,
1386 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1387 int flags, unsigned long caller_ip),
1388 TP_ARGS(ip, bno, len, flags, caller_ip),
1389 TP_STRUCT__entry(
1390 __field(dev_t, dev)
1391 __field(xfs_ino_t, ino)
1392 __field(xfs_fsize_t, size)
1393 __field(xfs_fileoff_t, bno)
1394 __field(xfs_filblks_t, len)
1395 __field(unsigned long, caller_ip)
1396 __field(int, flags)
1397 ),
1398 TP_fast_assign(
1399 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1400 __entry->ino = ip->i_ino;
1401 __entry->size = ip->i_d.di_size;
1402 __entry->bno = bno;
1403 __entry->len = len;
1404 __entry->caller_ip = caller_ip;
1405 __entry->flags = flags;
1406 ),
1407 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Scott Wood65dd2972015-03-25 14:56:21 +11001408 "flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001409 MAJOR(__entry->dev), MINOR(__entry->dev),
1410 __entry->ino,
1411 __entry->size,
1412 __entry->bno,
1413 __entry->len,
1414 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1415 (void *)__entry->caller_ip)
1416
1417);
1418
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001419DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001420 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1421 xfs_agblock_t agbno, xfs_extlen_t len),
1422 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001423 TP_STRUCT__entry(
1424 __field(dev_t, dev)
1425 __field(xfs_agnumber_t, agno)
1426 __field(xfs_agblock_t, agbno)
1427 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001428 ),
1429 TP_fast_assign(
1430 __entry->dev = mp->m_super->s_dev;
1431 __entry->agno = agno;
1432 __entry->agbno = agbno;
1433 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001434 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001435 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001436 MAJOR(__entry->dev), MINOR(__entry->dev),
1437 __entry->agno,
1438 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001439 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001440);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001441#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001442DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001443 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1444 xfs_agblock_t agbno, xfs_extlen_t len), \
1445 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001446DEFINE_BUSY_EVENT(xfs_extent_busy);
1447DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1448DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1449DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1450DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001451
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001452TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001453 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1454 xfs_agblock_t agbno, xfs_extlen_t len,
1455 xfs_agblock_t tbno, xfs_extlen_t tlen),
1456 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1457 TP_STRUCT__entry(
1458 __field(dev_t, dev)
1459 __field(xfs_agnumber_t, agno)
1460 __field(xfs_agblock_t, agbno)
1461 __field(xfs_extlen_t, len)
1462 __field(xfs_agblock_t, tbno)
1463 __field(xfs_extlen_t, tlen)
1464 ),
1465 TP_fast_assign(
1466 __entry->dev = mp->m_super->s_dev;
1467 __entry->agno = agno;
1468 __entry->agbno = agbno;
1469 __entry->len = len;
1470 __entry->tbno = tbno;
1471 __entry->tlen = tlen;
1472 ),
1473 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1474 MAJOR(__entry->dev), MINOR(__entry->dev),
1475 __entry->agno,
1476 __entry->agbno,
1477 __entry->len,
1478 __entry->tbno,
1479 __entry->tlen)
1480);
1481
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001482TRACE_EVENT(xfs_agf,
1483 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1484 unsigned long caller_ip),
1485 TP_ARGS(mp, agf, flags, caller_ip),
1486 TP_STRUCT__entry(
1487 __field(dev_t, dev)
1488 __field(xfs_agnumber_t, agno)
1489 __field(int, flags)
1490 __field(__u32, length)
1491 __field(__u32, bno_root)
1492 __field(__u32, cnt_root)
1493 __field(__u32, bno_level)
1494 __field(__u32, cnt_level)
1495 __field(__u32, flfirst)
1496 __field(__u32, fllast)
1497 __field(__u32, flcount)
1498 __field(__u32, freeblks)
1499 __field(__u32, longest)
1500 __field(unsigned long, caller_ip)
1501 ),
1502 TP_fast_assign(
1503 __entry->dev = mp->m_super->s_dev;
1504 __entry->agno = be32_to_cpu(agf->agf_seqno),
1505 __entry->flags = flags;
1506 __entry->length = be32_to_cpu(agf->agf_length),
1507 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1508 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1509 __entry->bno_level =
1510 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1511 __entry->cnt_level =
1512 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1513 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1514 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1515 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1516 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1517 __entry->longest = be32_to_cpu(agf->agf_longest);
1518 __entry->caller_ip = caller_ip;
1519 ),
1520 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1521 "levels b %u c %u flfirst %u fllast %u flcount %u "
Scott Wood65dd2972015-03-25 14:56:21 +11001522 "freeblks %u longest %u caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001523 MAJOR(__entry->dev), MINOR(__entry->dev),
1524 __entry->agno,
1525 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1526 __entry->length,
1527 __entry->bno_root,
1528 __entry->cnt_root,
1529 __entry->bno_level,
1530 __entry->cnt_level,
1531 __entry->flfirst,
1532 __entry->fllast,
1533 __entry->flcount,
1534 __entry->freeblks,
1535 __entry->longest,
1536 (void *)__entry->caller_ip)
1537);
1538
1539TRACE_EVENT(xfs_free_extent,
1540 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001541 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1542 int haveright),
1543 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001544 TP_STRUCT__entry(
1545 __field(dev_t, dev)
1546 __field(xfs_agnumber_t, agno)
1547 __field(xfs_agblock_t, agbno)
1548 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001549 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001550 __field(int, haveleft)
1551 __field(int, haveright)
1552 ),
1553 TP_fast_assign(
1554 __entry->dev = mp->m_super->s_dev;
1555 __entry->agno = agno;
1556 __entry->agbno = agbno;
1557 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001558 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001559 __entry->haveleft = haveleft;
1560 __entry->haveright = haveright;
1561 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001562 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001563 MAJOR(__entry->dev), MINOR(__entry->dev),
1564 __entry->agno,
1565 __entry->agbno,
1566 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001567 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001568 __entry->haveleft ?
1569 (__entry->haveright ? "both" : "left") :
1570 (__entry->haveright ? "right" : "none"))
1571
1572);
1573
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001574DECLARE_EVENT_CLASS(xfs_alloc_class,
1575 TP_PROTO(struct xfs_alloc_arg *args),
1576 TP_ARGS(args),
1577 TP_STRUCT__entry(
1578 __field(dev_t, dev)
1579 __field(xfs_agnumber_t, agno)
1580 __field(xfs_agblock_t, agbno)
1581 __field(xfs_extlen_t, minlen)
1582 __field(xfs_extlen_t, maxlen)
1583 __field(xfs_extlen_t, mod)
1584 __field(xfs_extlen_t, prod)
1585 __field(xfs_extlen_t, minleft)
1586 __field(xfs_extlen_t, total)
1587 __field(xfs_extlen_t, alignment)
1588 __field(xfs_extlen_t, minalignslop)
1589 __field(xfs_extlen_t, len)
1590 __field(short, type)
1591 __field(short, otype)
1592 __field(char, wasdel)
1593 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001594 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001595 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001596 __field(xfs_fsblock_t, firstblock)
1597 ),
1598 TP_fast_assign(
1599 __entry->dev = args->mp->m_super->s_dev;
1600 __entry->agno = args->agno;
1601 __entry->agbno = args->agbno;
1602 __entry->minlen = args->minlen;
1603 __entry->maxlen = args->maxlen;
1604 __entry->mod = args->mod;
1605 __entry->prod = args->prod;
1606 __entry->minleft = args->minleft;
1607 __entry->total = args->total;
1608 __entry->alignment = args->alignment;
1609 __entry->minalignslop = args->minalignslop;
1610 __entry->len = args->len;
1611 __entry->type = args->type;
1612 __entry->otype = args->otype;
1613 __entry->wasdel = args->wasdel;
1614 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001615 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001616 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001617 __entry->firstblock = args->firstblock;
1618 ),
1619 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1620 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001621 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001622 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001623 MAJOR(__entry->dev), MINOR(__entry->dev),
1624 __entry->agno,
1625 __entry->agbno,
1626 __entry->minlen,
1627 __entry->maxlen,
1628 __entry->mod,
1629 __entry->prod,
1630 __entry->minleft,
1631 __entry->total,
1632 __entry->alignment,
1633 __entry->minalignslop,
1634 __entry->len,
1635 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1636 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1637 __entry->wasdel,
1638 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001639 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001640 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001641 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001642)
1643
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001644#define DEFINE_ALLOC_EVENT(name) \
1645DEFINE_EVENT(xfs_alloc_class, name, \
1646 TP_PROTO(struct xfs_alloc_arg *args), \
1647 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001648DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001649DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001650DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1651DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1652DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1653DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1654DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1655DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001656DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1657DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001658DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1659DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1660DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1661DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1662DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001663DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001664DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1665DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1666DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1667DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1668DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1669DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1670DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1671DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1672DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1673
Dave Chinner5a5881c2012-03-22 05:15:13 +00001674DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001675 TP_PROTO(struct xfs_da_args *args),
1676 TP_ARGS(args),
1677 TP_STRUCT__entry(
1678 __field(dev_t, dev)
1679 __field(xfs_ino_t, ino)
1680 __dynamic_array(char, name, args->namelen)
1681 __field(int, namelen)
1682 __field(xfs_dahash_t, hashval)
1683 __field(xfs_ino_t, inumber)
1684 __field(int, op_flags)
1685 ),
1686 TP_fast_assign(
1687 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1688 __entry->ino = args->dp->i_ino;
1689 if (args->namelen)
1690 memcpy(__get_str(name), args->name, args->namelen);
1691 __entry->namelen = args->namelen;
1692 __entry->hashval = args->hashval;
1693 __entry->inumber = args->inumber;
1694 __entry->op_flags = args->op_flags;
1695 ),
1696 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1697 "inumber 0x%llx op_flags %s",
1698 MAJOR(__entry->dev), MINOR(__entry->dev),
1699 __entry->ino,
1700 __entry->namelen,
1701 __entry->namelen ? __get_str(name) : NULL,
1702 __entry->namelen,
1703 __entry->hashval,
1704 __entry->inumber,
1705 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001706)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001707
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001708#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001709DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001710 TP_PROTO(struct xfs_da_args *args), \
1711 TP_ARGS(args))
1712DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1713DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1714DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1715DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1716DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1717DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1718DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1719DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1720DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1721DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1722DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1723DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1724DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1725DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1726DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1727DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1728DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1729DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1730DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1731DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1732DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1733DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1734DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1735DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1736DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1737
Dave Chinneree732592012-11-12 22:53:53 +11001738DECLARE_EVENT_CLASS(xfs_attr_class,
1739 TP_PROTO(struct xfs_da_args *args),
1740 TP_ARGS(args),
1741 TP_STRUCT__entry(
1742 __field(dev_t, dev)
1743 __field(xfs_ino_t, ino)
1744 __dynamic_array(char, name, args->namelen)
1745 __field(int, namelen)
1746 __field(int, valuelen)
1747 __field(xfs_dahash_t, hashval)
1748 __field(int, op_flags)
1749 ),
1750 TP_fast_assign(
1751 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1752 __entry->ino = args->dp->i_ino;
1753 if (args->namelen)
1754 memcpy(__get_str(name), args->name, args->namelen);
1755 __entry->namelen = args->namelen;
1756 __entry->valuelen = args->valuelen;
1757 __entry->hashval = args->hashval;
1758 __entry->op_flags = args->op_flags;
1759 ),
1760 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1761 "hashval 0x%x op_flags %s",
1762 MAJOR(__entry->dev), MINOR(__entry->dev),
1763 __entry->ino,
1764 __entry->namelen,
1765 __entry->namelen ? __get_str(name) : NULL,
1766 __entry->namelen,
1767 __entry->valuelen,
1768 __entry->hashval,
1769 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1770)
1771
Dave Chinner5a5881c2012-03-22 05:15:13 +00001772#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001773DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001774 TP_PROTO(struct xfs_da_args *args), \
1775 TP_ARGS(args))
1776DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1777DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1778DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1779DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1780DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001781DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1782
1783DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1784DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1785DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001786DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001787DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1788DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001789DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1790DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001791DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1792DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001793DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001794DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1795DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1796DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1797DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1798DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1799DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1800DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1801DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1802DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1803DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1804DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001805DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001806
1807DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001808DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001809DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1810DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1811
Dave Chinneree732592012-11-12 22:53:53 +11001812DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1813DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1814
1815DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1816DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1817DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1818
Dave Chinner5a5881c2012-03-22 05:15:13 +00001819#define DEFINE_DA_EVENT(name) \
1820DEFINE_EVENT(xfs_da_class, name, \
1821 TP_PROTO(struct xfs_da_args *args), \
1822 TP_ARGS(args))
1823DEFINE_DA_EVENT(xfs_da_split);
1824DEFINE_DA_EVENT(xfs_da_join);
1825DEFINE_DA_EVENT(xfs_da_link_before);
1826DEFINE_DA_EVENT(xfs_da_link_after);
1827DEFINE_DA_EVENT(xfs_da_unlink_back);
1828DEFINE_DA_EVENT(xfs_da_unlink_forward);
1829DEFINE_DA_EVENT(xfs_da_root_split);
1830DEFINE_DA_EVENT(xfs_da_root_join);
1831DEFINE_DA_EVENT(xfs_da_node_add);
1832DEFINE_DA_EVENT(xfs_da_node_create);
1833DEFINE_DA_EVENT(xfs_da_node_split);
1834DEFINE_DA_EVENT(xfs_da_node_remove);
1835DEFINE_DA_EVENT(xfs_da_node_rebalance);
1836DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001837DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001838DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1839DEFINE_DA_EVENT(xfs_da_grow_inode);
1840DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001841DEFINE_DA_EVENT(xfs_da_fixhashpath);
1842DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001843
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001844DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1845 TP_PROTO(struct xfs_da_args *args, int idx),
1846 TP_ARGS(args, idx),
1847 TP_STRUCT__entry(
1848 __field(dev_t, dev)
1849 __field(xfs_ino_t, ino)
1850 __field(int, op_flags)
1851 __field(int, idx)
1852 ),
1853 TP_fast_assign(
1854 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1855 __entry->ino = args->dp->i_ino;
1856 __entry->op_flags = args->op_flags;
1857 __entry->idx = idx;
1858 ),
1859 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1860 MAJOR(__entry->dev), MINOR(__entry->dev),
1861 __entry->ino,
1862 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1863 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001864)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001865
1866#define DEFINE_DIR2_SPACE_EVENT(name) \
1867DEFINE_EVENT(xfs_dir2_space_class, name, \
1868 TP_PROTO(struct xfs_da_args *args, int idx), \
1869 TP_ARGS(args, idx))
1870DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1871DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1872DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1873DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001874
1875TRACE_EVENT(xfs_dir2_leafn_moveents,
1876 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1877 TP_ARGS(args, src_idx, dst_idx, count),
1878 TP_STRUCT__entry(
1879 __field(dev_t, dev)
1880 __field(xfs_ino_t, ino)
1881 __field(int, op_flags)
1882 __field(int, src_idx)
1883 __field(int, dst_idx)
1884 __field(int, count)
1885 ),
1886 TP_fast_assign(
1887 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1888 __entry->ino = args->dp->i_ino;
1889 __entry->op_flags = args->op_flags;
1890 __entry->src_idx = src_idx;
1891 __entry->dst_idx = dst_idx;
1892 __entry->count = count;
1893 ),
1894 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1895 "src_idx %d dst_idx %d count %d",
1896 MAJOR(__entry->dev), MINOR(__entry->dev),
1897 __entry->ino,
1898 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1899 __entry->src_idx,
1900 __entry->dst_idx,
1901 __entry->count)
1902);
1903
Dave Chinner3a85cd92010-01-14 01:33:55 +00001904#define XFS_SWAPEXT_INODES \
1905 { 0, "target" }, \
1906 { 1, "temp" }
1907
1908#define XFS_INODE_FORMAT_STR \
1909 { 0, "invalid" }, \
1910 { 1, "local" }, \
1911 { 2, "extent" }, \
1912 { 3, "btree" }
1913
1914DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1915 TP_PROTO(struct xfs_inode *ip, int which),
1916 TP_ARGS(ip, which),
1917 TP_STRUCT__entry(
1918 __field(dev_t, dev)
1919 __field(int, which)
1920 __field(xfs_ino_t, ino)
1921 __field(int, format)
1922 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001923 __field(int, broot_size)
1924 __field(int, fork_off)
1925 ),
1926 TP_fast_assign(
1927 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1928 __entry->which = which;
1929 __entry->ino = ip->i_ino;
1930 __entry->format = ip->i_d.di_format;
1931 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001932 __entry->broot_size = ip->i_df.if_broot_bytes;
1933 __entry->fork_off = XFS_IFORK_BOFF(ip);
1934 ),
1935 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001936 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001937 MAJOR(__entry->dev), MINOR(__entry->dev),
1938 __entry->ino,
1939 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1940 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1941 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001942 __entry->broot_size,
1943 __entry->fork_off)
1944)
1945
1946#define DEFINE_SWAPEXT_EVENT(name) \
1947DEFINE_EVENT(xfs_swap_extent_class, name, \
1948 TP_PROTO(struct xfs_inode *ip, int which), \
1949 TP_ARGS(ip, which))
1950
1951DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1952DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1953
Brian Fostere67d3d42017-08-08 18:21:53 -07001954TRACE_EVENT(xfs_log_recover,
1955 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1956 TP_ARGS(log, headblk, tailblk),
1957 TP_STRUCT__entry(
1958 __field(dev_t, dev)
1959 __field(xfs_daddr_t, headblk)
1960 __field(xfs_daddr_t, tailblk)
1961 ),
1962 TP_fast_assign(
1963 __entry->dev = log->l_mp->m_super->s_dev;
1964 __entry->headblk = headblk;
1965 __entry->tailblk = tailblk;
1966 ),
1967 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
1968 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
1969 __entry->tailblk)
1970)
1971
Brian Foster5cd9cee2016-09-26 08:34:52 +10001972TRACE_EVENT(xfs_log_recover_record,
1973 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1974 TP_ARGS(log, rhead, pass),
1975 TP_STRUCT__entry(
1976 __field(dev_t, dev)
1977 __field(xfs_lsn_t, lsn)
1978 __field(int, len)
1979 __field(int, num_logops)
1980 __field(int, pass)
1981 ),
1982 TP_fast_assign(
1983 __entry->dev = log->l_mp->m_super->s_dev;
1984 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1985 __entry->len = be32_to_cpu(rhead->h_len);
1986 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1987 __entry->pass = pass;
1988 ),
1989 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
1990 MAJOR(__entry->dev), MINOR(__entry->dev),
1991 __entry->lsn, __entry->len, __entry->num_logops,
1992 __entry->pass)
1993)
1994
Dave Chinner9abbc532010-04-13 15:06:46 +10001995DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05001996 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10001997 struct xlog_recover_item *item, int pass),
1998 TP_ARGS(log, trans, item, pass),
1999 TP_STRUCT__entry(
2000 __field(dev_t, dev)
2001 __field(unsigned long, item)
2002 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002003 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002004 __field(int, type)
2005 __field(int, pass)
2006 __field(int, count)
2007 __field(int, total)
2008 ),
2009 TP_fast_assign(
2010 __entry->dev = log->l_mp->m_super->s_dev;
2011 __entry->item = (unsigned long)item;
2012 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002013 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002014 __entry->type = ITEM_TYPE(item);
2015 __entry->pass = pass;
2016 __entry->count = item->ri_cnt;
2017 __entry->total = item->ri_total;
2018 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002019 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2020 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002021 MAJOR(__entry->dev), MINOR(__entry->dev),
2022 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002023 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002024 __entry->pass,
2025 (void *)__entry->item,
2026 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2027 __entry->count,
2028 __entry->total)
2029)
2030
2031#define DEFINE_LOG_RECOVER_ITEM(name) \
2032DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002033 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002034 struct xlog_recover_item *item, int pass), \
2035 TP_ARGS(log, trans, item, pass))
2036
2037DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2038DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2039DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2040DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2041DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2042
2043DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002044 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002045 TP_ARGS(log, buf_f),
2046 TP_STRUCT__entry(
2047 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002048 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002049 __field(unsigned short, len)
2050 __field(unsigned short, flags)
2051 __field(unsigned short, size)
2052 __field(unsigned int, map_size)
2053 ),
2054 TP_fast_assign(
2055 __entry->dev = log->l_mp->m_super->s_dev;
2056 __entry->blkno = buf_f->blf_blkno;
2057 __entry->len = buf_f->blf_len;
2058 __entry->flags = buf_f->blf_flags;
2059 __entry->size = buf_f->blf_size;
2060 __entry->map_size = buf_f->blf_map_size;
2061 ),
2062 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2063 "map_size %d",
2064 MAJOR(__entry->dev), MINOR(__entry->dev),
2065 __entry->blkno,
2066 __entry->len,
2067 __entry->flags,
2068 __entry->size,
2069 __entry->map_size)
2070)
2071
2072#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2073DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002074 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002075 TP_ARGS(log, buf_f))
2076
2077DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2078DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2079DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2080DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2081DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002082DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002083DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2084DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2085DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2086
2087DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002088 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002089 TP_ARGS(log, in_f),
2090 TP_STRUCT__entry(
2091 __field(dev_t, dev)
2092 __field(xfs_ino_t, ino)
2093 __field(unsigned short, size)
2094 __field(int, fields)
2095 __field(unsigned short, asize)
2096 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002097 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002098 __field(int, len)
2099 __field(int, boffset)
2100 ),
2101 TP_fast_assign(
2102 __entry->dev = log->l_mp->m_super->s_dev;
2103 __entry->ino = in_f->ilf_ino;
2104 __entry->size = in_f->ilf_size;
2105 __entry->fields = in_f->ilf_fields;
2106 __entry->asize = in_f->ilf_asize;
2107 __entry->dsize = in_f->ilf_dsize;
2108 __entry->blkno = in_f->ilf_blkno;
2109 __entry->len = in_f->ilf_len;
2110 __entry->boffset = in_f->ilf_boffset;
2111 ),
2112 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2113 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2114 MAJOR(__entry->dev), MINOR(__entry->dev),
2115 __entry->ino,
2116 __entry->size,
2117 __entry->fields,
2118 __entry->asize,
2119 __entry->dsize,
2120 __entry->blkno,
2121 __entry->len,
2122 __entry->boffset)
2123)
2124#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2125DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002126 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002127 TP_ARGS(log, in_f))
2128
2129DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2130DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2131DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2132
Brian Foster78d57e42015-08-19 09:58:48 +10002133DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2134 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2135 TP_ARGS(log, in_f),
2136 TP_STRUCT__entry(
2137 __field(dev_t, dev)
2138 __field(xfs_agnumber_t, agno)
2139 __field(xfs_agblock_t, agbno)
2140 __field(unsigned int, count)
2141 __field(unsigned int, isize)
2142 __field(xfs_agblock_t, length)
2143 __field(unsigned int, gen)
2144 ),
2145 TP_fast_assign(
2146 __entry->dev = log->l_mp->m_super->s_dev;
2147 __entry->agno = be32_to_cpu(in_f->icl_ag);
2148 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2149 __entry->count = be32_to_cpu(in_f->icl_count);
2150 __entry->isize = be32_to_cpu(in_f->icl_isize);
2151 __entry->length = be32_to_cpu(in_f->icl_length);
2152 __entry->gen = be32_to_cpu(in_f->icl_gen);
2153 ),
2154 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2155 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2156 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2157 __entry->length, __entry->gen)
2158)
2159#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2160DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2161 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2162 TP_ARGS(log, in_f))
2163
2164DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2165DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2166
Christoph Hellwiga46db602011-01-07 13:02:04 +00002167DECLARE_EVENT_CLASS(xfs_discard_class,
2168 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2169 xfs_agblock_t agbno, xfs_extlen_t len),
2170 TP_ARGS(mp, agno, agbno, len),
2171 TP_STRUCT__entry(
2172 __field(dev_t, dev)
2173 __field(xfs_agnumber_t, agno)
2174 __field(xfs_agblock_t, agbno)
2175 __field(xfs_extlen_t, len)
2176 ),
2177 TP_fast_assign(
2178 __entry->dev = mp->m_super->s_dev;
2179 __entry->agno = agno;
2180 __entry->agbno = agbno;
2181 __entry->len = len;
2182 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002183 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002184 MAJOR(__entry->dev), MINOR(__entry->dev),
2185 __entry->agno,
2186 __entry->agbno,
2187 __entry->len)
2188)
2189
2190#define DEFINE_DISCARD_EVENT(name) \
2191DEFINE_EVENT(xfs_discard_class, name, \
2192 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2193 xfs_agblock_t agbno, xfs_extlen_t len), \
2194 TP_ARGS(mp, agno, agbno, len))
2195DEFINE_DISCARD_EVENT(xfs_discard_extent);
2196DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2197DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2198DEFINE_DISCARD_EVENT(xfs_discard_busy);
2199
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002200/* btree cursor events */
2201DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2202 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2203 TP_ARGS(cur, level, bp),
2204 TP_STRUCT__entry(
2205 __field(dev_t, dev)
2206 __field(xfs_btnum_t, btnum)
2207 __field(int, level)
2208 __field(int, nlevels)
2209 __field(int, ptr)
2210 __field(xfs_daddr_t, daddr)
2211 ),
2212 TP_fast_assign(
2213 __entry->dev = cur->bc_mp->m_super->s_dev;
2214 __entry->btnum = cur->bc_btnum;
2215 __entry->level = level;
2216 __entry->nlevels = cur->bc_nlevels;
2217 __entry->ptr = cur->bc_ptrs[level];
2218 __entry->daddr = bp ? bp->b_bn : -1;
2219 ),
2220 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2221 MAJOR(__entry->dev), MINOR(__entry->dev),
2222 __entry->btnum,
2223 __entry->level,
2224 __entry->nlevels,
2225 __entry->ptr,
2226 (unsigned long long)__entry->daddr)
2227)
2228
2229#define DEFINE_BTREE_CUR_EVENT(name) \
2230DEFINE_EVENT(xfs_btree_cur_class, name, \
2231 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2232 TP_ARGS(cur, level, bp))
2233DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002234DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002235
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002236/* deferred ops */
2237struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002238struct xfs_defer_ops;
2239
2240DECLARE_EVENT_CLASS(xfs_defer_class,
2241 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2242 TP_ARGS(mp, dop),
2243 TP_STRUCT__entry(
2244 __field(dev_t, dev)
2245 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002246 __field(char, committed)
2247 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002248 ),
2249 TP_fast_assign(
2250 __entry->dev = mp ? mp->m_super->s_dev : 0;
2251 __entry->dop = dop;
2252 __entry->committed = dop->dop_committed;
2253 __entry->low = dop->dop_low;
2254 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002255 TP_printk("dev %d:%d ops %p committed %d low %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002256 MAJOR(__entry->dev), MINOR(__entry->dev),
2257 __entry->dop,
2258 __entry->committed,
2259 __entry->low)
2260)
2261#define DEFINE_DEFER_EVENT(name) \
2262DEFINE_EVENT(xfs_defer_class, name, \
2263 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2264 TP_ARGS(mp, dop))
2265
2266DECLARE_EVENT_CLASS(xfs_defer_error_class,
2267 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2268 TP_ARGS(mp, dop, error),
2269 TP_STRUCT__entry(
2270 __field(dev_t, dev)
2271 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002272 __field(char, committed)
2273 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002274 __field(int, error)
2275 ),
2276 TP_fast_assign(
2277 __entry->dev = mp ? mp->m_super->s_dev : 0;
2278 __entry->dop = dop;
2279 __entry->committed = dop->dop_committed;
2280 __entry->low = dop->dop_low;
2281 __entry->error = error;
2282 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002283 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002284 MAJOR(__entry->dev), MINOR(__entry->dev),
2285 __entry->dop,
2286 __entry->committed,
2287 __entry->low,
2288 __entry->error)
2289)
2290#define DEFINE_DEFER_ERROR_EVENT(name) \
2291DEFINE_EVENT(xfs_defer_error_class, name, \
2292 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2293 TP_ARGS(mp, dop, error))
2294
2295DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2296 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2297 TP_ARGS(mp, dfp),
2298 TP_STRUCT__entry(
2299 __field(dev_t, dev)
2300 __field(int, type)
2301 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002302 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002303 __field(int, nr)
2304 ),
2305 TP_fast_assign(
2306 __entry->dev = mp ? mp->m_super->s_dev : 0;
2307 __entry->type = dfp->dfp_type->type;
2308 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002309 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002310 __entry->nr = dfp->dfp_count;
2311 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002312 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002313 MAJOR(__entry->dev), MINOR(__entry->dev),
2314 __entry->type,
2315 __entry->intent,
2316 __entry->committed,
2317 __entry->nr)
2318)
2319#define DEFINE_DEFER_PENDING_EVENT(name) \
2320DEFINE_EVENT(xfs_defer_pending_class, name, \
2321 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2322 TP_ARGS(mp, dfp))
2323
2324DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2325 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2326 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2327 TP_ARGS(mp, agno, type, agbno, len),
2328 TP_STRUCT__entry(
2329 __field(dev_t, dev)
2330 __field(xfs_agnumber_t, agno)
2331 __field(int, type)
2332 __field(xfs_agblock_t, agbno)
2333 __field(xfs_extlen_t, len)
2334 ),
2335 TP_fast_assign(
2336 __entry->dev = mp->m_super->s_dev;
2337 __entry->agno = agno;
2338 __entry->type = type;
2339 __entry->agbno = agbno;
2340 __entry->len = len;
2341 ),
2342 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2343 MAJOR(__entry->dev), MINOR(__entry->dev),
2344 __entry->type,
2345 __entry->agno,
2346 __entry->agbno,
2347 __entry->len)
2348);
2349#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2350DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2351 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2352 int type, \
2353 xfs_agblock_t bno, \
2354 xfs_extlen_t len), \
2355 TP_ARGS(mp, agno, type, bno, len))
2356
2357DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2358 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2359 int op,
2360 xfs_agblock_t agbno,
2361 xfs_ino_t ino,
2362 int whichfork,
2363 xfs_fileoff_t offset,
2364 xfs_filblks_t len,
2365 xfs_exntst_t state),
2366 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2367 TP_STRUCT__entry(
2368 __field(dev_t, dev)
2369 __field(xfs_agnumber_t, agno)
2370 __field(xfs_ino_t, ino)
2371 __field(xfs_agblock_t, agbno)
2372 __field(int, whichfork)
2373 __field(xfs_fileoff_t, l_loff)
2374 __field(xfs_filblks_t, l_len)
2375 __field(xfs_exntst_t, l_state)
2376 __field(int, op)
2377 ),
2378 TP_fast_assign(
2379 __entry->dev = mp->m_super->s_dev;
2380 __entry->agno = agno;
2381 __entry->ino = ino;
2382 __entry->agbno = agbno;
2383 __entry->whichfork = whichfork;
2384 __entry->l_loff = offset;
2385 __entry->l_len = len;
2386 __entry->l_state = state;
2387 __entry->op = op;
2388 ),
2389 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2390 MAJOR(__entry->dev), MINOR(__entry->dev),
2391 __entry->op,
2392 __entry->agno,
2393 __entry->agbno,
2394 __entry->ino,
2395 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2396 __entry->l_loff,
2397 __entry->l_len,
2398 __entry->l_state)
2399);
2400#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2401DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2402 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2403 int op, \
2404 xfs_agblock_t agbno, \
2405 xfs_ino_t ino, \
2406 int whichfork, \
2407 xfs_fileoff_t offset, \
2408 xfs_filblks_t len, \
2409 xfs_exntst_t state), \
2410 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2411
2412DEFINE_DEFER_EVENT(xfs_defer_init);
2413DEFINE_DEFER_EVENT(xfs_defer_cancel);
2414DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2415DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2416DEFINE_DEFER_EVENT(xfs_defer_finish);
2417DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2418
2419DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2420DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002421
2422DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2423DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002424DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2425DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2426DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2427
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002428#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2429DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2430DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2431
Darrick J. Wong673930c2016-08-03 11:33:43 +10002432/* rmap tracepoints */
2433DECLARE_EVENT_CLASS(xfs_rmap_class,
2434 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2435 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2436 struct xfs_owner_info *oinfo),
2437 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2438 TP_STRUCT__entry(
2439 __field(dev_t, dev)
2440 __field(xfs_agnumber_t, agno)
2441 __field(xfs_agblock_t, agbno)
2442 __field(xfs_extlen_t, len)
2443 __field(uint64_t, owner)
2444 __field(uint64_t, offset)
2445 __field(unsigned long, flags)
2446 ),
2447 TP_fast_assign(
2448 __entry->dev = mp->m_super->s_dev;
2449 __entry->agno = agno;
2450 __entry->agbno = agbno;
2451 __entry->len = len;
2452 __entry->owner = oinfo->oi_owner;
2453 __entry->offset = oinfo->oi_offset;
2454 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002455 if (unwritten)
2456 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002457 ),
2458 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2459 MAJOR(__entry->dev), MINOR(__entry->dev),
2460 __entry->agno,
2461 __entry->agbno,
2462 __entry->len,
2463 __entry->owner,
2464 __entry->offset,
2465 __entry->flags)
2466);
2467#define DEFINE_RMAP_EVENT(name) \
2468DEFINE_EVENT(xfs_rmap_class, name, \
2469 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2470 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2471 struct xfs_owner_info *oinfo), \
2472 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2473
2474/* simple AG-based error/%ip tracepoint class */
2475DECLARE_EVENT_CLASS(xfs_ag_error_class,
2476 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2477 unsigned long caller_ip),
2478 TP_ARGS(mp, agno, error, caller_ip),
2479 TP_STRUCT__entry(
2480 __field(dev_t, dev)
2481 __field(xfs_agnumber_t, agno)
2482 __field(int, error)
2483 __field(unsigned long, caller_ip)
2484 ),
2485 TP_fast_assign(
2486 __entry->dev = mp->m_super->s_dev;
2487 __entry->agno = agno;
2488 __entry->error = error;
2489 __entry->caller_ip = caller_ip;
2490 ),
2491 TP_printk("dev %d:%d agno %u error %d caller %ps",
2492 MAJOR(__entry->dev), MINOR(__entry->dev),
2493 __entry->agno,
2494 __entry->error,
2495 (char *)__entry->caller_ip)
2496);
2497
2498#define DEFINE_AG_ERROR_EVENT(name) \
2499DEFINE_EVENT(xfs_ag_error_class, name, \
2500 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2501 unsigned long caller_ip), \
2502 TP_ARGS(mp, agno, error, caller_ip))
2503
2504DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2505DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2506DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2507DEFINE_RMAP_EVENT(xfs_rmap_map);
2508DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2509DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002510DEFINE_RMAP_EVENT(xfs_rmap_convert);
2511DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2512DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2513DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002514
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002515DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2516 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2517 xfs_agblock_t agbno, xfs_extlen_t len,
2518 uint64_t owner, uint64_t offset, unsigned int flags),
2519 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2520 TP_STRUCT__entry(
2521 __field(dev_t, dev)
2522 __field(xfs_agnumber_t, agno)
2523 __field(xfs_agblock_t, agbno)
2524 __field(xfs_extlen_t, len)
2525 __field(uint64_t, owner)
2526 __field(uint64_t, offset)
2527 __field(unsigned int, flags)
2528 ),
2529 TP_fast_assign(
2530 __entry->dev = mp->m_super->s_dev;
2531 __entry->agno = agno;
2532 __entry->agbno = agbno;
2533 __entry->len = len;
2534 __entry->owner = owner;
2535 __entry->offset = offset;
2536 __entry->flags = flags;
2537 ),
2538 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2539 MAJOR(__entry->dev), MINOR(__entry->dev),
2540 __entry->agno,
2541 __entry->agbno,
2542 __entry->len,
2543 __entry->owner,
2544 __entry->offset,
2545 __entry->flags)
2546);
2547#define DEFINE_RMAPBT_EVENT(name) \
2548DEFINE_EVENT(xfs_rmapbt_class, name, \
2549 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2550 xfs_agblock_t agbno, xfs_extlen_t len, \
2551 uint64_t owner, uint64_t offset, unsigned int flags), \
2552 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2553
2554#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2555DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2556DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2557
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002558DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2559DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002560DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2561DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2562DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2563DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2564DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2565DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002566
2567DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2568DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2569DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2570DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002571DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2572DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002573DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002574
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002575/* deferred bmbt updates */
2576#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2577DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2578DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2579
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002580/* per-AG reservation */
2581DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2582 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2583 xfs_extlen_t len),
2584 TP_ARGS(pag, resv, len),
2585 TP_STRUCT__entry(
2586 __field(dev_t, dev)
2587 __field(xfs_agnumber_t, agno)
2588 __field(int, resv)
2589 __field(xfs_extlen_t, freeblks)
2590 __field(xfs_extlen_t, flcount)
2591 __field(xfs_extlen_t, reserved)
2592 __field(xfs_extlen_t, asked)
2593 __field(xfs_extlen_t, len)
2594 ),
2595 TP_fast_assign(
2596 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2597
2598 __entry->dev = pag->pag_mount->m_super->s_dev;
2599 __entry->agno = pag->pag_agno;
2600 __entry->resv = resv;
2601 __entry->freeblks = pag->pagf_freeblks;
2602 __entry->flcount = pag->pagf_flcount;
2603 __entry->reserved = r ? r->ar_reserved : 0;
2604 __entry->asked = r ? r->ar_asked : 0;
2605 __entry->len = len;
2606 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002607 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2608 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002609 MAJOR(__entry->dev), MINOR(__entry->dev),
2610 __entry->agno,
2611 __entry->resv,
2612 __entry->freeblks,
2613 __entry->flcount,
2614 __entry->reserved,
2615 __entry->asked,
2616 __entry->len)
2617)
2618#define DEFINE_AG_RESV_EVENT(name) \
2619DEFINE_EVENT(xfs_ag_resv_class, name, \
2620 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2621 xfs_extlen_t len), \
2622 TP_ARGS(pag, type, len))
2623
2624/* per-AG reservation tracepoints */
2625DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2626DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2627DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2628DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2629DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2630DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2631
2632DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2633DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2634
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002635/* refcount tracepoint classes */
2636
2637/* reuse the discard trace class for agbno/aglen-based traces */
2638#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2639
2640/* ag btree lookup tracepoint class */
2641#define XFS_AG_BTREE_CMP_FORMAT_STR \
2642 { XFS_LOOKUP_EQ, "eq" }, \
2643 { XFS_LOOKUP_LE, "le" }, \
2644 { XFS_LOOKUP_GE, "ge" }
2645DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2646 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2647 xfs_agblock_t agbno, xfs_lookup_t dir),
2648 TP_ARGS(mp, agno, agbno, dir),
2649 TP_STRUCT__entry(
2650 __field(dev_t, dev)
2651 __field(xfs_agnumber_t, agno)
2652 __field(xfs_agblock_t, agbno)
2653 __field(xfs_lookup_t, dir)
2654 ),
2655 TP_fast_assign(
2656 __entry->dev = mp->m_super->s_dev;
2657 __entry->agno = agno;
2658 __entry->agbno = agbno;
2659 __entry->dir = dir;
2660 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002661 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002662 MAJOR(__entry->dev), MINOR(__entry->dev),
2663 __entry->agno,
2664 __entry->agbno,
2665 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2666 __entry->dir)
2667)
2668
2669#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2670DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2671 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2672 xfs_agblock_t agbno, xfs_lookup_t dir), \
2673 TP_ARGS(mp, agno, agbno, dir))
2674
2675/* single-rcext tracepoint class */
2676DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2677 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2678 struct xfs_refcount_irec *irec),
2679 TP_ARGS(mp, agno, irec),
2680 TP_STRUCT__entry(
2681 __field(dev_t, dev)
2682 __field(xfs_agnumber_t, agno)
2683 __field(xfs_agblock_t, startblock)
2684 __field(xfs_extlen_t, blockcount)
2685 __field(xfs_nlink_t, refcount)
2686 ),
2687 TP_fast_assign(
2688 __entry->dev = mp->m_super->s_dev;
2689 __entry->agno = agno;
2690 __entry->startblock = irec->rc_startblock;
2691 __entry->blockcount = irec->rc_blockcount;
2692 __entry->refcount = irec->rc_refcount;
2693 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002694 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002695 MAJOR(__entry->dev), MINOR(__entry->dev),
2696 __entry->agno,
2697 __entry->startblock,
2698 __entry->blockcount,
2699 __entry->refcount)
2700)
2701
2702#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2703DEFINE_EVENT(xfs_refcount_extent_class, name, \
2704 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2705 struct xfs_refcount_irec *irec), \
2706 TP_ARGS(mp, agno, irec))
2707
2708/* single-rcext and an agbno tracepoint class */
2709DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2710 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2711 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2712 TP_ARGS(mp, agno, irec, agbno),
2713 TP_STRUCT__entry(
2714 __field(dev_t, dev)
2715 __field(xfs_agnumber_t, agno)
2716 __field(xfs_agblock_t, startblock)
2717 __field(xfs_extlen_t, blockcount)
2718 __field(xfs_nlink_t, refcount)
2719 __field(xfs_agblock_t, agbno)
2720 ),
2721 TP_fast_assign(
2722 __entry->dev = mp->m_super->s_dev;
2723 __entry->agno = agno;
2724 __entry->startblock = irec->rc_startblock;
2725 __entry->blockcount = irec->rc_blockcount;
2726 __entry->refcount = irec->rc_refcount;
2727 __entry->agbno = agbno;
2728 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002729 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002730 MAJOR(__entry->dev), MINOR(__entry->dev),
2731 __entry->agno,
2732 __entry->startblock,
2733 __entry->blockcount,
2734 __entry->refcount,
2735 __entry->agbno)
2736)
2737
2738#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2739DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2740 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2741 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2742 TP_ARGS(mp, agno, irec, agbno))
2743
2744/* double-rcext tracepoint class */
2745DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2746 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2747 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2748 TP_ARGS(mp, agno, i1, i2),
2749 TP_STRUCT__entry(
2750 __field(dev_t, dev)
2751 __field(xfs_agnumber_t, agno)
2752 __field(xfs_agblock_t, i1_startblock)
2753 __field(xfs_extlen_t, i1_blockcount)
2754 __field(xfs_nlink_t, i1_refcount)
2755 __field(xfs_agblock_t, i2_startblock)
2756 __field(xfs_extlen_t, i2_blockcount)
2757 __field(xfs_nlink_t, i2_refcount)
2758 ),
2759 TP_fast_assign(
2760 __entry->dev = mp->m_super->s_dev;
2761 __entry->agno = agno;
2762 __entry->i1_startblock = i1->rc_startblock;
2763 __entry->i1_blockcount = i1->rc_blockcount;
2764 __entry->i1_refcount = i1->rc_refcount;
2765 __entry->i2_startblock = i2->rc_startblock;
2766 __entry->i2_blockcount = i2->rc_blockcount;
2767 __entry->i2_refcount = i2->rc_refcount;
2768 ),
2769 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002770 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002771 MAJOR(__entry->dev), MINOR(__entry->dev),
2772 __entry->agno,
2773 __entry->i1_startblock,
2774 __entry->i1_blockcount,
2775 __entry->i1_refcount,
2776 __entry->i2_startblock,
2777 __entry->i2_blockcount,
2778 __entry->i2_refcount)
2779)
2780
2781#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2782DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2783 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2784 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2785 TP_ARGS(mp, agno, i1, i2))
2786
2787/* double-rcext and an agbno tracepoint class */
2788DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2789 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2790 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2791 xfs_agblock_t agbno),
2792 TP_ARGS(mp, agno, i1, i2, agbno),
2793 TP_STRUCT__entry(
2794 __field(dev_t, dev)
2795 __field(xfs_agnumber_t, agno)
2796 __field(xfs_agblock_t, i1_startblock)
2797 __field(xfs_extlen_t, i1_blockcount)
2798 __field(xfs_nlink_t, i1_refcount)
2799 __field(xfs_agblock_t, i2_startblock)
2800 __field(xfs_extlen_t, i2_blockcount)
2801 __field(xfs_nlink_t, i2_refcount)
2802 __field(xfs_agblock_t, agbno)
2803 ),
2804 TP_fast_assign(
2805 __entry->dev = mp->m_super->s_dev;
2806 __entry->agno = agno;
2807 __entry->i1_startblock = i1->rc_startblock;
2808 __entry->i1_blockcount = i1->rc_blockcount;
2809 __entry->i1_refcount = i1->rc_refcount;
2810 __entry->i2_startblock = i2->rc_startblock;
2811 __entry->i2_blockcount = i2->rc_blockcount;
2812 __entry->i2_refcount = i2->rc_refcount;
2813 __entry->agbno = agbno;
2814 ),
2815 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002816 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002817 MAJOR(__entry->dev), MINOR(__entry->dev),
2818 __entry->agno,
2819 __entry->i1_startblock,
2820 __entry->i1_blockcount,
2821 __entry->i1_refcount,
2822 __entry->i2_startblock,
2823 __entry->i2_blockcount,
2824 __entry->i2_refcount,
2825 __entry->agbno)
2826)
2827
2828#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2829DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2830 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2831 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2832 xfs_agblock_t agbno), \
2833 TP_ARGS(mp, agno, i1, i2, agbno))
2834
2835/* triple-rcext tracepoint class */
2836DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2837 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2838 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2839 struct xfs_refcount_irec *i3),
2840 TP_ARGS(mp, agno, i1, i2, i3),
2841 TP_STRUCT__entry(
2842 __field(dev_t, dev)
2843 __field(xfs_agnumber_t, agno)
2844 __field(xfs_agblock_t, i1_startblock)
2845 __field(xfs_extlen_t, i1_blockcount)
2846 __field(xfs_nlink_t, i1_refcount)
2847 __field(xfs_agblock_t, i2_startblock)
2848 __field(xfs_extlen_t, i2_blockcount)
2849 __field(xfs_nlink_t, i2_refcount)
2850 __field(xfs_agblock_t, i3_startblock)
2851 __field(xfs_extlen_t, i3_blockcount)
2852 __field(xfs_nlink_t, i3_refcount)
2853 ),
2854 TP_fast_assign(
2855 __entry->dev = mp->m_super->s_dev;
2856 __entry->agno = agno;
2857 __entry->i1_startblock = i1->rc_startblock;
2858 __entry->i1_blockcount = i1->rc_blockcount;
2859 __entry->i1_refcount = i1->rc_refcount;
2860 __entry->i2_startblock = i2->rc_startblock;
2861 __entry->i2_blockcount = i2->rc_blockcount;
2862 __entry->i2_refcount = i2->rc_refcount;
2863 __entry->i3_startblock = i3->rc_startblock;
2864 __entry->i3_blockcount = i3->rc_blockcount;
2865 __entry->i3_refcount = i3->rc_refcount;
2866 ),
2867 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2868 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002869 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002870 MAJOR(__entry->dev), MINOR(__entry->dev),
2871 __entry->agno,
2872 __entry->i1_startblock,
2873 __entry->i1_blockcount,
2874 __entry->i1_refcount,
2875 __entry->i2_startblock,
2876 __entry->i2_blockcount,
2877 __entry->i2_refcount,
2878 __entry->i3_startblock,
2879 __entry->i3_blockcount,
2880 __entry->i3_refcount)
2881);
2882
2883#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2884DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2885 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2886 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2887 struct xfs_refcount_irec *i3), \
2888 TP_ARGS(mp, agno, i1, i2, i3))
2889
2890/* refcount btree tracepoints */
2891DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2892DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2893DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2894DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2895DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2896DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2897DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2898DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2899DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2900DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2901
2902/* refcount adjustment tracepoints */
2903DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2904DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002905DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2906DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002907DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2908DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002909DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002910DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2911DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2912DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2913DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2914DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2915DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002916DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002917DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2918DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2919DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2920DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2921DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2922DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2923DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2924
2925/* reflink helpers */
2926DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2927DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2928DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002929#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2930DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2931DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002932
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002933TRACE_EVENT(xfs_refcount_finish_one_leftover,
2934 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2935 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2936 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2937 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2938 TP_STRUCT__entry(
2939 __field(dev_t, dev)
2940 __field(xfs_agnumber_t, agno)
2941 __field(int, type)
2942 __field(xfs_agblock_t, agbno)
2943 __field(xfs_extlen_t, len)
2944 __field(xfs_agblock_t, new_agbno)
2945 __field(xfs_extlen_t, new_len)
2946 ),
2947 TP_fast_assign(
2948 __entry->dev = mp->m_super->s_dev;
2949 __entry->agno = agno;
2950 __entry->type = type;
2951 __entry->agbno = agbno;
2952 __entry->len = len;
2953 __entry->new_agbno = new_agbno;
2954 __entry->new_len = new_len;
2955 ),
2956 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2957 MAJOR(__entry->dev), MINOR(__entry->dev),
2958 __entry->type,
2959 __entry->agno,
2960 __entry->agbno,
2961 __entry->len,
2962 __entry->new_agbno,
2963 __entry->new_len)
2964);
2965
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002966/* simple inode-based error/%ip tracepoint class */
2967DECLARE_EVENT_CLASS(xfs_inode_error_class,
2968 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2969 TP_ARGS(ip, error, caller_ip),
2970 TP_STRUCT__entry(
2971 __field(dev_t, dev)
2972 __field(xfs_ino_t, ino)
2973 __field(int, error)
2974 __field(unsigned long, caller_ip)
2975 ),
2976 TP_fast_assign(
2977 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2978 __entry->ino = ip->i_ino;
2979 __entry->error = error;
2980 __entry->caller_ip = caller_ip;
2981 ),
2982 TP_printk("dev %d:%d ino %llx error %d caller %ps",
2983 MAJOR(__entry->dev), MINOR(__entry->dev),
2984 __entry->ino,
2985 __entry->error,
2986 (char *)__entry->caller_ip)
2987);
2988
2989#define DEFINE_INODE_ERROR_EVENT(name) \
2990DEFINE_EVENT(xfs_inode_error_class, name, \
2991 TP_PROTO(struct xfs_inode *ip, int error, \
2992 unsigned long caller_ip), \
2993 TP_ARGS(ip, error, caller_ip))
2994
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07002995/* reflink tracepoint classes */
2996
2997/* two-file io tracepoint class */
2998DECLARE_EVENT_CLASS(xfs_double_io_class,
2999 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3000 struct xfs_inode *dest, xfs_off_t doffset),
3001 TP_ARGS(src, soffset, len, dest, doffset),
3002 TP_STRUCT__entry(
3003 __field(dev_t, dev)
3004 __field(xfs_ino_t, src_ino)
3005 __field(loff_t, src_isize)
3006 __field(loff_t, src_disize)
3007 __field(loff_t, src_offset)
3008 __field(size_t, len)
3009 __field(xfs_ino_t, dest_ino)
3010 __field(loff_t, dest_isize)
3011 __field(loff_t, dest_disize)
3012 __field(loff_t, dest_offset)
3013 ),
3014 TP_fast_assign(
3015 __entry->dev = VFS_I(src)->i_sb->s_dev;
3016 __entry->src_ino = src->i_ino;
3017 __entry->src_isize = VFS_I(src)->i_size;
3018 __entry->src_disize = src->i_d.di_size;
3019 __entry->src_offset = soffset;
3020 __entry->len = len;
3021 __entry->dest_ino = dest->i_ino;
3022 __entry->dest_isize = VFS_I(dest)->i_size;
3023 __entry->dest_disize = dest->i_d.di_size;
3024 __entry->dest_offset = doffset;
3025 ),
3026 TP_printk("dev %d:%d count %zd "
3027 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3028 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3029 MAJOR(__entry->dev), MINOR(__entry->dev),
3030 __entry->len,
3031 __entry->src_ino,
3032 __entry->src_isize,
3033 __entry->src_disize,
3034 __entry->src_offset,
3035 __entry->dest_ino,
3036 __entry->dest_isize,
3037 __entry->dest_disize,
3038 __entry->dest_offset)
3039)
3040
3041#define DEFINE_DOUBLE_IO_EVENT(name) \
3042DEFINE_EVENT(xfs_double_io_class, name, \
3043 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3044 struct xfs_inode *dest, xfs_off_t doffset), \
3045 TP_ARGS(src, soffset, len, dest, doffset))
3046
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003047/* inode/irec events */
3048DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3049 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3050 TP_ARGS(ip, irec),
3051 TP_STRUCT__entry(
3052 __field(dev_t, dev)
3053 __field(xfs_ino_t, ino)
3054 __field(xfs_fileoff_t, lblk)
3055 __field(xfs_extlen_t, len)
3056 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003057 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003058 ),
3059 TP_fast_assign(
3060 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3061 __entry->ino = ip->i_ino;
3062 __entry->lblk = irec->br_startoff;
3063 __entry->len = irec->br_blockcount;
3064 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003065 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003066 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003067 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu st %d",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003068 MAJOR(__entry->dev), MINOR(__entry->dev),
3069 __entry->ino,
3070 __entry->lblk,
3071 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003072 __entry->pblk,
3073 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003074);
3075#define DEFINE_INODE_IREC_EVENT(name) \
3076DEFINE_EVENT(xfs_inode_irec_class, name, \
3077 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3078 TP_ARGS(ip, irec))
3079
3080/* refcount/reflink tracepoint definitions */
3081
3082/* reflink tracepoints */
3083DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3084DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3085DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3086DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3087TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3088 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3089 xfs_filblks_t len, struct xfs_inode *dest,
3090 xfs_fileoff_t doffset),
3091 TP_ARGS(src, soffset, len, dest, doffset),
3092 TP_STRUCT__entry(
3093 __field(dev_t, dev)
3094 __field(xfs_ino_t, src_ino)
3095 __field(xfs_fileoff_t, src_lblk)
3096 __field(xfs_filblks_t, len)
3097 __field(xfs_ino_t, dest_ino)
3098 __field(xfs_fileoff_t, dest_lblk)
3099 ),
3100 TP_fast_assign(
3101 __entry->dev = VFS_I(src)->i_sb->s_dev;
3102 __entry->src_ino = src->i_ino;
3103 __entry->src_lblk = soffset;
3104 __entry->len = len;
3105 __entry->dest_ino = dest->i_ino;
3106 __entry->dest_lblk = doffset;
3107 ),
3108 TP_printk("dev %d:%d len 0x%llx "
3109 "ino 0x%llx offset 0x%llx blocks -> "
3110 "ino 0x%llx offset 0x%llx blocks",
3111 MAJOR(__entry->dev), MINOR(__entry->dev),
3112 __entry->len,
3113 __entry->src_ino,
3114 __entry->src_lblk,
3115 __entry->dest_ino,
3116 __entry->dest_lblk)
3117);
3118TRACE_EVENT(xfs_reflink_punch_range,
3119 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3120 xfs_extlen_t len),
3121 TP_ARGS(ip, lblk, len),
3122 TP_STRUCT__entry(
3123 __field(dev_t, dev)
3124 __field(xfs_ino_t, ino)
3125 __field(xfs_fileoff_t, lblk)
3126 __field(xfs_extlen_t, len)
3127 ),
3128 TP_fast_assign(
3129 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3130 __entry->ino = ip->i_ino;
3131 __entry->lblk = lblk;
3132 __entry->len = len;
3133 ),
3134 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3135 MAJOR(__entry->dev), MINOR(__entry->dev),
3136 __entry->ino,
3137 __entry->lblk,
3138 __entry->len)
3139);
3140TRACE_EVENT(xfs_reflink_remap,
3141 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3142 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3143 TP_ARGS(ip, lblk, len, new_pblk),
3144 TP_STRUCT__entry(
3145 __field(dev_t, dev)
3146 __field(xfs_ino_t, ino)
3147 __field(xfs_fileoff_t, lblk)
3148 __field(xfs_extlen_t, len)
3149 __field(xfs_fsblock_t, new_pblk)
3150 ),
3151 TP_fast_assign(
3152 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3153 __entry->ino = ip->i_ino;
3154 __entry->lblk = lblk;
3155 __entry->len = len;
3156 __entry->new_pblk = new_pblk;
3157 ),
3158 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3159 MAJOR(__entry->dev), MINOR(__entry->dev),
3160 __entry->ino,
3161 __entry->lblk,
3162 __entry->len,
3163 __entry->new_pblk)
3164);
3165DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3166DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3167DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3168DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003169DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3170DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3171
3172/* dedupe tracepoints */
3173DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3174DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3175
3176/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003177TRACE_EVENT(xfs_ioctl_clone,
3178 TP_PROTO(struct inode *src, struct inode *dest),
3179 TP_ARGS(src, dest),
3180 TP_STRUCT__entry(
3181 __field(dev_t, dev)
3182 __field(unsigned long, src_ino)
3183 __field(loff_t, src_isize)
3184 __field(unsigned long, dest_ino)
3185 __field(loff_t, dest_isize)
3186 ),
3187 TP_fast_assign(
3188 __entry->dev = src->i_sb->s_dev;
3189 __entry->src_ino = src->i_ino;
3190 __entry->src_isize = i_size_read(src);
3191 __entry->dest_ino = dest->i_ino;
3192 __entry->dest_isize = i_size_read(dest);
3193 ),
3194 TP_printk("dev %d:%d "
3195 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003196 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003197 MAJOR(__entry->dev), MINOR(__entry->dev),
3198 __entry->src_ino,
3199 __entry->src_isize,
3200 __entry->dest_ino,
3201 __entry->dest_isize)
3202);
3203
3204/* unshare tracepoints */
3205DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003206DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003207
3208/* copy on write */
3209DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003210DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3211DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3212DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003213DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003214
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003215DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003216
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003217DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003218DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3219DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003220
3221DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3222DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3223DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003224
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003225DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3226DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3227
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003228
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003229DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003230
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003231/* rmap swapext tracepoints */
3232DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3233DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3234DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3235
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003236/* fsmap traces */
3237DECLARE_EVENT_CLASS(xfs_fsmap_class,
3238 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3239 struct xfs_rmap_irec *rmap),
3240 TP_ARGS(mp, keydev, agno, rmap),
3241 TP_STRUCT__entry(
3242 __field(dev_t, dev)
3243 __field(dev_t, keydev)
3244 __field(xfs_agnumber_t, agno)
3245 __field(xfs_fsblock_t, bno)
3246 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003247 __field(uint64_t, owner)
3248 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003249 __field(unsigned int, flags)
3250 ),
3251 TP_fast_assign(
3252 __entry->dev = mp->m_super->s_dev;
3253 __entry->keydev = new_decode_dev(keydev);
3254 __entry->agno = agno;
3255 __entry->bno = rmap->rm_startblock;
3256 __entry->len = rmap->rm_blockcount;
3257 __entry->owner = rmap->rm_owner;
3258 __entry->offset = rmap->rm_offset;
3259 __entry->flags = rmap->rm_flags;
3260 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003261 TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld offset %llu flags 0x%x",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003262 MAJOR(__entry->dev), MINOR(__entry->dev),
3263 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3264 __entry->agno,
3265 __entry->bno,
3266 __entry->len,
3267 __entry->owner,
3268 __entry->offset,
3269 __entry->flags)
3270)
3271#define DEFINE_FSMAP_EVENT(name) \
3272DEFINE_EVENT(xfs_fsmap_class, name, \
3273 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3274 struct xfs_rmap_irec *rmap), \
3275 TP_ARGS(mp, keydev, agno, rmap))
3276DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3277DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3278DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3279
3280DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3281 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3282 TP_ARGS(mp, fsmap),
3283 TP_STRUCT__entry(
3284 __field(dev_t, dev)
3285 __field(dev_t, keydev)
3286 __field(xfs_daddr_t, block)
3287 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003288 __field(uint64_t, owner)
3289 __field(uint64_t, offset)
3290 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003291 ),
3292 TP_fast_assign(
3293 __entry->dev = mp->m_super->s_dev;
3294 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3295 __entry->block = fsmap->fmr_physical;
3296 __entry->len = fsmap->fmr_length;
3297 __entry->owner = fsmap->fmr_owner;
3298 __entry->offset = fsmap->fmr_offset;
3299 __entry->flags = fsmap->fmr_flags;
3300 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003301 TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld offset %llu flags 0x%llx",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003302 MAJOR(__entry->dev), MINOR(__entry->dev),
3303 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3304 __entry->block,
3305 __entry->len,
3306 __entry->owner,
3307 __entry->offset,
3308 __entry->flags)
3309)
3310#define DEFINE_GETFSMAP_EVENT(name) \
3311DEFINE_EVENT(xfs_getfsmap_class, name, \
3312 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3313 TP_ARGS(mp, fsmap))
3314DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3315DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3316DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3317
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003318#endif /* _TRACE_XFS_H */
3319
3320#undef TRACE_INCLUDE_PATH
3321#define TRACE_INCLUDE_PATH .
3322#define TRACE_INCLUDE_FILE xfs_trace
3323#include <trace/define_trace.h>