blob: 828f383df1212a27d6bf57e67c5357443e8b457c [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;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000043
Christoph Hellwigea9a4882009-12-21 14:03:03 +000044DECLARE_EVENT_CLASS(xfs_attr_list_class,
45 TP_PROTO(struct xfs_attr_list_context *ctx),
46 TP_ARGS(ctx),
47 TP_STRUCT__entry(
48 __field(dev_t, dev)
49 __field(xfs_ino_t, ino)
50 __field(u32, hashval)
51 __field(u32, blkno)
52 __field(u32, offset)
53 __field(void *, alist)
54 __field(int, bufsize)
55 __field(int, count)
56 __field(int, firstu)
57 __field(int, dupcnt)
58 __field(int, flags)
59 ),
60 TP_fast_assign(
61 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
62 __entry->ino = ctx->dp->i_ino;
63 __entry->hashval = ctx->cursor->hashval;
64 __entry->blkno = ctx->cursor->blkno;
65 __entry->offset = ctx->cursor->offset;
66 __entry->alist = ctx->alist;
67 __entry->bufsize = ctx->bufsize;
68 __entry->count = ctx->count;
69 __entry->firstu = ctx->firstu;
70 __entry->flags = ctx->flags;
71 ),
72 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
73 "alist 0x%p size %u count %u firstu %u flags %d %s",
74 MAJOR(__entry->dev), MINOR(__entry->dev),
75 __entry->ino,
76 __entry->hashval,
77 __entry->blkno,
78 __entry->offset,
79 __entry->dupcnt,
80 __entry->alist,
81 __entry->bufsize,
82 __entry->count,
83 __entry->firstu,
84 __entry->flags,
85 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
86 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000087)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000088
89#define DEFINE_ATTR_LIST_EVENT(name) \
90DEFINE_EVENT(xfs_attr_list_class, name, \
91 TP_PROTO(struct xfs_attr_list_context *ctx), \
92 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000093DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
94DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
95DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +1100101DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
102DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000103
Li Zefanf8adb4d2010-05-24 08:25:57 +0000104DECLARE_EVENT_CLASS(xfs_perag_class,
105 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
106 unsigned long caller_ip),
107 TP_ARGS(mp, agno, refcount, caller_ip),
108 TP_STRUCT__entry(
109 __field(dev_t, dev)
110 __field(xfs_agnumber_t, agno)
111 __field(int, refcount)
112 __field(unsigned long, caller_ip)
113 ),
114 TP_fast_assign(
115 __entry->dev = mp->m_super->s_dev;
116 __entry->agno = agno;
117 __entry->refcount = refcount;
118 __entry->caller_ip = caller_ip;
119 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100120 TP_printk("dev %d:%d agno %u refcount %d caller %ps",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000121 MAJOR(__entry->dev), MINOR(__entry->dev),
122 __entry->agno,
123 __entry->refcount,
124 (char *)__entry->caller_ip)
125);
126
127#define DEFINE_PERAG_REF_EVENT(name) \
128DEFINE_EVENT(xfs_perag_class, name, \
129 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
130 unsigned long caller_ip), \
131 TP_ARGS(mp, agno, refcount, caller_ip))
132DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000133DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000134DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000135DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
136DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500137DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
138DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700139DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
140DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000141
Dave Chinnerd1230312013-11-01 15:27:19 +1100142DECLARE_EVENT_CLASS(xfs_ag_class,
143 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
144 TP_ARGS(mp, agno),
145 TP_STRUCT__entry(
146 __field(dev_t, dev)
147 __field(xfs_agnumber_t, agno)
148 ),
149 TP_fast_assign(
150 __entry->dev = mp->m_super->s_dev;
151 __entry->agno = agno;
152 ),
153 TP_printk("dev %d:%d agno %u",
154 MAJOR(__entry->dev), MINOR(__entry->dev),
155 __entry->agno)
156);
157#define DEFINE_AG_EVENT(name) \
158DEFINE_EVENT(xfs_ag_class, name, \
159 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
160 TP_ARGS(mp, agno))
161
162DEFINE_AG_EVENT(xfs_read_agf);
163DEFINE_AG_EVENT(xfs_alloc_read_agf);
164DEFINE_AG_EVENT(xfs_read_agi);
165DEFINE_AG_EVENT(xfs_ialloc_read_agi);
166
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000167TRACE_EVENT(xfs_attr_list_node_descend,
168 TP_PROTO(struct xfs_attr_list_context *ctx,
169 struct xfs_da_node_entry *btree),
170 TP_ARGS(ctx, btree),
171 TP_STRUCT__entry(
172 __field(dev_t, dev)
173 __field(xfs_ino_t, ino)
174 __field(u32, hashval)
175 __field(u32, blkno)
176 __field(u32, offset)
177 __field(void *, alist)
178 __field(int, bufsize)
179 __field(int, count)
180 __field(int, firstu)
181 __field(int, dupcnt)
182 __field(int, flags)
183 __field(u32, bt_hashval)
184 __field(u32, bt_before)
185 ),
186 TP_fast_assign(
187 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
188 __entry->ino = ctx->dp->i_ino;
189 __entry->hashval = ctx->cursor->hashval;
190 __entry->blkno = ctx->cursor->blkno;
191 __entry->offset = ctx->cursor->offset;
192 __entry->alist = ctx->alist;
193 __entry->bufsize = ctx->bufsize;
194 __entry->count = ctx->count;
195 __entry->firstu = ctx->firstu;
196 __entry->flags = ctx->flags;
197 __entry->bt_hashval = be32_to_cpu(btree->hashval);
198 __entry->bt_before = be32_to_cpu(btree->before);
199 ),
200 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
201 "alist 0x%p size %u count %u firstu %u flags %d %s "
202 "node hashval %u, node before %u",
203 MAJOR(__entry->dev), MINOR(__entry->dev),
204 __entry->ino,
205 __entry->hashval,
206 __entry->blkno,
207 __entry->offset,
208 __entry->dupcnt,
209 __entry->alist,
210 __entry->bufsize,
211 __entry->count,
212 __entry->firstu,
213 __entry->flags,
214 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
215 __entry->bt_hashval,
216 __entry->bt_before)
217);
218
219TRACE_EVENT(xfs_iext_insert,
220 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
221 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
222 TP_ARGS(ip, idx, r, state, caller_ip),
223 TP_STRUCT__entry(
224 __field(dev_t, dev)
225 __field(xfs_ino_t, ino)
226 __field(xfs_extnum_t, idx)
227 __field(xfs_fileoff_t, startoff)
228 __field(xfs_fsblock_t, startblock)
229 __field(xfs_filblks_t, blockcount)
230 __field(xfs_exntst_t, state)
231 __field(int, bmap_state)
232 __field(unsigned long, caller_ip)
233 ),
234 TP_fast_assign(
235 __entry->dev = VFS_I(ip)->i_sb->s_dev;
236 __entry->ino = ip->i_ino;
237 __entry->idx = idx;
238 __entry->startoff = r->br_startoff;
239 __entry->startblock = r->br_startblock;
240 __entry->blockcount = r->br_blockcount;
241 __entry->state = r->br_state;
242 __entry->bmap_state = state;
243 __entry->caller_ip = caller_ip;
244 ),
245 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100246 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000247 MAJOR(__entry->dev), MINOR(__entry->dev),
248 __entry->ino,
249 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
250 (long)__entry->idx,
251 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000252 (__int64_t)__entry->startblock,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000253 __entry->blockcount,
254 __entry->state,
255 (char *)__entry->caller_ip)
256);
257
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000258DECLARE_EVENT_CLASS(xfs_bmap_class,
259 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
260 unsigned long caller_ip),
261 TP_ARGS(ip, idx, state, caller_ip),
262 TP_STRUCT__entry(
263 __field(dev_t, dev)
264 __field(xfs_ino_t, ino)
265 __field(xfs_extnum_t, idx)
266 __field(xfs_fileoff_t, startoff)
267 __field(xfs_fsblock_t, startblock)
268 __field(xfs_filblks_t, blockcount)
269 __field(xfs_exntst_t, state)
270 __field(int, bmap_state)
271 __field(unsigned long, caller_ip)
272 ),
273 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700274 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000275 struct xfs_bmbt_irec r;
276
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700277 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000278 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
279 __entry->dev = VFS_I(ip)->i_sb->s_dev;
280 __entry->ino = ip->i_ino;
281 __entry->idx = idx;
282 __entry->startoff = r.br_startoff;
283 __entry->startblock = r.br_startblock;
284 __entry->blockcount = r.br_blockcount;
285 __entry->state = r.br_state;
286 __entry->bmap_state = state;
287 __entry->caller_ip = caller_ip;
288 ),
289 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100290 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000291 MAJOR(__entry->dev), MINOR(__entry->dev),
292 __entry->ino,
293 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
294 (long)__entry->idx,
295 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000296 (__int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000297 __entry->blockcount,
298 __entry->state,
299 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000300)
301
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000302#define DEFINE_BMAP_EVENT(name) \
303DEFINE_EVENT(xfs_bmap_class, name, \
304 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
305 unsigned long caller_ip), \
306 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000307DEFINE_BMAP_EVENT(xfs_iext_remove);
308DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
309DEFINE_BMAP_EVENT(xfs_bmap_post_update);
310DEFINE_BMAP_EVENT(xfs_extlist);
311
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000312DECLARE_EVENT_CLASS(xfs_buf_class,
313 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
314 TP_ARGS(bp, caller_ip),
315 TP_STRUCT__entry(
316 __field(dev_t, dev)
317 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000318 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000319 __field(int, hold)
320 __field(int, pincount)
321 __field(unsigned, lockval)
322 __field(unsigned, flags)
323 __field(unsigned long, caller_ip)
324 ),
325 TP_fast_assign(
326 __entry->dev = bp->b_target->bt_dev;
327 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000328 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000329 __entry->hold = atomic_read(&bp->b_hold);
330 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200331 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000332 __entry->flags = bp->b_flags;
333 __entry->caller_ip = caller_ip;
334 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000335 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100336 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000337 MAJOR(__entry->dev), MINOR(__entry->dev),
338 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000339 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000340 __entry->hold,
341 __entry->pincount,
342 __entry->lockval,
343 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
344 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000345)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000346
347#define DEFINE_BUF_EVENT(name) \
348DEFINE_EVENT(xfs_buf_class, name, \
349 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
350 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000351DEFINE_BUF_EVENT(xfs_buf_init);
352DEFINE_BUF_EVENT(xfs_buf_free);
353DEFINE_BUF_EVENT(xfs_buf_hold);
354DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000355DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000356DEFINE_BUF_EVENT(xfs_buf_submit);
357DEFINE_BUF_EVENT(xfs_buf_submit_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000358DEFINE_BUF_EVENT(xfs_buf_bawrite);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000359DEFINE_BUF_EVENT(xfs_buf_lock);
360DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000361DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200362DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000363DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000364DEFINE_BUF_EVENT(xfs_buf_iowait);
365DEFINE_BUF_EVENT(xfs_buf_iowait_done);
366DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000367DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000368DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Dave Chinner686865f2010-09-24 20:07:47 +1000369DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000370DEFINE_BUF_EVENT(xfs_bdstrat_shut);
371DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000372DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
373DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100374DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000375DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
376DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
377
378/* not really buffer traces, but the buf provides useful information */
379DEFINE_BUF_EVENT(xfs_btree_corrupt);
380DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
381DEFINE_BUF_EVENT(xfs_reset_dqcounts);
382DEFINE_BUF_EVENT(xfs_inode_item_push);
383
384/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000385DECLARE_EVENT_CLASS(xfs_buf_flags_class,
386 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
387 TP_ARGS(bp, flags, caller_ip),
388 TP_STRUCT__entry(
389 __field(dev_t, dev)
390 __field(xfs_daddr_t, bno)
391 __field(size_t, buffer_length)
392 __field(int, hold)
393 __field(int, pincount)
394 __field(unsigned, lockval)
395 __field(unsigned, flags)
396 __field(unsigned long, caller_ip)
397 ),
398 TP_fast_assign(
399 __entry->dev = bp->b_target->bt_dev;
400 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000401 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000402 __entry->flags = flags;
403 __entry->hold = atomic_read(&bp->b_hold);
404 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200405 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000406 __entry->caller_ip = caller_ip;
407 ),
408 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100409 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000410 MAJOR(__entry->dev), MINOR(__entry->dev),
411 (unsigned long long)__entry->bno,
412 __entry->buffer_length,
413 __entry->hold,
414 __entry->pincount,
415 __entry->lockval,
416 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
417 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000418)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000419
420#define DEFINE_BUF_FLAGS_EVENT(name) \
421DEFINE_EVENT(xfs_buf_flags_class, name, \
422 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
423 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000424DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
425DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
426DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
427
428TRACE_EVENT(xfs_buf_ioerror,
429 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
430 TP_ARGS(bp, error, caller_ip),
431 TP_STRUCT__entry(
432 __field(dev_t, dev)
433 __field(xfs_daddr_t, bno)
434 __field(size_t, buffer_length)
435 __field(unsigned, flags)
436 __field(int, hold)
437 __field(int, pincount)
438 __field(unsigned, lockval)
439 __field(int, error)
440 __field(unsigned long, caller_ip)
441 ),
442 TP_fast_assign(
443 __entry->dev = bp->b_target->bt_dev;
444 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000445 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000446 __entry->hold = atomic_read(&bp->b_hold);
447 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200448 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000449 __entry->error = error;
450 __entry->flags = bp->b_flags;
451 __entry->caller_ip = caller_ip;
452 ),
453 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100454 "lock %d error %d flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000455 MAJOR(__entry->dev), MINOR(__entry->dev),
456 (unsigned long long)__entry->bno,
457 __entry->buffer_length,
458 __entry->hold,
459 __entry->pincount,
460 __entry->lockval,
461 __entry->error,
462 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
463 (void *)__entry->caller_ip)
464);
465
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000466DECLARE_EVENT_CLASS(xfs_buf_item_class,
467 TP_PROTO(struct xfs_buf_log_item *bip),
468 TP_ARGS(bip),
469 TP_STRUCT__entry(
470 __field(dev_t, dev)
471 __field(xfs_daddr_t, buf_bno)
472 __field(size_t, buf_len)
473 __field(int, buf_hold)
474 __field(int, buf_pincount)
475 __field(int, buf_lockval)
476 __field(unsigned, buf_flags)
477 __field(unsigned, bli_recur)
478 __field(int, bli_refcount)
479 __field(unsigned, bli_flags)
480 __field(void *, li_desc)
481 __field(unsigned, li_flags)
482 ),
483 TP_fast_assign(
484 __entry->dev = bip->bli_buf->b_target->bt_dev;
485 __entry->bli_flags = bip->bli_flags;
486 __entry->bli_recur = bip->bli_recur;
487 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
488 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000489 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000490 __entry->buf_flags = bip->bli_buf->b_flags;
491 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
492 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200493 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000494 __entry->li_desc = bip->bli_item.li_desc;
495 __entry->li_flags = bip->bli_item.li_flags;
496 ),
497 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
498 "lock %d flags %s recur %d refcount %d bliflags %s "
499 "lidesc 0x%p liflags %s",
500 MAJOR(__entry->dev), MINOR(__entry->dev),
501 (unsigned long long)__entry->buf_bno,
502 __entry->buf_len,
503 __entry->buf_hold,
504 __entry->buf_pincount,
505 __entry->buf_lockval,
506 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
507 __entry->bli_recur,
508 __entry->bli_refcount,
509 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
510 __entry->li_desc,
511 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000512)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000513
514#define DEFINE_BUF_ITEM_EVENT(name) \
515DEFINE_EVENT(xfs_buf_item_class, name, \
516 TP_PROTO(struct xfs_buf_log_item *bip), \
517 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000523DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000524DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000525DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
526DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
527DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000528DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
529DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
530DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
531DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
532DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
533DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
534DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
535DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
536DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
537DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
538DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
539DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
540DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
541DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
542DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
543DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000544DEFINE_BUF_ITEM_EVENT(xfs_trans_buf_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000545
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000546DECLARE_EVENT_CLASS(xfs_filestream_class,
547 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
548 TP_ARGS(ip, agno),
549 TP_STRUCT__entry(
550 __field(dev_t, dev)
551 __field(xfs_ino_t, ino)
552 __field(xfs_agnumber_t, agno)
553 __field(int, streams)
554 ),
555 TP_fast_assign(
556 __entry->dev = VFS_I(ip)->i_sb->s_dev;
557 __entry->ino = ip->i_ino;
558 __entry->agno = agno;
559 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
560 ),
561 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
562 MAJOR(__entry->dev), MINOR(__entry->dev),
563 __entry->ino,
564 __entry->agno,
565 __entry->streams)
566)
567#define DEFINE_FILESTREAM_EVENT(name) \
568DEFINE_EVENT(xfs_filestream_class, name, \
569 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
570 TP_ARGS(ip, agno))
571DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
572DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
573DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
574
575TRACE_EVENT(xfs_filestream_pick,
576 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
577 xfs_extlen_t free, int nscan),
578 TP_ARGS(ip, agno, free, nscan),
579 TP_STRUCT__entry(
580 __field(dev_t, dev)
581 __field(xfs_ino_t, ino)
582 __field(xfs_agnumber_t, agno)
583 __field(int, streams)
584 __field(xfs_extlen_t, free)
585 __field(int, nscan)
586 ),
587 TP_fast_assign(
588 __entry->dev = VFS_I(ip)->i_sb->s_dev;
589 __entry->ino = ip->i_ino;
590 __entry->agno = agno;
591 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
592 __entry->free = free;
593 __entry->nscan = nscan;
594 ),
595 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
596 MAJOR(__entry->dev), MINOR(__entry->dev),
597 __entry->ino,
598 __entry->agno,
599 __entry->streams,
600 __entry->free,
601 __entry->nscan)
602);
603
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000604DECLARE_EVENT_CLASS(xfs_lock_class,
605 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
606 unsigned long caller_ip),
607 TP_ARGS(ip, lock_flags, caller_ip),
608 TP_STRUCT__entry(
609 __field(dev_t, dev)
610 __field(xfs_ino_t, ino)
611 __field(int, lock_flags)
612 __field(unsigned long, caller_ip)
613 ),
614 TP_fast_assign(
615 __entry->dev = VFS_I(ip)->i_sb->s_dev;
616 __entry->ino = ip->i_ino;
617 __entry->lock_flags = lock_flags;
618 __entry->caller_ip = caller_ip;
619 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100620 TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000621 MAJOR(__entry->dev), MINOR(__entry->dev),
622 __entry->ino,
623 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
624 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000625)
626
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000627#define DEFINE_LOCK_EVENT(name) \
628DEFINE_EVENT(xfs_lock_class, name, \
629 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
630 unsigned long caller_ip), \
631 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000632DEFINE_LOCK_EVENT(xfs_ilock);
633DEFINE_LOCK_EVENT(xfs_ilock_nowait);
634DEFINE_LOCK_EVENT(xfs_ilock_demote);
635DEFINE_LOCK_EVENT(xfs_iunlock);
636
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000637DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000638 TP_PROTO(struct xfs_inode *ip),
639 TP_ARGS(ip),
640 TP_STRUCT__entry(
641 __field(dev_t, dev)
642 __field(xfs_ino_t, ino)
643 ),
644 TP_fast_assign(
645 __entry->dev = VFS_I(ip)->i_sb->s_dev;
646 __entry->ino = ip->i_ino;
647 ),
648 TP_printk("dev %d:%d ino 0x%llx",
649 MAJOR(__entry->dev), MINOR(__entry->dev),
650 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000651)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000652
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000653#define DEFINE_INODE_EVENT(name) \
654DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000655 TP_PROTO(struct xfs_inode *ip), \
656 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000657DEFINE_INODE_EVENT(xfs_iget_skip);
658DEFINE_INODE_EVENT(xfs_iget_reclaim);
659DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
660DEFINE_INODE_EVENT(xfs_iget_hit);
661DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000662
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000663DEFINE_INODE_EVENT(xfs_getattr);
664DEFINE_INODE_EVENT(xfs_setattr);
665DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500666DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000667DEFINE_INODE_EVENT(xfs_alloc_file_space);
668DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000669DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100670DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100671DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000672DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000673#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200674DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000675#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000676DEFINE_INODE_EVENT(xfs_vm_bmap);
677DEFINE_INODE_EVENT(xfs_file_ioctl);
678DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
679DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000680DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000681DEFINE_INODE_EVENT(xfs_file_fsync);
682DEFINE_INODE_EVENT(xfs_destroy_inode);
Al Virob57922d2010-06-07 14:34:48 -0400683DEFINE_INODE_EVENT(xfs_evict_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400684DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000685
686DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
687DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
688
Brian Foster27b52862012-11-06 09:50:38 -0500689DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
690DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500691DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700692DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
693DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
694DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500695
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100696DEFINE_INODE_EVENT(xfs_filemap_fault);
Matthew Wilcoxacd76e72015-09-08 14:59:06 -0700697DEFINE_INODE_EVENT(xfs_filemap_pmd_fault);
Dave Chinner075a9242015-02-23 21:44:54 +1100698DEFINE_INODE_EVENT(xfs_filemap_page_mkwrite);
Dave Chinner3af49282015-11-03 12:37:02 +1100699DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100700
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000701DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000702 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
703 TP_ARGS(ip, caller_ip),
704 TP_STRUCT__entry(
705 __field(dev_t, dev)
706 __field(xfs_ino_t, ino)
707 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100708 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000709 __field(unsigned long, caller_ip)
710 ),
711 TP_fast_assign(
712 __entry->dev = VFS_I(ip)->i_sb->s_dev;
713 __entry->ino = ip->i_ino;
714 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100715 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000716 __entry->caller_ip = caller_ip;
717 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100718 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000719 MAJOR(__entry->dev), MINOR(__entry->dev),
720 __entry->ino,
721 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100722 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000723 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000724)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000725
Brian Foster19cb7e32013-03-18 10:51:48 -0400726TRACE_EVENT(xfs_iomap_prealloc_size,
727 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
728 unsigned int writeio_blocks),
729 TP_ARGS(ip, blocks, shift, writeio_blocks),
730 TP_STRUCT__entry(
731 __field(dev_t, dev)
732 __field(xfs_ino_t, ino)
733 __field(xfs_fsblock_t, blocks)
734 __field(int, shift)
735 __field(unsigned int, writeio_blocks)
736 ),
737 TP_fast_assign(
738 __entry->dev = VFS_I(ip)->i_sb->s_dev;
739 __entry->ino = ip->i_ino;
740 __entry->blocks = blocks;
741 __entry->shift = shift;
742 __entry->writeio_blocks = writeio_blocks;
743 ),
744 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
745 "m_writeio_blocks %u",
746 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
747 __entry->blocks, __entry->shift, __entry->writeio_blocks)
748)
749
Brian Foster56d11152015-05-29 09:18:32 +1000750TRACE_EVENT(xfs_irec_merge_pre,
751 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
752 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
753 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
754 TP_STRUCT__entry(
755 __field(dev_t, dev)
756 __field(xfs_agnumber_t, agno)
757 __field(xfs_agino_t, agino)
758 __field(uint16_t, holemask)
759 __field(xfs_agino_t, nagino)
760 __field(uint16_t, nholemask)
761 ),
762 TP_fast_assign(
763 __entry->dev = mp->m_super->s_dev;
764 __entry->agno = agno;
765 __entry->agino = agino;
766 __entry->holemask = holemask;
767 __entry->nagino = nagino;
768 __entry->nholemask = holemask;
769 ),
770 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
771 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
772 __entry->agino, __entry->holemask, __entry->nagino,
773 __entry->nholemask)
774)
775
776TRACE_EVENT(xfs_irec_merge_post,
777 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
778 uint16_t holemask),
779 TP_ARGS(mp, agno, agino, holemask),
780 TP_STRUCT__entry(
781 __field(dev_t, dev)
782 __field(xfs_agnumber_t, agno)
783 __field(xfs_agino_t, agino)
784 __field(uint16_t, holemask)
785 ),
786 TP_fast_assign(
787 __entry->dev = mp->m_super->s_dev;
788 __entry->agno = agno;
789 __entry->agino = agino;
790 __entry->holemask = holemask;
791 ),
792 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
793 MINOR(__entry->dev), __entry->agno, __entry->agino,
794 __entry->holemask)
795)
796
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000797#define DEFINE_IREF_EVENT(name) \
798DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000799 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
800 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000801DEFINE_IREF_EVENT(xfs_ihold);
802DEFINE_IREF_EVENT(xfs_irele);
803DEFINE_IREF_EVENT(xfs_inode_pin);
804DEFINE_IREF_EVENT(xfs_inode_unpin);
805DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100806
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000807DECLARE_EVENT_CLASS(xfs_namespace_class,
808 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
809 TP_ARGS(dp, name),
810 TP_STRUCT__entry(
811 __field(dev_t, dev)
812 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000813 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000814 __dynamic_array(char, name, name->len)
815 ),
816 TP_fast_assign(
817 __entry->dev = VFS_I(dp)->i_sb->s_dev;
818 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000819 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000820 memcpy(__get_str(name), name->name, name->len);
821 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000822 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000823 MAJOR(__entry->dev), MINOR(__entry->dev),
824 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000825 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000826 __get_str(name))
827)
828
829#define DEFINE_NAMESPACE_EVENT(name) \
830DEFINE_EVENT(xfs_namespace_class, name, \
831 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
832 TP_ARGS(dp, name))
833DEFINE_NAMESPACE_EVENT(xfs_remove);
834DEFINE_NAMESPACE_EVENT(xfs_link);
835DEFINE_NAMESPACE_EVENT(xfs_lookup);
836DEFINE_NAMESPACE_EVENT(xfs_create);
837DEFINE_NAMESPACE_EVENT(xfs_symlink);
838
839TRACE_EVENT(xfs_rename,
840 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
841 struct xfs_name *src_name, struct xfs_name *target_name),
842 TP_ARGS(src_dp, target_dp, src_name, target_name),
843 TP_STRUCT__entry(
844 __field(dev_t, dev)
845 __field(xfs_ino_t, src_dp_ino)
846 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000847 __field(int, src_namelen)
848 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000849 __dynamic_array(char, src_name, src_name->len)
850 __dynamic_array(char, target_name, target_name->len)
851 ),
852 TP_fast_assign(
853 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
854 __entry->src_dp_ino = src_dp->i_ino;
855 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000856 __entry->src_namelen = src_name->len;
857 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000858 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000859 memcpy(__get_str(target_name), target_name->name,
860 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000861 ),
862 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000863 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000864 MAJOR(__entry->dev), MINOR(__entry->dev),
865 __entry->src_dp_ino,
866 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000867 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000868 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000869 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000870 __get_str(target_name))
871)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000872
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000873DECLARE_EVENT_CLASS(xfs_dquot_class,
874 TP_PROTO(struct xfs_dquot *dqp),
875 TP_ARGS(dqp),
876 TP_STRUCT__entry(
877 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000878 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000879 __field(unsigned, flags)
880 __field(unsigned, nrefs)
881 __field(unsigned long long, res_bcount)
882 __field(unsigned long long, bcount)
883 __field(unsigned long long, icount)
884 __field(unsigned long long, blk_hardlimit)
885 __field(unsigned long long, blk_softlimit)
886 __field(unsigned long long, ino_hardlimit)
887 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000888 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000889 TP_fast_assign(
890 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000891 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000892 __entry->flags = dqp->dq_flags;
893 __entry->nrefs = dqp->q_nrefs;
894 __entry->res_bcount = dqp->q_res_bcount;
895 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
896 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
897 __entry->blk_hardlimit =
898 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
899 __entry->blk_softlimit =
900 be64_to_cpu(dqp->q_core.d_blk_softlimit);
901 __entry->ino_hardlimit =
902 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
903 __entry->ino_softlimit =
904 be64_to_cpu(dqp->q_core.d_ino_softlimit);
905 ),
906 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000907 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
908 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000909 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000910 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000911 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
912 __entry->nrefs,
913 __entry->res_bcount,
914 __entry->bcount,
915 __entry->blk_hardlimit,
916 __entry->blk_softlimit,
917 __entry->icount,
918 __entry->ino_hardlimit,
919 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000920)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000921
922#define DEFINE_DQUOT_EVENT(name) \
923DEFINE_EVENT(xfs_dquot_class, name, \
924 TP_PROTO(struct xfs_dquot *dqp), \
925 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000926DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000927DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
928DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b32012-02-01 13:57:20 +0000929DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
930DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000931DEFINE_DQUOT_EVENT(xfs_dqattach_found);
932DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000933DEFINE_DQUOT_EVENT(xfs_dqalloc);
934DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
935DEFINE_DQUOT_EVENT(xfs_dqread);
936DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000937DEFINE_DQUOT_EVENT(xfs_dqget_hit);
938DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000939DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
940DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000941DEFINE_DQUOT_EVENT(xfs_dqput);
942DEFINE_DQUOT_EVENT(xfs_dqput_wait);
943DEFINE_DQUOT_EVENT(xfs_dqput_free);
944DEFINE_DQUOT_EVENT(xfs_dqrele);
945DEFINE_DQUOT_EVENT(xfs_dqflush);
946DEFINE_DQUOT_EVENT(xfs_dqflush_force);
947DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000948
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000949DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500950 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000951 TP_ARGS(log, tic),
952 TP_STRUCT__entry(
953 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000954 __field(char, ocnt)
955 __field(char, cnt)
956 __field(int, curr_res)
957 __field(int, unit_res)
958 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100959 __field(int, reserveq)
960 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000961 __field(int, grant_reserve_cycle)
962 __field(int, grant_reserve_bytes)
963 __field(int, grant_write_cycle)
964 __field(int, grant_write_bytes)
965 __field(int, curr_cycle)
966 __field(int, curr_block)
967 __field(xfs_lsn_t, tail_lsn)
968 ),
969 TP_fast_assign(
970 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000971 __entry->ocnt = tic->t_ocnt;
972 __entry->cnt = tic->t_cnt;
973 __entry->curr_res = tic->t_curr_res;
974 __entry->unit_res = tic->t_unit_res;
975 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000976 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
977 __entry->writeq = list_empty(&log->l_write_head.waiters);
978 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100979 &__entry->grant_reserve_cycle,
980 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000981 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100982 &__entry->grant_write_cycle,
983 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000984 __entry->curr_cycle = log->l_curr_cycle;
985 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100986 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000987 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000988 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100989 "t_unit_res %u t_flags %s reserveq %s "
990 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000991 "grant_reserve_bytes %d grant_write_cycle %d "
992 "grant_write_bytes %d curr_cycle %d curr_block %d "
993 "tail_cycle %d tail_block %d",
994 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000995 __entry->ocnt,
996 __entry->cnt,
997 __entry->curr_res,
998 __entry->unit_res,
999 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +11001000 __entry->reserveq ? "empty" : "active",
1001 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001002 __entry->grant_reserve_cycle,
1003 __entry->grant_reserve_bytes,
1004 __entry->grant_write_cycle,
1005 __entry->grant_write_bytes,
1006 __entry->curr_cycle,
1007 __entry->curr_block,
1008 CYCLE_LSN(__entry->tail_lsn),
1009 BLOCK_LSN(__entry->tail_lsn)
1010 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001011)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001012
1013#define DEFINE_LOGGRANT_EVENT(name) \
1014DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001015 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001016 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001017DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1018DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001019DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001020DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1021DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001022DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001023DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1024DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1025DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1026DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001027DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1028DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1029DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1030DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1031DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1032DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1033
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001034DECLARE_EVENT_CLASS(xfs_log_item_class,
1035 TP_PROTO(struct xfs_log_item *lip),
1036 TP_ARGS(lip),
1037 TP_STRUCT__entry(
1038 __field(dev_t, dev)
1039 __field(void *, lip)
1040 __field(uint, type)
1041 __field(uint, flags)
1042 __field(xfs_lsn_t, lsn)
1043 ),
1044 TP_fast_assign(
1045 __entry->dev = lip->li_mountp->m_super->s_dev;
1046 __entry->lip = lip;
1047 __entry->type = lip->li_type;
1048 __entry->flags = lip->li_flags;
1049 __entry->lsn = lip->li_lsn;
1050 ),
1051 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1052 MAJOR(__entry->dev), MINOR(__entry->dev),
1053 __entry->lip,
1054 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1055 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1056 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1057)
1058
Dave Chinner14c26c62012-04-24 16:33:31 +10001059TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001060 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1061 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001062 TP_STRUCT__entry(
1063 __field(dev_t, dev)
1064 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001065 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001066 ),
1067 TP_fast_assign(
1068 __entry->dev = mp->m_super->s_dev;
1069 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001070 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001071 ),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001072 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
Dave Chinner14c26c62012-04-24 16:33:31 +10001073 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001074 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001075)
1076
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001077#define DEFINE_LOG_ITEM_EVENT(name) \
1078DEFINE_EVENT(xfs_log_item_class, name, \
1079 TP_PROTO(struct xfs_log_item *lip), \
1080 TP_ARGS(lip))
1081DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001082DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1083DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001084DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001085
Dave Chinner750b9c92013-11-01 15:27:18 +11001086DECLARE_EVENT_CLASS(xfs_ail_class,
1087 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1088 TP_ARGS(lip, old_lsn, new_lsn),
1089 TP_STRUCT__entry(
1090 __field(dev_t, dev)
1091 __field(void *, lip)
1092 __field(uint, type)
1093 __field(uint, flags)
1094 __field(xfs_lsn_t, old_lsn)
1095 __field(xfs_lsn_t, new_lsn)
1096 ),
1097 TP_fast_assign(
1098 __entry->dev = lip->li_mountp->m_super->s_dev;
1099 __entry->lip = lip;
1100 __entry->type = lip->li_type;
1101 __entry->flags = lip->li_flags;
1102 __entry->old_lsn = old_lsn;
1103 __entry->new_lsn = new_lsn;
1104 ),
1105 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1106 MAJOR(__entry->dev), MINOR(__entry->dev),
1107 __entry->lip,
1108 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1109 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1110 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1111 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1112)
1113
1114#define DEFINE_AIL_EVENT(name) \
1115DEFINE_EVENT(xfs_ail_class, name, \
1116 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1117 TP_ARGS(lip, old_lsn, new_lsn))
1118DEFINE_AIL_EVENT(xfs_ail_insert);
1119DEFINE_AIL_EVENT(xfs_ail_move);
1120DEFINE_AIL_EVENT(xfs_ail_delete);
1121
1122TRACE_EVENT(xfs_log_assign_tail_lsn,
1123 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1124 TP_ARGS(log, new_lsn),
1125 TP_STRUCT__entry(
1126 __field(dev_t, dev)
1127 __field(xfs_lsn_t, new_lsn)
1128 __field(xfs_lsn_t, old_lsn)
1129 __field(xfs_lsn_t, last_sync_lsn)
1130 ),
1131 TP_fast_assign(
1132 __entry->dev = log->l_mp->m_super->s_dev;
1133 __entry->new_lsn = new_lsn;
1134 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1135 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1136 ),
1137 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1138 MAJOR(__entry->dev), MINOR(__entry->dev),
1139 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1140 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1141 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1142)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001143
Li Zefanf8adb4d2010-05-24 08:25:57 +00001144DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001145 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1146 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001147 TP_STRUCT__entry(
1148 __field(dev_t, dev)
1149 __field(xfs_ino_t, ino)
1150 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001151 __field(loff_t, offset)
1152 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001153 ),
1154 TP_fast_assign(
1155 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1156 __entry->ino = ip->i_ino;
1157 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001158 __entry->offset = offset;
1159 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001160 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001161 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001162 MAJOR(__entry->dev), MINOR(__entry->dev),
1163 __entry->ino,
1164 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001165 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001166 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001167)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001168
1169#define DEFINE_RW_EVENT(name) \
1170DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001171 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1172 TP_ARGS(ip, count, offset))
1173DEFINE_RW_EVENT(xfs_file_buffered_read);
1174DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001175DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001176DEFINE_RW_EVENT(xfs_file_buffered_write);
1177DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001178DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001179
Li Zefanf8adb4d2010-05-24 08:25:57 +00001180DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001181 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1182 unsigned int len),
1183 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001184 TP_STRUCT__entry(
1185 __field(dev_t, dev)
1186 __field(xfs_ino_t, ino)
1187 __field(pgoff_t, pgoff)
1188 __field(loff_t, size)
1189 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001190 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001191 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001192 __field(int, unwritten)
1193 ),
1194 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001195 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001196
Li Zefanf8adb4d2010-05-24 08:25:57 +00001197 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001198 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001199 __entry->dev = inode->i_sb->s_dev;
1200 __entry->ino = XFS_I(inode)->i_ino;
1201 __entry->pgoff = page_offset(page);
1202 __entry->size = i_size_read(inode);
1203 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001204 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001205 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001206 __entry->unwritten = unwritten;
1207 ),
1208 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001209 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001210 MAJOR(__entry->dev), MINOR(__entry->dev),
1211 __entry->ino,
1212 __entry->pgoff,
1213 __entry->size,
1214 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001215 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001216 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001217 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001218)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001219
1220#define DEFINE_PAGE_EVENT(name) \
1221DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001222 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1223 unsigned int len), \
1224 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001225DEFINE_PAGE_EVENT(xfs_writepage);
1226DEFINE_PAGE_EVENT(xfs_releasepage);
1227DEFINE_PAGE_EVENT(xfs_invalidatepage);
1228
Dave Chinner121e2132016-01-08 11:28:35 +11001229DECLARE_EVENT_CLASS(xfs_readpage_class,
1230 TP_PROTO(struct inode *inode, int nr_pages),
1231 TP_ARGS(inode, nr_pages),
1232 TP_STRUCT__entry(
1233 __field(dev_t, dev)
1234 __field(xfs_ino_t, ino)
1235 __field(int, nr_pages)
1236 ),
1237 TP_fast_assign(
1238 __entry->dev = inode->i_sb->s_dev;
1239 __entry->ino = inode->i_ino;
1240 __entry->nr_pages = nr_pages;
1241 ),
1242 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1243 MAJOR(__entry->dev), MINOR(__entry->dev),
1244 __entry->ino,
1245 __entry->nr_pages)
1246)
1247
1248#define DEFINE_READPAGE_EVENT(name) \
1249DEFINE_EVENT(xfs_readpage_class, name, \
1250 TP_PROTO(struct inode *inode, int nr_pages), \
1251 TP_ARGS(inode, nr_pages))
1252DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1253DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1254
Christoph Hellwiga206c812010-12-10 08:42:20 +00001255DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001256 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001257 int type, struct xfs_bmbt_irec *irec),
1258 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001259 TP_STRUCT__entry(
1260 __field(dev_t, dev)
1261 __field(xfs_ino_t, ino)
1262 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001263 __field(loff_t, offset)
1264 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001265 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001266 __field(xfs_fileoff_t, startoff)
1267 __field(xfs_fsblock_t, startblock)
1268 __field(xfs_filblks_t, blockcount)
1269 ),
1270 TP_fast_assign(
1271 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1272 __entry->ino = ip->i_ino;
1273 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001274 __entry->offset = offset;
1275 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001276 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001277 __entry->startoff = irec ? irec->br_startoff : 0;
1278 __entry->startblock = irec ? irec->br_startblock : 0;
1279 __entry->blockcount = irec ? irec->br_blockcount : 0;
1280 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001281 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1282 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001283 MAJOR(__entry->dev), MINOR(__entry->dev),
1284 __entry->ino,
1285 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001286 __entry->offset,
1287 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001288 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001289 __entry->startoff,
1290 (__int64_t)__entry->startblock,
1291 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001292)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001293
1294#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001295DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001296 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001297 int type, struct xfs_bmbt_irec *irec), \
1298 TP_ARGS(ip, offset, count, type, irec))
1299DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1300DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1301DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1302DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001303DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001304DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1305DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001306
Li Zefanf8adb4d2010-05-24 08:25:57 +00001307DECLARE_EVENT_CLASS(xfs_simple_io_class,
1308 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1309 TP_ARGS(ip, offset, count),
1310 TP_STRUCT__entry(
1311 __field(dev_t, dev)
1312 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001313 __field(loff_t, isize)
1314 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001315 __field(loff_t, offset)
1316 __field(size_t, count)
1317 ),
1318 TP_fast_assign(
1319 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1320 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001321 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001322 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001323 __entry->offset = offset;
1324 __entry->count = count;
1325 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001326 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001327 "offset 0x%llx count %zd",
1328 MAJOR(__entry->dev), MINOR(__entry->dev),
1329 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001330 __entry->isize,
1331 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001332 __entry->offset,
1333 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001334);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001335
1336#define DEFINE_SIMPLE_IO_EVENT(name) \
1337DEFINE_EVENT(xfs_simple_io_class, name, \
1338 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1339 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001340DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1341DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001342DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001343DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001344DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001345DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1346DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1347DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001348
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001349DECLARE_EVENT_CLASS(xfs_itrunc_class,
1350 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1351 TP_ARGS(ip, new_size),
1352 TP_STRUCT__entry(
1353 __field(dev_t, dev)
1354 __field(xfs_ino_t, ino)
1355 __field(xfs_fsize_t, size)
1356 __field(xfs_fsize_t, new_size)
1357 ),
1358 TP_fast_assign(
1359 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1360 __entry->ino = ip->i_ino;
1361 __entry->size = ip->i_d.di_size;
1362 __entry->new_size = new_size;
1363 ),
1364 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1365 MAJOR(__entry->dev), MINOR(__entry->dev),
1366 __entry->ino,
1367 __entry->size,
1368 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001369)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001370
1371#define DEFINE_ITRUNC_EVENT(name) \
1372DEFINE_EVENT(xfs_itrunc_class, name, \
1373 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1374 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001375DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1376DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001377
1378TRACE_EVENT(xfs_pagecache_inval,
1379 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1380 TP_ARGS(ip, start, finish),
1381 TP_STRUCT__entry(
1382 __field(dev_t, dev)
1383 __field(xfs_ino_t, ino)
1384 __field(xfs_fsize_t, size)
1385 __field(xfs_off_t, start)
1386 __field(xfs_off_t, finish)
1387 ),
1388 TP_fast_assign(
1389 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1390 __entry->ino = ip->i_ino;
1391 __entry->size = ip->i_d.di_size;
1392 __entry->start = start;
1393 __entry->finish = finish;
1394 ),
1395 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1396 MAJOR(__entry->dev), MINOR(__entry->dev),
1397 __entry->ino,
1398 __entry->size,
1399 __entry->start,
1400 __entry->finish)
1401);
1402
1403TRACE_EVENT(xfs_bunmap,
1404 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1405 int flags, unsigned long caller_ip),
1406 TP_ARGS(ip, bno, len, flags, caller_ip),
1407 TP_STRUCT__entry(
1408 __field(dev_t, dev)
1409 __field(xfs_ino_t, ino)
1410 __field(xfs_fsize_t, size)
1411 __field(xfs_fileoff_t, bno)
1412 __field(xfs_filblks_t, len)
1413 __field(unsigned long, caller_ip)
1414 __field(int, flags)
1415 ),
1416 TP_fast_assign(
1417 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1418 __entry->ino = ip->i_ino;
1419 __entry->size = ip->i_d.di_size;
1420 __entry->bno = bno;
1421 __entry->len = len;
1422 __entry->caller_ip = caller_ip;
1423 __entry->flags = flags;
1424 ),
1425 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Scott Wood65dd2972015-03-25 14:56:21 +11001426 "flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001427 MAJOR(__entry->dev), MINOR(__entry->dev),
1428 __entry->ino,
1429 __entry->size,
1430 __entry->bno,
1431 __entry->len,
1432 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1433 (void *)__entry->caller_ip)
1434
1435);
1436
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001437DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001438 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1439 xfs_agblock_t agbno, xfs_extlen_t len),
1440 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001441 TP_STRUCT__entry(
1442 __field(dev_t, dev)
1443 __field(xfs_agnumber_t, agno)
1444 __field(xfs_agblock_t, agbno)
1445 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001446 ),
1447 TP_fast_assign(
1448 __entry->dev = mp->m_super->s_dev;
1449 __entry->agno = agno;
1450 __entry->agbno = agbno;
1451 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001452 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001453 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001454 MAJOR(__entry->dev), MINOR(__entry->dev),
1455 __entry->agno,
1456 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001457 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001458);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001459#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001460DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001461 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1462 xfs_agblock_t agbno, xfs_extlen_t len), \
1463 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001464DEFINE_BUSY_EVENT(xfs_extent_busy);
1465DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1466DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1467DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1468DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001469
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001470TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001471 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1472 xfs_agblock_t agbno, xfs_extlen_t len,
1473 xfs_agblock_t tbno, xfs_extlen_t tlen),
1474 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1475 TP_STRUCT__entry(
1476 __field(dev_t, dev)
1477 __field(xfs_agnumber_t, agno)
1478 __field(xfs_agblock_t, agbno)
1479 __field(xfs_extlen_t, len)
1480 __field(xfs_agblock_t, tbno)
1481 __field(xfs_extlen_t, tlen)
1482 ),
1483 TP_fast_assign(
1484 __entry->dev = mp->m_super->s_dev;
1485 __entry->agno = agno;
1486 __entry->agbno = agbno;
1487 __entry->len = len;
1488 __entry->tbno = tbno;
1489 __entry->tlen = tlen;
1490 ),
1491 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1492 MAJOR(__entry->dev), MINOR(__entry->dev),
1493 __entry->agno,
1494 __entry->agbno,
1495 __entry->len,
1496 __entry->tbno,
1497 __entry->tlen)
1498);
1499
Dave Chinnered3b4d62010-05-21 12:07:08 +10001500TRACE_EVENT(xfs_trans_commit_lsn,
1501 TP_PROTO(struct xfs_trans *trans),
1502 TP_ARGS(trans),
1503 TP_STRUCT__entry(
1504 __field(dev_t, dev)
1505 __field(struct xfs_trans *, tp)
1506 __field(xfs_lsn_t, lsn)
1507 ),
1508 TP_fast_assign(
1509 __entry->dev = trans->t_mountp->m_super->s_dev;
1510 __entry->tp = trans;
1511 __entry->lsn = trans->t_commit_lsn;
1512 ),
1513 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1514 MAJOR(__entry->dev), MINOR(__entry->dev),
1515 __entry->tp,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001516 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001517);
1518
1519TRACE_EVENT(xfs_agf,
1520 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1521 unsigned long caller_ip),
1522 TP_ARGS(mp, agf, flags, caller_ip),
1523 TP_STRUCT__entry(
1524 __field(dev_t, dev)
1525 __field(xfs_agnumber_t, agno)
1526 __field(int, flags)
1527 __field(__u32, length)
1528 __field(__u32, bno_root)
1529 __field(__u32, cnt_root)
1530 __field(__u32, bno_level)
1531 __field(__u32, cnt_level)
1532 __field(__u32, flfirst)
1533 __field(__u32, fllast)
1534 __field(__u32, flcount)
1535 __field(__u32, freeblks)
1536 __field(__u32, longest)
1537 __field(unsigned long, caller_ip)
1538 ),
1539 TP_fast_assign(
1540 __entry->dev = mp->m_super->s_dev;
1541 __entry->agno = be32_to_cpu(agf->agf_seqno),
1542 __entry->flags = flags;
1543 __entry->length = be32_to_cpu(agf->agf_length),
1544 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1545 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1546 __entry->bno_level =
1547 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1548 __entry->cnt_level =
1549 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1550 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1551 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1552 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1553 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1554 __entry->longest = be32_to_cpu(agf->agf_longest);
1555 __entry->caller_ip = caller_ip;
1556 ),
1557 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1558 "levels b %u c %u flfirst %u fllast %u flcount %u "
Scott Wood65dd2972015-03-25 14:56:21 +11001559 "freeblks %u longest %u caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001560 MAJOR(__entry->dev), MINOR(__entry->dev),
1561 __entry->agno,
1562 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1563 __entry->length,
1564 __entry->bno_root,
1565 __entry->cnt_root,
1566 __entry->bno_level,
1567 __entry->cnt_level,
1568 __entry->flfirst,
1569 __entry->fllast,
1570 __entry->flcount,
1571 __entry->freeblks,
1572 __entry->longest,
1573 (void *)__entry->caller_ip)
1574);
1575
1576TRACE_EVENT(xfs_free_extent,
1577 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001578 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1579 int haveright),
1580 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001581 TP_STRUCT__entry(
1582 __field(dev_t, dev)
1583 __field(xfs_agnumber_t, agno)
1584 __field(xfs_agblock_t, agbno)
1585 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001586 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001587 __field(int, haveleft)
1588 __field(int, haveright)
1589 ),
1590 TP_fast_assign(
1591 __entry->dev = mp->m_super->s_dev;
1592 __entry->agno = agno;
1593 __entry->agbno = agbno;
1594 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001595 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001596 __entry->haveleft = haveleft;
1597 __entry->haveright = haveright;
1598 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001599 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001600 MAJOR(__entry->dev), MINOR(__entry->dev),
1601 __entry->agno,
1602 __entry->agbno,
1603 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001604 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001605 __entry->haveleft ?
1606 (__entry->haveright ? "both" : "left") :
1607 (__entry->haveright ? "right" : "none"))
1608
1609);
1610
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001611DECLARE_EVENT_CLASS(xfs_alloc_class,
1612 TP_PROTO(struct xfs_alloc_arg *args),
1613 TP_ARGS(args),
1614 TP_STRUCT__entry(
1615 __field(dev_t, dev)
1616 __field(xfs_agnumber_t, agno)
1617 __field(xfs_agblock_t, agbno)
1618 __field(xfs_extlen_t, minlen)
1619 __field(xfs_extlen_t, maxlen)
1620 __field(xfs_extlen_t, mod)
1621 __field(xfs_extlen_t, prod)
1622 __field(xfs_extlen_t, minleft)
1623 __field(xfs_extlen_t, total)
1624 __field(xfs_extlen_t, alignment)
1625 __field(xfs_extlen_t, minalignslop)
1626 __field(xfs_extlen_t, len)
1627 __field(short, type)
1628 __field(short, otype)
1629 __field(char, wasdel)
1630 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001631 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001632 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001633 __field(xfs_fsblock_t, firstblock)
1634 ),
1635 TP_fast_assign(
1636 __entry->dev = args->mp->m_super->s_dev;
1637 __entry->agno = args->agno;
1638 __entry->agbno = args->agbno;
1639 __entry->minlen = args->minlen;
1640 __entry->maxlen = args->maxlen;
1641 __entry->mod = args->mod;
1642 __entry->prod = args->prod;
1643 __entry->minleft = args->minleft;
1644 __entry->total = args->total;
1645 __entry->alignment = args->alignment;
1646 __entry->minalignslop = args->minalignslop;
1647 __entry->len = args->len;
1648 __entry->type = args->type;
1649 __entry->otype = args->otype;
1650 __entry->wasdel = args->wasdel;
1651 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001652 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001653 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001654 __entry->firstblock = args->firstblock;
1655 ),
1656 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1657 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001658 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001659 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001660 MAJOR(__entry->dev), MINOR(__entry->dev),
1661 __entry->agno,
1662 __entry->agbno,
1663 __entry->minlen,
1664 __entry->maxlen,
1665 __entry->mod,
1666 __entry->prod,
1667 __entry->minleft,
1668 __entry->total,
1669 __entry->alignment,
1670 __entry->minalignslop,
1671 __entry->len,
1672 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1673 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1674 __entry->wasdel,
1675 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001676 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001677 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001678 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001679)
1680
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001681#define DEFINE_ALLOC_EVENT(name) \
1682DEFINE_EVENT(xfs_alloc_class, name, \
1683 TP_PROTO(struct xfs_alloc_arg *args), \
1684 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001685DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001686DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001687DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1688DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1689DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1690DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1691DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1692DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001693DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1694DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001695DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1696DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1697DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1698DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1699DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001700DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001701DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1702DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1703DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1704DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1705DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1706DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1707DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1708DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1709DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1710
Dave Chinner5a5881c2012-03-22 05:15:13 +00001711DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001712 TP_PROTO(struct xfs_da_args *args),
1713 TP_ARGS(args),
1714 TP_STRUCT__entry(
1715 __field(dev_t, dev)
1716 __field(xfs_ino_t, ino)
1717 __dynamic_array(char, name, args->namelen)
1718 __field(int, namelen)
1719 __field(xfs_dahash_t, hashval)
1720 __field(xfs_ino_t, inumber)
1721 __field(int, op_flags)
1722 ),
1723 TP_fast_assign(
1724 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1725 __entry->ino = args->dp->i_ino;
1726 if (args->namelen)
1727 memcpy(__get_str(name), args->name, args->namelen);
1728 __entry->namelen = args->namelen;
1729 __entry->hashval = args->hashval;
1730 __entry->inumber = args->inumber;
1731 __entry->op_flags = args->op_flags;
1732 ),
1733 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1734 "inumber 0x%llx op_flags %s",
1735 MAJOR(__entry->dev), MINOR(__entry->dev),
1736 __entry->ino,
1737 __entry->namelen,
1738 __entry->namelen ? __get_str(name) : NULL,
1739 __entry->namelen,
1740 __entry->hashval,
1741 __entry->inumber,
1742 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001743)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001744
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001745#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001746DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001747 TP_PROTO(struct xfs_da_args *args), \
1748 TP_ARGS(args))
1749DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1750DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1751DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1752DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1753DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1754DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1755DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1756DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1757DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1758DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1759DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1760DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1761DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1762DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1763DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1764DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1765DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1766DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1767DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1768DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1769DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1770DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1771DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1772DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1773DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1774
Dave Chinneree732592012-11-12 22:53:53 +11001775DECLARE_EVENT_CLASS(xfs_attr_class,
1776 TP_PROTO(struct xfs_da_args *args),
1777 TP_ARGS(args),
1778 TP_STRUCT__entry(
1779 __field(dev_t, dev)
1780 __field(xfs_ino_t, ino)
1781 __dynamic_array(char, name, args->namelen)
1782 __field(int, namelen)
1783 __field(int, valuelen)
1784 __field(xfs_dahash_t, hashval)
1785 __field(int, op_flags)
1786 ),
1787 TP_fast_assign(
1788 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1789 __entry->ino = args->dp->i_ino;
1790 if (args->namelen)
1791 memcpy(__get_str(name), args->name, args->namelen);
1792 __entry->namelen = args->namelen;
1793 __entry->valuelen = args->valuelen;
1794 __entry->hashval = args->hashval;
1795 __entry->op_flags = args->op_flags;
1796 ),
1797 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1798 "hashval 0x%x op_flags %s",
1799 MAJOR(__entry->dev), MINOR(__entry->dev),
1800 __entry->ino,
1801 __entry->namelen,
1802 __entry->namelen ? __get_str(name) : NULL,
1803 __entry->namelen,
1804 __entry->valuelen,
1805 __entry->hashval,
1806 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1807)
1808
Dave Chinner5a5881c2012-03-22 05:15:13 +00001809#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001810DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001811 TP_PROTO(struct xfs_da_args *args), \
1812 TP_ARGS(args))
1813DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1814DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1815DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1816DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1817DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1818DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1819DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1820
1821DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1823DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001824DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001825DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001827DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1828DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001829DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001831DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001832DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1834DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1835DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1836DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1837DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1838DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1839DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1840DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1841DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1842DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001843DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001844
1845DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001846DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001847DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1848DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1849DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1850
Dave Chinneree732592012-11-12 22:53:53 +11001851DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1852DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1853
1854DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1855DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1856DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1857
Dave Chinner5a5881c2012-03-22 05:15:13 +00001858#define DEFINE_DA_EVENT(name) \
1859DEFINE_EVENT(xfs_da_class, name, \
1860 TP_PROTO(struct xfs_da_args *args), \
1861 TP_ARGS(args))
1862DEFINE_DA_EVENT(xfs_da_split);
1863DEFINE_DA_EVENT(xfs_da_join);
1864DEFINE_DA_EVENT(xfs_da_link_before);
1865DEFINE_DA_EVENT(xfs_da_link_after);
1866DEFINE_DA_EVENT(xfs_da_unlink_back);
1867DEFINE_DA_EVENT(xfs_da_unlink_forward);
1868DEFINE_DA_EVENT(xfs_da_root_split);
1869DEFINE_DA_EVENT(xfs_da_root_join);
1870DEFINE_DA_EVENT(xfs_da_node_add);
1871DEFINE_DA_EVENT(xfs_da_node_create);
1872DEFINE_DA_EVENT(xfs_da_node_split);
1873DEFINE_DA_EVENT(xfs_da_node_remove);
1874DEFINE_DA_EVENT(xfs_da_node_rebalance);
1875DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001876DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001877DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1878DEFINE_DA_EVENT(xfs_da_grow_inode);
1879DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001880DEFINE_DA_EVENT(xfs_da_fixhashpath);
1881DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001882
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001883DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1884 TP_PROTO(struct xfs_da_args *args, int idx),
1885 TP_ARGS(args, idx),
1886 TP_STRUCT__entry(
1887 __field(dev_t, dev)
1888 __field(xfs_ino_t, ino)
1889 __field(int, op_flags)
1890 __field(int, idx)
1891 ),
1892 TP_fast_assign(
1893 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1894 __entry->ino = args->dp->i_ino;
1895 __entry->op_flags = args->op_flags;
1896 __entry->idx = idx;
1897 ),
1898 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1899 MAJOR(__entry->dev), MINOR(__entry->dev),
1900 __entry->ino,
1901 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1902 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001903)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001904
1905#define DEFINE_DIR2_SPACE_EVENT(name) \
1906DEFINE_EVENT(xfs_dir2_space_class, name, \
1907 TP_PROTO(struct xfs_da_args *args, int idx), \
1908 TP_ARGS(args, idx))
1909DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1910DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1911DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1912DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001913
1914TRACE_EVENT(xfs_dir2_leafn_moveents,
1915 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1916 TP_ARGS(args, src_idx, dst_idx, count),
1917 TP_STRUCT__entry(
1918 __field(dev_t, dev)
1919 __field(xfs_ino_t, ino)
1920 __field(int, op_flags)
1921 __field(int, src_idx)
1922 __field(int, dst_idx)
1923 __field(int, count)
1924 ),
1925 TP_fast_assign(
1926 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1927 __entry->ino = args->dp->i_ino;
1928 __entry->op_flags = args->op_flags;
1929 __entry->src_idx = src_idx;
1930 __entry->dst_idx = dst_idx;
1931 __entry->count = count;
1932 ),
1933 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1934 "src_idx %d dst_idx %d count %d",
1935 MAJOR(__entry->dev), MINOR(__entry->dev),
1936 __entry->ino,
1937 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1938 __entry->src_idx,
1939 __entry->dst_idx,
1940 __entry->count)
1941);
1942
Dave Chinner3a85cd92010-01-14 01:33:55 +00001943#define XFS_SWAPEXT_INODES \
1944 { 0, "target" }, \
1945 { 1, "temp" }
1946
1947#define XFS_INODE_FORMAT_STR \
1948 { 0, "invalid" }, \
1949 { 1, "local" }, \
1950 { 2, "extent" }, \
1951 { 3, "btree" }
1952
1953DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1954 TP_PROTO(struct xfs_inode *ip, int which),
1955 TP_ARGS(ip, which),
1956 TP_STRUCT__entry(
1957 __field(dev_t, dev)
1958 __field(int, which)
1959 __field(xfs_ino_t, ino)
1960 __field(int, format)
1961 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001962 __field(int, broot_size)
1963 __field(int, fork_off)
1964 ),
1965 TP_fast_assign(
1966 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1967 __entry->which = which;
1968 __entry->ino = ip->i_ino;
1969 __entry->format = ip->i_d.di_format;
1970 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001971 __entry->broot_size = ip->i_df.if_broot_bytes;
1972 __entry->fork_off = XFS_IFORK_BOFF(ip);
1973 ),
1974 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001975 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001976 MAJOR(__entry->dev), MINOR(__entry->dev),
1977 __entry->ino,
1978 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1979 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1980 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001981 __entry->broot_size,
1982 __entry->fork_off)
1983)
1984
1985#define DEFINE_SWAPEXT_EVENT(name) \
1986DEFINE_EVENT(xfs_swap_extent_class, name, \
1987 TP_PROTO(struct xfs_inode *ip, int which), \
1988 TP_ARGS(ip, which))
1989
1990DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1991DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1992
Brian Foster5cd9cee2016-09-26 08:34:52 +10001993TRACE_EVENT(xfs_log_recover_record,
1994 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1995 TP_ARGS(log, rhead, pass),
1996 TP_STRUCT__entry(
1997 __field(dev_t, dev)
1998 __field(xfs_lsn_t, lsn)
1999 __field(int, len)
2000 __field(int, num_logops)
2001 __field(int, pass)
2002 ),
2003 TP_fast_assign(
2004 __entry->dev = log->l_mp->m_super->s_dev;
2005 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2006 __entry->len = be32_to_cpu(rhead->h_len);
2007 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2008 __entry->pass = pass;
2009 ),
2010 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2011 MAJOR(__entry->dev), MINOR(__entry->dev),
2012 __entry->lsn, __entry->len, __entry->num_logops,
2013 __entry->pass)
2014)
2015
Dave Chinner9abbc532010-04-13 15:06:46 +10002016DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002017 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002018 struct xlog_recover_item *item, int pass),
2019 TP_ARGS(log, trans, item, pass),
2020 TP_STRUCT__entry(
2021 __field(dev_t, dev)
2022 __field(unsigned long, item)
2023 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002024 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002025 __field(int, type)
2026 __field(int, pass)
2027 __field(int, count)
2028 __field(int, total)
2029 ),
2030 TP_fast_assign(
2031 __entry->dev = log->l_mp->m_super->s_dev;
2032 __entry->item = (unsigned long)item;
2033 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002034 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002035 __entry->type = ITEM_TYPE(item);
2036 __entry->pass = pass;
2037 __entry->count = item->ri_cnt;
2038 __entry->total = item->ri_total;
2039 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002040 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2041 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002042 MAJOR(__entry->dev), MINOR(__entry->dev),
2043 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002044 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002045 __entry->pass,
2046 (void *)__entry->item,
2047 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2048 __entry->count,
2049 __entry->total)
2050)
2051
2052#define DEFINE_LOG_RECOVER_ITEM(name) \
2053DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002054 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002055 struct xlog_recover_item *item, int pass), \
2056 TP_ARGS(log, trans, item, pass))
2057
2058DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2059DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2060DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2061DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2062DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2063
2064DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002065 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002066 TP_ARGS(log, buf_f),
2067 TP_STRUCT__entry(
2068 __field(dev_t, dev)
2069 __field(__int64_t, blkno)
2070 __field(unsigned short, len)
2071 __field(unsigned short, flags)
2072 __field(unsigned short, size)
2073 __field(unsigned int, map_size)
2074 ),
2075 TP_fast_assign(
2076 __entry->dev = log->l_mp->m_super->s_dev;
2077 __entry->blkno = buf_f->blf_blkno;
2078 __entry->len = buf_f->blf_len;
2079 __entry->flags = buf_f->blf_flags;
2080 __entry->size = buf_f->blf_size;
2081 __entry->map_size = buf_f->blf_map_size;
2082 ),
2083 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2084 "map_size %d",
2085 MAJOR(__entry->dev), MINOR(__entry->dev),
2086 __entry->blkno,
2087 __entry->len,
2088 __entry->flags,
2089 __entry->size,
2090 __entry->map_size)
2091)
2092
2093#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2094DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002095 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002096 TP_ARGS(log, buf_f))
2097
2098DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2099DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2100DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2101DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2102DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002103DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002104DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2105DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2106DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2107
2108DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002109 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002110 TP_ARGS(log, in_f),
2111 TP_STRUCT__entry(
2112 __field(dev_t, dev)
2113 __field(xfs_ino_t, ino)
2114 __field(unsigned short, size)
2115 __field(int, fields)
2116 __field(unsigned short, asize)
2117 __field(unsigned short, dsize)
2118 __field(__int64_t, blkno)
2119 __field(int, len)
2120 __field(int, boffset)
2121 ),
2122 TP_fast_assign(
2123 __entry->dev = log->l_mp->m_super->s_dev;
2124 __entry->ino = in_f->ilf_ino;
2125 __entry->size = in_f->ilf_size;
2126 __entry->fields = in_f->ilf_fields;
2127 __entry->asize = in_f->ilf_asize;
2128 __entry->dsize = in_f->ilf_dsize;
2129 __entry->blkno = in_f->ilf_blkno;
2130 __entry->len = in_f->ilf_len;
2131 __entry->boffset = in_f->ilf_boffset;
2132 ),
2133 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2134 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2135 MAJOR(__entry->dev), MINOR(__entry->dev),
2136 __entry->ino,
2137 __entry->size,
2138 __entry->fields,
2139 __entry->asize,
2140 __entry->dsize,
2141 __entry->blkno,
2142 __entry->len,
2143 __entry->boffset)
2144)
2145#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2146DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002147 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002148 TP_ARGS(log, in_f))
2149
2150DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2151DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2152DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2153
Brian Foster78d57e42015-08-19 09:58:48 +10002154DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2155 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2156 TP_ARGS(log, in_f),
2157 TP_STRUCT__entry(
2158 __field(dev_t, dev)
2159 __field(xfs_agnumber_t, agno)
2160 __field(xfs_agblock_t, agbno)
2161 __field(unsigned int, count)
2162 __field(unsigned int, isize)
2163 __field(xfs_agblock_t, length)
2164 __field(unsigned int, gen)
2165 ),
2166 TP_fast_assign(
2167 __entry->dev = log->l_mp->m_super->s_dev;
2168 __entry->agno = be32_to_cpu(in_f->icl_ag);
2169 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2170 __entry->count = be32_to_cpu(in_f->icl_count);
2171 __entry->isize = be32_to_cpu(in_f->icl_isize);
2172 __entry->length = be32_to_cpu(in_f->icl_length);
2173 __entry->gen = be32_to_cpu(in_f->icl_gen);
2174 ),
2175 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2176 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2177 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2178 __entry->length, __entry->gen)
2179)
2180#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2181DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2182 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2183 TP_ARGS(log, in_f))
2184
2185DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2186DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2187
Christoph Hellwiga46db602011-01-07 13:02:04 +00002188DECLARE_EVENT_CLASS(xfs_discard_class,
2189 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2190 xfs_agblock_t agbno, xfs_extlen_t len),
2191 TP_ARGS(mp, agno, agbno, len),
2192 TP_STRUCT__entry(
2193 __field(dev_t, dev)
2194 __field(xfs_agnumber_t, agno)
2195 __field(xfs_agblock_t, agbno)
2196 __field(xfs_extlen_t, len)
2197 ),
2198 TP_fast_assign(
2199 __entry->dev = mp->m_super->s_dev;
2200 __entry->agno = agno;
2201 __entry->agbno = agbno;
2202 __entry->len = len;
2203 ),
2204 TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2205 MAJOR(__entry->dev), MINOR(__entry->dev),
2206 __entry->agno,
2207 __entry->agbno,
2208 __entry->len)
2209)
2210
2211#define DEFINE_DISCARD_EVENT(name) \
2212DEFINE_EVENT(xfs_discard_class, name, \
2213 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2214 xfs_agblock_t agbno, xfs_extlen_t len), \
2215 TP_ARGS(mp, agno, agbno, len))
2216DEFINE_DISCARD_EVENT(xfs_discard_extent);
2217DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2218DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2219DEFINE_DISCARD_EVENT(xfs_discard_busy);
2220
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002221/* btree cursor events */
2222DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2223 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2224 TP_ARGS(cur, level, bp),
2225 TP_STRUCT__entry(
2226 __field(dev_t, dev)
2227 __field(xfs_btnum_t, btnum)
2228 __field(int, level)
2229 __field(int, nlevels)
2230 __field(int, ptr)
2231 __field(xfs_daddr_t, daddr)
2232 ),
2233 TP_fast_assign(
2234 __entry->dev = cur->bc_mp->m_super->s_dev;
2235 __entry->btnum = cur->bc_btnum;
2236 __entry->level = level;
2237 __entry->nlevels = cur->bc_nlevels;
2238 __entry->ptr = cur->bc_ptrs[level];
2239 __entry->daddr = bp ? bp->b_bn : -1;
2240 ),
2241 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2242 MAJOR(__entry->dev), MINOR(__entry->dev),
2243 __entry->btnum,
2244 __entry->level,
2245 __entry->nlevels,
2246 __entry->ptr,
2247 (unsigned long long)__entry->daddr)
2248)
2249
2250#define DEFINE_BTREE_CUR_EVENT(name) \
2251DEFINE_EVENT(xfs_btree_cur_class, name, \
2252 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2253 TP_ARGS(cur, level, bp))
2254DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002255DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002256
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002257/* deferred ops */
2258struct xfs_defer_pending;
2259struct xfs_defer_intake;
2260struct xfs_defer_ops;
2261
2262DECLARE_EVENT_CLASS(xfs_defer_class,
2263 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2264 TP_ARGS(mp, dop),
2265 TP_STRUCT__entry(
2266 __field(dev_t, dev)
2267 __field(void *, dop)
2268 __field(bool, committed)
2269 __field(bool, low)
2270 ),
2271 TP_fast_assign(
2272 __entry->dev = mp ? mp->m_super->s_dev : 0;
2273 __entry->dop = dop;
2274 __entry->committed = dop->dop_committed;
2275 __entry->low = dop->dop_low;
2276 ),
2277 TP_printk("dev %d:%d ops %p committed %d low %d\n",
2278 MAJOR(__entry->dev), MINOR(__entry->dev),
2279 __entry->dop,
2280 __entry->committed,
2281 __entry->low)
2282)
2283#define DEFINE_DEFER_EVENT(name) \
2284DEFINE_EVENT(xfs_defer_class, name, \
2285 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2286 TP_ARGS(mp, dop))
2287
2288DECLARE_EVENT_CLASS(xfs_defer_error_class,
2289 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2290 TP_ARGS(mp, dop, error),
2291 TP_STRUCT__entry(
2292 __field(dev_t, dev)
2293 __field(void *, dop)
2294 __field(bool, committed)
2295 __field(bool, low)
2296 __field(int, error)
2297 ),
2298 TP_fast_assign(
2299 __entry->dev = mp ? mp->m_super->s_dev : 0;
2300 __entry->dop = dop;
2301 __entry->committed = dop->dop_committed;
2302 __entry->low = dop->dop_low;
2303 __entry->error = error;
2304 ),
2305 TP_printk("dev %d:%d ops %p committed %d low %d err %d\n",
2306 MAJOR(__entry->dev), MINOR(__entry->dev),
2307 __entry->dop,
2308 __entry->committed,
2309 __entry->low,
2310 __entry->error)
2311)
2312#define DEFINE_DEFER_ERROR_EVENT(name) \
2313DEFINE_EVENT(xfs_defer_error_class, name, \
2314 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2315 TP_ARGS(mp, dop, error))
2316
2317DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2318 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2319 TP_ARGS(mp, dfp),
2320 TP_STRUCT__entry(
2321 __field(dev_t, dev)
2322 __field(int, type)
2323 __field(void *, intent)
2324 __field(bool, committed)
2325 __field(int, nr)
2326 ),
2327 TP_fast_assign(
2328 __entry->dev = mp ? mp->m_super->s_dev : 0;
2329 __entry->type = dfp->dfp_type->type;
2330 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002331 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002332 __entry->nr = dfp->dfp_count;
2333 ),
2334 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d\n",
2335 MAJOR(__entry->dev), MINOR(__entry->dev),
2336 __entry->type,
2337 __entry->intent,
2338 __entry->committed,
2339 __entry->nr)
2340)
2341#define DEFINE_DEFER_PENDING_EVENT(name) \
2342DEFINE_EVENT(xfs_defer_pending_class, name, \
2343 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2344 TP_ARGS(mp, dfp))
2345
2346DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2347 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2348 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2349 TP_ARGS(mp, agno, type, agbno, len),
2350 TP_STRUCT__entry(
2351 __field(dev_t, dev)
2352 __field(xfs_agnumber_t, agno)
2353 __field(int, type)
2354 __field(xfs_agblock_t, agbno)
2355 __field(xfs_extlen_t, len)
2356 ),
2357 TP_fast_assign(
2358 __entry->dev = mp->m_super->s_dev;
2359 __entry->agno = agno;
2360 __entry->type = type;
2361 __entry->agbno = agbno;
2362 __entry->len = len;
2363 ),
2364 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2365 MAJOR(__entry->dev), MINOR(__entry->dev),
2366 __entry->type,
2367 __entry->agno,
2368 __entry->agbno,
2369 __entry->len)
2370);
2371#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2372DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2373 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2374 int type, \
2375 xfs_agblock_t bno, \
2376 xfs_extlen_t len), \
2377 TP_ARGS(mp, agno, type, bno, len))
2378
2379DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2380 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2381 int op,
2382 xfs_agblock_t agbno,
2383 xfs_ino_t ino,
2384 int whichfork,
2385 xfs_fileoff_t offset,
2386 xfs_filblks_t len,
2387 xfs_exntst_t state),
2388 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2389 TP_STRUCT__entry(
2390 __field(dev_t, dev)
2391 __field(xfs_agnumber_t, agno)
2392 __field(xfs_ino_t, ino)
2393 __field(xfs_agblock_t, agbno)
2394 __field(int, whichfork)
2395 __field(xfs_fileoff_t, l_loff)
2396 __field(xfs_filblks_t, l_len)
2397 __field(xfs_exntst_t, l_state)
2398 __field(int, op)
2399 ),
2400 TP_fast_assign(
2401 __entry->dev = mp->m_super->s_dev;
2402 __entry->agno = agno;
2403 __entry->ino = ino;
2404 __entry->agbno = agbno;
2405 __entry->whichfork = whichfork;
2406 __entry->l_loff = offset;
2407 __entry->l_len = len;
2408 __entry->l_state = state;
2409 __entry->op = op;
2410 ),
2411 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2412 MAJOR(__entry->dev), MINOR(__entry->dev),
2413 __entry->op,
2414 __entry->agno,
2415 __entry->agbno,
2416 __entry->ino,
2417 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2418 __entry->l_loff,
2419 __entry->l_len,
2420 __entry->l_state)
2421);
2422#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2423DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2424 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2425 int op, \
2426 xfs_agblock_t agbno, \
2427 xfs_ino_t ino, \
2428 int whichfork, \
2429 xfs_fileoff_t offset, \
2430 xfs_filblks_t len, \
2431 xfs_exntst_t state), \
2432 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2433
2434DEFINE_DEFER_EVENT(xfs_defer_init);
2435DEFINE_DEFER_EVENT(xfs_defer_cancel);
2436DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2437DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2438DEFINE_DEFER_EVENT(xfs_defer_finish);
2439DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2440
2441DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2442DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2443DEFINE_DEFER_ERROR_EVENT(xfs_defer_op_finish_error);
2444
2445DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2446DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
2447DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_commit);
2448DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2449DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2450DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2451
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002452#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2453DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2454DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2455
Darrick J. Wong673930c2016-08-03 11:33:43 +10002456/* rmap tracepoints */
2457DECLARE_EVENT_CLASS(xfs_rmap_class,
2458 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2459 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2460 struct xfs_owner_info *oinfo),
2461 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2462 TP_STRUCT__entry(
2463 __field(dev_t, dev)
2464 __field(xfs_agnumber_t, agno)
2465 __field(xfs_agblock_t, agbno)
2466 __field(xfs_extlen_t, len)
2467 __field(uint64_t, owner)
2468 __field(uint64_t, offset)
2469 __field(unsigned long, flags)
2470 ),
2471 TP_fast_assign(
2472 __entry->dev = mp->m_super->s_dev;
2473 __entry->agno = agno;
2474 __entry->agbno = agbno;
2475 __entry->len = len;
2476 __entry->owner = oinfo->oi_owner;
2477 __entry->offset = oinfo->oi_offset;
2478 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002479 if (unwritten)
2480 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002481 ),
2482 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2483 MAJOR(__entry->dev), MINOR(__entry->dev),
2484 __entry->agno,
2485 __entry->agbno,
2486 __entry->len,
2487 __entry->owner,
2488 __entry->offset,
2489 __entry->flags)
2490);
2491#define DEFINE_RMAP_EVENT(name) \
2492DEFINE_EVENT(xfs_rmap_class, name, \
2493 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2494 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2495 struct xfs_owner_info *oinfo), \
2496 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2497
2498/* simple AG-based error/%ip tracepoint class */
2499DECLARE_EVENT_CLASS(xfs_ag_error_class,
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 TP_STRUCT__entry(
2504 __field(dev_t, dev)
2505 __field(xfs_agnumber_t, agno)
2506 __field(int, error)
2507 __field(unsigned long, caller_ip)
2508 ),
2509 TP_fast_assign(
2510 __entry->dev = mp->m_super->s_dev;
2511 __entry->agno = agno;
2512 __entry->error = error;
2513 __entry->caller_ip = caller_ip;
2514 ),
2515 TP_printk("dev %d:%d agno %u error %d caller %ps",
2516 MAJOR(__entry->dev), MINOR(__entry->dev),
2517 __entry->agno,
2518 __entry->error,
2519 (char *)__entry->caller_ip)
2520);
2521
2522#define DEFINE_AG_ERROR_EVENT(name) \
2523DEFINE_EVENT(xfs_ag_error_class, name, \
2524 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2525 unsigned long caller_ip), \
2526 TP_ARGS(mp, agno, error, caller_ip))
2527
2528DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2529DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2530DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2531DEFINE_RMAP_EVENT(xfs_rmap_map);
2532DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2533DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002534DEFINE_RMAP_EVENT(xfs_rmap_convert);
2535DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2536DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2537DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002538
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002539DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2540 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2541 xfs_agblock_t agbno, xfs_extlen_t len,
2542 uint64_t owner, uint64_t offset, unsigned int flags),
2543 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2544 TP_STRUCT__entry(
2545 __field(dev_t, dev)
2546 __field(xfs_agnumber_t, agno)
2547 __field(xfs_agblock_t, agbno)
2548 __field(xfs_extlen_t, len)
2549 __field(uint64_t, owner)
2550 __field(uint64_t, offset)
2551 __field(unsigned int, flags)
2552 ),
2553 TP_fast_assign(
2554 __entry->dev = mp->m_super->s_dev;
2555 __entry->agno = agno;
2556 __entry->agbno = agbno;
2557 __entry->len = len;
2558 __entry->owner = owner;
2559 __entry->offset = offset;
2560 __entry->flags = flags;
2561 ),
2562 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2563 MAJOR(__entry->dev), MINOR(__entry->dev),
2564 __entry->agno,
2565 __entry->agbno,
2566 __entry->len,
2567 __entry->owner,
2568 __entry->offset,
2569 __entry->flags)
2570);
2571#define DEFINE_RMAPBT_EVENT(name) \
2572DEFINE_EVENT(xfs_rmapbt_class, name, \
2573 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2574 xfs_agblock_t agbno, xfs_extlen_t len, \
2575 uint64_t owner, uint64_t offset, unsigned int flags), \
2576 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2577
2578#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2579DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2580DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2581
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002582DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2583DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002584DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2585DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2586DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2587DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2588DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2589DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002590
2591DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2592DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2593DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2594DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002595DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2596DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002597DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002598
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002599/* deferred bmbt updates */
2600#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2601DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2602DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2603
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002604/* per-AG reservation */
2605DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2606 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2607 xfs_extlen_t len),
2608 TP_ARGS(pag, resv, len),
2609 TP_STRUCT__entry(
2610 __field(dev_t, dev)
2611 __field(xfs_agnumber_t, agno)
2612 __field(int, resv)
2613 __field(xfs_extlen_t, freeblks)
2614 __field(xfs_extlen_t, flcount)
2615 __field(xfs_extlen_t, reserved)
2616 __field(xfs_extlen_t, asked)
2617 __field(xfs_extlen_t, len)
2618 ),
2619 TP_fast_assign(
2620 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2621
2622 __entry->dev = pag->pag_mount->m_super->s_dev;
2623 __entry->agno = pag->pag_agno;
2624 __entry->resv = resv;
2625 __entry->freeblks = pag->pagf_freeblks;
2626 __entry->flcount = pag->pagf_flcount;
2627 __entry->reserved = r ? r->ar_reserved : 0;
2628 __entry->asked = r ? r->ar_asked : 0;
2629 __entry->len = len;
2630 ),
2631 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u resv %u ask %u len %u\n",
2632 MAJOR(__entry->dev), MINOR(__entry->dev),
2633 __entry->agno,
2634 __entry->resv,
2635 __entry->freeblks,
2636 __entry->flcount,
2637 __entry->reserved,
2638 __entry->asked,
2639 __entry->len)
2640)
2641#define DEFINE_AG_RESV_EVENT(name) \
2642DEFINE_EVENT(xfs_ag_resv_class, name, \
2643 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2644 xfs_extlen_t len), \
2645 TP_ARGS(pag, type, len))
2646
2647/* per-AG reservation tracepoints */
2648DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2649DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2650DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2651DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2652DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2653DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2654
2655DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2656DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2657
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002658/* refcount tracepoint classes */
2659
2660/* reuse the discard trace class for agbno/aglen-based traces */
2661#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2662
2663/* ag btree lookup tracepoint class */
2664#define XFS_AG_BTREE_CMP_FORMAT_STR \
2665 { XFS_LOOKUP_EQ, "eq" }, \
2666 { XFS_LOOKUP_LE, "le" }, \
2667 { XFS_LOOKUP_GE, "ge" }
2668DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2669 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2670 xfs_agblock_t agbno, xfs_lookup_t dir),
2671 TP_ARGS(mp, agno, agbno, dir),
2672 TP_STRUCT__entry(
2673 __field(dev_t, dev)
2674 __field(xfs_agnumber_t, agno)
2675 __field(xfs_agblock_t, agbno)
2676 __field(xfs_lookup_t, dir)
2677 ),
2678 TP_fast_assign(
2679 __entry->dev = mp->m_super->s_dev;
2680 __entry->agno = agno;
2681 __entry->agbno = agbno;
2682 __entry->dir = dir;
2683 ),
2684 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)\n",
2685 MAJOR(__entry->dev), MINOR(__entry->dev),
2686 __entry->agno,
2687 __entry->agbno,
2688 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2689 __entry->dir)
2690)
2691
2692#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2693DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2694 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2695 xfs_agblock_t agbno, xfs_lookup_t dir), \
2696 TP_ARGS(mp, agno, agbno, dir))
2697
2698/* single-rcext tracepoint class */
2699DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2700 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2701 struct xfs_refcount_irec *irec),
2702 TP_ARGS(mp, agno, irec),
2703 TP_STRUCT__entry(
2704 __field(dev_t, dev)
2705 __field(xfs_agnumber_t, agno)
2706 __field(xfs_agblock_t, startblock)
2707 __field(xfs_extlen_t, blockcount)
2708 __field(xfs_nlink_t, refcount)
2709 ),
2710 TP_fast_assign(
2711 __entry->dev = mp->m_super->s_dev;
2712 __entry->agno = agno;
2713 __entry->startblock = irec->rc_startblock;
2714 __entry->blockcount = irec->rc_blockcount;
2715 __entry->refcount = irec->rc_refcount;
2716 ),
2717 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u\n",
2718 MAJOR(__entry->dev), MINOR(__entry->dev),
2719 __entry->agno,
2720 __entry->startblock,
2721 __entry->blockcount,
2722 __entry->refcount)
2723)
2724
2725#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2726DEFINE_EVENT(xfs_refcount_extent_class, name, \
2727 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2728 struct xfs_refcount_irec *irec), \
2729 TP_ARGS(mp, agno, irec))
2730
2731/* single-rcext and an agbno tracepoint class */
2732DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2733 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2734 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2735 TP_ARGS(mp, agno, irec, agbno),
2736 TP_STRUCT__entry(
2737 __field(dev_t, dev)
2738 __field(xfs_agnumber_t, agno)
2739 __field(xfs_agblock_t, startblock)
2740 __field(xfs_extlen_t, blockcount)
2741 __field(xfs_nlink_t, refcount)
2742 __field(xfs_agblock_t, agbno)
2743 ),
2744 TP_fast_assign(
2745 __entry->dev = mp->m_super->s_dev;
2746 __entry->agno = agno;
2747 __entry->startblock = irec->rc_startblock;
2748 __entry->blockcount = irec->rc_blockcount;
2749 __entry->refcount = irec->rc_refcount;
2750 __entry->agbno = agbno;
2751 ),
2752 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u\n",
2753 MAJOR(__entry->dev), MINOR(__entry->dev),
2754 __entry->agno,
2755 __entry->startblock,
2756 __entry->blockcount,
2757 __entry->refcount,
2758 __entry->agbno)
2759)
2760
2761#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2762DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2763 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2764 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2765 TP_ARGS(mp, agno, irec, agbno))
2766
2767/* double-rcext tracepoint class */
2768DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2769 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2770 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2771 TP_ARGS(mp, agno, i1, i2),
2772 TP_STRUCT__entry(
2773 __field(dev_t, dev)
2774 __field(xfs_agnumber_t, agno)
2775 __field(xfs_agblock_t, i1_startblock)
2776 __field(xfs_extlen_t, i1_blockcount)
2777 __field(xfs_nlink_t, i1_refcount)
2778 __field(xfs_agblock_t, i2_startblock)
2779 __field(xfs_extlen_t, i2_blockcount)
2780 __field(xfs_nlink_t, i2_refcount)
2781 ),
2782 TP_fast_assign(
2783 __entry->dev = mp->m_super->s_dev;
2784 __entry->agno = agno;
2785 __entry->i1_startblock = i1->rc_startblock;
2786 __entry->i1_blockcount = i1->rc_blockcount;
2787 __entry->i1_refcount = i1->rc_refcount;
2788 __entry->i2_startblock = i2->rc_startblock;
2789 __entry->i2_blockcount = i2->rc_blockcount;
2790 __entry->i2_refcount = i2->rc_refcount;
2791 ),
2792 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2793 "agbno %u len %u refcount %u\n",
2794 MAJOR(__entry->dev), MINOR(__entry->dev),
2795 __entry->agno,
2796 __entry->i1_startblock,
2797 __entry->i1_blockcount,
2798 __entry->i1_refcount,
2799 __entry->i2_startblock,
2800 __entry->i2_blockcount,
2801 __entry->i2_refcount)
2802)
2803
2804#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2805DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2806 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2807 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2808 TP_ARGS(mp, agno, i1, i2))
2809
2810/* double-rcext and an agbno tracepoint class */
2811DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2812 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2813 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2814 xfs_agblock_t agbno),
2815 TP_ARGS(mp, agno, i1, i2, agbno),
2816 TP_STRUCT__entry(
2817 __field(dev_t, dev)
2818 __field(xfs_agnumber_t, agno)
2819 __field(xfs_agblock_t, i1_startblock)
2820 __field(xfs_extlen_t, i1_blockcount)
2821 __field(xfs_nlink_t, i1_refcount)
2822 __field(xfs_agblock_t, i2_startblock)
2823 __field(xfs_extlen_t, i2_blockcount)
2824 __field(xfs_nlink_t, i2_refcount)
2825 __field(xfs_agblock_t, agbno)
2826 ),
2827 TP_fast_assign(
2828 __entry->dev = mp->m_super->s_dev;
2829 __entry->agno = agno;
2830 __entry->i1_startblock = i1->rc_startblock;
2831 __entry->i1_blockcount = i1->rc_blockcount;
2832 __entry->i1_refcount = i1->rc_refcount;
2833 __entry->i2_startblock = i2->rc_startblock;
2834 __entry->i2_blockcount = i2->rc_blockcount;
2835 __entry->i2_refcount = i2->rc_refcount;
2836 __entry->agbno = agbno;
2837 ),
2838 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2839 "agbno %u len %u refcount %u @ agbno %u\n",
2840 MAJOR(__entry->dev), MINOR(__entry->dev),
2841 __entry->agno,
2842 __entry->i1_startblock,
2843 __entry->i1_blockcount,
2844 __entry->i1_refcount,
2845 __entry->i2_startblock,
2846 __entry->i2_blockcount,
2847 __entry->i2_refcount,
2848 __entry->agbno)
2849)
2850
2851#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2852DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2853 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2854 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2855 xfs_agblock_t agbno), \
2856 TP_ARGS(mp, agno, i1, i2, agbno))
2857
2858/* triple-rcext tracepoint class */
2859DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2860 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2861 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2862 struct xfs_refcount_irec *i3),
2863 TP_ARGS(mp, agno, i1, i2, i3),
2864 TP_STRUCT__entry(
2865 __field(dev_t, dev)
2866 __field(xfs_agnumber_t, agno)
2867 __field(xfs_agblock_t, i1_startblock)
2868 __field(xfs_extlen_t, i1_blockcount)
2869 __field(xfs_nlink_t, i1_refcount)
2870 __field(xfs_agblock_t, i2_startblock)
2871 __field(xfs_extlen_t, i2_blockcount)
2872 __field(xfs_nlink_t, i2_refcount)
2873 __field(xfs_agblock_t, i3_startblock)
2874 __field(xfs_extlen_t, i3_blockcount)
2875 __field(xfs_nlink_t, i3_refcount)
2876 ),
2877 TP_fast_assign(
2878 __entry->dev = mp->m_super->s_dev;
2879 __entry->agno = agno;
2880 __entry->i1_startblock = i1->rc_startblock;
2881 __entry->i1_blockcount = i1->rc_blockcount;
2882 __entry->i1_refcount = i1->rc_refcount;
2883 __entry->i2_startblock = i2->rc_startblock;
2884 __entry->i2_blockcount = i2->rc_blockcount;
2885 __entry->i2_refcount = i2->rc_refcount;
2886 __entry->i3_startblock = i3->rc_startblock;
2887 __entry->i3_blockcount = i3->rc_blockcount;
2888 __entry->i3_refcount = i3->rc_refcount;
2889 ),
2890 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2891 "agbno %u len %u refcount %u -- "
2892 "agbno %u len %u refcount %u\n",
2893 MAJOR(__entry->dev), MINOR(__entry->dev),
2894 __entry->agno,
2895 __entry->i1_startblock,
2896 __entry->i1_blockcount,
2897 __entry->i1_refcount,
2898 __entry->i2_startblock,
2899 __entry->i2_blockcount,
2900 __entry->i2_refcount,
2901 __entry->i3_startblock,
2902 __entry->i3_blockcount,
2903 __entry->i3_refcount)
2904);
2905
2906#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2907DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2908 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2909 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2910 struct xfs_refcount_irec *i3), \
2911 TP_ARGS(mp, agno, i1, i2, i3))
2912
2913/* refcount btree tracepoints */
2914DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2915DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2916DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2917DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2918DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2919DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2920DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2921DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2922DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2923DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2924
2925/* refcount adjustment tracepoints */
2926DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2927DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002928DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2929DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002930DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2931DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002932DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002933DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2934DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2935DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2936DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2937DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2938DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002939DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002940DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2941DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2942DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2943DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2944DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2945DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2946DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2947
2948/* reflink helpers */
2949DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2950DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2951DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba6122016-10-03 09:11:22 -07002952#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2953DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2954DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002955
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002956TRACE_EVENT(xfs_refcount_finish_one_leftover,
2957 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2958 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2959 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2960 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2961 TP_STRUCT__entry(
2962 __field(dev_t, dev)
2963 __field(xfs_agnumber_t, agno)
2964 __field(int, type)
2965 __field(xfs_agblock_t, agbno)
2966 __field(xfs_extlen_t, len)
2967 __field(xfs_agblock_t, new_agbno)
2968 __field(xfs_extlen_t, new_len)
2969 ),
2970 TP_fast_assign(
2971 __entry->dev = mp->m_super->s_dev;
2972 __entry->agno = agno;
2973 __entry->type = type;
2974 __entry->agbno = agbno;
2975 __entry->len = len;
2976 __entry->new_agbno = new_agbno;
2977 __entry->new_len = new_len;
2978 ),
2979 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2980 MAJOR(__entry->dev), MINOR(__entry->dev),
2981 __entry->type,
2982 __entry->agno,
2983 __entry->agbno,
2984 __entry->len,
2985 __entry->new_agbno,
2986 __entry->new_len)
2987);
2988
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002989/* simple inode-based error/%ip tracepoint class */
2990DECLARE_EVENT_CLASS(xfs_inode_error_class,
2991 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2992 TP_ARGS(ip, error, caller_ip),
2993 TP_STRUCT__entry(
2994 __field(dev_t, dev)
2995 __field(xfs_ino_t, ino)
2996 __field(int, error)
2997 __field(unsigned long, caller_ip)
2998 ),
2999 TP_fast_assign(
3000 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3001 __entry->ino = ip->i_ino;
3002 __entry->error = error;
3003 __entry->caller_ip = caller_ip;
3004 ),
3005 TP_printk("dev %d:%d ino %llx error %d caller %ps",
3006 MAJOR(__entry->dev), MINOR(__entry->dev),
3007 __entry->ino,
3008 __entry->error,
3009 (char *)__entry->caller_ip)
3010);
3011
3012#define DEFINE_INODE_ERROR_EVENT(name) \
3013DEFINE_EVENT(xfs_inode_error_class, name, \
3014 TP_PROTO(struct xfs_inode *ip, int error, \
3015 unsigned long caller_ip), \
3016 TP_ARGS(ip, error, caller_ip))
3017
3018/* reflink allocator */
3019TRACE_EVENT(xfs_bmap_remap_alloc,
3020 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t fsbno,
3021 xfs_extlen_t len),
3022 TP_ARGS(ip, fsbno, len),
3023 TP_STRUCT__entry(
3024 __field(dev_t, dev)
3025 __field(xfs_ino_t, ino)
3026 __field(xfs_fsblock_t, fsbno)
3027 __field(xfs_extlen_t, len)
3028 ),
3029 TP_fast_assign(
3030 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3031 __entry->ino = ip->i_ino;
3032 __entry->fsbno = fsbno;
3033 __entry->len = len;
3034 ),
3035 TP_printk("dev %d:%d ino 0x%llx fsbno 0x%llx len %x",
3036 MAJOR(__entry->dev), MINOR(__entry->dev),
3037 __entry->ino,
3038 __entry->fsbno,
3039 __entry->len)
3040);
3041DEFINE_INODE_ERROR_EVENT(xfs_bmap_remap_alloc_error);
3042
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003043/* reflink tracepoint classes */
3044
3045/* two-file io tracepoint class */
3046DECLARE_EVENT_CLASS(xfs_double_io_class,
3047 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3048 struct xfs_inode *dest, xfs_off_t doffset),
3049 TP_ARGS(src, soffset, len, dest, doffset),
3050 TP_STRUCT__entry(
3051 __field(dev_t, dev)
3052 __field(xfs_ino_t, src_ino)
3053 __field(loff_t, src_isize)
3054 __field(loff_t, src_disize)
3055 __field(loff_t, src_offset)
3056 __field(size_t, len)
3057 __field(xfs_ino_t, dest_ino)
3058 __field(loff_t, dest_isize)
3059 __field(loff_t, dest_disize)
3060 __field(loff_t, dest_offset)
3061 ),
3062 TP_fast_assign(
3063 __entry->dev = VFS_I(src)->i_sb->s_dev;
3064 __entry->src_ino = src->i_ino;
3065 __entry->src_isize = VFS_I(src)->i_size;
3066 __entry->src_disize = src->i_d.di_size;
3067 __entry->src_offset = soffset;
3068 __entry->len = len;
3069 __entry->dest_ino = dest->i_ino;
3070 __entry->dest_isize = VFS_I(dest)->i_size;
3071 __entry->dest_disize = dest->i_d.di_size;
3072 __entry->dest_offset = doffset;
3073 ),
3074 TP_printk("dev %d:%d count %zd "
3075 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3076 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3077 MAJOR(__entry->dev), MINOR(__entry->dev),
3078 __entry->len,
3079 __entry->src_ino,
3080 __entry->src_isize,
3081 __entry->src_disize,
3082 __entry->src_offset,
3083 __entry->dest_ino,
3084 __entry->dest_isize,
3085 __entry->dest_disize,
3086 __entry->dest_offset)
3087)
3088
3089#define DEFINE_DOUBLE_IO_EVENT(name) \
3090DEFINE_EVENT(xfs_double_io_class, name, \
3091 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3092 struct xfs_inode *dest, xfs_off_t doffset), \
3093 TP_ARGS(src, soffset, len, dest, doffset))
3094
3095/* two-file vfs io tracepoint class */
3096DECLARE_EVENT_CLASS(xfs_double_vfs_io_class,
3097 TP_PROTO(struct inode *src, u64 soffset, u64 len,
3098 struct inode *dest, u64 doffset),
3099 TP_ARGS(src, soffset, len, dest, doffset),
3100 TP_STRUCT__entry(
3101 __field(dev_t, dev)
3102 __field(unsigned long, src_ino)
3103 __field(loff_t, src_isize)
3104 __field(loff_t, src_offset)
3105 __field(size_t, len)
3106 __field(unsigned long, dest_ino)
3107 __field(loff_t, dest_isize)
3108 __field(loff_t, dest_offset)
3109 ),
3110 TP_fast_assign(
3111 __entry->dev = src->i_sb->s_dev;
3112 __entry->src_ino = src->i_ino;
3113 __entry->src_isize = i_size_read(src);
3114 __entry->src_offset = soffset;
3115 __entry->len = len;
3116 __entry->dest_ino = dest->i_ino;
3117 __entry->dest_isize = i_size_read(dest);
3118 __entry->dest_offset = doffset;
3119 ),
3120 TP_printk("dev %d:%d count %zd "
3121 "ino 0x%lx isize 0x%llx offset 0x%llx -> "
3122 "ino 0x%lx isize 0x%llx offset 0x%llx",
3123 MAJOR(__entry->dev), MINOR(__entry->dev),
3124 __entry->len,
3125 __entry->src_ino,
3126 __entry->src_isize,
3127 __entry->src_offset,
3128 __entry->dest_ino,
3129 __entry->dest_isize,
3130 __entry->dest_offset)
3131)
3132
3133#define DEFINE_DOUBLE_VFS_IO_EVENT(name) \
3134DEFINE_EVENT(xfs_double_vfs_io_class, name, \
3135 TP_PROTO(struct inode *src, u64 soffset, u64 len, \
3136 struct inode *dest, u64 doffset), \
3137 TP_ARGS(src, soffset, len, dest, doffset))
3138
3139/* CoW write tracepoint */
3140DECLARE_EVENT_CLASS(xfs_copy_on_write_class,
3141 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk,
3142 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3143 TP_ARGS(ip, lblk, pblk, 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_fsblock_t, pblk)
3149 __field(xfs_extlen_t, len)
3150 __field(xfs_fsblock_t, new_pblk)
3151 ),
3152 TP_fast_assign(
3153 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3154 __entry->ino = ip->i_ino;
3155 __entry->lblk = lblk;
3156 __entry->pblk = pblk;
3157 __entry->len = len;
3158 __entry->new_pblk = new_pblk;
3159 ),
3160 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx pblk 0x%llx "
3161 "len 0x%x new_pblk %llu",
3162 MAJOR(__entry->dev), MINOR(__entry->dev),
3163 __entry->ino,
3164 __entry->lblk,
3165 __entry->pblk,
3166 __entry->len,
3167 __entry->new_pblk)
3168)
3169
3170#define DEFINE_COW_EVENT(name) \
3171DEFINE_EVENT(xfs_copy_on_write_class, name, \
3172 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk, \
3173 xfs_extlen_t len, xfs_fsblock_t new_pblk), \
3174 TP_ARGS(ip, lblk, pblk, len, new_pblk))
3175
3176/* inode/irec events */
3177DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3178 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3179 TP_ARGS(ip, irec),
3180 TP_STRUCT__entry(
3181 __field(dev_t, dev)
3182 __field(xfs_ino_t, ino)
3183 __field(xfs_fileoff_t, lblk)
3184 __field(xfs_extlen_t, len)
3185 __field(xfs_fsblock_t, pblk)
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003186 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003187 ),
3188 TP_fast_assign(
3189 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3190 __entry->ino = ip->i_ino;
3191 __entry->lblk = irec->br_startoff;
3192 __entry->len = irec->br_blockcount;
3193 __entry->pblk = irec->br_startblock;
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003194 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003195 ),
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003196 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 -07003197 MAJOR(__entry->dev), MINOR(__entry->dev),
3198 __entry->ino,
3199 __entry->lblk,
3200 __entry->len,
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003201 __entry->pblk,
3202 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003203);
3204#define DEFINE_INODE_IREC_EVENT(name) \
3205DEFINE_EVENT(xfs_inode_irec_class, name, \
3206 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3207 TP_ARGS(ip, irec))
3208
3209/* refcount/reflink tracepoint definitions */
3210
3211/* reflink tracepoints */
3212DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3213DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3214DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3215DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3216TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3217 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3218 xfs_filblks_t len, struct xfs_inode *dest,
3219 xfs_fileoff_t doffset),
3220 TP_ARGS(src, soffset, len, dest, doffset),
3221 TP_STRUCT__entry(
3222 __field(dev_t, dev)
3223 __field(xfs_ino_t, src_ino)
3224 __field(xfs_fileoff_t, src_lblk)
3225 __field(xfs_filblks_t, len)
3226 __field(xfs_ino_t, dest_ino)
3227 __field(xfs_fileoff_t, dest_lblk)
3228 ),
3229 TP_fast_assign(
3230 __entry->dev = VFS_I(src)->i_sb->s_dev;
3231 __entry->src_ino = src->i_ino;
3232 __entry->src_lblk = soffset;
3233 __entry->len = len;
3234 __entry->dest_ino = dest->i_ino;
3235 __entry->dest_lblk = doffset;
3236 ),
3237 TP_printk("dev %d:%d len 0x%llx "
3238 "ino 0x%llx offset 0x%llx blocks -> "
3239 "ino 0x%llx offset 0x%llx blocks",
3240 MAJOR(__entry->dev), MINOR(__entry->dev),
3241 __entry->len,
3242 __entry->src_ino,
3243 __entry->src_lblk,
3244 __entry->dest_ino,
3245 __entry->dest_lblk)
3246);
3247TRACE_EVENT(xfs_reflink_punch_range,
3248 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3249 xfs_extlen_t len),
3250 TP_ARGS(ip, lblk, len),
3251 TP_STRUCT__entry(
3252 __field(dev_t, dev)
3253 __field(xfs_ino_t, ino)
3254 __field(xfs_fileoff_t, lblk)
3255 __field(xfs_extlen_t, len)
3256 ),
3257 TP_fast_assign(
3258 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3259 __entry->ino = ip->i_ino;
3260 __entry->lblk = lblk;
3261 __entry->len = len;
3262 ),
3263 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3264 MAJOR(__entry->dev), MINOR(__entry->dev),
3265 __entry->ino,
3266 __entry->lblk,
3267 __entry->len)
3268);
3269TRACE_EVENT(xfs_reflink_remap,
3270 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3271 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3272 TP_ARGS(ip, lblk, len, new_pblk),
3273 TP_STRUCT__entry(
3274 __field(dev_t, dev)
3275 __field(xfs_ino_t, ino)
3276 __field(xfs_fileoff_t, lblk)
3277 __field(xfs_extlen_t, len)
3278 __field(xfs_fsblock_t, new_pblk)
3279 ),
3280 TP_fast_assign(
3281 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3282 __entry->ino = ip->i_ino;
3283 __entry->lblk = lblk;
3284 __entry->len = len;
3285 __entry->new_pblk = new_pblk;
3286 ),
3287 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3288 MAJOR(__entry->dev), MINOR(__entry->dev),
3289 __entry->ino,
3290 __entry->lblk,
3291 __entry->len,
3292 __entry->new_pblk)
3293);
3294DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3295DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3296DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3297DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3298DEFINE_INODE_ERROR_EVENT(xfs_reflink_reflink_main_loop_error);
3299DEFINE_INODE_ERROR_EVENT(xfs_reflink_read_iomap_error);
3300DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3301DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3302
3303/* dedupe tracepoints */
3304DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3305DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3306
3307/* ioctl tracepoints */
3308DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_reflink);
3309DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_clone_range);
3310DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_file_extent_same);
3311TRACE_EVENT(xfs_ioctl_clone,
3312 TP_PROTO(struct inode *src, struct inode *dest),
3313 TP_ARGS(src, dest),
3314 TP_STRUCT__entry(
3315 __field(dev_t, dev)
3316 __field(unsigned long, src_ino)
3317 __field(loff_t, src_isize)
3318 __field(unsigned long, dest_ino)
3319 __field(loff_t, dest_isize)
3320 ),
3321 TP_fast_assign(
3322 __entry->dev = src->i_sb->s_dev;
3323 __entry->src_ino = src->i_ino;
3324 __entry->src_isize = i_size_read(src);
3325 __entry->dest_ino = dest->i_ino;
3326 __entry->dest_isize = i_size_read(dest);
3327 ),
3328 TP_printk("dev %d:%d "
3329 "ino 0x%lx isize 0x%llx -> "
3330 "ino 0x%lx isize 0x%llx\n",
3331 MAJOR(__entry->dev), MINOR(__entry->dev),
3332 __entry->src_ino,
3333 __entry->src_isize,
3334 __entry->dest_ino,
3335 __entry->dest_isize)
3336);
3337
3338/* unshare tracepoints */
3339DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3340DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cow_eof_block);
3341DEFINE_PAGE_EVENT(xfs_reflink_unshare_page);
3342DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3343DEFINE_INODE_ERROR_EVENT(xfs_reflink_cow_eof_block_error);
3344DEFINE_INODE_ERROR_EVENT(xfs_reflink_dirty_page_error);
3345
3346/* copy on write */
3347DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003348DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3349DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3350DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003351DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003352
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003353DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003354DEFINE_RW_EVENT(xfs_reflink_allocate_cow_range);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003355
Christoph Hellwig5bbf5ba2017-02-06 13:00:54 -08003356DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003357DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3358DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003359
3360DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3361DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3362DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003363
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003364DEFINE_INODE_ERROR_EVENT(xfs_reflink_allocate_cow_range_error);
3365DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3366DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3367
3368DEFINE_COW_EVENT(xfs_reflink_fork_buf);
3369DEFINE_COW_EVENT(xfs_reflink_finish_fork_buf);
3370DEFINE_INODE_ERROR_EVENT(xfs_reflink_fork_buf_error);
3371DEFINE_INODE_ERROR_EVENT(xfs_reflink_finish_fork_buf_error);
3372
3373DEFINE_INODE_EVENT(xfs_reflink_cancel_pending_cow);
3374DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3375DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_pending_cow_error);
3376
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003377/* rmap swapext tracepoints */
3378DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3379DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3380DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3381
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003382#endif /* _TRACE_XFS_H */
3383
3384#undef TRACE_INCLUDE_PATH
3385#define TRACE_INCLUDE_PATH .
3386#define TRACE_INCLUDE_FILE xfs_trace
3387#include <trace/define_trace.h>