blob: 5c10b12170d06e41b48b31b958369673d2e54a43 [file] [log] [blame]
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM xfs
20
21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22#define _TRACE_XFS_H
23
24#include <linux/tracepoint.h>
25
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000033struct xfs_log_item;
Mark Tinguelyad223e62012-06-14 09:22:15 -050034struct xlog;
Dave Chinner750b9c92013-11-01 15:27:18 +110035struct xlog_ticket;
Dave Chinner9abbc532010-04-13 15:06:46 +100036struct xlog_recover;
37struct xlog_recover_item;
38struct xfs_buf_log_format;
39struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050040struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100041struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070042struct xfs_refcount_irec;
Darrick J. Wongc75c7522016-10-03 09:11:15 -070043
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);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000139
Dave Chinnerd1230312013-11-01 15:27:19 +1100140DECLARE_EVENT_CLASS(xfs_ag_class,
141 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
142 TP_ARGS(mp, agno),
143 TP_STRUCT__entry(
144 __field(dev_t, dev)
145 __field(xfs_agnumber_t, agno)
146 ),
147 TP_fast_assign(
148 __entry->dev = mp->m_super->s_dev;
149 __entry->agno = agno;
150 ),
151 TP_printk("dev %d:%d agno %u",
152 MAJOR(__entry->dev), MINOR(__entry->dev),
153 __entry->agno)
154);
155#define DEFINE_AG_EVENT(name) \
156DEFINE_EVENT(xfs_ag_class, name, \
157 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
158 TP_ARGS(mp, agno))
159
160DEFINE_AG_EVENT(xfs_read_agf);
161DEFINE_AG_EVENT(xfs_alloc_read_agf);
162DEFINE_AG_EVENT(xfs_read_agi);
163DEFINE_AG_EVENT(xfs_ialloc_read_agi);
164
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000165TRACE_EVENT(xfs_attr_list_node_descend,
166 TP_PROTO(struct xfs_attr_list_context *ctx,
167 struct xfs_da_node_entry *btree),
168 TP_ARGS(ctx, btree),
169 TP_STRUCT__entry(
170 __field(dev_t, dev)
171 __field(xfs_ino_t, ino)
172 __field(u32, hashval)
173 __field(u32, blkno)
174 __field(u32, offset)
175 __field(void *, alist)
176 __field(int, bufsize)
177 __field(int, count)
178 __field(int, firstu)
179 __field(int, dupcnt)
180 __field(int, flags)
181 __field(u32, bt_hashval)
182 __field(u32, bt_before)
183 ),
184 TP_fast_assign(
185 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
186 __entry->ino = ctx->dp->i_ino;
187 __entry->hashval = ctx->cursor->hashval;
188 __entry->blkno = ctx->cursor->blkno;
189 __entry->offset = ctx->cursor->offset;
190 __entry->alist = ctx->alist;
191 __entry->bufsize = ctx->bufsize;
192 __entry->count = ctx->count;
193 __entry->firstu = ctx->firstu;
194 __entry->flags = ctx->flags;
195 __entry->bt_hashval = be32_to_cpu(btree->hashval);
196 __entry->bt_before = be32_to_cpu(btree->before);
197 ),
198 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
199 "alist 0x%p size %u count %u firstu %u flags %d %s "
200 "node hashval %u, node before %u",
201 MAJOR(__entry->dev), MINOR(__entry->dev),
202 __entry->ino,
203 __entry->hashval,
204 __entry->blkno,
205 __entry->offset,
206 __entry->dupcnt,
207 __entry->alist,
208 __entry->bufsize,
209 __entry->count,
210 __entry->firstu,
211 __entry->flags,
212 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
213 __entry->bt_hashval,
214 __entry->bt_before)
215);
216
217TRACE_EVENT(xfs_iext_insert,
218 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
219 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
220 TP_ARGS(ip, idx, r, state, caller_ip),
221 TP_STRUCT__entry(
222 __field(dev_t, dev)
223 __field(xfs_ino_t, ino)
224 __field(xfs_extnum_t, idx)
225 __field(xfs_fileoff_t, startoff)
226 __field(xfs_fsblock_t, startblock)
227 __field(xfs_filblks_t, blockcount)
228 __field(xfs_exntst_t, state)
229 __field(int, bmap_state)
230 __field(unsigned long, caller_ip)
231 ),
232 TP_fast_assign(
233 __entry->dev = VFS_I(ip)->i_sb->s_dev;
234 __entry->ino = ip->i_ino;
235 __entry->idx = idx;
236 __entry->startoff = r->br_startoff;
237 __entry->startblock = r->br_startblock;
238 __entry->blockcount = r->br_blockcount;
239 __entry->state = r->br_state;
240 __entry->bmap_state = state;
241 __entry->caller_ip = caller_ip;
242 ),
243 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100244 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000245 MAJOR(__entry->dev), MINOR(__entry->dev),
246 __entry->ino,
247 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
248 (long)__entry->idx,
249 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000250 (__int64_t)__entry->startblock,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000251 __entry->blockcount,
252 __entry->state,
253 (char *)__entry->caller_ip)
254);
255
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000256DECLARE_EVENT_CLASS(xfs_bmap_class,
257 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
258 unsigned long caller_ip),
259 TP_ARGS(ip, idx, state, caller_ip),
260 TP_STRUCT__entry(
261 __field(dev_t, dev)
262 __field(xfs_ino_t, ino)
263 __field(xfs_extnum_t, idx)
264 __field(xfs_fileoff_t, startoff)
265 __field(xfs_fsblock_t, startblock)
266 __field(xfs_filblks_t, blockcount)
267 __field(xfs_exntst_t, state)
268 __field(int, bmap_state)
269 __field(unsigned long, caller_ip)
270 ),
271 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700272 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000273 struct xfs_bmbt_irec r;
274
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700275 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000276 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
277 __entry->dev = VFS_I(ip)->i_sb->s_dev;
278 __entry->ino = ip->i_ino;
279 __entry->idx = idx;
280 __entry->startoff = r.br_startoff;
281 __entry->startblock = r.br_startblock;
282 __entry->blockcount = r.br_blockcount;
283 __entry->state = r.br_state;
284 __entry->bmap_state = state;
285 __entry->caller_ip = caller_ip;
286 ),
287 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100288 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000289 MAJOR(__entry->dev), MINOR(__entry->dev),
290 __entry->ino,
291 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
292 (long)__entry->idx,
293 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000294 (__int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000295 __entry->blockcount,
296 __entry->state,
297 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000298)
299
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000300#define DEFINE_BMAP_EVENT(name) \
301DEFINE_EVENT(xfs_bmap_class, name, \
302 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
303 unsigned long caller_ip), \
304 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000305DEFINE_BMAP_EVENT(xfs_iext_remove);
306DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
307DEFINE_BMAP_EVENT(xfs_bmap_post_update);
308DEFINE_BMAP_EVENT(xfs_extlist);
309
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000310DECLARE_EVENT_CLASS(xfs_buf_class,
311 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
312 TP_ARGS(bp, caller_ip),
313 TP_STRUCT__entry(
314 __field(dev_t, dev)
315 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000316 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000317 __field(int, hold)
318 __field(int, pincount)
319 __field(unsigned, lockval)
320 __field(unsigned, flags)
321 __field(unsigned long, caller_ip)
322 ),
323 TP_fast_assign(
324 __entry->dev = bp->b_target->bt_dev;
325 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000326 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000327 __entry->hold = atomic_read(&bp->b_hold);
328 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200329 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000330 __entry->flags = bp->b_flags;
331 __entry->caller_ip = caller_ip;
332 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000333 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100334 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000335 MAJOR(__entry->dev), MINOR(__entry->dev),
336 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000337 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000338 __entry->hold,
339 __entry->pincount,
340 __entry->lockval,
341 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
342 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000343)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000344
345#define DEFINE_BUF_EVENT(name) \
346DEFINE_EVENT(xfs_buf_class, name, \
347 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
348 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000349DEFINE_BUF_EVENT(xfs_buf_init);
350DEFINE_BUF_EVENT(xfs_buf_free);
351DEFINE_BUF_EVENT(xfs_buf_hold);
352DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000353DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000354DEFINE_BUF_EVENT(xfs_buf_submit);
355DEFINE_BUF_EVENT(xfs_buf_submit_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000356DEFINE_BUF_EVENT(xfs_buf_bawrite);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000357DEFINE_BUF_EVENT(xfs_buf_lock);
358DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000359DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200360DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000361DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000362DEFINE_BUF_EVENT(xfs_buf_iowait);
363DEFINE_BUF_EVENT(xfs_buf_iowait_done);
364DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000365DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000366DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Dave Chinner686865f2010-09-24 20:07:47 +1000367DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000368DEFINE_BUF_EVENT(xfs_bdstrat_shut);
369DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000370DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
371DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100372DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000373DEFINE_BUF_EVENT(xfs_trans_read_buf_io);
374DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
375
376/* not really buffer traces, but the buf provides useful information */
377DEFINE_BUF_EVENT(xfs_btree_corrupt);
378DEFINE_BUF_EVENT(xfs_da_btree_corrupt);
379DEFINE_BUF_EVENT(xfs_reset_dqcounts);
380DEFINE_BUF_EVENT(xfs_inode_item_push);
381
382/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000383DECLARE_EVENT_CLASS(xfs_buf_flags_class,
384 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
385 TP_ARGS(bp, flags, caller_ip),
386 TP_STRUCT__entry(
387 __field(dev_t, dev)
388 __field(xfs_daddr_t, bno)
389 __field(size_t, buffer_length)
390 __field(int, hold)
391 __field(int, pincount)
392 __field(unsigned, lockval)
393 __field(unsigned, flags)
394 __field(unsigned long, caller_ip)
395 ),
396 TP_fast_assign(
397 __entry->dev = bp->b_target->bt_dev;
398 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000399 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000400 __entry->flags = flags;
401 __entry->hold = atomic_read(&bp->b_hold);
402 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200403 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000404 __entry->caller_ip = caller_ip;
405 ),
406 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100407 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000408 MAJOR(__entry->dev), MINOR(__entry->dev),
409 (unsigned long long)__entry->bno,
410 __entry->buffer_length,
411 __entry->hold,
412 __entry->pincount,
413 __entry->lockval,
414 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
415 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000416)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000417
418#define DEFINE_BUF_FLAGS_EVENT(name) \
419DEFINE_EVENT(xfs_buf_flags_class, name, \
420 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
421 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000422DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
423DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
424DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
425
426TRACE_EVENT(xfs_buf_ioerror,
427 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
428 TP_ARGS(bp, error, caller_ip),
429 TP_STRUCT__entry(
430 __field(dev_t, dev)
431 __field(xfs_daddr_t, bno)
432 __field(size_t, buffer_length)
433 __field(unsigned, flags)
434 __field(int, hold)
435 __field(int, pincount)
436 __field(unsigned, lockval)
437 __field(int, error)
438 __field(unsigned long, caller_ip)
439 ),
440 TP_fast_assign(
441 __entry->dev = bp->b_target->bt_dev;
442 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000443 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000444 __entry->hold = atomic_read(&bp->b_hold);
445 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200446 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000447 __entry->error = error;
448 __entry->flags = bp->b_flags;
449 __entry->caller_ip = caller_ip;
450 ),
451 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100452 "lock %d error %d flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000453 MAJOR(__entry->dev), MINOR(__entry->dev),
454 (unsigned long long)__entry->bno,
455 __entry->buffer_length,
456 __entry->hold,
457 __entry->pincount,
458 __entry->lockval,
459 __entry->error,
460 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
461 (void *)__entry->caller_ip)
462);
463
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000464DECLARE_EVENT_CLASS(xfs_buf_item_class,
465 TP_PROTO(struct xfs_buf_log_item *bip),
466 TP_ARGS(bip),
467 TP_STRUCT__entry(
468 __field(dev_t, dev)
469 __field(xfs_daddr_t, buf_bno)
470 __field(size_t, buf_len)
471 __field(int, buf_hold)
472 __field(int, buf_pincount)
473 __field(int, buf_lockval)
474 __field(unsigned, buf_flags)
475 __field(unsigned, bli_recur)
476 __field(int, bli_refcount)
477 __field(unsigned, bli_flags)
478 __field(void *, li_desc)
479 __field(unsigned, li_flags)
480 ),
481 TP_fast_assign(
482 __entry->dev = bip->bli_buf->b_target->bt_dev;
483 __entry->bli_flags = bip->bli_flags;
484 __entry->bli_recur = bip->bli_recur;
485 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
486 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000487 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000488 __entry->buf_flags = bip->bli_buf->b_flags;
489 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
490 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200491 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000492 __entry->li_desc = bip->bli_item.li_desc;
493 __entry->li_flags = bip->bli_item.li_flags;
494 ),
495 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
496 "lock %d flags %s recur %d refcount %d bliflags %s "
497 "lidesc 0x%p liflags %s",
498 MAJOR(__entry->dev), MINOR(__entry->dev),
499 (unsigned long long)__entry->buf_bno,
500 __entry->buf_len,
501 __entry->buf_hold,
502 __entry->buf_pincount,
503 __entry->buf_lockval,
504 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
505 __entry->bli_recur,
506 __entry->bli_refcount,
507 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
508 __entry->li_desc,
509 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000510)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000511
512#define DEFINE_BUF_ITEM_EVENT(name) \
513DEFINE_EVENT(xfs_buf_item_class, name, \
514 TP_PROTO(struct xfs_buf_log_item *bip), \
515 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000516DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000517DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000523DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
524DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
525DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000526DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
527DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
528DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
529DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
530DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
531DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
532DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
533DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
534DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
535DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
536DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
537DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
538DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
539DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
540DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
541DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000542DEFINE_BUF_ITEM_EVENT(xfs_trans_buf_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000543
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000544DECLARE_EVENT_CLASS(xfs_filestream_class,
545 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
546 TP_ARGS(ip, agno),
547 TP_STRUCT__entry(
548 __field(dev_t, dev)
549 __field(xfs_ino_t, ino)
550 __field(xfs_agnumber_t, agno)
551 __field(int, streams)
552 ),
553 TP_fast_assign(
554 __entry->dev = VFS_I(ip)->i_sb->s_dev;
555 __entry->ino = ip->i_ino;
556 __entry->agno = agno;
557 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
558 ),
559 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
560 MAJOR(__entry->dev), MINOR(__entry->dev),
561 __entry->ino,
562 __entry->agno,
563 __entry->streams)
564)
565#define DEFINE_FILESTREAM_EVENT(name) \
566DEFINE_EVENT(xfs_filestream_class, name, \
567 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
568 TP_ARGS(ip, agno))
569DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
570DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
571DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
572
573TRACE_EVENT(xfs_filestream_pick,
574 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
575 xfs_extlen_t free, int nscan),
576 TP_ARGS(ip, agno, free, nscan),
577 TP_STRUCT__entry(
578 __field(dev_t, dev)
579 __field(xfs_ino_t, ino)
580 __field(xfs_agnumber_t, agno)
581 __field(int, streams)
582 __field(xfs_extlen_t, free)
583 __field(int, nscan)
584 ),
585 TP_fast_assign(
586 __entry->dev = VFS_I(ip)->i_sb->s_dev;
587 __entry->ino = ip->i_ino;
588 __entry->agno = agno;
589 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
590 __entry->free = free;
591 __entry->nscan = nscan;
592 ),
593 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
594 MAJOR(__entry->dev), MINOR(__entry->dev),
595 __entry->ino,
596 __entry->agno,
597 __entry->streams,
598 __entry->free,
599 __entry->nscan)
600);
601
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000602DECLARE_EVENT_CLASS(xfs_lock_class,
603 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
604 unsigned long caller_ip),
605 TP_ARGS(ip, lock_flags, caller_ip),
606 TP_STRUCT__entry(
607 __field(dev_t, dev)
608 __field(xfs_ino_t, ino)
609 __field(int, lock_flags)
610 __field(unsigned long, caller_ip)
611 ),
612 TP_fast_assign(
613 __entry->dev = VFS_I(ip)->i_sb->s_dev;
614 __entry->ino = ip->i_ino;
615 __entry->lock_flags = lock_flags;
616 __entry->caller_ip = caller_ip;
617 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100618 TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000619 MAJOR(__entry->dev), MINOR(__entry->dev),
620 __entry->ino,
621 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
622 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000623)
624
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000625#define DEFINE_LOCK_EVENT(name) \
626DEFINE_EVENT(xfs_lock_class, name, \
627 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
628 unsigned long caller_ip), \
629 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000630DEFINE_LOCK_EVENT(xfs_ilock);
631DEFINE_LOCK_EVENT(xfs_ilock_nowait);
632DEFINE_LOCK_EVENT(xfs_ilock_demote);
633DEFINE_LOCK_EVENT(xfs_iunlock);
634
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000635DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000636 TP_PROTO(struct xfs_inode *ip),
637 TP_ARGS(ip),
638 TP_STRUCT__entry(
639 __field(dev_t, dev)
640 __field(xfs_ino_t, ino)
641 ),
642 TP_fast_assign(
643 __entry->dev = VFS_I(ip)->i_sb->s_dev;
644 __entry->ino = ip->i_ino;
645 ),
646 TP_printk("dev %d:%d ino 0x%llx",
647 MAJOR(__entry->dev), MINOR(__entry->dev),
648 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000649)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000650
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000651#define DEFINE_INODE_EVENT(name) \
652DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000653 TP_PROTO(struct xfs_inode *ip), \
654 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000655DEFINE_INODE_EVENT(xfs_iget_skip);
656DEFINE_INODE_EVENT(xfs_iget_reclaim);
657DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
658DEFINE_INODE_EVENT(xfs_iget_hit);
659DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000660
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000661DEFINE_INODE_EVENT(xfs_getattr);
662DEFINE_INODE_EVENT(xfs_setattr);
663DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500664DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000665DEFINE_INODE_EVENT(xfs_alloc_file_space);
666DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000667DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100668DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100669DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000670DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000671#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200672DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000673#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000674DEFINE_INODE_EVENT(xfs_vm_bmap);
675DEFINE_INODE_EVENT(xfs_file_ioctl);
676DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
677DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000678DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000679DEFINE_INODE_EVENT(xfs_file_fsync);
680DEFINE_INODE_EVENT(xfs_destroy_inode);
Al Virob57922d2010-06-07 14:34:48 -0400681DEFINE_INODE_EVENT(xfs_evict_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400682DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000683
684DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
685DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
686
Brian Foster27b52862012-11-06 09:50:38 -0500687DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
688DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500689DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500690
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100691DEFINE_INODE_EVENT(xfs_filemap_fault);
Matthew Wilcoxacd76e72015-09-08 14:59:06 -0700692DEFINE_INODE_EVENT(xfs_filemap_pmd_fault);
Dave Chinner075a9242015-02-23 21:44:54 +1100693DEFINE_INODE_EVENT(xfs_filemap_page_mkwrite);
Dave Chinner3af49282015-11-03 12:37:02 +1100694DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100695
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000696DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000697 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
698 TP_ARGS(ip, caller_ip),
699 TP_STRUCT__entry(
700 __field(dev_t, dev)
701 __field(xfs_ino_t, ino)
702 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100703 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000704 __field(unsigned long, caller_ip)
705 ),
706 TP_fast_assign(
707 __entry->dev = VFS_I(ip)->i_sb->s_dev;
708 __entry->ino = ip->i_ino;
709 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100710 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000711 __entry->caller_ip = caller_ip;
712 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100713 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000714 MAJOR(__entry->dev), MINOR(__entry->dev),
715 __entry->ino,
716 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100717 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000718 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000719)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000720
Brian Foster19cb7e32013-03-18 10:51:48 -0400721TRACE_EVENT(xfs_iomap_prealloc_size,
722 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
723 unsigned int writeio_blocks),
724 TP_ARGS(ip, blocks, shift, writeio_blocks),
725 TP_STRUCT__entry(
726 __field(dev_t, dev)
727 __field(xfs_ino_t, ino)
728 __field(xfs_fsblock_t, blocks)
729 __field(int, shift)
730 __field(unsigned int, writeio_blocks)
731 ),
732 TP_fast_assign(
733 __entry->dev = VFS_I(ip)->i_sb->s_dev;
734 __entry->ino = ip->i_ino;
735 __entry->blocks = blocks;
736 __entry->shift = shift;
737 __entry->writeio_blocks = writeio_blocks;
738 ),
739 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
740 "m_writeio_blocks %u",
741 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
742 __entry->blocks, __entry->shift, __entry->writeio_blocks)
743)
744
Brian Foster56d11152015-05-29 09:18:32 +1000745TRACE_EVENT(xfs_irec_merge_pre,
746 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
747 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
748 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
749 TP_STRUCT__entry(
750 __field(dev_t, dev)
751 __field(xfs_agnumber_t, agno)
752 __field(xfs_agino_t, agino)
753 __field(uint16_t, holemask)
754 __field(xfs_agino_t, nagino)
755 __field(uint16_t, nholemask)
756 ),
757 TP_fast_assign(
758 __entry->dev = mp->m_super->s_dev;
759 __entry->agno = agno;
760 __entry->agino = agino;
761 __entry->holemask = holemask;
762 __entry->nagino = nagino;
763 __entry->nholemask = holemask;
764 ),
765 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
766 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
767 __entry->agino, __entry->holemask, __entry->nagino,
768 __entry->nholemask)
769)
770
771TRACE_EVENT(xfs_irec_merge_post,
772 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
773 uint16_t holemask),
774 TP_ARGS(mp, agno, agino, holemask),
775 TP_STRUCT__entry(
776 __field(dev_t, dev)
777 __field(xfs_agnumber_t, agno)
778 __field(xfs_agino_t, agino)
779 __field(uint16_t, holemask)
780 ),
781 TP_fast_assign(
782 __entry->dev = mp->m_super->s_dev;
783 __entry->agno = agno;
784 __entry->agino = agino;
785 __entry->holemask = holemask;
786 ),
787 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
788 MINOR(__entry->dev), __entry->agno, __entry->agino,
789 __entry->holemask)
790)
791
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000792#define DEFINE_IREF_EVENT(name) \
793DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000794 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
795 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000796DEFINE_IREF_EVENT(xfs_ihold);
797DEFINE_IREF_EVENT(xfs_irele);
798DEFINE_IREF_EVENT(xfs_inode_pin);
799DEFINE_IREF_EVENT(xfs_inode_unpin);
800DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100801
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000802DECLARE_EVENT_CLASS(xfs_namespace_class,
803 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
804 TP_ARGS(dp, name),
805 TP_STRUCT__entry(
806 __field(dev_t, dev)
807 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000808 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000809 __dynamic_array(char, name, name->len)
810 ),
811 TP_fast_assign(
812 __entry->dev = VFS_I(dp)->i_sb->s_dev;
813 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000814 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000815 memcpy(__get_str(name), name->name, name->len);
816 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000817 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000818 MAJOR(__entry->dev), MINOR(__entry->dev),
819 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000820 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000821 __get_str(name))
822)
823
824#define DEFINE_NAMESPACE_EVENT(name) \
825DEFINE_EVENT(xfs_namespace_class, name, \
826 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
827 TP_ARGS(dp, name))
828DEFINE_NAMESPACE_EVENT(xfs_remove);
829DEFINE_NAMESPACE_EVENT(xfs_link);
830DEFINE_NAMESPACE_EVENT(xfs_lookup);
831DEFINE_NAMESPACE_EVENT(xfs_create);
832DEFINE_NAMESPACE_EVENT(xfs_symlink);
833
834TRACE_EVENT(xfs_rename,
835 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
836 struct xfs_name *src_name, struct xfs_name *target_name),
837 TP_ARGS(src_dp, target_dp, src_name, target_name),
838 TP_STRUCT__entry(
839 __field(dev_t, dev)
840 __field(xfs_ino_t, src_dp_ino)
841 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000842 __field(int, src_namelen)
843 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000844 __dynamic_array(char, src_name, src_name->len)
845 __dynamic_array(char, target_name, target_name->len)
846 ),
847 TP_fast_assign(
848 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
849 __entry->src_dp_ino = src_dp->i_ino;
850 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000851 __entry->src_namelen = src_name->len;
852 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000853 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000854 memcpy(__get_str(target_name), target_name->name,
855 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000856 ),
857 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000858 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000859 MAJOR(__entry->dev), MINOR(__entry->dev),
860 __entry->src_dp_ino,
861 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000862 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000863 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000864 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000865 __get_str(target_name))
866)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000867
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000868DECLARE_EVENT_CLASS(xfs_dquot_class,
869 TP_PROTO(struct xfs_dquot *dqp),
870 TP_ARGS(dqp),
871 TP_STRUCT__entry(
872 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000873 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000874 __field(unsigned, flags)
875 __field(unsigned, nrefs)
876 __field(unsigned long long, res_bcount)
877 __field(unsigned long long, bcount)
878 __field(unsigned long long, icount)
879 __field(unsigned long long, blk_hardlimit)
880 __field(unsigned long long, blk_softlimit)
881 __field(unsigned long long, ino_hardlimit)
882 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000883 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000884 TP_fast_assign(
885 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000886 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000887 __entry->flags = dqp->dq_flags;
888 __entry->nrefs = dqp->q_nrefs;
889 __entry->res_bcount = dqp->q_res_bcount;
890 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
891 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
892 __entry->blk_hardlimit =
893 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
894 __entry->blk_softlimit =
895 be64_to_cpu(dqp->q_core.d_blk_softlimit);
896 __entry->ino_hardlimit =
897 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
898 __entry->ino_softlimit =
899 be64_to_cpu(dqp->q_core.d_ino_softlimit);
900 ),
901 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000902 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
903 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000904 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000905 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000906 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
907 __entry->nrefs,
908 __entry->res_bcount,
909 __entry->bcount,
910 __entry->blk_hardlimit,
911 __entry->blk_softlimit,
912 __entry->icount,
913 __entry->ino_hardlimit,
914 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000915)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000916
917#define DEFINE_DQUOT_EVENT(name) \
918DEFINE_EVENT(xfs_dquot_class, name, \
919 TP_PROTO(struct xfs_dquot *dqp), \
920 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000921DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000922DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
923DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000924DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
925DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000926DEFINE_DQUOT_EVENT(xfs_dqattach_found);
927DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000928DEFINE_DQUOT_EVENT(xfs_dqalloc);
929DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
930DEFINE_DQUOT_EVENT(xfs_dqread);
931DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000932DEFINE_DQUOT_EVENT(xfs_dqget_hit);
933DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000934DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
935DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000936DEFINE_DQUOT_EVENT(xfs_dqput);
937DEFINE_DQUOT_EVENT(xfs_dqput_wait);
938DEFINE_DQUOT_EVENT(xfs_dqput_free);
939DEFINE_DQUOT_EVENT(xfs_dqrele);
940DEFINE_DQUOT_EVENT(xfs_dqflush);
941DEFINE_DQUOT_EVENT(xfs_dqflush_force);
942DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000943
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000944DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500945 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000946 TP_ARGS(log, tic),
947 TP_STRUCT__entry(
948 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000949 __field(char, ocnt)
950 __field(char, cnt)
951 __field(int, curr_res)
952 __field(int, unit_res)
953 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100954 __field(int, reserveq)
955 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000956 __field(int, grant_reserve_cycle)
957 __field(int, grant_reserve_bytes)
958 __field(int, grant_write_cycle)
959 __field(int, grant_write_bytes)
960 __field(int, curr_cycle)
961 __field(int, curr_block)
962 __field(xfs_lsn_t, tail_lsn)
963 ),
964 TP_fast_assign(
965 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000966 __entry->ocnt = tic->t_ocnt;
967 __entry->cnt = tic->t_cnt;
968 __entry->curr_res = tic->t_curr_res;
969 __entry->unit_res = tic->t_unit_res;
970 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000971 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
972 __entry->writeq = list_empty(&log->l_write_head.waiters);
973 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100974 &__entry->grant_reserve_cycle,
975 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000976 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100977 &__entry->grant_write_cycle,
978 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000979 __entry->curr_cycle = log->l_curr_cycle;
980 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100981 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000982 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000983 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100984 "t_unit_res %u t_flags %s reserveq %s "
985 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000986 "grant_reserve_bytes %d grant_write_cycle %d "
987 "grant_write_bytes %d curr_cycle %d curr_block %d "
988 "tail_cycle %d tail_block %d",
989 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000990 __entry->ocnt,
991 __entry->cnt,
992 __entry->curr_res,
993 __entry->unit_res,
994 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100995 __entry->reserveq ? "empty" : "active",
996 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000997 __entry->grant_reserve_cycle,
998 __entry->grant_reserve_bytes,
999 __entry->grant_write_cycle,
1000 __entry->grant_write_bytes,
1001 __entry->curr_cycle,
1002 __entry->curr_block,
1003 CYCLE_LSN(__entry->tail_lsn),
1004 BLOCK_LSN(__entry->tail_lsn)
1005 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001006)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001007
1008#define DEFINE_LOGGRANT_EVENT(name) \
1009DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001010 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001011 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001012DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1013DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001014DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001015DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1016DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001017DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001018DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1019DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1020DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1021DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001022DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1023DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1024DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1025DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1026DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1027DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1028
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001029DECLARE_EVENT_CLASS(xfs_log_item_class,
1030 TP_PROTO(struct xfs_log_item *lip),
1031 TP_ARGS(lip),
1032 TP_STRUCT__entry(
1033 __field(dev_t, dev)
1034 __field(void *, lip)
1035 __field(uint, type)
1036 __field(uint, flags)
1037 __field(xfs_lsn_t, lsn)
1038 ),
1039 TP_fast_assign(
1040 __entry->dev = lip->li_mountp->m_super->s_dev;
1041 __entry->lip = lip;
1042 __entry->type = lip->li_type;
1043 __entry->flags = lip->li_flags;
1044 __entry->lsn = lip->li_lsn;
1045 ),
1046 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1047 MAJOR(__entry->dev), MINOR(__entry->dev),
1048 __entry->lip,
1049 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1050 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1051 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1052)
1053
Dave Chinner14c26c62012-04-24 16:33:31 +10001054TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001055 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1056 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001057 TP_STRUCT__entry(
1058 __field(dev_t, dev)
1059 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001060 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001061 ),
1062 TP_fast_assign(
1063 __entry->dev = mp->m_super->s_dev;
1064 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001065 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001066 ),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001067 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
Dave Chinner14c26c62012-04-24 16:33:31 +10001068 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001069 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001070)
1071
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001072#define DEFINE_LOG_ITEM_EVENT(name) \
1073DEFINE_EVENT(xfs_log_item_class, name, \
1074 TP_PROTO(struct xfs_log_item *lip), \
1075 TP_ARGS(lip))
1076DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001077DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1078DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001079DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001080
Dave Chinner750b9c92013-11-01 15:27:18 +11001081DECLARE_EVENT_CLASS(xfs_ail_class,
1082 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1083 TP_ARGS(lip, old_lsn, new_lsn),
1084 TP_STRUCT__entry(
1085 __field(dev_t, dev)
1086 __field(void *, lip)
1087 __field(uint, type)
1088 __field(uint, flags)
1089 __field(xfs_lsn_t, old_lsn)
1090 __field(xfs_lsn_t, new_lsn)
1091 ),
1092 TP_fast_assign(
1093 __entry->dev = lip->li_mountp->m_super->s_dev;
1094 __entry->lip = lip;
1095 __entry->type = lip->li_type;
1096 __entry->flags = lip->li_flags;
1097 __entry->old_lsn = old_lsn;
1098 __entry->new_lsn = new_lsn;
1099 ),
1100 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1101 MAJOR(__entry->dev), MINOR(__entry->dev),
1102 __entry->lip,
1103 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1104 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1105 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1106 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1107)
1108
1109#define DEFINE_AIL_EVENT(name) \
1110DEFINE_EVENT(xfs_ail_class, name, \
1111 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1112 TP_ARGS(lip, old_lsn, new_lsn))
1113DEFINE_AIL_EVENT(xfs_ail_insert);
1114DEFINE_AIL_EVENT(xfs_ail_move);
1115DEFINE_AIL_EVENT(xfs_ail_delete);
1116
1117TRACE_EVENT(xfs_log_assign_tail_lsn,
1118 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1119 TP_ARGS(log, new_lsn),
1120 TP_STRUCT__entry(
1121 __field(dev_t, dev)
1122 __field(xfs_lsn_t, new_lsn)
1123 __field(xfs_lsn_t, old_lsn)
1124 __field(xfs_lsn_t, last_sync_lsn)
1125 ),
1126 TP_fast_assign(
1127 __entry->dev = log->l_mp->m_super->s_dev;
1128 __entry->new_lsn = new_lsn;
1129 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1130 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1131 ),
1132 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1133 MAJOR(__entry->dev), MINOR(__entry->dev),
1134 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1135 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1136 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1137)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001138
Li Zefanf8adb4d2010-05-24 08:25:57 +00001139DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001140 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1141 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001142 TP_STRUCT__entry(
1143 __field(dev_t, dev)
1144 __field(xfs_ino_t, ino)
1145 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001146 __field(loff_t, offset)
1147 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001148 ),
1149 TP_fast_assign(
1150 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1151 __entry->ino = ip->i_ino;
1152 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001153 __entry->offset = offset;
1154 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001155 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001156 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001157 MAJOR(__entry->dev), MINOR(__entry->dev),
1158 __entry->ino,
1159 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001160 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001161 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001162)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001163
1164#define DEFINE_RW_EVENT(name) \
1165DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001166 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1167 TP_ARGS(ip, count, offset))
1168DEFINE_RW_EVENT(xfs_file_buffered_read);
1169DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001170DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001171DEFINE_RW_EVENT(xfs_file_buffered_write);
1172DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001173DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001174DEFINE_RW_EVENT(xfs_file_splice_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001175
Li Zefanf8adb4d2010-05-24 08:25:57 +00001176DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001177 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1178 unsigned int len),
1179 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001180 TP_STRUCT__entry(
1181 __field(dev_t, dev)
1182 __field(xfs_ino_t, ino)
1183 __field(pgoff_t, pgoff)
1184 __field(loff_t, size)
1185 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001186 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001187 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001188 __field(int, unwritten)
1189 ),
1190 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001191 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001192
Li Zefanf8adb4d2010-05-24 08:25:57 +00001193 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001194 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001195 __entry->dev = inode->i_sb->s_dev;
1196 __entry->ino = XFS_I(inode)->i_ino;
1197 __entry->pgoff = page_offset(page);
1198 __entry->size = i_size_read(inode);
1199 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001200 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001201 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001202 __entry->unwritten = unwritten;
1203 ),
1204 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001205 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001206 MAJOR(__entry->dev), MINOR(__entry->dev),
1207 __entry->ino,
1208 __entry->pgoff,
1209 __entry->size,
1210 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001211 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001212 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001213 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001214)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001215
1216#define DEFINE_PAGE_EVENT(name) \
1217DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001218 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1219 unsigned int len), \
1220 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001221DEFINE_PAGE_EVENT(xfs_writepage);
1222DEFINE_PAGE_EVENT(xfs_releasepage);
1223DEFINE_PAGE_EVENT(xfs_invalidatepage);
1224
Dave Chinner121e2132016-01-08 11:28:35 +11001225DECLARE_EVENT_CLASS(xfs_readpage_class,
1226 TP_PROTO(struct inode *inode, int nr_pages),
1227 TP_ARGS(inode, nr_pages),
1228 TP_STRUCT__entry(
1229 __field(dev_t, dev)
1230 __field(xfs_ino_t, ino)
1231 __field(int, nr_pages)
1232 ),
1233 TP_fast_assign(
1234 __entry->dev = inode->i_sb->s_dev;
1235 __entry->ino = inode->i_ino;
1236 __entry->nr_pages = nr_pages;
1237 ),
1238 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1239 MAJOR(__entry->dev), MINOR(__entry->dev),
1240 __entry->ino,
1241 __entry->nr_pages)
1242)
1243
1244#define DEFINE_READPAGE_EVENT(name) \
1245DEFINE_EVENT(xfs_readpage_class, name, \
1246 TP_PROTO(struct inode *inode, int nr_pages), \
1247 TP_ARGS(inode, nr_pages))
1248DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1249DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1250
Christoph Hellwiga206c812010-12-10 08:42:20 +00001251DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001252 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001253 int type, struct xfs_bmbt_irec *irec),
1254 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001255 TP_STRUCT__entry(
1256 __field(dev_t, dev)
1257 __field(xfs_ino_t, ino)
1258 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001259 __field(loff_t, offset)
1260 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001261 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001262 __field(xfs_fileoff_t, startoff)
1263 __field(xfs_fsblock_t, startblock)
1264 __field(xfs_filblks_t, blockcount)
1265 ),
1266 TP_fast_assign(
1267 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1268 __entry->ino = ip->i_ino;
1269 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001270 __entry->offset = offset;
1271 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001272 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001273 __entry->startoff = irec ? irec->br_startoff : 0;
1274 __entry->startblock = irec ? irec->br_startblock : 0;
1275 __entry->blockcount = irec ? irec->br_blockcount : 0;
1276 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001277 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1278 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001279 MAJOR(__entry->dev), MINOR(__entry->dev),
1280 __entry->ino,
1281 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001282 __entry->offset,
1283 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001284 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001285 __entry->startoff,
1286 (__int64_t)__entry->startblock,
1287 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001288)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001289
1290#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001291DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001292 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001293 int type, struct xfs_bmbt_irec *irec), \
1294 TP_ARGS(ip, offset, count, type, irec))
1295DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1296DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1297DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1298DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001299DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001300DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1301DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001302
Li Zefanf8adb4d2010-05-24 08:25:57 +00001303DECLARE_EVENT_CLASS(xfs_simple_io_class,
1304 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1305 TP_ARGS(ip, offset, count),
1306 TP_STRUCT__entry(
1307 __field(dev_t, dev)
1308 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001309 __field(loff_t, isize)
1310 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001311 __field(loff_t, offset)
1312 __field(size_t, count)
1313 ),
1314 TP_fast_assign(
1315 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1316 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001317 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001318 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001319 __entry->offset = offset;
1320 __entry->count = count;
1321 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001322 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001323 "offset 0x%llx count %zd",
1324 MAJOR(__entry->dev), MINOR(__entry->dev),
1325 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001326 __entry->isize,
1327 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001328 __entry->offset,
1329 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001330);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001331
1332#define DEFINE_SIMPLE_IO_EVENT(name) \
1333DEFINE_EVENT(xfs_simple_io_class, name, \
1334 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1335 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001336DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1337DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001338DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001339DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001340DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001341DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1342DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1343DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001344
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001345DECLARE_EVENT_CLASS(xfs_itrunc_class,
1346 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1347 TP_ARGS(ip, new_size),
1348 TP_STRUCT__entry(
1349 __field(dev_t, dev)
1350 __field(xfs_ino_t, ino)
1351 __field(xfs_fsize_t, size)
1352 __field(xfs_fsize_t, new_size)
1353 ),
1354 TP_fast_assign(
1355 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1356 __entry->ino = ip->i_ino;
1357 __entry->size = ip->i_d.di_size;
1358 __entry->new_size = new_size;
1359 ),
1360 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1361 MAJOR(__entry->dev), MINOR(__entry->dev),
1362 __entry->ino,
1363 __entry->size,
1364 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001365)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001366
1367#define DEFINE_ITRUNC_EVENT(name) \
1368DEFINE_EVENT(xfs_itrunc_class, name, \
1369 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1370 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001371DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1372DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001373
1374TRACE_EVENT(xfs_pagecache_inval,
1375 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1376 TP_ARGS(ip, start, finish),
1377 TP_STRUCT__entry(
1378 __field(dev_t, dev)
1379 __field(xfs_ino_t, ino)
1380 __field(xfs_fsize_t, size)
1381 __field(xfs_off_t, start)
1382 __field(xfs_off_t, finish)
1383 ),
1384 TP_fast_assign(
1385 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1386 __entry->ino = ip->i_ino;
1387 __entry->size = ip->i_d.di_size;
1388 __entry->start = start;
1389 __entry->finish = finish;
1390 ),
1391 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1392 MAJOR(__entry->dev), MINOR(__entry->dev),
1393 __entry->ino,
1394 __entry->size,
1395 __entry->start,
1396 __entry->finish)
1397);
1398
1399TRACE_EVENT(xfs_bunmap,
1400 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1401 int flags, unsigned long caller_ip),
1402 TP_ARGS(ip, bno, len, flags, caller_ip),
1403 TP_STRUCT__entry(
1404 __field(dev_t, dev)
1405 __field(xfs_ino_t, ino)
1406 __field(xfs_fsize_t, size)
1407 __field(xfs_fileoff_t, bno)
1408 __field(xfs_filblks_t, len)
1409 __field(unsigned long, caller_ip)
1410 __field(int, flags)
1411 ),
1412 TP_fast_assign(
1413 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1414 __entry->ino = ip->i_ino;
1415 __entry->size = ip->i_d.di_size;
1416 __entry->bno = bno;
1417 __entry->len = len;
1418 __entry->caller_ip = caller_ip;
1419 __entry->flags = flags;
1420 ),
1421 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Scott Wood65dd2972015-03-25 14:56:21 +11001422 "flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001423 MAJOR(__entry->dev), MINOR(__entry->dev),
1424 __entry->ino,
1425 __entry->size,
1426 __entry->bno,
1427 __entry->len,
1428 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1429 (void *)__entry->caller_ip)
1430
1431);
1432
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001433DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001434 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1435 xfs_agblock_t agbno, xfs_extlen_t len),
1436 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001437 TP_STRUCT__entry(
1438 __field(dev_t, dev)
1439 __field(xfs_agnumber_t, agno)
1440 __field(xfs_agblock_t, agbno)
1441 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001442 ),
1443 TP_fast_assign(
1444 __entry->dev = mp->m_super->s_dev;
1445 __entry->agno = agno;
1446 __entry->agbno = agbno;
1447 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001448 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001449 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001450 MAJOR(__entry->dev), MINOR(__entry->dev),
1451 __entry->agno,
1452 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001453 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001454);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001455#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001456DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001457 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1458 xfs_agblock_t agbno, xfs_extlen_t len), \
1459 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001460DEFINE_BUSY_EVENT(xfs_extent_busy);
1461DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1462DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1463DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1464DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001465
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001466TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001467 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1468 xfs_agblock_t agbno, xfs_extlen_t len,
1469 xfs_agblock_t tbno, xfs_extlen_t tlen),
1470 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1471 TP_STRUCT__entry(
1472 __field(dev_t, dev)
1473 __field(xfs_agnumber_t, agno)
1474 __field(xfs_agblock_t, agbno)
1475 __field(xfs_extlen_t, len)
1476 __field(xfs_agblock_t, tbno)
1477 __field(xfs_extlen_t, tlen)
1478 ),
1479 TP_fast_assign(
1480 __entry->dev = mp->m_super->s_dev;
1481 __entry->agno = agno;
1482 __entry->agbno = agbno;
1483 __entry->len = len;
1484 __entry->tbno = tbno;
1485 __entry->tlen = tlen;
1486 ),
1487 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1488 MAJOR(__entry->dev), MINOR(__entry->dev),
1489 __entry->agno,
1490 __entry->agbno,
1491 __entry->len,
1492 __entry->tbno,
1493 __entry->tlen)
1494);
1495
Dave Chinnered3b4d62010-05-21 12:07:08 +10001496TRACE_EVENT(xfs_trans_commit_lsn,
1497 TP_PROTO(struct xfs_trans *trans),
1498 TP_ARGS(trans),
1499 TP_STRUCT__entry(
1500 __field(dev_t, dev)
1501 __field(struct xfs_trans *, tp)
1502 __field(xfs_lsn_t, lsn)
1503 ),
1504 TP_fast_assign(
1505 __entry->dev = trans->t_mountp->m_super->s_dev;
1506 __entry->tp = trans;
1507 __entry->lsn = trans->t_commit_lsn;
1508 ),
1509 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1510 MAJOR(__entry->dev), MINOR(__entry->dev),
1511 __entry->tp,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001512 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001513);
1514
1515TRACE_EVENT(xfs_agf,
1516 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1517 unsigned long caller_ip),
1518 TP_ARGS(mp, agf, flags, caller_ip),
1519 TP_STRUCT__entry(
1520 __field(dev_t, dev)
1521 __field(xfs_agnumber_t, agno)
1522 __field(int, flags)
1523 __field(__u32, length)
1524 __field(__u32, bno_root)
1525 __field(__u32, cnt_root)
1526 __field(__u32, bno_level)
1527 __field(__u32, cnt_level)
1528 __field(__u32, flfirst)
1529 __field(__u32, fllast)
1530 __field(__u32, flcount)
1531 __field(__u32, freeblks)
1532 __field(__u32, longest)
1533 __field(unsigned long, caller_ip)
1534 ),
1535 TP_fast_assign(
1536 __entry->dev = mp->m_super->s_dev;
1537 __entry->agno = be32_to_cpu(agf->agf_seqno),
1538 __entry->flags = flags;
1539 __entry->length = be32_to_cpu(agf->agf_length),
1540 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1541 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1542 __entry->bno_level =
1543 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1544 __entry->cnt_level =
1545 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1546 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1547 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1548 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1549 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1550 __entry->longest = be32_to_cpu(agf->agf_longest);
1551 __entry->caller_ip = caller_ip;
1552 ),
1553 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1554 "levels b %u c %u flfirst %u fllast %u flcount %u "
Scott Wood65dd2972015-03-25 14:56:21 +11001555 "freeblks %u longest %u caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001556 MAJOR(__entry->dev), MINOR(__entry->dev),
1557 __entry->agno,
1558 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1559 __entry->length,
1560 __entry->bno_root,
1561 __entry->cnt_root,
1562 __entry->bno_level,
1563 __entry->cnt_level,
1564 __entry->flfirst,
1565 __entry->fllast,
1566 __entry->flcount,
1567 __entry->freeblks,
1568 __entry->longest,
1569 (void *)__entry->caller_ip)
1570);
1571
1572TRACE_EVENT(xfs_free_extent,
1573 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001574 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1575 int haveright),
1576 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001577 TP_STRUCT__entry(
1578 __field(dev_t, dev)
1579 __field(xfs_agnumber_t, agno)
1580 __field(xfs_agblock_t, agbno)
1581 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001582 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001583 __field(int, haveleft)
1584 __field(int, haveright)
1585 ),
1586 TP_fast_assign(
1587 __entry->dev = mp->m_super->s_dev;
1588 __entry->agno = agno;
1589 __entry->agbno = agbno;
1590 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001591 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001592 __entry->haveleft = haveleft;
1593 __entry->haveright = haveright;
1594 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001595 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001596 MAJOR(__entry->dev), MINOR(__entry->dev),
1597 __entry->agno,
1598 __entry->agbno,
1599 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001600 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001601 __entry->haveleft ?
1602 (__entry->haveright ? "both" : "left") :
1603 (__entry->haveright ? "right" : "none"))
1604
1605);
1606
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001607DECLARE_EVENT_CLASS(xfs_alloc_class,
1608 TP_PROTO(struct xfs_alloc_arg *args),
1609 TP_ARGS(args),
1610 TP_STRUCT__entry(
1611 __field(dev_t, dev)
1612 __field(xfs_agnumber_t, agno)
1613 __field(xfs_agblock_t, agbno)
1614 __field(xfs_extlen_t, minlen)
1615 __field(xfs_extlen_t, maxlen)
1616 __field(xfs_extlen_t, mod)
1617 __field(xfs_extlen_t, prod)
1618 __field(xfs_extlen_t, minleft)
1619 __field(xfs_extlen_t, total)
1620 __field(xfs_extlen_t, alignment)
1621 __field(xfs_extlen_t, minalignslop)
1622 __field(xfs_extlen_t, len)
1623 __field(short, type)
1624 __field(short, otype)
1625 __field(char, wasdel)
1626 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001627 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001628 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001629 __field(xfs_fsblock_t, firstblock)
1630 ),
1631 TP_fast_assign(
1632 __entry->dev = args->mp->m_super->s_dev;
1633 __entry->agno = args->agno;
1634 __entry->agbno = args->agbno;
1635 __entry->minlen = args->minlen;
1636 __entry->maxlen = args->maxlen;
1637 __entry->mod = args->mod;
1638 __entry->prod = args->prod;
1639 __entry->minleft = args->minleft;
1640 __entry->total = args->total;
1641 __entry->alignment = args->alignment;
1642 __entry->minalignslop = args->minalignslop;
1643 __entry->len = args->len;
1644 __entry->type = args->type;
1645 __entry->otype = args->otype;
1646 __entry->wasdel = args->wasdel;
1647 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001648 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001649 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001650 __entry->firstblock = args->firstblock;
1651 ),
1652 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1653 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001654 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001655 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001656 MAJOR(__entry->dev), MINOR(__entry->dev),
1657 __entry->agno,
1658 __entry->agbno,
1659 __entry->minlen,
1660 __entry->maxlen,
1661 __entry->mod,
1662 __entry->prod,
1663 __entry->minleft,
1664 __entry->total,
1665 __entry->alignment,
1666 __entry->minalignslop,
1667 __entry->len,
1668 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1669 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1670 __entry->wasdel,
1671 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001672 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001673 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001674 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001675)
1676
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001677#define DEFINE_ALLOC_EVENT(name) \
1678DEFINE_EVENT(xfs_alloc_class, name, \
1679 TP_PROTO(struct xfs_alloc_arg *args), \
1680 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001681DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001682DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001683DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1684DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1685DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1686DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1687DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1688DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001689DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1690DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001691DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1692DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1693DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1694DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1695DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001696DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001697DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1698DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1699DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1700DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1701DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1702DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1703DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1704DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1705DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1706
Dave Chinner5a5881c2012-03-22 05:15:13 +00001707DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001708 TP_PROTO(struct xfs_da_args *args),
1709 TP_ARGS(args),
1710 TP_STRUCT__entry(
1711 __field(dev_t, dev)
1712 __field(xfs_ino_t, ino)
1713 __dynamic_array(char, name, args->namelen)
1714 __field(int, namelen)
1715 __field(xfs_dahash_t, hashval)
1716 __field(xfs_ino_t, inumber)
1717 __field(int, op_flags)
1718 ),
1719 TP_fast_assign(
1720 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1721 __entry->ino = args->dp->i_ino;
1722 if (args->namelen)
1723 memcpy(__get_str(name), args->name, args->namelen);
1724 __entry->namelen = args->namelen;
1725 __entry->hashval = args->hashval;
1726 __entry->inumber = args->inumber;
1727 __entry->op_flags = args->op_flags;
1728 ),
1729 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1730 "inumber 0x%llx op_flags %s",
1731 MAJOR(__entry->dev), MINOR(__entry->dev),
1732 __entry->ino,
1733 __entry->namelen,
1734 __entry->namelen ? __get_str(name) : NULL,
1735 __entry->namelen,
1736 __entry->hashval,
1737 __entry->inumber,
1738 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001739)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001740
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001741#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001742DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001743 TP_PROTO(struct xfs_da_args *args), \
1744 TP_ARGS(args))
1745DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1746DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1747DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1748DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1749DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1750DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1751DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1752DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1753DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1754DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1755DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1756DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1757DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1758DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1759DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1760DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1761DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1762DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1763DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1764DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1765DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1766DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1767DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1768DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1769DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1770
Dave Chinneree732592012-11-12 22:53:53 +11001771DECLARE_EVENT_CLASS(xfs_attr_class,
1772 TP_PROTO(struct xfs_da_args *args),
1773 TP_ARGS(args),
1774 TP_STRUCT__entry(
1775 __field(dev_t, dev)
1776 __field(xfs_ino_t, ino)
1777 __dynamic_array(char, name, args->namelen)
1778 __field(int, namelen)
1779 __field(int, valuelen)
1780 __field(xfs_dahash_t, hashval)
1781 __field(int, op_flags)
1782 ),
1783 TP_fast_assign(
1784 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1785 __entry->ino = args->dp->i_ino;
1786 if (args->namelen)
1787 memcpy(__get_str(name), args->name, args->namelen);
1788 __entry->namelen = args->namelen;
1789 __entry->valuelen = args->valuelen;
1790 __entry->hashval = args->hashval;
1791 __entry->op_flags = args->op_flags;
1792 ),
1793 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1794 "hashval 0x%x op_flags %s",
1795 MAJOR(__entry->dev), MINOR(__entry->dev),
1796 __entry->ino,
1797 __entry->namelen,
1798 __entry->namelen ? __get_str(name) : NULL,
1799 __entry->namelen,
1800 __entry->valuelen,
1801 __entry->hashval,
1802 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1803)
1804
Dave Chinner5a5881c2012-03-22 05:15:13 +00001805#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001806DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001807 TP_PROTO(struct xfs_da_args *args), \
1808 TP_ARGS(args))
1809DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1810DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1811DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1812DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1813DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
1814DEFINE_ATTR_EVENT(xfs_attr_sf_removename);
1815DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1816
1817DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1818DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1819DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001820DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001821DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001823DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1824DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001825DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001827DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001828DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1829DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1831DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1832DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1834DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1835DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1836DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1837DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1838DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001839DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001840
1841DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001842DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001843DEFINE_ATTR_EVENT(xfs_attr_node_lookup);
1844DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1845DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1846
Dave Chinneree732592012-11-12 22:53:53 +11001847DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1848DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1849
1850DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1851DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1852DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1853
Dave Chinner5a5881c2012-03-22 05:15:13 +00001854#define DEFINE_DA_EVENT(name) \
1855DEFINE_EVENT(xfs_da_class, name, \
1856 TP_PROTO(struct xfs_da_args *args), \
1857 TP_ARGS(args))
1858DEFINE_DA_EVENT(xfs_da_split);
1859DEFINE_DA_EVENT(xfs_da_join);
1860DEFINE_DA_EVENT(xfs_da_link_before);
1861DEFINE_DA_EVENT(xfs_da_link_after);
1862DEFINE_DA_EVENT(xfs_da_unlink_back);
1863DEFINE_DA_EVENT(xfs_da_unlink_forward);
1864DEFINE_DA_EVENT(xfs_da_root_split);
1865DEFINE_DA_EVENT(xfs_da_root_join);
1866DEFINE_DA_EVENT(xfs_da_node_add);
1867DEFINE_DA_EVENT(xfs_da_node_create);
1868DEFINE_DA_EVENT(xfs_da_node_split);
1869DEFINE_DA_EVENT(xfs_da_node_remove);
1870DEFINE_DA_EVENT(xfs_da_node_rebalance);
1871DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001872DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001873DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1874DEFINE_DA_EVENT(xfs_da_grow_inode);
1875DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001876DEFINE_DA_EVENT(xfs_da_fixhashpath);
1877DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001878
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001879DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1880 TP_PROTO(struct xfs_da_args *args, int idx),
1881 TP_ARGS(args, idx),
1882 TP_STRUCT__entry(
1883 __field(dev_t, dev)
1884 __field(xfs_ino_t, ino)
1885 __field(int, op_flags)
1886 __field(int, idx)
1887 ),
1888 TP_fast_assign(
1889 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1890 __entry->ino = args->dp->i_ino;
1891 __entry->op_flags = args->op_flags;
1892 __entry->idx = idx;
1893 ),
1894 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1895 MAJOR(__entry->dev), MINOR(__entry->dev),
1896 __entry->ino,
1897 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1898 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001899)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001900
1901#define DEFINE_DIR2_SPACE_EVENT(name) \
1902DEFINE_EVENT(xfs_dir2_space_class, name, \
1903 TP_PROTO(struct xfs_da_args *args, int idx), \
1904 TP_ARGS(args, idx))
1905DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1906DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1907DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1908DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001909
1910TRACE_EVENT(xfs_dir2_leafn_moveents,
1911 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1912 TP_ARGS(args, src_idx, dst_idx, count),
1913 TP_STRUCT__entry(
1914 __field(dev_t, dev)
1915 __field(xfs_ino_t, ino)
1916 __field(int, op_flags)
1917 __field(int, src_idx)
1918 __field(int, dst_idx)
1919 __field(int, count)
1920 ),
1921 TP_fast_assign(
1922 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1923 __entry->ino = args->dp->i_ino;
1924 __entry->op_flags = args->op_flags;
1925 __entry->src_idx = src_idx;
1926 __entry->dst_idx = dst_idx;
1927 __entry->count = count;
1928 ),
1929 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1930 "src_idx %d dst_idx %d count %d",
1931 MAJOR(__entry->dev), MINOR(__entry->dev),
1932 __entry->ino,
1933 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1934 __entry->src_idx,
1935 __entry->dst_idx,
1936 __entry->count)
1937);
1938
Dave Chinner3a85cd92010-01-14 01:33:55 +00001939#define XFS_SWAPEXT_INODES \
1940 { 0, "target" }, \
1941 { 1, "temp" }
1942
1943#define XFS_INODE_FORMAT_STR \
1944 { 0, "invalid" }, \
1945 { 1, "local" }, \
1946 { 2, "extent" }, \
1947 { 3, "btree" }
1948
1949DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1950 TP_PROTO(struct xfs_inode *ip, int which),
1951 TP_ARGS(ip, which),
1952 TP_STRUCT__entry(
1953 __field(dev_t, dev)
1954 __field(int, which)
1955 __field(xfs_ino_t, ino)
1956 __field(int, format)
1957 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001958 __field(int, broot_size)
1959 __field(int, fork_off)
1960 ),
1961 TP_fast_assign(
1962 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1963 __entry->which = which;
1964 __entry->ino = ip->i_ino;
1965 __entry->format = ip->i_d.di_format;
1966 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001967 __entry->broot_size = ip->i_df.if_broot_bytes;
1968 __entry->fork_off = XFS_IFORK_BOFF(ip);
1969 ),
1970 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001971 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001972 MAJOR(__entry->dev), MINOR(__entry->dev),
1973 __entry->ino,
1974 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1975 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1976 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001977 __entry->broot_size,
1978 __entry->fork_off)
1979)
1980
1981#define DEFINE_SWAPEXT_EVENT(name) \
1982DEFINE_EVENT(xfs_swap_extent_class, name, \
1983 TP_PROTO(struct xfs_inode *ip, int which), \
1984 TP_ARGS(ip, which))
1985
1986DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1987DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1988
Brian Foster5cd9cee2016-09-26 08:34:52 +10001989TRACE_EVENT(xfs_log_recover_record,
1990 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1991 TP_ARGS(log, rhead, pass),
1992 TP_STRUCT__entry(
1993 __field(dev_t, dev)
1994 __field(xfs_lsn_t, lsn)
1995 __field(int, len)
1996 __field(int, num_logops)
1997 __field(int, pass)
1998 ),
1999 TP_fast_assign(
2000 __entry->dev = log->l_mp->m_super->s_dev;
2001 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2002 __entry->len = be32_to_cpu(rhead->h_len);
2003 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2004 __entry->pass = pass;
2005 ),
2006 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2007 MAJOR(__entry->dev), MINOR(__entry->dev),
2008 __entry->lsn, __entry->len, __entry->num_logops,
2009 __entry->pass)
2010)
2011
Dave Chinner9abbc532010-04-13 15:06:46 +10002012DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002013 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002014 struct xlog_recover_item *item, int pass),
2015 TP_ARGS(log, trans, item, pass),
2016 TP_STRUCT__entry(
2017 __field(dev_t, dev)
2018 __field(unsigned long, item)
2019 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002020 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002021 __field(int, type)
2022 __field(int, pass)
2023 __field(int, count)
2024 __field(int, total)
2025 ),
2026 TP_fast_assign(
2027 __entry->dev = log->l_mp->m_super->s_dev;
2028 __entry->item = (unsigned long)item;
2029 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002030 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002031 __entry->type = ITEM_TYPE(item);
2032 __entry->pass = pass;
2033 __entry->count = item->ri_cnt;
2034 __entry->total = item->ri_total;
2035 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002036 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2037 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002038 MAJOR(__entry->dev), MINOR(__entry->dev),
2039 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002040 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002041 __entry->pass,
2042 (void *)__entry->item,
2043 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2044 __entry->count,
2045 __entry->total)
2046)
2047
2048#define DEFINE_LOG_RECOVER_ITEM(name) \
2049DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002050 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002051 struct xlog_recover_item *item, int pass), \
2052 TP_ARGS(log, trans, item, pass))
2053
2054DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2055DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2056DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2057DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2058DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2059
2060DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002061 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002062 TP_ARGS(log, buf_f),
2063 TP_STRUCT__entry(
2064 __field(dev_t, dev)
2065 __field(__int64_t, blkno)
2066 __field(unsigned short, len)
2067 __field(unsigned short, flags)
2068 __field(unsigned short, size)
2069 __field(unsigned int, map_size)
2070 ),
2071 TP_fast_assign(
2072 __entry->dev = log->l_mp->m_super->s_dev;
2073 __entry->blkno = buf_f->blf_blkno;
2074 __entry->len = buf_f->blf_len;
2075 __entry->flags = buf_f->blf_flags;
2076 __entry->size = buf_f->blf_size;
2077 __entry->map_size = buf_f->blf_map_size;
2078 ),
2079 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2080 "map_size %d",
2081 MAJOR(__entry->dev), MINOR(__entry->dev),
2082 __entry->blkno,
2083 __entry->len,
2084 __entry->flags,
2085 __entry->size,
2086 __entry->map_size)
2087)
2088
2089#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2090DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002091 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002092 TP_ARGS(log, buf_f))
2093
2094DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2095DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2096DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2097DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2098DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002099DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002100DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2101DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2102DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2103
2104DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002105 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002106 TP_ARGS(log, in_f),
2107 TP_STRUCT__entry(
2108 __field(dev_t, dev)
2109 __field(xfs_ino_t, ino)
2110 __field(unsigned short, size)
2111 __field(int, fields)
2112 __field(unsigned short, asize)
2113 __field(unsigned short, dsize)
2114 __field(__int64_t, blkno)
2115 __field(int, len)
2116 __field(int, boffset)
2117 ),
2118 TP_fast_assign(
2119 __entry->dev = log->l_mp->m_super->s_dev;
2120 __entry->ino = in_f->ilf_ino;
2121 __entry->size = in_f->ilf_size;
2122 __entry->fields = in_f->ilf_fields;
2123 __entry->asize = in_f->ilf_asize;
2124 __entry->dsize = in_f->ilf_dsize;
2125 __entry->blkno = in_f->ilf_blkno;
2126 __entry->len = in_f->ilf_len;
2127 __entry->boffset = in_f->ilf_boffset;
2128 ),
2129 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2130 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2131 MAJOR(__entry->dev), MINOR(__entry->dev),
2132 __entry->ino,
2133 __entry->size,
2134 __entry->fields,
2135 __entry->asize,
2136 __entry->dsize,
2137 __entry->blkno,
2138 __entry->len,
2139 __entry->boffset)
2140)
2141#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2142DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002143 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002144 TP_ARGS(log, in_f))
2145
2146DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2147DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2148DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2149
Brian Foster78d57e42015-08-19 09:58:48 +10002150DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2151 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2152 TP_ARGS(log, in_f),
2153 TP_STRUCT__entry(
2154 __field(dev_t, dev)
2155 __field(xfs_agnumber_t, agno)
2156 __field(xfs_agblock_t, agbno)
2157 __field(unsigned int, count)
2158 __field(unsigned int, isize)
2159 __field(xfs_agblock_t, length)
2160 __field(unsigned int, gen)
2161 ),
2162 TP_fast_assign(
2163 __entry->dev = log->l_mp->m_super->s_dev;
2164 __entry->agno = be32_to_cpu(in_f->icl_ag);
2165 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2166 __entry->count = be32_to_cpu(in_f->icl_count);
2167 __entry->isize = be32_to_cpu(in_f->icl_isize);
2168 __entry->length = be32_to_cpu(in_f->icl_length);
2169 __entry->gen = be32_to_cpu(in_f->icl_gen);
2170 ),
2171 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2172 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2173 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2174 __entry->length, __entry->gen)
2175)
2176#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2177DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2178 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2179 TP_ARGS(log, in_f))
2180
2181DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2182DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2183
Christoph Hellwiga46db602011-01-07 13:02:04 +00002184DECLARE_EVENT_CLASS(xfs_discard_class,
2185 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2186 xfs_agblock_t agbno, xfs_extlen_t len),
2187 TP_ARGS(mp, agno, agbno, len),
2188 TP_STRUCT__entry(
2189 __field(dev_t, dev)
2190 __field(xfs_agnumber_t, agno)
2191 __field(xfs_agblock_t, agbno)
2192 __field(xfs_extlen_t, len)
2193 ),
2194 TP_fast_assign(
2195 __entry->dev = mp->m_super->s_dev;
2196 __entry->agno = agno;
2197 __entry->agbno = agbno;
2198 __entry->len = len;
2199 ),
2200 TP_printk("dev %d:%d agno %u agbno %u len %u\n",
2201 MAJOR(__entry->dev), MINOR(__entry->dev),
2202 __entry->agno,
2203 __entry->agbno,
2204 __entry->len)
2205)
2206
2207#define DEFINE_DISCARD_EVENT(name) \
2208DEFINE_EVENT(xfs_discard_class, name, \
2209 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2210 xfs_agblock_t agbno, xfs_extlen_t len), \
2211 TP_ARGS(mp, agno, agbno, len))
2212DEFINE_DISCARD_EVENT(xfs_discard_extent);
2213DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2214DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2215DEFINE_DISCARD_EVENT(xfs_discard_busy);
2216
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002217/* btree cursor events */
2218DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2219 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2220 TP_ARGS(cur, level, bp),
2221 TP_STRUCT__entry(
2222 __field(dev_t, dev)
2223 __field(xfs_btnum_t, btnum)
2224 __field(int, level)
2225 __field(int, nlevels)
2226 __field(int, ptr)
2227 __field(xfs_daddr_t, daddr)
2228 ),
2229 TP_fast_assign(
2230 __entry->dev = cur->bc_mp->m_super->s_dev;
2231 __entry->btnum = cur->bc_btnum;
2232 __entry->level = level;
2233 __entry->nlevels = cur->bc_nlevels;
2234 __entry->ptr = cur->bc_ptrs[level];
2235 __entry->daddr = bp ? bp->b_bn : -1;
2236 ),
2237 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2238 MAJOR(__entry->dev), MINOR(__entry->dev),
2239 __entry->btnum,
2240 __entry->level,
2241 __entry->nlevels,
2242 __entry->ptr,
2243 (unsigned long long)__entry->daddr)
2244)
2245
2246#define DEFINE_BTREE_CUR_EVENT(name) \
2247DEFINE_EVENT(xfs_btree_cur_class, name, \
2248 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2249 TP_ARGS(cur, level, bp))
2250DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002251DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002252
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002253/* deferred ops */
2254struct xfs_defer_pending;
2255struct xfs_defer_intake;
2256struct xfs_defer_ops;
2257
2258DECLARE_EVENT_CLASS(xfs_defer_class,
2259 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2260 TP_ARGS(mp, dop),
2261 TP_STRUCT__entry(
2262 __field(dev_t, dev)
2263 __field(void *, dop)
2264 __field(bool, committed)
2265 __field(bool, low)
2266 ),
2267 TP_fast_assign(
2268 __entry->dev = mp ? mp->m_super->s_dev : 0;
2269 __entry->dop = dop;
2270 __entry->committed = dop->dop_committed;
2271 __entry->low = dop->dop_low;
2272 ),
2273 TP_printk("dev %d:%d ops %p committed %d low %d\n",
2274 MAJOR(__entry->dev), MINOR(__entry->dev),
2275 __entry->dop,
2276 __entry->committed,
2277 __entry->low)
2278)
2279#define DEFINE_DEFER_EVENT(name) \
2280DEFINE_EVENT(xfs_defer_class, name, \
2281 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2282 TP_ARGS(mp, dop))
2283
2284DECLARE_EVENT_CLASS(xfs_defer_error_class,
2285 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2286 TP_ARGS(mp, dop, error),
2287 TP_STRUCT__entry(
2288 __field(dev_t, dev)
2289 __field(void *, dop)
2290 __field(bool, committed)
2291 __field(bool, low)
2292 __field(int, error)
2293 ),
2294 TP_fast_assign(
2295 __entry->dev = mp ? mp->m_super->s_dev : 0;
2296 __entry->dop = dop;
2297 __entry->committed = dop->dop_committed;
2298 __entry->low = dop->dop_low;
2299 __entry->error = error;
2300 ),
2301 TP_printk("dev %d:%d ops %p committed %d low %d err %d\n",
2302 MAJOR(__entry->dev), MINOR(__entry->dev),
2303 __entry->dop,
2304 __entry->committed,
2305 __entry->low,
2306 __entry->error)
2307)
2308#define DEFINE_DEFER_ERROR_EVENT(name) \
2309DEFINE_EVENT(xfs_defer_error_class, name, \
2310 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2311 TP_ARGS(mp, dop, error))
2312
2313DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2314 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2315 TP_ARGS(mp, dfp),
2316 TP_STRUCT__entry(
2317 __field(dev_t, dev)
2318 __field(int, type)
2319 __field(void *, intent)
2320 __field(bool, committed)
2321 __field(int, nr)
2322 ),
2323 TP_fast_assign(
2324 __entry->dev = mp ? mp->m_super->s_dev : 0;
2325 __entry->type = dfp->dfp_type->type;
2326 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002327 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002328 __entry->nr = dfp->dfp_count;
2329 ),
2330 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d\n",
2331 MAJOR(__entry->dev), MINOR(__entry->dev),
2332 __entry->type,
2333 __entry->intent,
2334 __entry->committed,
2335 __entry->nr)
2336)
2337#define DEFINE_DEFER_PENDING_EVENT(name) \
2338DEFINE_EVENT(xfs_defer_pending_class, name, \
2339 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2340 TP_ARGS(mp, dfp))
2341
2342DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2343 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2344 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2345 TP_ARGS(mp, agno, type, agbno, len),
2346 TP_STRUCT__entry(
2347 __field(dev_t, dev)
2348 __field(xfs_agnumber_t, agno)
2349 __field(int, type)
2350 __field(xfs_agblock_t, agbno)
2351 __field(xfs_extlen_t, len)
2352 ),
2353 TP_fast_assign(
2354 __entry->dev = mp->m_super->s_dev;
2355 __entry->agno = agno;
2356 __entry->type = type;
2357 __entry->agbno = agbno;
2358 __entry->len = len;
2359 ),
2360 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2361 MAJOR(__entry->dev), MINOR(__entry->dev),
2362 __entry->type,
2363 __entry->agno,
2364 __entry->agbno,
2365 __entry->len)
2366);
2367#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2368DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2369 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2370 int type, \
2371 xfs_agblock_t bno, \
2372 xfs_extlen_t len), \
2373 TP_ARGS(mp, agno, type, bno, len))
2374
2375DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2376 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2377 int op,
2378 xfs_agblock_t agbno,
2379 xfs_ino_t ino,
2380 int whichfork,
2381 xfs_fileoff_t offset,
2382 xfs_filblks_t len,
2383 xfs_exntst_t state),
2384 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2385 TP_STRUCT__entry(
2386 __field(dev_t, dev)
2387 __field(xfs_agnumber_t, agno)
2388 __field(xfs_ino_t, ino)
2389 __field(xfs_agblock_t, agbno)
2390 __field(int, whichfork)
2391 __field(xfs_fileoff_t, l_loff)
2392 __field(xfs_filblks_t, l_len)
2393 __field(xfs_exntst_t, l_state)
2394 __field(int, op)
2395 ),
2396 TP_fast_assign(
2397 __entry->dev = mp->m_super->s_dev;
2398 __entry->agno = agno;
2399 __entry->ino = ino;
2400 __entry->agbno = agbno;
2401 __entry->whichfork = whichfork;
2402 __entry->l_loff = offset;
2403 __entry->l_len = len;
2404 __entry->l_state = state;
2405 __entry->op = op;
2406 ),
2407 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2408 MAJOR(__entry->dev), MINOR(__entry->dev),
2409 __entry->op,
2410 __entry->agno,
2411 __entry->agbno,
2412 __entry->ino,
2413 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2414 __entry->l_loff,
2415 __entry->l_len,
2416 __entry->l_state)
2417);
2418#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2419DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2420 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2421 int op, \
2422 xfs_agblock_t agbno, \
2423 xfs_ino_t ino, \
2424 int whichfork, \
2425 xfs_fileoff_t offset, \
2426 xfs_filblks_t len, \
2427 xfs_exntst_t state), \
2428 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2429
2430DEFINE_DEFER_EVENT(xfs_defer_init);
2431DEFINE_DEFER_EVENT(xfs_defer_cancel);
2432DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2433DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2434DEFINE_DEFER_EVENT(xfs_defer_finish);
2435DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2436
2437DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2438DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
2439DEFINE_DEFER_ERROR_EVENT(xfs_defer_op_finish_error);
2440
2441DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2442DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
2443DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_commit);
2444DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2445DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2446DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2447
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002448#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2449DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2450DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2451
Darrick J. Wong673930c2016-08-03 11:33:43 +10002452/* rmap tracepoints */
2453DECLARE_EVENT_CLASS(xfs_rmap_class,
2454 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2455 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2456 struct xfs_owner_info *oinfo),
2457 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2458 TP_STRUCT__entry(
2459 __field(dev_t, dev)
2460 __field(xfs_agnumber_t, agno)
2461 __field(xfs_agblock_t, agbno)
2462 __field(xfs_extlen_t, len)
2463 __field(uint64_t, owner)
2464 __field(uint64_t, offset)
2465 __field(unsigned long, flags)
2466 ),
2467 TP_fast_assign(
2468 __entry->dev = mp->m_super->s_dev;
2469 __entry->agno = agno;
2470 __entry->agbno = agbno;
2471 __entry->len = len;
2472 __entry->owner = oinfo->oi_owner;
2473 __entry->offset = oinfo->oi_offset;
2474 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002475 if (unwritten)
2476 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002477 ),
2478 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2479 MAJOR(__entry->dev), MINOR(__entry->dev),
2480 __entry->agno,
2481 __entry->agbno,
2482 __entry->len,
2483 __entry->owner,
2484 __entry->offset,
2485 __entry->flags)
2486);
2487#define DEFINE_RMAP_EVENT(name) \
2488DEFINE_EVENT(xfs_rmap_class, name, \
2489 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2490 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2491 struct xfs_owner_info *oinfo), \
2492 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2493
2494/* simple AG-based error/%ip tracepoint class */
2495DECLARE_EVENT_CLASS(xfs_ag_error_class,
2496 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2497 unsigned long caller_ip),
2498 TP_ARGS(mp, agno, error, caller_ip),
2499 TP_STRUCT__entry(
2500 __field(dev_t, dev)
2501 __field(xfs_agnumber_t, agno)
2502 __field(int, error)
2503 __field(unsigned long, caller_ip)
2504 ),
2505 TP_fast_assign(
2506 __entry->dev = mp->m_super->s_dev;
2507 __entry->agno = agno;
2508 __entry->error = error;
2509 __entry->caller_ip = caller_ip;
2510 ),
2511 TP_printk("dev %d:%d agno %u error %d caller %ps",
2512 MAJOR(__entry->dev), MINOR(__entry->dev),
2513 __entry->agno,
2514 __entry->error,
2515 (char *)__entry->caller_ip)
2516);
2517
2518#define DEFINE_AG_ERROR_EVENT(name) \
2519DEFINE_EVENT(xfs_ag_error_class, name, \
2520 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2521 unsigned long caller_ip), \
2522 TP_ARGS(mp, agno, error, caller_ip))
2523
2524DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2525DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2526DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2527DEFINE_RMAP_EVENT(xfs_rmap_map);
2528DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2529DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002530DEFINE_RMAP_EVENT(xfs_rmap_convert);
2531DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2532DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2533DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002534
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002535DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2536 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2537 xfs_agblock_t agbno, xfs_extlen_t len,
2538 uint64_t owner, uint64_t offset, unsigned int flags),
2539 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2540 TP_STRUCT__entry(
2541 __field(dev_t, dev)
2542 __field(xfs_agnumber_t, agno)
2543 __field(xfs_agblock_t, agbno)
2544 __field(xfs_extlen_t, len)
2545 __field(uint64_t, owner)
2546 __field(uint64_t, offset)
2547 __field(unsigned int, flags)
2548 ),
2549 TP_fast_assign(
2550 __entry->dev = mp->m_super->s_dev;
2551 __entry->agno = agno;
2552 __entry->agbno = agbno;
2553 __entry->len = len;
2554 __entry->owner = owner;
2555 __entry->offset = offset;
2556 __entry->flags = flags;
2557 ),
2558 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2559 MAJOR(__entry->dev), MINOR(__entry->dev),
2560 __entry->agno,
2561 __entry->agbno,
2562 __entry->len,
2563 __entry->owner,
2564 __entry->offset,
2565 __entry->flags)
2566);
2567#define DEFINE_RMAPBT_EVENT(name) \
2568DEFINE_EVENT(xfs_rmapbt_class, name, \
2569 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2570 xfs_agblock_t agbno, xfs_extlen_t len, \
2571 uint64_t owner, uint64_t offset, unsigned int flags), \
2572 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2573
2574#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2575DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2576DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2577
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002578DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2579DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002580DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2581DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2582DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2583DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2584DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2585DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002586DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2587DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002588DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002589
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002590/* deferred bmbt updates */
2591#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2592DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2593DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2594
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002595/* per-AG reservation */
2596DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2597 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2598 xfs_extlen_t len),
2599 TP_ARGS(pag, resv, len),
2600 TP_STRUCT__entry(
2601 __field(dev_t, dev)
2602 __field(xfs_agnumber_t, agno)
2603 __field(int, resv)
2604 __field(xfs_extlen_t, freeblks)
2605 __field(xfs_extlen_t, flcount)
2606 __field(xfs_extlen_t, reserved)
2607 __field(xfs_extlen_t, asked)
2608 __field(xfs_extlen_t, len)
2609 ),
2610 TP_fast_assign(
2611 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2612
2613 __entry->dev = pag->pag_mount->m_super->s_dev;
2614 __entry->agno = pag->pag_agno;
2615 __entry->resv = resv;
2616 __entry->freeblks = pag->pagf_freeblks;
2617 __entry->flcount = pag->pagf_flcount;
2618 __entry->reserved = r ? r->ar_reserved : 0;
2619 __entry->asked = r ? r->ar_asked : 0;
2620 __entry->len = len;
2621 ),
2622 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u resv %u ask %u len %u\n",
2623 MAJOR(__entry->dev), MINOR(__entry->dev),
2624 __entry->agno,
2625 __entry->resv,
2626 __entry->freeblks,
2627 __entry->flcount,
2628 __entry->reserved,
2629 __entry->asked,
2630 __entry->len)
2631)
2632#define DEFINE_AG_RESV_EVENT(name) \
2633DEFINE_EVENT(xfs_ag_resv_class, name, \
2634 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2635 xfs_extlen_t len), \
2636 TP_ARGS(pag, type, len))
2637
2638/* per-AG reservation tracepoints */
2639DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2640DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2641DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2642DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2643DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2644DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2645
2646DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2647DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2648
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002649/* refcount tracepoint classes */
2650
2651/* reuse the discard trace class for agbno/aglen-based traces */
2652#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2653
2654/* ag btree lookup tracepoint class */
2655#define XFS_AG_BTREE_CMP_FORMAT_STR \
2656 { XFS_LOOKUP_EQ, "eq" }, \
2657 { XFS_LOOKUP_LE, "le" }, \
2658 { XFS_LOOKUP_GE, "ge" }
2659DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2660 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2661 xfs_agblock_t agbno, xfs_lookup_t dir),
2662 TP_ARGS(mp, agno, agbno, dir),
2663 TP_STRUCT__entry(
2664 __field(dev_t, dev)
2665 __field(xfs_agnumber_t, agno)
2666 __field(xfs_agblock_t, agbno)
2667 __field(xfs_lookup_t, dir)
2668 ),
2669 TP_fast_assign(
2670 __entry->dev = mp->m_super->s_dev;
2671 __entry->agno = agno;
2672 __entry->agbno = agbno;
2673 __entry->dir = dir;
2674 ),
2675 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)\n",
2676 MAJOR(__entry->dev), MINOR(__entry->dev),
2677 __entry->agno,
2678 __entry->agbno,
2679 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2680 __entry->dir)
2681)
2682
2683#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2684DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2685 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2686 xfs_agblock_t agbno, xfs_lookup_t dir), \
2687 TP_ARGS(mp, agno, agbno, dir))
2688
2689/* single-rcext tracepoint class */
2690DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2691 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2692 struct xfs_refcount_irec *irec),
2693 TP_ARGS(mp, agno, irec),
2694 TP_STRUCT__entry(
2695 __field(dev_t, dev)
2696 __field(xfs_agnumber_t, agno)
2697 __field(xfs_agblock_t, startblock)
2698 __field(xfs_extlen_t, blockcount)
2699 __field(xfs_nlink_t, refcount)
2700 ),
2701 TP_fast_assign(
2702 __entry->dev = mp->m_super->s_dev;
2703 __entry->agno = agno;
2704 __entry->startblock = irec->rc_startblock;
2705 __entry->blockcount = irec->rc_blockcount;
2706 __entry->refcount = irec->rc_refcount;
2707 ),
2708 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u\n",
2709 MAJOR(__entry->dev), MINOR(__entry->dev),
2710 __entry->agno,
2711 __entry->startblock,
2712 __entry->blockcount,
2713 __entry->refcount)
2714)
2715
2716#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2717DEFINE_EVENT(xfs_refcount_extent_class, name, \
2718 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2719 struct xfs_refcount_irec *irec), \
2720 TP_ARGS(mp, agno, irec))
2721
2722/* single-rcext and an agbno tracepoint class */
2723DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2724 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2725 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2726 TP_ARGS(mp, agno, irec, agbno),
2727 TP_STRUCT__entry(
2728 __field(dev_t, dev)
2729 __field(xfs_agnumber_t, agno)
2730 __field(xfs_agblock_t, startblock)
2731 __field(xfs_extlen_t, blockcount)
2732 __field(xfs_nlink_t, refcount)
2733 __field(xfs_agblock_t, agbno)
2734 ),
2735 TP_fast_assign(
2736 __entry->dev = mp->m_super->s_dev;
2737 __entry->agno = agno;
2738 __entry->startblock = irec->rc_startblock;
2739 __entry->blockcount = irec->rc_blockcount;
2740 __entry->refcount = irec->rc_refcount;
2741 __entry->agbno = agbno;
2742 ),
2743 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u\n",
2744 MAJOR(__entry->dev), MINOR(__entry->dev),
2745 __entry->agno,
2746 __entry->startblock,
2747 __entry->blockcount,
2748 __entry->refcount,
2749 __entry->agbno)
2750)
2751
2752#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2753DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2754 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2755 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2756 TP_ARGS(mp, agno, irec, agbno))
2757
2758/* double-rcext tracepoint class */
2759DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2760 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2761 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2762 TP_ARGS(mp, agno, i1, i2),
2763 TP_STRUCT__entry(
2764 __field(dev_t, dev)
2765 __field(xfs_agnumber_t, agno)
2766 __field(xfs_agblock_t, i1_startblock)
2767 __field(xfs_extlen_t, i1_blockcount)
2768 __field(xfs_nlink_t, i1_refcount)
2769 __field(xfs_agblock_t, i2_startblock)
2770 __field(xfs_extlen_t, i2_blockcount)
2771 __field(xfs_nlink_t, i2_refcount)
2772 ),
2773 TP_fast_assign(
2774 __entry->dev = mp->m_super->s_dev;
2775 __entry->agno = agno;
2776 __entry->i1_startblock = i1->rc_startblock;
2777 __entry->i1_blockcount = i1->rc_blockcount;
2778 __entry->i1_refcount = i1->rc_refcount;
2779 __entry->i2_startblock = i2->rc_startblock;
2780 __entry->i2_blockcount = i2->rc_blockcount;
2781 __entry->i2_refcount = i2->rc_refcount;
2782 ),
2783 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2784 "agbno %u len %u refcount %u\n",
2785 MAJOR(__entry->dev), MINOR(__entry->dev),
2786 __entry->agno,
2787 __entry->i1_startblock,
2788 __entry->i1_blockcount,
2789 __entry->i1_refcount,
2790 __entry->i2_startblock,
2791 __entry->i2_blockcount,
2792 __entry->i2_refcount)
2793)
2794
2795#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2796DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2797 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2798 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2799 TP_ARGS(mp, agno, i1, i2))
2800
2801/* double-rcext and an agbno tracepoint class */
2802DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2803 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2804 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2805 xfs_agblock_t agbno),
2806 TP_ARGS(mp, agno, i1, i2, agbno),
2807 TP_STRUCT__entry(
2808 __field(dev_t, dev)
2809 __field(xfs_agnumber_t, agno)
2810 __field(xfs_agblock_t, i1_startblock)
2811 __field(xfs_extlen_t, i1_blockcount)
2812 __field(xfs_nlink_t, i1_refcount)
2813 __field(xfs_agblock_t, i2_startblock)
2814 __field(xfs_extlen_t, i2_blockcount)
2815 __field(xfs_nlink_t, i2_refcount)
2816 __field(xfs_agblock_t, agbno)
2817 ),
2818 TP_fast_assign(
2819 __entry->dev = mp->m_super->s_dev;
2820 __entry->agno = agno;
2821 __entry->i1_startblock = i1->rc_startblock;
2822 __entry->i1_blockcount = i1->rc_blockcount;
2823 __entry->i1_refcount = i1->rc_refcount;
2824 __entry->i2_startblock = i2->rc_startblock;
2825 __entry->i2_blockcount = i2->rc_blockcount;
2826 __entry->i2_refcount = i2->rc_refcount;
2827 __entry->agbno = agbno;
2828 ),
2829 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2830 "agbno %u len %u refcount %u @ agbno %u\n",
2831 MAJOR(__entry->dev), MINOR(__entry->dev),
2832 __entry->agno,
2833 __entry->i1_startblock,
2834 __entry->i1_blockcount,
2835 __entry->i1_refcount,
2836 __entry->i2_startblock,
2837 __entry->i2_blockcount,
2838 __entry->i2_refcount,
2839 __entry->agbno)
2840)
2841
2842#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2843DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2844 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2845 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2846 xfs_agblock_t agbno), \
2847 TP_ARGS(mp, agno, i1, i2, agbno))
2848
2849/* triple-rcext tracepoint class */
2850DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2851 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2852 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2853 struct xfs_refcount_irec *i3),
2854 TP_ARGS(mp, agno, i1, i2, i3),
2855 TP_STRUCT__entry(
2856 __field(dev_t, dev)
2857 __field(xfs_agnumber_t, agno)
2858 __field(xfs_agblock_t, i1_startblock)
2859 __field(xfs_extlen_t, i1_blockcount)
2860 __field(xfs_nlink_t, i1_refcount)
2861 __field(xfs_agblock_t, i2_startblock)
2862 __field(xfs_extlen_t, i2_blockcount)
2863 __field(xfs_nlink_t, i2_refcount)
2864 __field(xfs_agblock_t, i3_startblock)
2865 __field(xfs_extlen_t, i3_blockcount)
2866 __field(xfs_nlink_t, i3_refcount)
2867 ),
2868 TP_fast_assign(
2869 __entry->dev = mp->m_super->s_dev;
2870 __entry->agno = agno;
2871 __entry->i1_startblock = i1->rc_startblock;
2872 __entry->i1_blockcount = i1->rc_blockcount;
2873 __entry->i1_refcount = i1->rc_refcount;
2874 __entry->i2_startblock = i2->rc_startblock;
2875 __entry->i2_blockcount = i2->rc_blockcount;
2876 __entry->i2_refcount = i2->rc_refcount;
2877 __entry->i3_startblock = i3->rc_startblock;
2878 __entry->i3_blockcount = i3->rc_blockcount;
2879 __entry->i3_refcount = i3->rc_refcount;
2880 ),
2881 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2882 "agbno %u len %u refcount %u -- "
2883 "agbno %u len %u refcount %u\n",
2884 MAJOR(__entry->dev), MINOR(__entry->dev),
2885 __entry->agno,
2886 __entry->i1_startblock,
2887 __entry->i1_blockcount,
2888 __entry->i1_refcount,
2889 __entry->i2_startblock,
2890 __entry->i2_blockcount,
2891 __entry->i2_refcount,
2892 __entry->i3_startblock,
2893 __entry->i3_blockcount,
2894 __entry->i3_refcount)
2895);
2896
2897#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2898DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2899 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2900 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2901 struct xfs_refcount_irec *i3), \
2902 TP_ARGS(mp, agno, i1, i2, i3))
2903
2904/* refcount btree tracepoints */
2905DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2906DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2907DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2908DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2909DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2910DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2911DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2912DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2913DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2914DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2915
2916/* refcount adjustment tracepoints */
2917DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2918DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002919DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2920DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002921DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2922DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002923DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002924DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2925DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2926DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2927DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2928DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2929DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002930DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002931DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2932DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2933DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2934DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2935DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2936DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2937DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2938
2939/* reflink helpers */
2940DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2941DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2942DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002943#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2944DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2945DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002946
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002947TRACE_EVENT(xfs_refcount_finish_one_leftover,
2948 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2949 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2950 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2951 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2952 TP_STRUCT__entry(
2953 __field(dev_t, dev)
2954 __field(xfs_agnumber_t, agno)
2955 __field(int, type)
2956 __field(xfs_agblock_t, agbno)
2957 __field(xfs_extlen_t, len)
2958 __field(xfs_agblock_t, new_agbno)
2959 __field(xfs_extlen_t, new_len)
2960 ),
2961 TP_fast_assign(
2962 __entry->dev = mp->m_super->s_dev;
2963 __entry->agno = agno;
2964 __entry->type = type;
2965 __entry->agbno = agbno;
2966 __entry->len = len;
2967 __entry->new_agbno = new_agbno;
2968 __entry->new_len = new_len;
2969 ),
2970 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2971 MAJOR(__entry->dev), MINOR(__entry->dev),
2972 __entry->type,
2973 __entry->agno,
2974 __entry->agbno,
2975 __entry->len,
2976 __entry->new_agbno,
2977 __entry->new_len)
2978);
2979
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002980/* simple inode-based error/%ip tracepoint class */
2981DECLARE_EVENT_CLASS(xfs_inode_error_class,
2982 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2983 TP_ARGS(ip, error, caller_ip),
2984 TP_STRUCT__entry(
2985 __field(dev_t, dev)
2986 __field(xfs_ino_t, ino)
2987 __field(int, error)
2988 __field(unsigned long, caller_ip)
2989 ),
2990 TP_fast_assign(
2991 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2992 __entry->ino = ip->i_ino;
2993 __entry->error = error;
2994 __entry->caller_ip = caller_ip;
2995 ),
2996 TP_printk("dev %d:%d ino %llx error %d caller %ps",
2997 MAJOR(__entry->dev), MINOR(__entry->dev),
2998 __entry->ino,
2999 __entry->error,
3000 (char *)__entry->caller_ip)
3001);
3002
3003#define DEFINE_INODE_ERROR_EVENT(name) \
3004DEFINE_EVENT(xfs_inode_error_class, name, \
3005 TP_PROTO(struct xfs_inode *ip, int error, \
3006 unsigned long caller_ip), \
3007 TP_ARGS(ip, error, caller_ip))
3008
3009/* reflink allocator */
3010TRACE_EVENT(xfs_bmap_remap_alloc,
3011 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t fsbno,
3012 xfs_extlen_t len),
3013 TP_ARGS(ip, fsbno, len),
3014 TP_STRUCT__entry(
3015 __field(dev_t, dev)
3016 __field(xfs_ino_t, ino)
3017 __field(xfs_fsblock_t, fsbno)
3018 __field(xfs_extlen_t, len)
3019 ),
3020 TP_fast_assign(
3021 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3022 __entry->ino = ip->i_ino;
3023 __entry->fsbno = fsbno;
3024 __entry->len = len;
3025 ),
3026 TP_printk("dev %d:%d ino 0x%llx fsbno 0x%llx len %x",
3027 MAJOR(__entry->dev), MINOR(__entry->dev),
3028 __entry->ino,
3029 __entry->fsbno,
3030 __entry->len)
3031);
3032DEFINE_INODE_ERROR_EVENT(xfs_bmap_remap_alloc_error);
3033
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003034/* reflink tracepoint classes */
3035
3036/* two-file io tracepoint class */
3037DECLARE_EVENT_CLASS(xfs_double_io_class,
3038 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3039 struct xfs_inode *dest, xfs_off_t doffset),
3040 TP_ARGS(src, soffset, len, dest, doffset),
3041 TP_STRUCT__entry(
3042 __field(dev_t, dev)
3043 __field(xfs_ino_t, src_ino)
3044 __field(loff_t, src_isize)
3045 __field(loff_t, src_disize)
3046 __field(loff_t, src_offset)
3047 __field(size_t, len)
3048 __field(xfs_ino_t, dest_ino)
3049 __field(loff_t, dest_isize)
3050 __field(loff_t, dest_disize)
3051 __field(loff_t, dest_offset)
3052 ),
3053 TP_fast_assign(
3054 __entry->dev = VFS_I(src)->i_sb->s_dev;
3055 __entry->src_ino = src->i_ino;
3056 __entry->src_isize = VFS_I(src)->i_size;
3057 __entry->src_disize = src->i_d.di_size;
3058 __entry->src_offset = soffset;
3059 __entry->len = len;
3060 __entry->dest_ino = dest->i_ino;
3061 __entry->dest_isize = VFS_I(dest)->i_size;
3062 __entry->dest_disize = dest->i_d.di_size;
3063 __entry->dest_offset = doffset;
3064 ),
3065 TP_printk("dev %d:%d count %zd "
3066 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3067 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3068 MAJOR(__entry->dev), MINOR(__entry->dev),
3069 __entry->len,
3070 __entry->src_ino,
3071 __entry->src_isize,
3072 __entry->src_disize,
3073 __entry->src_offset,
3074 __entry->dest_ino,
3075 __entry->dest_isize,
3076 __entry->dest_disize,
3077 __entry->dest_offset)
3078)
3079
3080#define DEFINE_DOUBLE_IO_EVENT(name) \
3081DEFINE_EVENT(xfs_double_io_class, name, \
3082 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3083 struct xfs_inode *dest, xfs_off_t doffset), \
3084 TP_ARGS(src, soffset, len, dest, doffset))
3085
3086/* two-file vfs io tracepoint class */
3087DECLARE_EVENT_CLASS(xfs_double_vfs_io_class,
3088 TP_PROTO(struct inode *src, u64 soffset, u64 len,
3089 struct inode *dest, u64 doffset),
3090 TP_ARGS(src, soffset, len, dest, doffset),
3091 TP_STRUCT__entry(
3092 __field(dev_t, dev)
3093 __field(unsigned long, src_ino)
3094 __field(loff_t, src_isize)
3095 __field(loff_t, src_offset)
3096 __field(size_t, len)
3097 __field(unsigned long, dest_ino)
3098 __field(loff_t, dest_isize)
3099 __field(loff_t, dest_offset)
3100 ),
3101 TP_fast_assign(
3102 __entry->dev = src->i_sb->s_dev;
3103 __entry->src_ino = src->i_ino;
3104 __entry->src_isize = i_size_read(src);
3105 __entry->src_offset = soffset;
3106 __entry->len = len;
3107 __entry->dest_ino = dest->i_ino;
3108 __entry->dest_isize = i_size_read(dest);
3109 __entry->dest_offset = doffset;
3110 ),
3111 TP_printk("dev %d:%d count %zd "
3112 "ino 0x%lx isize 0x%llx offset 0x%llx -> "
3113 "ino 0x%lx isize 0x%llx offset 0x%llx",
3114 MAJOR(__entry->dev), MINOR(__entry->dev),
3115 __entry->len,
3116 __entry->src_ino,
3117 __entry->src_isize,
3118 __entry->src_offset,
3119 __entry->dest_ino,
3120 __entry->dest_isize,
3121 __entry->dest_offset)
3122)
3123
3124#define DEFINE_DOUBLE_VFS_IO_EVENT(name) \
3125DEFINE_EVENT(xfs_double_vfs_io_class, name, \
3126 TP_PROTO(struct inode *src, u64 soffset, u64 len, \
3127 struct inode *dest, u64 doffset), \
3128 TP_ARGS(src, soffset, len, dest, doffset))
3129
3130/* CoW write tracepoint */
3131DECLARE_EVENT_CLASS(xfs_copy_on_write_class,
3132 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk,
3133 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3134 TP_ARGS(ip, lblk, pblk, len, new_pblk),
3135 TP_STRUCT__entry(
3136 __field(dev_t, dev)
3137 __field(xfs_ino_t, ino)
3138 __field(xfs_fileoff_t, lblk)
3139 __field(xfs_fsblock_t, pblk)
3140 __field(xfs_extlen_t, len)
3141 __field(xfs_fsblock_t, new_pblk)
3142 ),
3143 TP_fast_assign(
3144 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3145 __entry->ino = ip->i_ino;
3146 __entry->lblk = lblk;
3147 __entry->pblk = pblk;
3148 __entry->len = len;
3149 __entry->new_pblk = new_pblk;
3150 ),
3151 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx pblk 0x%llx "
3152 "len 0x%x new_pblk %llu",
3153 MAJOR(__entry->dev), MINOR(__entry->dev),
3154 __entry->ino,
3155 __entry->lblk,
3156 __entry->pblk,
3157 __entry->len,
3158 __entry->new_pblk)
3159)
3160
3161#define DEFINE_COW_EVENT(name) \
3162DEFINE_EVENT(xfs_copy_on_write_class, name, \
3163 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk, xfs_fsblock_t pblk, \
3164 xfs_extlen_t len, xfs_fsblock_t new_pblk), \
3165 TP_ARGS(ip, lblk, pblk, len, new_pblk))
3166
3167/* inode/irec events */
3168DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3169 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3170 TP_ARGS(ip, irec),
3171 TP_STRUCT__entry(
3172 __field(dev_t, dev)
3173 __field(xfs_ino_t, ino)
3174 __field(xfs_fileoff_t, lblk)
3175 __field(xfs_extlen_t, len)
3176 __field(xfs_fsblock_t, pblk)
3177 ),
3178 TP_fast_assign(
3179 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3180 __entry->ino = ip->i_ino;
3181 __entry->lblk = irec->br_startoff;
3182 __entry->len = irec->br_blockcount;
3183 __entry->pblk = irec->br_startblock;
3184 ),
3185 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu",
3186 MAJOR(__entry->dev), MINOR(__entry->dev),
3187 __entry->ino,
3188 __entry->lblk,
3189 __entry->len,
3190 __entry->pblk)
3191);
3192#define DEFINE_INODE_IREC_EVENT(name) \
3193DEFINE_EVENT(xfs_inode_irec_class, name, \
3194 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3195 TP_ARGS(ip, irec))
3196
3197/* refcount/reflink tracepoint definitions */
3198
3199/* reflink tracepoints */
3200DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3201DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3202DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3203DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3204TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3205 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3206 xfs_filblks_t len, struct xfs_inode *dest,
3207 xfs_fileoff_t doffset),
3208 TP_ARGS(src, soffset, len, dest, doffset),
3209 TP_STRUCT__entry(
3210 __field(dev_t, dev)
3211 __field(xfs_ino_t, src_ino)
3212 __field(xfs_fileoff_t, src_lblk)
3213 __field(xfs_filblks_t, len)
3214 __field(xfs_ino_t, dest_ino)
3215 __field(xfs_fileoff_t, dest_lblk)
3216 ),
3217 TP_fast_assign(
3218 __entry->dev = VFS_I(src)->i_sb->s_dev;
3219 __entry->src_ino = src->i_ino;
3220 __entry->src_lblk = soffset;
3221 __entry->len = len;
3222 __entry->dest_ino = dest->i_ino;
3223 __entry->dest_lblk = doffset;
3224 ),
3225 TP_printk("dev %d:%d len 0x%llx "
3226 "ino 0x%llx offset 0x%llx blocks -> "
3227 "ino 0x%llx offset 0x%llx blocks",
3228 MAJOR(__entry->dev), MINOR(__entry->dev),
3229 __entry->len,
3230 __entry->src_ino,
3231 __entry->src_lblk,
3232 __entry->dest_ino,
3233 __entry->dest_lblk)
3234);
3235TRACE_EVENT(xfs_reflink_punch_range,
3236 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3237 xfs_extlen_t len),
3238 TP_ARGS(ip, lblk, len),
3239 TP_STRUCT__entry(
3240 __field(dev_t, dev)
3241 __field(xfs_ino_t, ino)
3242 __field(xfs_fileoff_t, lblk)
3243 __field(xfs_extlen_t, len)
3244 ),
3245 TP_fast_assign(
3246 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3247 __entry->ino = ip->i_ino;
3248 __entry->lblk = lblk;
3249 __entry->len = len;
3250 ),
3251 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3252 MAJOR(__entry->dev), MINOR(__entry->dev),
3253 __entry->ino,
3254 __entry->lblk,
3255 __entry->len)
3256);
3257TRACE_EVENT(xfs_reflink_remap,
3258 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3259 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3260 TP_ARGS(ip, lblk, len, new_pblk),
3261 TP_STRUCT__entry(
3262 __field(dev_t, dev)
3263 __field(xfs_ino_t, ino)
3264 __field(xfs_fileoff_t, lblk)
3265 __field(xfs_extlen_t, len)
3266 __field(xfs_fsblock_t, new_pblk)
3267 ),
3268 TP_fast_assign(
3269 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3270 __entry->ino = ip->i_ino;
3271 __entry->lblk = lblk;
3272 __entry->len = len;
3273 __entry->new_pblk = new_pblk;
3274 ),
3275 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3276 MAJOR(__entry->dev), MINOR(__entry->dev),
3277 __entry->ino,
3278 __entry->lblk,
3279 __entry->len,
3280 __entry->new_pblk)
3281);
3282DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3283DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3284DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3285DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
3286DEFINE_INODE_ERROR_EVENT(xfs_reflink_reflink_main_loop_error);
3287DEFINE_INODE_ERROR_EVENT(xfs_reflink_read_iomap_error);
3288DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3289DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3290
3291/* dedupe tracepoints */
3292DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3293DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3294
3295/* ioctl tracepoints */
3296DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_reflink);
3297DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_clone_range);
3298DEFINE_DOUBLE_VFS_IO_EVENT(xfs_ioctl_file_extent_same);
3299TRACE_EVENT(xfs_ioctl_clone,
3300 TP_PROTO(struct inode *src, struct inode *dest),
3301 TP_ARGS(src, dest),
3302 TP_STRUCT__entry(
3303 __field(dev_t, dev)
3304 __field(unsigned long, src_ino)
3305 __field(loff_t, src_isize)
3306 __field(unsigned long, dest_ino)
3307 __field(loff_t, dest_isize)
3308 ),
3309 TP_fast_assign(
3310 __entry->dev = src->i_sb->s_dev;
3311 __entry->src_ino = src->i_ino;
3312 __entry->src_isize = i_size_read(src);
3313 __entry->dest_ino = dest->i_ino;
3314 __entry->dest_isize = i_size_read(dest);
3315 ),
3316 TP_printk("dev %d:%d "
3317 "ino 0x%lx isize 0x%llx -> "
3318 "ino 0x%lx isize 0x%llx\n",
3319 MAJOR(__entry->dev), MINOR(__entry->dev),
3320 __entry->src_ino,
3321 __entry->src_isize,
3322 __entry->dest_ino,
3323 __entry->dest_isize)
3324);
3325
3326/* unshare tracepoints */
3327DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
3328DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cow_eof_block);
3329DEFINE_PAGE_EVENT(xfs_reflink_unshare_page);
3330DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
3331DEFINE_INODE_ERROR_EVENT(xfs_reflink_cow_eof_block_error);
3332DEFINE_INODE_ERROR_EVENT(xfs_reflink_dirty_page_error);
3333
3334/* copy on write */
3335DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003336DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3337DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3338DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003339
3340DEFINE_RW_EVENT(xfs_reflink_reserve_cow_range);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003341DEFINE_RW_EVENT(xfs_reflink_allocate_cow_range);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003342
3343DEFINE_INODE_IREC_EVENT(xfs_reflink_bounce_dio_write);
3344DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3345DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003346
3347DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3348DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3349DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
3350DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap_piece);
3351
3352DEFINE_INODE_ERROR_EVENT(xfs_reflink_reserve_cow_range_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003353DEFINE_INODE_ERROR_EVENT(xfs_reflink_allocate_cow_range_error);
3354DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3355DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3356
3357DEFINE_COW_EVENT(xfs_reflink_fork_buf);
3358DEFINE_COW_EVENT(xfs_reflink_finish_fork_buf);
3359DEFINE_INODE_ERROR_EVENT(xfs_reflink_fork_buf_error);
3360DEFINE_INODE_ERROR_EVENT(xfs_reflink_finish_fork_buf_error);
3361
3362DEFINE_INODE_EVENT(xfs_reflink_cancel_pending_cow);
3363DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
3364DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_pending_cow_error);
3365
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003366#endif /* _TRACE_XFS_H */
3367
3368#undef TRACE_INCLUDE_PATH
3369#define TRACE_INCLUDE_PATH .
3370#define TRACE_INCLUDE_FILE xfs_trace
3371#include <trace/define_trace.h>