blob: bdf69e1c74102610e314a786c638253bcedef201 [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);
Brian Foster7cb011b2017-06-14 21:21:45 -0700369DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000370DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000371DEFINE_BUF_EVENT(xfs_bdstrat_shut);
372DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000373DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
374DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100375DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000376DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
377DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
378
379/* not really buffer traces, but the buf provides useful information */
380DEFINE_BUF_EVENT(xfs_btree_corrupt);
381DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
382DEFINE_BUF_EVENT(xfs_reset_dqcounts);
383DEFINE_BUF_EVENT(xfs_inode_item_push);
384
385/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000386DECLARE_EVENT_CLASS(xfs_buf_flags_class,
387 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
388 TP_ARGS(bp, flags, caller_ip),
389 TP_STRUCT__entry(
390 __field(dev_t, dev)
391 __field(xfs_daddr_t, bno)
392 __field(size_t, buffer_length)
393 __field(int, hold)
394 __field(int, pincount)
395 __field(unsigned, lockval)
396 __field(unsigned, flags)
397 __field(unsigned long, caller_ip)
398 ),
399 TP_fast_assign(
400 __entry->dev = bp->b_target->bt_dev;
401 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000402 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000403 __entry->flags = flags;
404 __entry->hold = atomic_read(&bp->b_hold);
405 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200406 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000407 __entry->caller_ip = caller_ip;
408 ),
409 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100410 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000411 MAJOR(__entry->dev), MINOR(__entry->dev),
412 (unsigned long long)__entry->bno,
413 __entry->buffer_length,
414 __entry->hold,
415 __entry->pincount,
416 __entry->lockval,
417 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
418 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000419)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000420
421#define DEFINE_BUF_FLAGS_EVENT(name) \
422DEFINE_EVENT(xfs_buf_flags_class, name, \
423 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
424 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000425DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
426DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
427DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
428
429TRACE_EVENT(xfs_buf_ioerror,
430 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
431 TP_ARGS(bp, error, caller_ip),
432 TP_STRUCT__entry(
433 __field(dev_t, dev)
434 __field(xfs_daddr_t, bno)
435 __field(size_t, buffer_length)
436 __field(unsigned, flags)
437 __field(int, hold)
438 __field(int, pincount)
439 __field(unsigned, lockval)
440 __field(int, error)
441 __field(unsigned long, caller_ip)
442 ),
443 TP_fast_assign(
444 __entry->dev = bp->b_target->bt_dev;
445 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000446 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000447 __entry->hold = atomic_read(&bp->b_hold);
448 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200449 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000450 __entry->error = error;
451 __entry->flags = bp->b_flags;
452 __entry->caller_ip = caller_ip;
453 ),
454 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100455 "lock %d error %d flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000456 MAJOR(__entry->dev), MINOR(__entry->dev),
457 (unsigned long long)__entry->bno,
458 __entry->buffer_length,
459 __entry->hold,
460 __entry->pincount,
461 __entry->lockval,
462 __entry->error,
463 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
464 (void *)__entry->caller_ip)
465);
466
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000467DECLARE_EVENT_CLASS(xfs_buf_item_class,
468 TP_PROTO(struct xfs_buf_log_item *bip),
469 TP_ARGS(bip),
470 TP_STRUCT__entry(
471 __field(dev_t, dev)
472 __field(xfs_daddr_t, buf_bno)
473 __field(size_t, buf_len)
474 __field(int, buf_hold)
475 __field(int, buf_pincount)
476 __field(int, buf_lockval)
477 __field(unsigned, buf_flags)
478 __field(unsigned, bli_recur)
479 __field(int, bli_refcount)
480 __field(unsigned, bli_flags)
481 __field(void *, li_desc)
482 __field(unsigned, li_flags)
483 ),
484 TP_fast_assign(
485 __entry->dev = bip->bli_buf->b_target->bt_dev;
486 __entry->bli_flags = bip->bli_flags;
487 __entry->bli_recur = bip->bli_recur;
488 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
489 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000490 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000491 __entry->buf_flags = bip->bli_buf->b_flags;
492 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
493 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200494 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000495 __entry->li_desc = bip->bli_item.li_desc;
496 __entry->li_flags = bip->bli_item.li_flags;
497 ),
498 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
499 "lock %d flags %s recur %d refcount %d bliflags %s "
500 "lidesc 0x%p liflags %s",
501 MAJOR(__entry->dev), MINOR(__entry->dev),
502 (unsigned long long)__entry->buf_bno,
503 __entry->buf_len,
504 __entry->buf_hold,
505 __entry->buf_pincount,
506 __entry->buf_lockval,
507 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
508 __entry->bli_recur,
509 __entry->bli_refcount,
510 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
511 __entry->li_desc,
512 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000513)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000514
515#define DEFINE_BUF_ITEM_EVENT(name) \
516DEFINE_EVENT(xfs_buf_item_class, name, \
517 TP_PROTO(struct xfs_buf_log_item *bip), \
518 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
523DEFINE_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 Foster6b6505d2017-09-17 14:06:55 -07001993TRACE_EVENT(xfs_log_recover,
1994 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1995 TP_ARGS(log, headblk, tailblk),
1996 TP_STRUCT__entry(
1997 __field(dev_t, dev)
1998 __field(xfs_daddr_t, headblk)
1999 __field(xfs_daddr_t, tailblk)
2000 ),
2001 TP_fast_assign(
2002 __entry->dev = log->l_mp->m_super->s_dev;
2003 __entry->headblk = headblk;
2004 __entry->tailblk = tailblk;
2005 ),
2006 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2007 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2008 __entry->tailblk)
2009)
2010
Brian Foster5cd9cee2016-09-26 08:34:52 +10002011TRACE_EVENT(xfs_log_recover_record,
2012 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2013 TP_ARGS(log, rhead, pass),
2014 TP_STRUCT__entry(
2015 __field(dev_t, dev)
2016 __field(xfs_lsn_t, lsn)
2017 __field(int, len)
2018 __field(int, num_logops)
2019 __field(int, pass)
2020 ),
2021 TP_fast_assign(
2022 __entry->dev = log->l_mp->m_super->s_dev;
2023 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2024 __entry->len = be32_to_cpu(rhead->h_len);
2025 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2026 __entry->pass = pass;
2027 ),
2028 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2029 MAJOR(__entry->dev), MINOR(__entry->dev),
2030 __entry->lsn, __entry->len, __entry->num_logops,
2031 __entry->pass)
2032)
2033
Dave Chinner9abbc532010-04-13 15:06:46 +10002034DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002035 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002036 struct xlog_recover_item *item, int pass),
2037 TP_ARGS(log, trans, item, pass),
2038 TP_STRUCT__entry(
2039 __field(dev_t, dev)
2040 __field(unsigned long, item)
2041 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002042 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002043 __field(int, type)
2044 __field(int, pass)
2045 __field(int, count)
2046 __field(int, total)
2047 ),
2048 TP_fast_assign(
2049 __entry->dev = log->l_mp->m_super->s_dev;
2050 __entry->item = (unsigned long)item;
2051 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002052 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002053 __entry->type = ITEM_TYPE(item);
2054 __entry->pass = pass;
2055 __entry->count = item->ri_cnt;
2056 __entry->total = item->ri_total;
2057 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002058 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2059 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002060 MAJOR(__entry->dev), MINOR(__entry->dev),
2061 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002062 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002063 __entry->pass,
2064 (void *)__entry->item,
2065 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2066 __entry->count,
2067 __entry->total)
2068)
2069
2070#define DEFINE_LOG_RECOVER_ITEM(name) \
2071DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002072 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002073 struct xlog_recover_item *item, int pass), \
2074 TP_ARGS(log, trans, item, pass))
2075
2076DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2077DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2078DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2079DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2080DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2081
2082DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002083 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002084 TP_ARGS(log, buf_f),
2085 TP_STRUCT__entry(
2086 __field(dev_t, dev)
2087 __field(__int64_t, blkno)
2088 __field(unsigned short, len)
2089 __field(unsigned short, flags)
2090 __field(unsigned short, size)
2091 __field(unsigned int, map_size)
2092 ),
2093 TP_fast_assign(
2094 __entry->dev = log->l_mp->m_super->s_dev;
2095 __entry->blkno = buf_f->blf_blkno;
2096 __entry->len = buf_f->blf_len;
2097 __entry->flags = buf_f->blf_flags;
2098 __entry->size = buf_f->blf_size;
2099 __entry->map_size = buf_f->blf_map_size;
2100 ),
2101 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2102 "map_size %d",
2103 MAJOR(__entry->dev), MINOR(__entry->dev),
2104 __entry->blkno,
2105 __entry->len,
2106 __entry->flags,
2107 __entry->size,
2108 __entry->map_size)
2109)
2110
2111#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2112DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002113 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002114 TP_ARGS(log, buf_f))
2115
2116DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2117DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2118DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2119DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2120DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002121DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002122DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2123DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2124DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2125
2126DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002127 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002128 TP_ARGS(log, in_f),
2129 TP_STRUCT__entry(
2130 __field(dev_t, dev)
2131 __field(xfs_ino_t, ino)
2132 __field(unsigned short, size)
2133 __field(int, fields)
2134 __field(unsigned short, asize)
2135 __field(unsigned short, dsize)
2136 __field(__int64_t, blkno)
2137 __field(int, len)
2138 __field(int, boffset)
2139 ),
2140 TP_fast_assign(
2141 __entry->dev = log->l_mp->m_super->s_dev;
2142 __entry->ino = in_f->ilf_ino;
2143 __entry->size = in_f->ilf_size;
2144 __entry->fields = in_f->ilf_fields;
2145 __entry->asize = in_f->ilf_asize;
2146 __entry->dsize = in_f->ilf_dsize;
2147 __entry->blkno = in_f->ilf_blkno;
2148 __entry->len = in_f->ilf_len;
2149 __entry->boffset = in_f->ilf_boffset;
2150 ),
2151 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2152 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2153 MAJOR(__entry->dev), MINOR(__entry->dev),
2154 __entry->ino,
2155 __entry->size,
2156 __entry->fields,
2157 __entry->asize,
2158 __entry->dsize,
2159 __entry->blkno,
2160 __entry->len,
2161 __entry->boffset)
2162)
2163#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2164DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002165 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002166 TP_ARGS(log, in_f))
2167
2168DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2169DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2170DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2171
Brian Foster78d57e42015-08-19 09:58:48 +10002172DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2173 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2174 TP_ARGS(log, in_f),
2175 TP_STRUCT__entry(
2176 __field(dev_t, dev)
2177 __field(xfs_agnumber_t, agno)
2178 __field(xfs_agblock_t, agbno)
2179 __field(unsigned int, count)
2180 __field(unsigned int, isize)
2181 __field(xfs_agblock_t, length)
2182 __field(unsigned int, gen)
2183 ),
2184 TP_fast_assign(
2185 __entry->dev = log->l_mp->m_super->s_dev;
2186 __entry->agno = be32_to_cpu(in_f->icl_ag);
2187 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2188 __entry->count = be32_to_cpu(in_f->icl_count);
2189 __entry->isize = be32_to_cpu(in_f->icl_isize);
2190 __entry->length = be32_to_cpu(in_f->icl_length);
2191 __entry->gen = be32_to_cpu(in_f->icl_gen);
2192 ),
2193 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2194 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2195 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2196 __entry->length, __entry->gen)
2197)
2198#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2199DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2200 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2201 TP_ARGS(log, in_f))
2202
2203DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2204DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2205
Christoph Hellwiga46db602011-01-07 13:02:04 +00002206DECLARE_EVENT_CLASS(xfs_discard_class,
2207 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2208 xfs_agblock_t agbno, xfs_extlen_t len),
2209 TP_ARGS(mp, agno, agbno, len),
2210 TP_STRUCT__entry(
2211 __field(dev_t, dev)
2212 __field(xfs_agnumber_t, agno)
2213 __field(xfs_agblock_t, agbno)
2214 __field(xfs_extlen_t, len)
2215 ),
2216 TP_fast_assign(
2217 __entry->dev = mp->m_super->s_dev;
2218 __entry->agno = agno;
2219 __entry->agbno = agbno;
2220 __entry->len = len;
2221 ),
2222 TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2223 MAJOR(__entry->dev), MINOR(__entry->dev),
2224 __entry->agno,
2225 __entry->agbno,
2226 __entry->len)
2227)
2228
2229#define DEFINE_DISCARD_EVENT(name) \
2230DEFINE_EVENT(xfs_discard_class, name, \
2231 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2232 xfs_agblock_t agbno, xfs_extlen_t len), \
2233 TP_ARGS(mp, agno, agbno, len))
2234DEFINE_DISCARD_EVENT(xfs_discard_extent);
2235DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2236DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2237DEFINE_DISCARD_EVENT(xfs_discard_busy);
2238
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002239/* btree cursor events */
2240DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2241 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2242 TP_ARGS(cur, level, bp),
2243 TP_STRUCT__entry(
2244 __field(dev_t, dev)
2245 __field(xfs_btnum_t, btnum)
2246 __field(int, level)
2247 __field(int, nlevels)
2248 __field(int, ptr)
2249 __field(xfs_daddr_t, daddr)
2250 ),
2251 TP_fast_assign(
2252 __entry->dev = cur->bc_mp->m_super->s_dev;
2253 __entry->btnum = cur->bc_btnum;
2254 __entry->level = level;
2255 __entry->nlevels = cur->bc_nlevels;
2256 __entry->ptr = cur->bc_ptrs[level];
2257 __entry->daddr = bp ? bp->b_bn : -1;
2258 ),
2259 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2260 MAJOR(__entry->dev), MINOR(__entry->dev),
2261 __entry->btnum,
2262 __entry->level,
2263 __entry->nlevels,
2264 __entry->ptr,
2265 (unsigned long long)__entry->daddr)
2266)
2267
2268#define DEFINE_BTREE_CUR_EVENT(name) \
2269DEFINE_EVENT(xfs_btree_cur_class, name, \
2270 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2271 TP_ARGS(cur, level, bp))
2272DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002273DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002274
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002275/* deferred ops */
2276struct xfs_defer_pending;
2277struct xfs_defer_intake;
2278struct xfs_defer_ops;
2279
2280DECLARE_EVENT_CLASS(xfs_defer_class,
2281 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2282 TP_ARGS(mp, dop),
2283 TP_STRUCT__entry(
2284 __field(dev_t, dev)
2285 __field(void *, dop)
2286 __field(bool, committed)
2287 __field(bool, low)
2288 ),
2289 TP_fast_assign(
2290 __entry->dev = mp ? mp->m_super->s_dev : 0;
2291 __entry->dop = dop;
2292 __entry->committed = dop->dop_committed;
2293 __entry->low = dop->dop_low;
2294 ),
2295 TP_printk("dev %d:%d ops %p committed %d low %d\n",
2296 MAJOR(__entry->dev), MINOR(__entry->dev),
2297 __entry->dop,
2298 __entry->committed,
2299 __entry->low)
2300)
2301#define DEFINE_DEFER_EVENT(name) \
2302DEFINE_EVENT(xfs_defer_class, name, \
2303 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2304 TP_ARGS(mp, dop))
2305
2306DECLARE_EVENT_CLASS(xfs_defer_error_class,
2307 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2308 TP_ARGS(mp, dop, error),
2309 TP_STRUCT__entry(
2310 __field(dev_t, dev)
2311 __field(void *, dop)
2312 __field(bool, committed)
2313 __field(bool, low)
2314 __field(int, error)
2315 ),
2316 TP_fast_assign(
2317 __entry->dev = mp ? mp->m_super->s_dev : 0;
2318 __entry->dop = dop;
2319 __entry->committed = dop->dop_committed;
2320 __entry->low = dop->dop_low;
2321 __entry->error = error;
2322 ),
2323 TP_printk("dev %d:%d ops %p committed %d low %d err %d\n",
2324 MAJOR(__entry->dev), MINOR(__entry->dev),
2325 __entry->dop,
2326 __entry->committed,
2327 __entry->low,
2328 __entry->error)
2329)
2330#define DEFINE_DEFER_ERROR_EVENT(name) \
2331DEFINE_EVENT(xfs_defer_error_class, name, \
2332 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2333 TP_ARGS(mp, dop, error))
2334
2335DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2336 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2337 TP_ARGS(mp, dfp),
2338 TP_STRUCT__entry(
2339 __field(dev_t, dev)
2340 __field(int, type)
2341 __field(void *, intent)
2342 __field(bool, committed)
2343 __field(int, nr)
2344 ),
2345 TP_fast_assign(
2346 __entry->dev = mp ? mp->m_super->s_dev : 0;
2347 __entry->type = dfp->dfp_type->type;
2348 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002349 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002350 __entry->nr = dfp->dfp_count;
2351 ),
2352 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d\n",
2353 MAJOR(__entry->dev), MINOR(__entry->dev),
2354 __entry->type,
2355 __entry->intent,
2356 __entry->committed,
2357 __entry->nr)
2358)
2359#define DEFINE_DEFER_PENDING_EVENT(name) \
2360DEFINE_EVENT(xfs_defer_pending_class, name, \
2361 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2362 TP_ARGS(mp, dfp))
2363
2364DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2365 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2366 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2367 TP_ARGS(mp, agno, type, agbno, len),
2368 TP_STRUCT__entry(
2369 __field(dev_t, dev)
2370 __field(xfs_agnumber_t, agno)
2371 __field(int, type)
2372 __field(xfs_agblock_t, agbno)
2373 __field(xfs_extlen_t, len)
2374 ),
2375 TP_fast_assign(
2376 __entry->dev = mp->m_super->s_dev;
2377 __entry->agno = agno;
2378 __entry->type = type;
2379 __entry->agbno = agbno;
2380 __entry->len = len;
2381 ),
2382 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2383 MAJOR(__entry->dev), MINOR(__entry->dev),
2384 __entry->type,
2385 __entry->agno,
2386 __entry->agbno,
2387 __entry->len)
2388);
2389#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2390DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2391 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2392 int type, \
2393 xfs_agblock_t bno, \
2394 xfs_extlen_t len), \
2395 TP_ARGS(mp, agno, type, bno, len))
2396
2397DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2398 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2399 int op,
2400 xfs_agblock_t agbno,
2401 xfs_ino_t ino,
2402 int whichfork,
2403 xfs_fileoff_t offset,
2404 xfs_filblks_t len,
2405 xfs_exntst_t state),
2406 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2407 TP_STRUCT__entry(
2408 __field(dev_t, dev)
2409 __field(xfs_agnumber_t, agno)
2410 __field(xfs_ino_t, ino)
2411 __field(xfs_agblock_t, agbno)
2412 __field(int, whichfork)
2413 __field(xfs_fileoff_t, l_loff)
2414 __field(xfs_filblks_t, l_len)
2415 __field(xfs_exntst_t, l_state)
2416 __field(int, op)
2417 ),
2418 TP_fast_assign(
2419 __entry->dev = mp->m_super->s_dev;
2420 __entry->agno = agno;
2421 __entry->ino = ino;
2422 __entry->agbno = agbno;
2423 __entry->whichfork = whichfork;
2424 __entry->l_loff = offset;
2425 __entry->l_len = len;
2426 __entry->l_state = state;
2427 __entry->op = op;
2428 ),
2429 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2430 MAJOR(__entry->dev), MINOR(__entry->dev),
2431 __entry->op,
2432 __entry->agno,
2433 __entry->agbno,
2434 __entry->ino,
2435 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2436 __entry->l_loff,
2437 __entry->l_len,
2438 __entry->l_state)
2439);
2440#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2441DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2442 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2443 int op, \
2444 xfs_agblock_t agbno, \
2445 xfs_ino_t ino, \
2446 int whichfork, \
2447 xfs_fileoff_t offset, \
2448 xfs_filblks_t len, \
2449 xfs_exntst_t state), \
2450 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2451
2452DEFINE_DEFER_EVENT(xfs_defer_init);
2453DEFINE_DEFER_EVENT(xfs_defer_cancel);
2454DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2455DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2456DEFINE_DEFER_EVENT(xfs_defer_finish);
2457DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2458
2459DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2460DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2461DEFINE_DEFER_ERROR_EVENT(xfs_defer_op_finish_error);
2462
2463DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2464DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
2465DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_commit);
2466DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2467DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2468DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2469
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002470#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2471DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2472DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2473
Darrick J. Wong673930c2016-08-03 11:33:43 +10002474/* rmap tracepoints */
2475DECLARE_EVENT_CLASS(xfs_rmap_class,
2476 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2477 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2478 struct xfs_owner_info *oinfo),
2479 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2480 TP_STRUCT__entry(
2481 __field(dev_t, dev)
2482 __field(xfs_agnumber_t, agno)
2483 __field(xfs_agblock_t, agbno)
2484 __field(xfs_extlen_t, len)
2485 __field(uint64_t, owner)
2486 __field(uint64_t, offset)
2487 __field(unsigned long, flags)
2488 ),
2489 TP_fast_assign(
2490 __entry->dev = mp->m_super->s_dev;
2491 __entry->agno = agno;
2492 __entry->agbno = agbno;
2493 __entry->len = len;
2494 __entry->owner = oinfo->oi_owner;
2495 __entry->offset = oinfo->oi_offset;
2496 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002497 if (unwritten)
2498 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002499 ),
2500 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2501 MAJOR(__entry->dev), MINOR(__entry->dev),
2502 __entry->agno,
2503 __entry->agbno,
2504 __entry->len,
2505 __entry->owner,
2506 __entry->offset,
2507 __entry->flags)
2508);
2509#define DEFINE_RMAP_EVENT(name) \
2510DEFINE_EVENT(xfs_rmap_class, name, \
2511 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2512 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2513 struct xfs_owner_info *oinfo), \
2514 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2515
2516/* simple AG-based error/%ip tracepoint class */
2517DECLARE_EVENT_CLASS(xfs_ag_error_class,
2518 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2519 unsigned long caller_ip),
2520 TP_ARGS(mp, agno, error, caller_ip),
2521 TP_STRUCT__entry(
2522 __field(dev_t, dev)
2523 __field(xfs_agnumber_t, agno)
2524 __field(int, error)
2525 __field(unsigned long, caller_ip)
2526 ),
2527 TP_fast_assign(
2528 __entry->dev = mp->m_super->s_dev;
2529 __entry->agno = agno;
2530 __entry->error = error;
2531 __entry->caller_ip = caller_ip;
2532 ),
2533 TP_printk("dev %d:%d agno %u error %d caller %ps",
2534 MAJOR(__entry->dev), MINOR(__entry->dev),
2535 __entry->agno,
2536 __entry->error,
2537 (char *)__entry->caller_ip)
2538);
2539
2540#define DEFINE_AG_ERROR_EVENT(name) \
2541DEFINE_EVENT(xfs_ag_error_class, name, \
2542 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2543 unsigned long caller_ip), \
2544 TP_ARGS(mp, agno, error, caller_ip))
2545
2546DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2547DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2548DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2549DEFINE_RMAP_EVENT(xfs_rmap_map);
2550DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2551DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002552DEFINE_RMAP_EVENT(xfs_rmap_convert);
2553DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2554DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2555DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002556
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002557DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2558 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2559 xfs_agblock_t agbno, xfs_extlen_t len,
2560 uint64_t owner, uint64_t offset, unsigned int flags),
2561 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2562 TP_STRUCT__entry(
2563 __field(dev_t, dev)
2564 __field(xfs_agnumber_t, agno)
2565 __field(xfs_agblock_t, agbno)
2566 __field(xfs_extlen_t, len)
2567 __field(uint64_t, owner)
2568 __field(uint64_t, offset)
2569 __field(unsigned int, flags)
2570 ),
2571 TP_fast_assign(
2572 __entry->dev = mp->m_super->s_dev;
2573 __entry->agno = agno;
2574 __entry->agbno = agbno;
2575 __entry->len = len;
2576 __entry->owner = owner;
2577 __entry->offset = offset;
2578 __entry->flags = flags;
2579 ),
2580 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2581 MAJOR(__entry->dev), MINOR(__entry->dev),
2582 __entry->agno,
2583 __entry->agbno,
2584 __entry->len,
2585 __entry->owner,
2586 __entry->offset,
2587 __entry->flags)
2588);
2589#define DEFINE_RMAPBT_EVENT(name) \
2590DEFINE_EVENT(xfs_rmapbt_class, name, \
2591 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2592 xfs_agblock_t agbno, xfs_extlen_t len, \
2593 uint64_t owner, uint64_t offset, unsigned int flags), \
2594 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2595
2596#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2597DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2598DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2599
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002600DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2601DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002602DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2603DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2604DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2605DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2606DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2607DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002608
2609DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2610DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2611DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2612DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002613DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2614DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002615DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002616
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002617/* deferred bmbt updates */
2618#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2619DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2620DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2621
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002622/* per-AG reservation */
2623DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2624 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2625 xfs_extlen_t len),
2626 TP_ARGS(pag, resv, len),
2627 TP_STRUCT__entry(
2628 __field(dev_t, dev)
2629 __field(xfs_agnumber_t, agno)
2630 __field(int, resv)
2631 __field(xfs_extlen_t, freeblks)
2632 __field(xfs_extlen_t, flcount)
2633 __field(xfs_extlen_t, reserved)
2634 __field(xfs_extlen_t, asked)
2635 __field(xfs_extlen_t, len)
2636 ),
2637 TP_fast_assign(
2638 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2639
2640 __entry->dev = pag->pag_mount->m_super->s_dev;
2641 __entry->agno = pag->pag_agno;
2642 __entry->resv = resv;
2643 __entry->freeblks = pag->pagf_freeblks;
2644 __entry->flcount = pag->pagf_flcount;
2645 __entry->reserved = r ? r->ar_reserved : 0;
2646 __entry->asked = r ? r->ar_asked : 0;
2647 __entry->len = len;
2648 ),
2649 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u resv %u ask %u len %u\n",
2650 MAJOR(__entry->dev), MINOR(__entry->dev),
2651 __entry->agno,
2652 __entry->resv,
2653 __entry->freeblks,
2654 __entry->flcount,
2655 __entry->reserved,
2656 __entry->asked,
2657 __entry->len)
2658)
2659#define DEFINE_AG_RESV_EVENT(name) \
2660DEFINE_EVENT(xfs_ag_resv_class, name, \
2661 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2662 xfs_extlen_t len), \
2663 TP_ARGS(pag, type, len))
2664
2665/* per-AG reservation tracepoints */
2666DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2667DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2668DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2669DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2670DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2671DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2672
2673DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2674DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2675
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002676/* refcount tracepoint classes */
2677
2678/* reuse the discard trace class for agbno/aglen-based traces */
2679#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2680
2681/* ag btree lookup tracepoint class */
2682#define XFS_AG_BTREE_CMP_FORMAT_STR \
2683 { XFS_LOOKUP_EQ, "eq" }, \
2684 { XFS_LOOKUP_LE, "le" }, \
2685 { XFS_LOOKUP_GE, "ge" }
2686DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2687 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2688 xfs_agblock_t agbno, xfs_lookup_t dir),
2689 TP_ARGS(mp, agno, agbno, dir),
2690 TP_STRUCT__entry(
2691 __field(dev_t, dev)
2692 __field(xfs_agnumber_t, agno)
2693 __field(xfs_agblock_t, agbno)
2694 __field(xfs_lookup_t, dir)
2695 ),
2696 TP_fast_assign(
2697 __entry->dev = mp->m_super->s_dev;
2698 __entry->agno = agno;
2699 __entry->agbno = agbno;
2700 __entry->dir = dir;
2701 ),
2702 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)\n",
2703 MAJOR(__entry->dev), MINOR(__entry->dev),
2704 __entry->agno,
2705 __entry->agbno,
2706 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2707 __entry->dir)
2708)
2709
2710#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2711DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2712 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2713 xfs_agblock_t agbno, xfs_lookup_t dir), \
2714 TP_ARGS(mp, agno, agbno, dir))
2715
2716/* single-rcext tracepoint class */
2717DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2718 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2719 struct xfs_refcount_irec *irec),
2720 TP_ARGS(mp, agno, irec),
2721 TP_STRUCT__entry(
2722 __field(dev_t, dev)
2723 __field(xfs_agnumber_t, agno)
2724 __field(xfs_agblock_t, startblock)
2725 __field(xfs_extlen_t, blockcount)
2726 __field(xfs_nlink_t, refcount)
2727 ),
2728 TP_fast_assign(
2729 __entry->dev = mp->m_super->s_dev;
2730 __entry->agno = agno;
2731 __entry->startblock = irec->rc_startblock;
2732 __entry->blockcount = irec->rc_blockcount;
2733 __entry->refcount = irec->rc_refcount;
2734 ),
2735 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u\n",
2736 MAJOR(__entry->dev), MINOR(__entry->dev),
2737 __entry->agno,
2738 __entry->startblock,
2739 __entry->blockcount,
2740 __entry->refcount)
2741)
2742
2743#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2744DEFINE_EVENT(xfs_refcount_extent_class, name, \
2745 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2746 struct xfs_refcount_irec *irec), \
2747 TP_ARGS(mp, agno, irec))
2748
2749/* single-rcext and an agbno tracepoint class */
2750DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2751 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2752 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2753 TP_ARGS(mp, agno, irec, agbno),
2754 TP_STRUCT__entry(
2755 __field(dev_t, dev)
2756 __field(xfs_agnumber_t, agno)
2757 __field(xfs_agblock_t, startblock)
2758 __field(xfs_extlen_t, blockcount)
2759 __field(xfs_nlink_t, refcount)
2760 __field(xfs_agblock_t, agbno)
2761 ),
2762 TP_fast_assign(
2763 __entry->dev = mp->m_super->s_dev;
2764 __entry->agno = agno;
2765 __entry->startblock = irec->rc_startblock;
2766 __entry->blockcount = irec->rc_blockcount;
2767 __entry->refcount = irec->rc_refcount;
2768 __entry->agbno = agbno;
2769 ),
2770 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u\n",
2771 MAJOR(__entry->dev), MINOR(__entry->dev),
2772 __entry->agno,
2773 __entry->startblock,
2774 __entry->blockcount,
2775 __entry->refcount,
2776 __entry->agbno)
2777)
2778
2779#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2780DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2781 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2782 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2783 TP_ARGS(mp, agno, irec, agbno))
2784
2785/* double-rcext tracepoint class */
2786DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2787 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2788 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2789 TP_ARGS(mp, agno, i1, i2),
2790 TP_STRUCT__entry(
2791 __field(dev_t, dev)
2792 __field(xfs_agnumber_t, agno)
2793 __field(xfs_agblock_t, i1_startblock)
2794 __field(xfs_extlen_t, i1_blockcount)
2795 __field(xfs_nlink_t, i1_refcount)
2796 __field(xfs_agblock_t, i2_startblock)
2797 __field(xfs_extlen_t, i2_blockcount)
2798 __field(xfs_nlink_t, i2_refcount)
2799 ),
2800 TP_fast_assign(
2801 __entry->dev = mp->m_super->s_dev;
2802 __entry->agno = agno;
2803 __entry->i1_startblock = i1->rc_startblock;
2804 __entry->i1_blockcount = i1->rc_blockcount;
2805 __entry->i1_refcount = i1->rc_refcount;
2806 __entry->i2_startblock = i2->rc_startblock;
2807 __entry->i2_blockcount = i2->rc_blockcount;
2808 __entry->i2_refcount = i2->rc_refcount;
2809 ),
2810 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2811 "agbno %u len %u refcount %u\n",
2812 MAJOR(__entry->dev), MINOR(__entry->dev),
2813 __entry->agno,
2814 __entry->i1_startblock,
2815 __entry->i1_blockcount,
2816 __entry->i1_refcount,
2817 __entry->i2_startblock,
2818 __entry->i2_blockcount,
2819 __entry->i2_refcount)
2820)
2821
2822#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2823DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2824 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2825 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2826 TP_ARGS(mp, agno, i1, i2))
2827
2828/* double-rcext and an agbno tracepoint class */
2829DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2830 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2831 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2832 xfs_agblock_t agbno),
2833 TP_ARGS(mp, agno, i1, i2, agbno),
2834 TP_STRUCT__entry(
2835 __field(dev_t, dev)
2836 __field(xfs_agnumber_t, agno)
2837 __field(xfs_agblock_t, i1_startblock)
2838 __field(xfs_extlen_t, i1_blockcount)
2839 __field(xfs_nlink_t, i1_refcount)
2840 __field(xfs_agblock_t, i2_startblock)
2841 __field(xfs_extlen_t, i2_blockcount)
2842 __field(xfs_nlink_t, i2_refcount)
2843 __field(xfs_agblock_t, agbno)
2844 ),
2845 TP_fast_assign(
2846 __entry->dev = mp->m_super->s_dev;
2847 __entry->agno = agno;
2848 __entry->i1_startblock = i1->rc_startblock;
2849 __entry->i1_blockcount = i1->rc_blockcount;
2850 __entry->i1_refcount = i1->rc_refcount;
2851 __entry->i2_startblock = i2->rc_startblock;
2852 __entry->i2_blockcount = i2->rc_blockcount;
2853 __entry->i2_refcount = i2->rc_refcount;
2854 __entry->agbno = agbno;
2855 ),
2856 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2857 "agbno %u len %u refcount %u @ agbno %u\n",
2858 MAJOR(__entry->dev), MINOR(__entry->dev),
2859 __entry->agno,
2860 __entry->i1_startblock,
2861 __entry->i1_blockcount,
2862 __entry->i1_refcount,
2863 __entry->i2_startblock,
2864 __entry->i2_blockcount,
2865 __entry->i2_refcount,
2866 __entry->agbno)
2867)
2868
2869#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2870DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2871 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2872 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2873 xfs_agblock_t agbno), \
2874 TP_ARGS(mp, agno, i1, i2, agbno))
2875
2876/* triple-rcext tracepoint class */
2877DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2878 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2879 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2880 struct xfs_refcount_irec *i3),
2881 TP_ARGS(mp, agno, i1, i2, i3),
2882 TP_STRUCT__entry(
2883 __field(dev_t, dev)
2884 __field(xfs_agnumber_t, agno)
2885 __field(xfs_agblock_t, i1_startblock)
2886 __field(xfs_extlen_t, i1_blockcount)
2887 __field(xfs_nlink_t, i1_refcount)
2888 __field(xfs_agblock_t, i2_startblock)
2889 __field(xfs_extlen_t, i2_blockcount)
2890 __field(xfs_nlink_t, i2_refcount)
2891 __field(xfs_agblock_t, i3_startblock)
2892 __field(xfs_extlen_t, i3_blockcount)
2893 __field(xfs_nlink_t, i3_refcount)
2894 ),
2895 TP_fast_assign(
2896 __entry->dev = mp->m_super->s_dev;
2897 __entry->agno = agno;
2898 __entry->i1_startblock = i1->rc_startblock;
2899 __entry->i1_blockcount = i1->rc_blockcount;
2900 __entry->i1_refcount = i1->rc_refcount;
2901 __entry->i2_startblock = i2->rc_startblock;
2902 __entry->i2_blockcount = i2->rc_blockcount;
2903 __entry->i2_refcount = i2->rc_refcount;
2904 __entry->i3_startblock = i3->rc_startblock;
2905 __entry->i3_blockcount = i3->rc_blockcount;
2906 __entry->i3_refcount = i3->rc_refcount;
2907 ),
2908 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2909 "agbno %u len %u refcount %u -- "
2910 "agbno %u len %u refcount %u\n",
2911 MAJOR(__entry->dev), MINOR(__entry->dev),
2912 __entry->agno,
2913 __entry->i1_startblock,
2914 __entry->i1_blockcount,
2915 __entry->i1_refcount,
2916 __entry->i2_startblock,
2917 __entry->i2_blockcount,
2918 __entry->i2_refcount,
2919 __entry->i3_startblock,
2920 __entry->i3_blockcount,
2921 __entry->i3_refcount)
2922);
2923
2924#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2925DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2926 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2927 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2928 struct xfs_refcount_irec *i3), \
2929 TP_ARGS(mp, agno, i1, i2, i3))
2930
2931/* refcount btree tracepoints */
2932DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2933DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2934DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2935DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2936DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2937DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2938DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2939DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2940DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2941DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2942
2943/* refcount adjustment tracepoints */
2944DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2945DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002946DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2947DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002948DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2949DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002950DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002951DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2952DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2953DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2954DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2955DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2956DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002957DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002958DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2959DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2960DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2961DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2962DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2963DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2964DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2965
2966/* reflink helpers */
2967DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2968DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2969DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba6122016-10-03 09:11:22 -07002970#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2971DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2972DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002973
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002974TRACE_EVENT(xfs_refcount_finish_one_leftover,
2975 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2976 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2977 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2978 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2979 TP_STRUCT__entry(
2980 __field(dev_t, dev)
2981 __field(xfs_agnumber_t, agno)
2982 __field(int, type)
2983 __field(xfs_agblock_t, agbno)
2984 __field(xfs_extlen_t, len)
2985 __field(xfs_agblock_t, new_agbno)
2986 __field(xfs_extlen_t, new_len)
2987 ),
2988 TP_fast_assign(
2989 __entry->dev = mp->m_super->s_dev;
2990 __entry->agno = agno;
2991 __entry->type = type;
2992 __entry->agbno = agbno;
2993 __entry->len = len;
2994 __entry->new_agbno = new_agbno;
2995 __entry->new_len = new_len;
2996 ),
2997 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2998 MAJOR(__entry->dev), MINOR(__entry->dev),
2999 __entry->type,
3000 __entry->agno,
3001 __entry->agbno,
3002 __entry->len,
3003 __entry->new_agbno,
3004 __entry->new_len)
3005);
3006
Darrick J. Wongf65306e2016-10-03 09:11:27 -07003007/* simple inode-based error/%ip tracepoint class */
3008DECLARE_EVENT_CLASS(xfs_inode_error_class,
3009 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3010 TP_ARGS(ip, error, caller_ip),
3011 TP_STRUCT__entry(
3012 __field(dev_t, dev)
3013 __field(xfs_ino_t, ino)
3014 __field(int, error)
3015 __field(unsigned long, caller_ip)
3016 ),
3017 TP_fast_assign(
3018 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3019 __entry->ino = ip->i_ino;
3020 __entry->error = error;
3021 __entry->caller_ip = caller_ip;
3022 ),
3023 TP_printk("dev %d:%d ino %llx error %d caller %ps",
3024 MAJOR(__entry->dev), MINOR(__entry->dev),
3025 __entry->ino,
3026 __entry->error,
3027 (char *)__entry->caller_ip)
3028);
3029
3030#define DEFINE_INODE_ERROR_EVENT(name) \
3031DEFINE_EVENT(xfs_inode_error_class, name, \
3032 TP_PROTO(struct xfs_inode *ip, int error, \
3033 unsigned long caller_ip), \
3034 TP_ARGS(ip, error, caller_ip))
3035
3036/* reflink allocator */
3037TRACE_EVENT(xfs_bmap_remap_alloc,
3038 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t fsbno,
3039 xfs_extlen_t len),
3040 TP_ARGS(ip, fsbno, len),
3041 TP_STRUCT__entry(
3042 __field(dev_t, dev)
3043 __field(xfs_ino_t, ino)
3044 __field(xfs_fsblock_t, fsbno)
3045 __field(xfs_extlen_t, len)
3046 ),
3047 TP_fast_assign(
3048 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3049 __entry->ino = ip->i_ino;
3050 __entry->fsbno = fsbno;
3051 __entry->len = len;
3052 ),
3053 TP_printk("dev %d:%d ino 0x%llx fsbno 0x%llx len %x",
3054 MAJOR(__entry->dev), MINOR(__entry->dev),
3055 __entry->ino,
3056 __entry->fsbno,
3057 __entry->len)
3058);
3059DEFINE_INODE_ERROR_EVENT(xfs_bmap_remap_alloc_error);
3060
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003061/* reflink tracepoint classes */
3062
3063/* two-file io tracepoint class */
3064DECLARE_EVENT_CLASS(xfs_double_io_class,
3065 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3066 struct xfs_inode *dest, xfs_off_t doffset),
3067 TP_ARGS(src, soffset, len, dest, doffset),
3068 TP_STRUCT__entry(
3069 __field(dev_t, dev)
3070 __field(xfs_ino_t, src_ino)
3071 __field(loff_t, src_isize)
3072 __field(loff_t, src_disize)
3073 __field(loff_t, src_offset)
3074 __field(size_t, len)
3075 __field(xfs_ino_t, dest_ino)
3076 __field(loff_t, dest_isize)
3077 __field(loff_t, dest_disize)
3078 __field(loff_t, dest_offset)
3079 ),
3080 TP_fast_assign(
3081 __entry->dev = VFS_I(src)->i_sb->s_dev;
3082 __entry->src_ino = src->i_ino;
3083 __entry->src_isize = VFS_I(src)->i_size;
3084 __entry->src_disize = src->i_d.di_size;
3085 __entry->src_offset = soffset;
3086 __entry->len = len;
3087 __entry->dest_ino = dest->i_ino;
3088 __entry->dest_isize = VFS_I(dest)->i_size;
3089 __entry->dest_disize = dest->i_d.di_size;
3090 __entry->dest_offset = doffset;
3091 ),
3092 TP_printk("dev %d:%d count %zd "
3093 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3094 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3095 MAJOR(__entry->dev), MINOR(__entry->dev),
3096 __entry->len,
3097 __entry->src_ino,
3098 __entry->src_isize,
3099 __entry->src_disize,
3100 __entry->src_offset,
3101 __entry->dest_ino,
3102 __entry->dest_isize,
3103 __entry->dest_disize,
3104 __entry->dest_offset)
3105)
3106
3107#define DEFINE_DOUBLE_IO_EVENT(name) \
3108DEFINE_EVENT(xfs_double_io_class, name, \
3109 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3110 struct xfs_inode *dest, xfs_off_t doffset), \
3111 TP_ARGS(src, soffset, len, dest, doffset))
3112
3113/* two-file vfs io tracepoint class */
3114DECLARE_EVENT_CLASS(xfs_double_vfs_io_class,
3115 TP_PROTO(struct inode *src, u64 soffset, u64 len,
3116 struct inode *dest, u64 doffset),
3117 TP_ARGS(src, soffset, len, dest, doffset),
3118 TP_STRUCT__entry(
3119 __field(dev_t, dev)
3120 __field(unsigned long, src_ino)
3121 __field(loff_t, src_isize)
3122 __field(loff_t, src_offset)
3123 __field(size_t, len)
3124 __field(unsigned long, dest_ino)
3125 __field(loff_t, dest_isize)
3126 __field(loff_t, dest_offset)
3127 ),
3128 TP_fast_assign(
3129 __entry->dev = src->i_sb->s_dev;
3130 __entry->src_ino = src->i_ino;
3131 __entry->src_isize = i_size_read(src);
3132 __entry->src_offset = soffset;
3133 __entry->len = len;
3134 __entry->dest_ino = dest->i_ino;
3135 __entry->dest_isize = i_size_read(dest);
3136 __entry->dest_offset = doffset;
3137 ),
3138 TP_printk("dev %d:%d count %zd "
3139 "ino 0x%lx isize 0x%llx offset 0x%llx -> "
3140 "ino 0x%lx isize 0x%llx offset 0x%llx",
3141 MAJOR(__entry->dev), MINOR(__entry->dev),
3142 __entry->len,
3143 __entry->src_ino,
3144 __entry->src_isize,
3145 __entry->src_offset,
3146 __entry->dest_ino,
3147 __entry->dest_isize,
3148 __entry->dest_offset)
3149)
3150
3151#define DEFINE_DOUBLE_VFS_IO_EVENT(name) \
3152DEFINE_EVENT(xfs_double_vfs_io_class, name, \
3153 TP_PROTO(struct inode *src, u64 soffset, u64 len, \
3154 struct inode *dest, u64 doffset), \
3155 TP_ARGS(src, soffset, len, dest, doffset))
3156
3157/* CoW write tracepoint */
3158DECLARE_EVENT_CLASS(xfs_copy_on_write_class,
3159 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk,
3160 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3161 TP_ARGS(ip, lblk, pblk, len, new_pblk),
3162 TP_STRUCT__entry(
3163 __field(dev_t, dev)
3164 __field(xfs_ino_t, ino)
3165 __field(xfs_fileoff_t, lblk)
3166 __field(xfs_fsblock_t, pblk)
3167 __field(xfs_extlen_t, len)
3168 __field(xfs_fsblock_t, new_pblk)
3169 ),
3170 TP_fast_assign(
3171 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3172 __entry->ino = ip->i_ino;
3173 __entry->lblk = lblk;
3174 __entry->pblk = pblk;
3175 __entry->len = len;
3176 __entry->new_pblk = new_pblk;
3177 ),
3178 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx pblk 0x%llx "
3179 "len 0x%x new_pblk %llu",
3180 MAJOR(__entry->dev), MINOR(__entry->dev),
3181 __entry->ino,
3182 __entry->lblk,
3183 __entry->pblk,
3184 __entry->len,
3185 __entry->new_pblk)
3186)
3187
3188#define DEFINE_COW_EVENT(name) \
3189DEFINE_EVENT(xfs_copy_on_write_class, name, \
3190 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk, \
3191 xfs_extlen_t len, xfs_fsblock_t new_pblk), \
3192 TP_ARGS(ip, lblk, pblk, len, new_pblk))
3193
3194/* inode/irec events */
3195DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3196 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3197 TP_ARGS(ip, irec),
3198 TP_STRUCT__entry(
3199 __field(dev_t, dev)
3200 __field(xfs_ino_t, ino)
3201 __field(xfs_fileoff_t, lblk)
3202 __field(xfs_extlen_t, len)
3203 __field(xfs_fsblock_t, pblk)
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003204 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003205 ),
3206 TP_fast_assign(
3207 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3208 __entry->ino = ip->i_ino;
3209 __entry->lblk = irec->br_startoff;
3210 __entry->len = irec->br_blockcount;
3211 __entry->pblk = irec->br_startblock;
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003212 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003213 ),
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003214 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 -07003215 MAJOR(__entry->dev), MINOR(__entry->dev),
3216 __entry->ino,
3217 __entry->lblk,
3218 __entry->len,
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003219 __entry->pblk,
3220 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003221);
3222#define DEFINE_INODE_IREC_EVENT(name) \
3223DEFINE_EVENT(xfs_inode_irec_class, name, \
3224 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3225 TP_ARGS(ip, irec))
3226
3227/* refcount/reflink tracepoint definitions */
3228
3229/* reflink tracepoints */
3230DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3231DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3232DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3233DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3234TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3235 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3236 xfs_filblks_t len, struct xfs_inode *dest,
3237 xfs_fileoff_t doffset),
3238 TP_ARGS(src, soffset, len, dest, doffset),
3239 TP_STRUCT__entry(
3240 __field(dev_t, dev)
3241 __field(xfs_ino_t, src_ino)
3242 __field(xfs_fileoff_t, src_lblk)
3243 __field(xfs_filblks_t, len)
3244 __field(xfs_ino_t, dest_ino)
3245 __field(xfs_fileoff_t, dest_lblk)
3246 ),
3247 TP_fast_assign(
3248 __entry->dev = VFS_I(src)->i_sb->s_dev;
3249 __entry->src_ino = src->i_ino;
3250 __entry->src_lblk = soffset;
3251 __entry->len = len;
3252 __entry->dest_ino = dest->i_ino;
3253 __entry->dest_lblk = doffset;
3254 ),
3255 TP_printk("dev %d:%d len 0x%llx "
3256 "ino 0x%llx offset 0x%llx blocks -> "
3257 "ino 0x%llx offset 0x%llx blocks",
3258 MAJOR(__entry->dev), MINOR(__entry->dev),
3259 __entry->len,
3260 __entry->src_ino,
3261 __entry->src_lblk,
3262 __entry->dest_ino,
3263 __entry->dest_lblk)
3264);
3265TRACE_EVENT(xfs_reflink_punch_range,
3266 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3267 xfs_extlen_t len),
3268 TP_ARGS(ip, lblk, len),
3269 TP_STRUCT__entry(
3270 __field(dev_t, dev)
3271 __field(xfs_ino_t, ino)
3272 __field(xfs_fileoff_t, lblk)
3273 __field(xfs_extlen_t, len)
3274 ),
3275 TP_fast_assign(
3276 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3277 __entry->ino = ip->i_ino;
3278 __entry->lblk = lblk;
3279 __entry->len = len;
3280 ),
3281 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3282 MAJOR(__entry->dev), MINOR(__entry->dev),
3283 __entry->ino,
3284 __entry->lblk,
3285 __entry->len)
3286);
3287TRACE_EVENT(xfs_reflink_remap,
3288 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3289 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3290 TP_ARGS(ip, lblk, len, new_pblk),
3291 TP_STRUCT__entry(
3292 __field(dev_t, dev)
3293 __field(xfs_ino_t, ino)
3294 __field(xfs_fileoff_t, lblk)
3295 __field(xfs_extlen_t, len)
3296 __field(xfs_fsblock_t, new_pblk)
3297 ),
3298 TP_fast_assign(
3299 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3300 __entry->ino = ip->i_ino;
3301 __entry->lblk = lblk;
3302 __entry->len = len;
3303 __entry->new_pblk = new_pblk;
3304 ),
3305 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3306 MAJOR(__entry->dev), MINOR(__entry->dev),
3307 __entry->ino,
3308 __entry->lblk,
3309 __entry->len,
3310 __entry->new_pblk)
3311);
3312DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3313DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3314DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3315DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3316DEFINE_INODE_ERROR_EVENT(xfs_reflink_reflink_main_loop_error);
3317DEFINE_INODE_ERROR_EVENT(xfs_reflink_read_iomap_error);
3318DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3319DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3320
3321/* dedupe tracepoints */
3322DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3323DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3324
3325/* ioctl tracepoints */
3326DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_reflink);
3327DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_clone_range);
3328DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_file_extent_same);
3329TRACE_EVENT(xfs_ioctl_clone,
3330 TP_PROTO(struct inode *src, struct inode *dest),
3331 TP_ARGS(src, dest),
3332 TP_STRUCT__entry(
3333 __field(dev_t, dev)
3334 __field(unsigned long, src_ino)
3335 __field(loff_t, src_isize)
3336 __field(unsigned long, dest_ino)
3337 __field(loff_t, dest_isize)
3338 ),
3339 TP_fast_assign(
3340 __entry->dev = src->i_sb->s_dev;
3341 __entry->src_ino = src->i_ino;
3342 __entry->src_isize = i_size_read(src);
3343 __entry->dest_ino = dest->i_ino;
3344 __entry->dest_isize = i_size_read(dest);
3345 ),
3346 TP_printk("dev %d:%d "
3347 "ino 0x%lx isize 0x%llx -> "
3348 "ino 0x%lx isize 0x%llx\n",
3349 MAJOR(__entry->dev), MINOR(__entry->dev),
3350 __entry->src_ino,
3351 __entry->src_isize,
3352 __entry->dest_ino,
3353 __entry->dest_isize)
3354);
3355
3356/* unshare tracepoints */
3357DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3358DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cow_eof_block);
3359DEFINE_PAGE_EVENT(xfs_reflink_unshare_page);
3360DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3361DEFINE_INODE_ERROR_EVENT(xfs_reflink_cow_eof_block_error);
3362DEFINE_INODE_ERROR_EVENT(xfs_reflink_dirty_page_error);
3363
3364/* copy on write */
3365DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003366DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3367DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3368DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wonge02f0ff2017-02-02 15:14:02 -08003369DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003370
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003371DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003372DEFINE_RW_EVENT(xfs_reflink_allocate_cow_range);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003373
Christoph Hellwig5bbf5ba2017-02-06 13:00:54 -08003374DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003375DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3376DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003377
3378DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3379DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3380DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003381
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003382DEFINE_INODE_ERROR_EVENT(xfs_reflink_allocate_cow_range_error);
3383DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3384DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3385
3386DEFINE_COW_EVENT(xfs_reflink_fork_buf);
3387DEFINE_COW_EVENT(xfs_reflink_finish_fork_buf);
3388DEFINE_INODE_ERROR_EVENT(xfs_reflink_fork_buf_error);
3389DEFINE_INODE_ERROR_EVENT(xfs_reflink_finish_fork_buf_error);
3390
3391DEFINE_INODE_EVENT(xfs_reflink_cancel_pending_cow);
3392DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3393DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_pending_cow_error);
3394
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003395/* rmap swapext tracepoints */
3396DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3397DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3398DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3399
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003400#endif /* _TRACE_XFS_H */
3401
3402#undef TRACE_INCLUDE_PATH
3403#define TRACE_INCLUDE_PATH .
3404#define TRACE_INCLUDE_FILE xfs_trace
3405#include <trace/define_trace.h>