blob: 7c5a16528d8bb0506e999d2673404604c2b76920 [file] [log] [blame]
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001/*
2 * Copyright (c) 2009, Christoph Hellwig
3 * All Rights Reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it would be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#undef TRACE_SYSTEM
19#define TRACE_SYSTEM xfs
20
21#if !defined(_TRACE_XFS_H) || defined(TRACE_HEADER_MULTI_READ)
22#define _TRACE_XFS_H
23
24#include <linux/tracepoint.h>
25
26struct xfs_agf;
27struct xfs_alloc_arg;
28struct xfs_attr_list_context;
29struct xfs_buf_log_item;
30struct xfs_da_args;
31struct xfs_da_node_entry;
32struct xfs_dquot;
Christoph Hellwig9e4c1092011-10-11 15:14:11 +000033struct xfs_log_item;
Mark Tinguelyad223e62012-06-14 09:22:15 -050034struct xlog;
Dave Chinner750b9c92013-11-01 15:27:18 +110035struct xlog_ticket;
Dave Chinner9abbc532010-04-13 15:06:46 +100036struct xlog_recover;
37struct xlog_recover_item;
38struct xfs_buf_log_format;
39struct xfs_inode_log_format;
Alex Elder1ed845d2012-08-01 09:56:49 -050040struct xfs_bmbt_irec;
Darrick J. Wong2c813ad2016-08-03 11:08:36 +100041struct xfs_btree_cur;
Darrick J. Wong1946b912016-10-03 09:11:18 -070042struct xfs_refcount_irec;
Darrick J. Wonge89c0412017-03-28 14:56:37 -070043struct xfs_fsmap;
44struct xfs_rmap_irec;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000045
Christoph Hellwigea9a4882009-12-21 14:03:03 +000046DECLARE_EVENT_CLASS(xfs_attr_list_class,
47 TP_PROTO(struct xfs_attr_list_context *ctx),
48 TP_ARGS(ctx),
49 TP_STRUCT__entry(
50 __field(dev_t, dev)
51 __field(xfs_ino_t, ino)
52 __field(u32, hashval)
53 __field(u32, blkno)
54 __field(u32, offset)
55 __field(void *, alist)
56 __field(int, bufsize)
57 __field(int, count)
58 __field(int, firstu)
59 __field(int, dupcnt)
60 __field(int, flags)
61 ),
62 TP_fast_assign(
63 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
64 __entry->ino = ctx->dp->i_ino;
65 __entry->hashval = ctx->cursor->hashval;
66 __entry->blkno = ctx->cursor->blkno;
67 __entry->offset = ctx->cursor->offset;
68 __entry->alist = ctx->alist;
69 __entry->bufsize = ctx->bufsize;
70 __entry->count = ctx->count;
71 __entry->firstu = ctx->firstu;
72 __entry->flags = ctx->flags;
73 ),
74 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
75 "alist 0x%p size %u count %u firstu %u flags %d %s",
76 MAJOR(__entry->dev), MINOR(__entry->dev),
77 __entry->ino,
78 __entry->hashval,
79 __entry->blkno,
80 __entry->offset,
81 __entry->dupcnt,
82 __entry->alist,
83 __entry->bufsize,
84 __entry->count,
85 __entry->firstu,
86 __entry->flags,
87 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS)
88 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000089)
Christoph Hellwigea9a4882009-12-21 14:03:03 +000090
91#define DEFINE_ATTR_LIST_EVENT(name) \
92DEFINE_EVENT(xfs_attr_list_class, name, \
93 TP_PROTO(struct xfs_attr_list_context *ctx), \
94 TP_ARGS(ctx))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +000095DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf);
96DEFINE_ATTR_LIST_EVENT(xfs_attr_list_sf_all);
97DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf);
98DEFINE_ATTR_LIST_EVENT(xfs_attr_list_leaf_end);
99DEFINE_ATTR_LIST_EVENT(xfs_attr_list_full);
100DEFINE_ATTR_LIST_EVENT(xfs_attr_list_add);
101DEFINE_ATTR_LIST_EVENT(xfs_attr_list_wrong_blk);
102DEFINE_ATTR_LIST_EVENT(xfs_attr_list_notfound);
Dave Chinneree732592012-11-12 22:53:53 +1100103DEFINE_ATTR_LIST_EVENT(xfs_attr_leaf_list);
104DEFINE_ATTR_LIST_EVENT(xfs_attr_node_list);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000105
Li Zefanf8adb4d2010-05-24 08:25:57 +0000106DECLARE_EVENT_CLASS(xfs_perag_class,
107 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount,
108 unsigned long caller_ip),
109 TP_ARGS(mp, agno, refcount, caller_ip),
110 TP_STRUCT__entry(
111 __field(dev_t, dev)
112 __field(xfs_agnumber_t, agno)
113 __field(int, refcount)
114 __field(unsigned long, caller_ip)
115 ),
116 TP_fast_assign(
117 __entry->dev = mp->m_super->s_dev;
118 __entry->agno = agno;
119 __entry->refcount = refcount;
120 __entry->caller_ip = caller_ip;
121 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100122 TP_printk("dev %d:%d agno %u refcount %d caller %ps",
Li Zefanf8adb4d2010-05-24 08:25:57 +0000123 MAJOR(__entry->dev), MINOR(__entry->dev),
124 __entry->agno,
125 __entry->refcount,
126 (char *)__entry->caller_ip)
127);
128
129#define DEFINE_PERAG_REF_EVENT(name) \
130DEFINE_EVENT(xfs_perag_class, name, \
131 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int refcount, \
132 unsigned long caller_ip), \
133 TP_ARGS(mp, agno, refcount, caller_ip))
134DEFINE_PERAG_REF_EVENT(xfs_perag_get);
Dave Chinner65d0f202010-09-24 18:40:15 +1000135DEFINE_PERAG_REF_EVENT(xfs_perag_get_tag);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000136DEFINE_PERAG_REF_EVENT(xfs_perag_put);
Dave Chinner16fd5362010-07-20 09:43:39 +1000137DEFINE_PERAG_REF_EVENT(xfs_perag_set_reclaim);
138DEFINE_PERAG_REF_EVENT(xfs_perag_clear_reclaim);
Brian Foster27b52862012-11-06 09:50:38 -0500139DEFINE_PERAG_REF_EVENT(xfs_perag_set_eofblocks);
140DEFINE_PERAG_REF_EVENT(xfs_perag_clear_eofblocks);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700141DEFINE_PERAG_REF_EVENT(xfs_perag_set_cowblocks);
142DEFINE_PERAG_REF_EVENT(xfs_perag_clear_cowblocks);
Li Zefanf8adb4d2010-05-24 08:25:57 +0000143
Dave Chinnerd1230312013-11-01 15:27:19 +1100144DECLARE_EVENT_CLASS(xfs_ag_class,
145 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno),
146 TP_ARGS(mp, agno),
147 TP_STRUCT__entry(
148 __field(dev_t, dev)
149 __field(xfs_agnumber_t, agno)
150 ),
151 TP_fast_assign(
152 __entry->dev = mp->m_super->s_dev;
153 __entry->agno = agno;
154 ),
155 TP_printk("dev %d:%d agno %u",
156 MAJOR(__entry->dev), MINOR(__entry->dev),
157 __entry->agno)
158);
159#define DEFINE_AG_EVENT(name) \
160DEFINE_EVENT(xfs_ag_class, name, \
161 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno), \
162 TP_ARGS(mp, agno))
163
164DEFINE_AG_EVENT(xfs_read_agf);
165DEFINE_AG_EVENT(xfs_alloc_read_agf);
166DEFINE_AG_EVENT(xfs_read_agi);
167DEFINE_AG_EVENT(xfs_ialloc_read_agi);
168
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000169TRACE_EVENT(xfs_attr_list_node_descend,
170 TP_PROTO(struct xfs_attr_list_context *ctx,
171 struct xfs_da_node_entry *btree),
172 TP_ARGS(ctx, btree),
173 TP_STRUCT__entry(
174 __field(dev_t, dev)
175 __field(xfs_ino_t, ino)
176 __field(u32, hashval)
177 __field(u32, blkno)
178 __field(u32, offset)
179 __field(void *, alist)
180 __field(int, bufsize)
181 __field(int, count)
182 __field(int, firstu)
183 __field(int, dupcnt)
184 __field(int, flags)
185 __field(u32, bt_hashval)
186 __field(u32, bt_before)
187 ),
188 TP_fast_assign(
189 __entry->dev = VFS_I(ctx->dp)->i_sb->s_dev;
190 __entry->ino = ctx->dp->i_ino;
191 __entry->hashval = ctx->cursor->hashval;
192 __entry->blkno = ctx->cursor->blkno;
193 __entry->offset = ctx->cursor->offset;
194 __entry->alist = ctx->alist;
195 __entry->bufsize = ctx->bufsize;
196 __entry->count = ctx->count;
197 __entry->firstu = ctx->firstu;
198 __entry->flags = ctx->flags;
199 __entry->bt_hashval = be32_to_cpu(btree->hashval);
200 __entry->bt_before = be32_to_cpu(btree->before);
201 ),
202 TP_printk("dev %d:%d ino 0x%llx cursor h/b/o 0x%x/0x%x/%u dupcnt %u "
203 "alist 0x%p size %u count %u firstu %u flags %d %s "
204 "node hashval %u, node before %u",
205 MAJOR(__entry->dev), MINOR(__entry->dev),
206 __entry->ino,
207 __entry->hashval,
208 __entry->blkno,
209 __entry->offset,
210 __entry->dupcnt,
211 __entry->alist,
212 __entry->bufsize,
213 __entry->count,
214 __entry->firstu,
215 __entry->flags,
216 __print_flags(__entry->flags, "|", XFS_ATTR_FLAGS),
217 __entry->bt_hashval,
218 __entry->bt_before)
219);
220
221TRACE_EVENT(xfs_iext_insert,
222 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx,
223 struct xfs_bmbt_irec *r, int state, unsigned long caller_ip),
224 TP_ARGS(ip, idx, r, state, caller_ip),
225 TP_STRUCT__entry(
226 __field(dev_t, dev)
227 __field(xfs_ino_t, ino)
228 __field(xfs_extnum_t, idx)
229 __field(xfs_fileoff_t, startoff)
230 __field(xfs_fsblock_t, startblock)
231 __field(xfs_filblks_t, blockcount)
232 __field(xfs_exntst_t, state)
233 __field(int, bmap_state)
234 __field(unsigned long, caller_ip)
235 ),
236 TP_fast_assign(
237 __entry->dev = VFS_I(ip)->i_sb->s_dev;
238 __entry->ino = ip->i_ino;
239 __entry->idx = idx;
240 __entry->startoff = r->br_startoff;
241 __entry->startblock = r->br_startblock;
242 __entry->blockcount = r->br_blockcount;
243 __entry->state = r->br_state;
244 __entry->bmap_state = state;
245 __entry->caller_ip = caller_ip;
246 ),
247 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100248 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000249 MAJOR(__entry->dev), MINOR(__entry->dev),
250 __entry->ino,
251 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
252 (long)__entry->idx,
253 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000254 (__int64_t)__entry->startblock,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000255 __entry->blockcount,
256 __entry->state,
257 (char *)__entry->caller_ip)
258);
259
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000260DECLARE_EVENT_CLASS(xfs_bmap_class,
261 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state,
262 unsigned long caller_ip),
263 TP_ARGS(ip, idx, state, caller_ip),
264 TP_STRUCT__entry(
265 __field(dev_t, dev)
266 __field(xfs_ino_t, ino)
267 __field(xfs_extnum_t, idx)
268 __field(xfs_fileoff_t, startoff)
269 __field(xfs_fsblock_t, startblock)
270 __field(xfs_filblks_t, blockcount)
271 __field(xfs_exntst_t, state)
272 __field(int, bmap_state)
273 __field(unsigned long, caller_ip)
274 ),
275 TP_fast_assign(
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700276 struct xfs_ifork *ifp;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000277 struct xfs_bmbt_irec r;
278
Darrick J. Wong3993bae2016-10-03 09:11:32 -0700279 ifp = xfs_iext_state_to_fork(ip, state);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000280 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &r);
281 __entry->dev = VFS_I(ip)->i_sb->s_dev;
282 __entry->ino = ip->i_ino;
283 __entry->idx = idx;
284 __entry->startoff = r.br_startoff;
285 __entry->startblock = r.br_startblock;
286 __entry->blockcount = r.br_blockcount;
287 __entry->state = r.br_state;
288 __entry->bmap_state = state;
289 __entry->caller_ip = caller_ip;
290 ),
291 TP_printk("dev %d:%d ino 0x%llx state %s idx %ld "
Scott Wood65dd2972015-03-25 14:56:21 +1100292 "offset %lld block %lld count %lld flag %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000293 MAJOR(__entry->dev), MINOR(__entry->dev),
294 __entry->ino,
295 __print_flags(__entry->bmap_state, "|", XFS_BMAP_EXT_FLAGS),
296 (long)__entry->idx,
297 __entry->startoff,
Christoph Hellwigf7008d02010-02-15 22:02:19 +0000298 (__int64_t)__entry->startblock,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000299 __entry->blockcount,
300 __entry->state,
301 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000302)
303
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000304#define DEFINE_BMAP_EVENT(name) \
305DEFINE_EVENT(xfs_bmap_class, name, \
306 TP_PROTO(struct xfs_inode *ip, xfs_extnum_t idx, int state, \
307 unsigned long caller_ip), \
308 TP_ARGS(ip, idx, state, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000309DEFINE_BMAP_EVENT(xfs_iext_remove);
310DEFINE_BMAP_EVENT(xfs_bmap_pre_update);
311DEFINE_BMAP_EVENT(xfs_bmap_post_update);
312DEFINE_BMAP_EVENT(xfs_extlist);
313
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000314DECLARE_EVENT_CLASS(xfs_buf_class,
315 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip),
316 TP_ARGS(bp, caller_ip),
317 TP_STRUCT__entry(
318 __field(dev_t, dev)
319 __field(xfs_daddr_t, bno)
Dave Chinner4e94b712012-04-23 15:58:51 +1000320 __field(int, nblks)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000321 __field(int, hold)
322 __field(int, pincount)
323 __field(unsigned, lockval)
324 __field(unsigned, flags)
325 __field(unsigned long, caller_ip)
326 ),
327 TP_fast_assign(
328 __entry->dev = bp->b_target->bt_dev;
329 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000330 __entry->nblks = bp->b_length;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000331 __entry->hold = atomic_read(&bp->b_hold);
332 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200333 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000334 __entry->flags = bp->b_flags;
335 __entry->caller_ip = caller_ip;
336 ),
Dave Chinner4e94b712012-04-23 15:58:51 +1000337 TP_printk("dev %d:%d bno 0x%llx nblks 0x%x hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100338 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000339 MAJOR(__entry->dev), MINOR(__entry->dev),
340 (unsigned long long)__entry->bno,
Dave Chinner4e94b712012-04-23 15:58:51 +1000341 __entry->nblks,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000342 __entry->hold,
343 __entry->pincount,
344 __entry->lockval,
345 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
346 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000347)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000348
349#define DEFINE_BUF_EVENT(name) \
350DEFINE_EVENT(xfs_buf_class, name, \
351 TP_PROTO(struct xfs_buf *bp, unsigned long caller_ip), \
352 TP_ARGS(bp, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000353DEFINE_BUF_EVENT(xfs_buf_init);
354DEFINE_BUF_EVENT(xfs_buf_free);
355DEFINE_BUF_EVENT(xfs_buf_hold);
356DEFINE_BUF_EVENT(xfs_buf_rele);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000357DEFINE_BUF_EVENT(xfs_buf_iodone);
Dave Chinner595bff72014-10-02 09:05:14 +1000358DEFINE_BUF_EVENT(xfs_buf_submit);
359DEFINE_BUF_EVENT(xfs_buf_submit_wait);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000360DEFINE_BUF_EVENT(xfs_buf_lock);
361DEFINE_BUF_EVENT(xfs_buf_lock_done);
Darrick J. Wong479c6412016-06-21 11:53:28 +1000362DEFINE_BUF_EVENT(xfs_buf_trylock_fail);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200363DEFINE_BUF_EVENT(xfs_buf_trylock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000364DEFINE_BUF_EVENT(xfs_buf_unlock);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000365DEFINE_BUF_EVENT(xfs_buf_iowait);
366DEFINE_BUF_EVENT(xfs_buf_iowait_done);
367DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Christoph Hellwig43ff2122012-04-23 15:58:39 +1000368DEFINE_BUF_EVENT(xfs_buf_delwri_queued);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000369DEFINE_BUF_EVENT(xfs_buf_delwri_split);
Dave Chinner686865f2010-09-24 20:07:47 +1000370DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000371DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000372DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
373DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100374DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000375DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
376
377/* not really buffer traces, but the buf provides useful information */
378DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000379DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000380
381/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000382DECLARE_EVENT_CLASS(xfs_buf_flags_class,
383 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
384 TP_ARGS(bp, flags, caller_ip),
385 TP_STRUCT__entry(
386 __field(dev_t, dev)
387 __field(xfs_daddr_t, bno)
388 __field(size_t, buffer_length)
389 __field(int, hold)
390 __field(int, pincount)
391 __field(unsigned, lockval)
392 __field(unsigned, flags)
393 __field(unsigned long, caller_ip)
394 ),
395 TP_fast_assign(
396 __entry->dev = bp->b_target->bt_dev;
397 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000398 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000399 __entry->flags = flags;
400 __entry->hold = atomic_read(&bp->b_hold);
401 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200402 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000403 __entry->caller_ip = caller_ip;
404 ),
405 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100406 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000407 MAJOR(__entry->dev), MINOR(__entry->dev),
408 (unsigned long long)__entry->bno,
409 __entry->buffer_length,
410 __entry->hold,
411 __entry->pincount,
412 __entry->lockval,
413 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
414 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000415)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000416
417#define DEFINE_BUF_FLAGS_EVENT(name) \
418DEFINE_EVENT(xfs_buf_flags_class, name, \
419 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
420 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000421DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
422DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
423DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
424
425TRACE_EVENT(xfs_buf_ioerror,
426 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
427 TP_ARGS(bp, error, caller_ip),
428 TP_STRUCT__entry(
429 __field(dev_t, dev)
430 __field(xfs_daddr_t, bno)
431 __field(size_t, buffer_length)
432 __field(unsigned, flags)
433 __field(int, hold)
434 __field(int, pincount)
435 __field(unsigned, lockval)
436 __field(int, error)
437 __field(unsigned long, caller_ip)
438 ),
439 TP_fast_assign(
440 __entry->dev = bp->b_target->bt_dev;
441 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000442 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000443 __entry->hold = atomic_read(&bp->b_hold);
444 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200445 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000446 __entry->error = error;
447 __entry->flags = bp->b_flags;
448 __entry->caller_ip = caller_ip;
449 ),
450 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100451 "lock %d error %d flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000452 MAJOR(__entry->dev), MINOR(__entry->dev),
453 (unsigned long long)__entry->bno,
454 __entry->buffer_length,
455 __entry->hold,
456 __entry->pincount,
457 __entry->lockval,
458 __entry->error,
459 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
460 (void *)__entry->caller_ip)
461);
462
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000463DECLARE_EVENT_CLASS(xfs_buf_item_class,
464 TP_PROTO(struct xfs_buf_log_item *bip),
465 TP_ARGS(bip),
466 TP_STRUCT__entry(
467 __field(dev_t, dev)
468 __field(xfs_daddr_t, buf_bno)
469 __field(size_t, buf_len)
470 __field(int, buf_hold)
471 __field(int, buf_pincount)
472 __field(int, buf_lockval)
473 __field(unsigned, buf_flags)
474 __field(unsigned, bli_recur)
475 __field(int, bli_refcount)
476 __field(unsigned, bli_flags)
477 __field(void *, li_desc)
478 __field(unsigned, li_flags)
479 ),
480 TP_fast_assign(
481 __entry->dev = bip->bli_buf->b_target->bt_dev;
482 __entry->bli_flags = bip->bli_flags;
483 __entry->bli_recur = bip->bli_recur;
484 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
485 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000486 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000487 __entry->buf_flags = bip->bli_buf->b_flags;
488 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
489 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200490 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000491 __entry->li_desc = bip->bli_item.li_desc;
492 __entry->li_flags = bip->bli_item.li_flags;
493 ),
494 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
495 "lock %d flags %s recur %d refcount %d bliflags %s "
496 "lidesc 0x%p liflags %s",
497 MAJOR(__entry->dev), MINOR(__entry->dev),
498 (unsigned long long)__entry->buf_bno,
499 __entry->buf_len,
500 __entry->buf_hold,
501 __entry->buf_pincount,
502 __entry->buf_lockval,
503 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
504 __entry->bli_recur,
505 __entry->bli_refcount,
506 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
507 __entry->li_desc,
508 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000509)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000510
511#define DEFINE_BUF_ITEM_EVENT(name) \
512DEFINE_EVENT(xfs_buf_item_class, name, \
513 TP_PROTO(struct xfs_buf_log_item *bip), \
514 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000515DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000516DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000517DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000520DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format_stale);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000521DEFINE_BUF_ITEM_EVENT(xfs_buf_item_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000522DEFINE_BUF_ITEM_EVENT(xfs_buf_item_pin);
523DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin);
524DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000525DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock);
526DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale);
527DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed);
528DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push);
529DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
530DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf_recur);
531DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb);
532DEFINE_BUF_ITEM_EVENT(xfs_trans_getsb_recur);
533DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf);
534DEFINE_BUF_ITEM_EVENT(xfs_trans_read_buf_recur);
535DEFINE_BUF_ITEM_EVENT(xfs_trans_log_buf);
536DEFINE_BUF_ITEM_EVENT(xfs_trans_brelse);
537DEFINE_BUF_ITEM_EVENT(xfs_trans_bjoin);
538DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold);
539DEFINE_BUF_ITEM_EVENT(xfs_trans_bhold_release);
540DEFINE_BUF_ITEM_EVENT(xfs_trans_binval);
541
Christoph Hellwigb94acd42014-04-23 07:11:52 +1000542DECLARE_EVENT_CLASS(xfs_filestream_class,
543 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno),
544 TP_ARGS(ip, agno),
545 TP_STRUCT__entry(
546 __field(dev_t, dev)
547 __field(xfs_ino_t, ino)
548 __field(xfs_agnumber_t, agno)
549 __field(int, streams)
550 ),
551 TP_fast_assign(
552 __entry->dev = VFS_I(ip)->i_sb->s_dev;
553 __entry->ino = ip->i_ino;
554 __entry->agno = agno;
555 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
556 ),
557 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d",
558 MAJOR(__entry->dev), MINOR(__entry->dev),
559 __entry->ino,
560 __entry->agno,
561 __entry->streams)
562)
563#define DEFINE_FILESTREAM_EVENT(name) \
564DEFINE_EVENT(xfs_filestream_class, name, \
565 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno), \
566 TP_ARGS(ip, agno))
567DEFINE_FILESTREAM_EVENT(xfs_filestream_free);
568DEFINE_FILESTREAM_EVENT(xfs_filestream_lookup);
569DEFINE_FILESTREAM_EVENT(xfs_filestream_scan);
570
571TRACE_EVENT(xfs_filestream_pick,
572 TP_PROTO(struct xfs_inode *ip, xfs_agnumber_t agno,
573 xfs_extlen_t free, int nscan),
574 TP_ARGS(ip, agno, free, nscan),
575 TP_STRUCT__entry(
576 __field(dev_t, dev)
577 __field(xfs_ino_t, ino)
578 __field(xfs_agnumber_t, agno)
579 __field(int, streams)
580 __field(xfs_extlen_t, free)
581 __field(int, nscan)
582 ),
583 TP_fast_assign(
584 __entry->dev = VFS_I(ip)->i_sb->s_dev;
585 __entry->ino = ip->i_ino;
586 __entry->agno = agno;
587 __entry->streams = xfs_filestream_peek_ag(ip->i_mount, agno);
588 __entry->free = free;
589 __entry->nscan = nscan;
590 ),
591 TP_printk("dev %d:%d ino 0x%llx agno %u streams %d free %d nscan %d",
592 MAJOR(__entry->dev), MINOR(__entry->dev),
593 __entry->ino,
594 __entry->agno,
595 __entry->streams,
596 __entry->free,
597 __entry->nscan)
598);
599
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000600DECLARE_EVENT_CLASS(xfs_lock_class,
601 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags,
602 unsigned long caller_ip),
603 TP_ARGS(ip, lock_flags, caller_ip),
604 TP_STRUCT__entry(
605 __field(dev_t, dev)
606 __field(xfs_ino_t, ino)
607 __field(int, lock_flags)
608 __field(unsigned long, caller_ip)
609 ),
610 TP_fast_assign(
611 __entry->dev = VFS_I(ip)->i_sb->s_dev;
612 __entry->ino = ip->i_ino;
613 __entry->lock_flags = lock_flags;
614 __entry->caller_ip = caller_ip;
615 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100616 TP_printk("dev %d:%d ino 0x%llx flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000617 MAJOR(__entry->dev), MINOR(__entry->dev),
618 __entry->ino,
619 __print_flags(__entry->lock_flags, "|", XFS_LOCK_FLAGS),
620 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000621)
622
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000623#define DEFINE_LOCK_EVENT(name) \
624DEFINE_EVENT(xfs_lock_class, name, \
625 TP_PROTO(struct xfs_inode *ip, unsigned lock_flags, \
626 unsigned long caller_ip), \
627 TP_ARGS(ip, lock_flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000628DEFINE_LOCK_EVENT(xfs_ilock);
629DEFINE_LOCK_EVENT(xfs_ilock_nowait);
630DEFINE_LOCK_EVENT(xfs_ilock_demote);
631DEFINE_LOCK_EVENT(xfs_iunlock);
632
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000633DECLARE_EVENT_CLASS(xfs_inode_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000634 TP_PROTO(struct xfs_inode *ip),
635 TP_ARGS(ip),
636 TP_STRUCT__entry(
637 __field(dev_t, dev)
638 __field(xfs_ino_t, ino)
639 ),
640 TP_fast_assign(
641 __entry->dev = VFS_I(ip)->i_sb->s_dev;
642 __entry->ino = ip->i_ino;
643 ),
644 TP_printk("dev %d:%d ino 0x%llx",
645 MAJOR(__entry->dev), MINOR(__entry->dev),
646 __entry->ino)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000647)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000648
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000649#define DEFINE_INODE_EVENT(name) \
650DEFINE_EVENT(xfs_inode_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000651 TP_PROTO(struct xfs_inode *ip), \
652 TP_ARGS(ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000653DEFINE_INODE_EVENT(xfs_iget_skip);
654DEFINE_INODE_EVENT(xfs_iget_reclaim);
655DEFINE_INODE_EVENT(xfs_iget_reclaim_fail);
656DEFINE_INODE_EVENT(xfs_iget_hit);
657DEFINE_INODE_EVENT(xfs_iget_miss);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000658
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000659DEFINE_INODE_EVENT(xfs_getattr);
660DEFINE_INODE_EVENT(xfs_setattr);
661DEFINE_INODE_EVENT(xfs_readlink);
Mark Tinguely725eb1e2013-06-17 15:35:57 -0500662DEFINE_INODE_EVENT(xfs_inactive_symlink);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000663DEFINE_INODE_EVENT(xfs_alloc_file_space);
664DEFINE_INODE_EVENT(xfs_free_file_space);
Dave Chinner897b73b2014-04-14 18:15:11 +1000665DEFINE_INODE_EVENT(xfs_zero_file_space);
Namjae Jeone1d8fb82014-02-24 10:58:19 +1100666DEFINE_INODE_EVENT(xfs_collapse_file_space);
Namjae Jeona904b1c2015-03-25 15:08:56 +1100667DEFINE_INODE_EVENT(xfs_insert_file_space);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000668DEFINE_INODE_EVENT(xfs_readdir);
Tony Luck0f1a9322010-07-20 17:54:41 +1000669#ifdef CONFIG_XFS_POSIX_ACL
Christoph Hellwig4e34e712011-07-23 17:37:31 +0200670DEFINE_INODE_EVENT(xfs_get_acl);
Tony Luck0f1a9322010-07-20 17:54:41 +1000671#endif
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000672DEFINE_INODE_EVENT(xfs_vm_bmap);
673DEFINE_INODE_EVENT(xfs_file_ioctl);
674DEFINE_INODE_EVENT(xfs_file_compat_ioctl);
675DEFINE_INODE_EVENT(xfs_ioctl_setattr);
Christoph Hellwig1da2f2d2011-10-02 14:25:16 +0000676DEFINE_INODE_EVENT(xfs_dir_fsync);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000677DEFINE_INODE_EVENT(xfs_file_fsync);
678DEFINE_INODE_EVENT(xfs_destroy_inode);
Christoph Hellwig69ff2822012-06-06 17:01:28 -0400679DEFINE_INODE_EVENT(xfs_update_time);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000680
681DEFINE_INODE_EVENT(xfs_dquot_dqalloc);
682DEFINE_INODE_EVENT(xfs_dquot_dqdetach);
683
Brian Foster27b52862012-11-06 09:50:38 -0500684DEFINE_INODE_EVENT(xfs_inode_set_eofblocks_tag);
685DEFINE_INODE_EVENT(xfs_inode_clear_eofblocks_tag);
Brian Foster41176a62012-11-06 09:50:42 -0500686DEFINE_INODE_EVENT(xfs_inode_free_eofblocks_invalid);
Darrick J. Wong83104d42016-10-03 09:11:46 -0700687DEFINE_INODE_EVENT(xfs_inode_set_cowblocks_tag);
688DEFINE_INODE_EVENT(xfs_inode_clear_cowblocks_tag);
689DEFINE_INODE_EVENT(xfs_inode_free_cowblocks_invalid);
Brian Foster27b52862012-11-06 09:50:38 -0500690
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100691DEFINE_INODE_EVENT(xfs_filemap_fault);
Dave Jianga2d58162017-02-24 14:56:59 -0800692DEFINE_INODE_EVENT(xfs_filemap_huge_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_irele);
797DEFINE_IREF_EVENT(xfs_inode_pin);
798DEFINE_IREF_EVENT(xfs_inode_unpin);
799DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100800
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000801DECLARE_EVENT_CLASS(xfs_namespace_class,
802 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
803 TP_ARGS(dp, name),
804 TP_STRUCT__entry(
805 __field(dev_t, dev)
806 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000807 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000808 __dynamic_array(char, name, name->len)
809 ),
810 TP_fast_assign(
811 __entry->dev = VFS_I(dp)->i_sb->s_dev;
812 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000813 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000814 memcpy(__get_str(name), name->name, name->len);
815 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000816 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000817 MAJOR(__entry->dev), MINOR(__entry->dev),
818 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000819 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000820 __get_str(name))
821)
822
823#define DEFINE_NAMESPACE_EVENT(name) \
824DEFINE_EVENT(xfs_namespace_class, name, \
825 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
826 TP_ARGS(dp, name))
827DEFINE_NAMESPACE_EVENT(xfs_remove);
828DEFINE_NAMESPACE_EVENT(xfs_link);
829DEFINE_NAMESPACE_EVENT(xfs_lookup);
830DEFINE_NAMESPACE_EVENT(xfs_create);
831DEFINE_NAMESPACE_EVENT(xfs_symlink);
832
833TRACE_EVENT(xfs_rename,
834 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
835 struct xfs_name *src_name, struct xfs_name *target_name),
836 TP_ARGS(src_dp, target_dp, src_name, target_name),
837 TP_STRUCT__entry(
838 __field(dev_t, dev)
839 __field(xfs_ino_t, src_dp_ino)
840 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000841 __field(int, src_namelen)
842 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000843 __dynamic_array(char, src_name, src_name->len)
844 __dynamic_array(char, target_name, target_name->len)
845 ),
846 TP_fast_assign(
847 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
848 __entry->src_dp_ino = src_dp->i_ino;
849 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000850 __entry->src_namelen = src_name->len;
851 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000852 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000853 memcpy(__get_str(target_name), target_name->name,
854 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000855 ),
856 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000857 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000858 MAJOR(__entry->dev), MINOR(__entry->dev),
859 __entry->src_dp_ino,
860 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000861 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000862 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000863 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000864 __get_str(target_name))
865)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000866
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000867DECLARE_EVENT_CLASS(xfs_dquot_class,
868 TP_PROTO(struct xfs_dquot *dqp),
869 TP_ARGS(dqp),
870 TP_STRUCT__entry(
871 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000872 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000873 __field(unsigned, flags)
874 __field(unsigned, nrefs)
875 __field(unsigned long long, res_bcount)
876 __field(unsigned long long, bcount)
877 __field(unsigned long long, icount)
878 __field(unsigned long long, blk_hardlimit)
879 __field(unsigned long long, blk_softlimit)
880 __field(unsigned long long, ino_hardlimit)
881 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000882 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000883 TP_fast_assign(
884 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000885 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000886 __entry->flags = dqp->dq_flags;
887 __entry->nrefs = dqp->q_nrefs;
888 __entry->res_bcount = dqp->q_res_bcount;
889 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
890 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
891 __entry->blk_hardlimit =
892 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
893 __entry->blk_softlimit =
894 be64_to_cpu(dqp->q_core.d_blk_softlimit);
895 __entry->ino_hardlimit =
896 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
897 __entry->ino_softlimit =
898 be64_to_cpu(dqp->q_core.d_ino_softlimit);
899 ),
900 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000901 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
902 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000903 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000904 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000905 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
906 __entry->nrefs,
907 __entry->res_bcount,
908 __entry->bcount,
909 __entry->blk_hardlimit,
910 __entry->blk_softlimit,
911 __entry->icount,
912 __entry->ino_hardlimit,
913 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000914)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000915
916#define DEFINE_DQUOT_EVENT(name) \
917DEFINE_EVENT(xfs_dquot_class, name, \
918 TP_PROTO(struct xfs_dquot *dqp), \
919 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000920DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000921DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
922DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000923DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
924DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000925DEFINE_DQUOT_EVENT(xfs_dqattach_found);
926DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000927DEFINE_DQUOT_EVENT(xfs_dqalloc);
928DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
929DEFINE_DQUOT_EVENT(xfs_dqread);
930DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000931DEFINE_DQUOT_EVENT(xfs_dqget_hit);
932DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000933DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
934DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000935DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000936DEFINE_DQUOT_EVENT(xfs_dqput_free);
937DEFINE_DQUOT_EVENT(xfs_dqrele);
938DEFINE_DQUOT_EVENT(xfs_dqflush);
939DEFINE_DQUOT_EVENT(xfs_dqflush_force);
940DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000941
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000942DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500943 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000944 TP_ARGS(log, tic),
945 TP_STRUCT__entry(
946 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000947 __field(char, ocnt)
948 __field(char, cnt)
949 __field(int, curr_res)
950 __field(int, unit_res)
951 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100952 __field(int, reserveq)
953 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000954 __field(int, grant_reserve_cycle)
955 __field(int, grant_reserve_bytes)
956 __field(int, grant_write_cycle)
957 __field(int, grant_write_bytes)
958 __field(int, curr_cycle)
959 __field(int, curr_block)
960 __field(xfs_lsn_t, tail_lsn)
961 ),
962 TP_fast_assign(
963 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000964 __entry->ocnt = tic->t_ocnt;
965 __entry->cnt = tic->t_cnt;
966 __entry->curr_res = tic->t_curr_res;
967 __entry->unit_res = tic->t_unit_res;
968 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000969 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
970 __entry->writeq = list_empty(&log->l_write_head.waiters);
971 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100972 &__entry->grant_reserve_cycle,
973 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000974 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100975 &__entry->grant_write_cycle,
976 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000977 __entry->curr_cycle = log->l_curr_cycle;
978 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +1100979 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000980 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +1000981 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +1100982 "t_unit_res %u t_flags %s reserveq %s "
983 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000984 "grant_reserve_bytes %d grant_write_cycle %d "
985 "grant_write_bytes %d curr_cycle %d curr_block %d "
986 "tail_cycle %d tail_block %d",
987 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000988 __entry->ocnt,
989 __entry->cnt,
990 __entry->curr_res,
991 __entry->unit_res,
992 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +1100993 __entry->reserveq ? "empty" : "active",
994 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000995 __entry->grant_reserve_cycle,
996 __entry->grant_reserve_bytes,
997 __entry->grant_write_cycle,
998 __entry->grant_write_bytes,
999 __entry->curr_cycle,
1000 __entry->curr_block,
1001 CYCLE_LSN(__entry->tail_lsn),
1002 BLOCK_LSN(__entry->tail_lsn)
1003 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001004)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001005
1006#define DEFINE_LOGGRANT_EVENT(name) \
1007DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001008 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001009 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001010DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1011DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001012DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001013DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1014DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001015DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001016DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1017DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1018DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1019DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001020DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1021DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1022DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1023DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1024DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1025DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1026
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001027DECLARE_EVENT_CLASS(xfs_log_item_class,
1028 TP_PROTO(struct xfs_log_item *lip),
1029 TP_ARGS(lip),
1030 TP_STRUCT__entry(
1031 __field(dev_t, dev)
1032 __field(void *, lip)
1033 __field(uint, type)
1034 __field(uint, flags)
1035 __field(xfs_lsn_t, lsn)
1036 ),
1037 TP_fast_assign(
1038 __entry->dev = lip->li_mountp->m_super->s_dev;
1039 __entry->lip = lip;
1040 __entry->type = lip->li_type;
1041 __entry->flags = lip->li_flags;
1042 __entry->lsn = lip->li_lsn;
1043 ),
1044 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1045 MAJOR(__entry->dev), MINOR(__entry->dev),
1046 __entry->lip,
1047 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1048 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1049 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1050)
1051
Dave Chinner14c26c62012-04-24 16:33:31 +10001052TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001053 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1054 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001055 TP_STRUCT__entry(
1056 __field(dev_t, dev)
1057 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001058 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001059 ),
1060 TP_fast_assign(
1061 __entry->dev = mp->m_super->s_dev;
1062 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001063 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001064 ),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001065 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
Dave Chinner14c26c62012-04-24 16:33:31 +10001066 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001067 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001068)
1069
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001070#define DEFINE_LOG_ITEM_EVENT(name) \
1071DEFINE_EVENT(xfs_log_item_class, name, \
1072 TP_PROTO(struct xfs_log_item *lip), \
1073 TP_ARGS(lip))
1074DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001075DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1076DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001077DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001078
Dave Chinner750b9c92013-11-01 15:27:18 +11001079DECLARE_EVENT_CLASS(xfs_ail_class,
1080 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1081 TP_ARGS(lip, old_lsn, new_lsn),
1082 TP_STRUCT__entry(
1083 __field(dev_t, dev)
1084 __field(void *, lip)
1085 __field(uint, type)
1086 __field(uint, flags)
1087 __field(xfs_lsn_t, old_lsn)
1088 __field(xfs_lsn_t, new_lsn)
1089 ),
1090 TP_fast_assign(
1091 __entry->dev = lip->li_mountp->m_super->s_dev;
1092 __entry->lip = lip;
1093 __entry->type = lip->li_type;
1094 __entry->flags = lip->li_flags;
1095 __entry->old_lsn = old_lsn;
1096 __entry->new_lsn = new_lsn;
1097 ),
1098 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1099 MAJOR(__entry->dev), MINOR(__entry->dev),
1100 __entry->lip,
1101 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1102 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1103 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1104 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1105)
1106
1107#define DEFINE_AIL_EVENT(name) \
1108DEFINE_EVENT(xfs_ail_class, name, \
1109 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1110 TP_ARGS(lip, old_lsn, new_lsn))
1111DEFINE_AIL_EVENT(xfs_ail_insert);
1112DEFINE_AIL_EVENT(xfs_ail_move);
1113DEFINE_AIL_EVENT(xfs_ail_delete);
1114
1115TRACE_EVENT(xfs_log_assign_tail_lsn,
1116 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1117 TP_ARGS(log, new_lsn),
1118 TP_STRUCT__entry(
1119 __field(dev_t, dev)
1120 __field(xfs_lsn_t, new_lsn)
1121 __field(xfs_lsn_t, old_lsn)
1122 __field(xfs_lsn_t, last_sync_lsn)
1123 ),
1124 TP_fast_assign(
1125 __entry->dev = log->l_mp->m_super->s_dev;
1126 __entry->new_lsn = new_lsn;
1127 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1128 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1129 ),
1130 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1131 MAJOR(__entry->dev), MINOR(__entry->dev),
1132 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1133 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1134 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1135)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001136
Li Zefanf8adb4d2010-05-24 08:25:57 +00001137DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001138 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1139 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001140 TP_STRUCT__entry(
1141 __field(dev_t, dev)
1142 __field(xfs_ino_t, ino)
1143 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001144 __field(loff_t, offset)
1145 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001146 ),
1147 TP_fast_assign(
1148 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1149 __entry->ino = ip->i_ino;
1150 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001151 __entry->offset = offset;
1152 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001153 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001154 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001155 MAJOR(__entry->dev), MINOR(__entry->dev),
1156 __entry->ino,
1157 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001158 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001159 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001160)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001161
1162#define DEFINE_RW_EVENT(name) \
1163DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001164 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1165 TP_ARGS(ip, count, offset))
1166DEFINE_RW_EVENT(xfs_file_buffered_read);
1167DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001168DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001169DEFINE_RW_EVENT(xfs_file_buffered_write);
1170DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001171DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001172
Li Zefanf8adb4d2010-05-24 08:25:57 +00001173DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001174 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1175 unsigned int len),
1176 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001177 TP_STRUCT__entry(
1178 __field(dev_t, dev)
1179 __field(xfs_ino_t, ino)
1180 __field(pgoff_t, pgoff)
1181 __field(loff_t, size)
1182 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001183 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001184 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001185 __field(int, unwritten)
1186 ),
1187 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001188 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001189
Li Zefanf8adb4d2010-05-24 08:25:57 +00001190 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001191 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001192 __entry->dev = inode->i_sb->s_dev;
1193 __entry->ino = XFS_I(inode)->i_ino;
1194 __entry->pgoff = page_offset(page);
1195 __entry->size = i_size_read(inode);
1196 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001197 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001198 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001199 __entry->unwritten = unwritten;
1200 ),
1201 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001202 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001203 MAJOR(__entry->dev), MINOR(__entry->dev),
1204 __entry->ino,
1205 __entry->pgoff,
1206 __entry->size,
1207 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001208 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001209 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001210 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001211)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001212
1213#define DEFINE_PAGE_EVENT(name) \
1214DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001215 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1216 unsigned int len), \
1217 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001218DEFINE_PAGE_EVENT(xfs_writepage);
1219DEFINE_PAGE_EVENT(xfs_releasepage);
1220DEFINE_PAGE_EVENT(xfs_invalidatepage);
1221
Dave Chinner121e2132016-01-08 11:28:35 +11001222DECLARE_EVENT_CLASS(xfs_readpage_class,
1223 TP_PROTO(struct inode *inode, int nr_pages),
1224 TP_ARGS(inode, nr_pages),
1225 TP_STRUCT__entry(
1226 __field(dev_t, dev)
1227 __field(xfs_ino_t, ino)
1228 __field(int, nr_pages)
1229 ),
1230 TP_fast_assign(
1231 __entry->dev = inode->i_sb->s_dev;
1232 __entry->ino = inode->i_ino;
1233 __entry->nr_pages = nr_pages;
1234 ),
1235 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1236 MAJOR(__entry->dev), MINOR(__entry->dev),
1237 __entry->ino,
1238 __entry->nr_pages)
1239)
1240
1241#define DEFINE_READPAGE_EVENT(name) \
1242DEFINE_EVENT(xfs_readpage_class, name, \
1243 TP_PROTO(struct inode *inode, int nr_pages), \
1244 TP_ARGS(inode, nr_pages))
1245DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1246DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1247
Christoph Hellwiga206c812010-12-10 08:42:20 +00001248DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001249 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001250 int type, struct xfs_bmbt_irec *irec),
1251 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001252 TP_STRUCT__entry(
1253 __field(dev_t, dev)
1254 __field(xfs_ino_t, ino)
1255 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001256 __field(loff_t, offset)
1257 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001258 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001259 __field(xfs_fileoff_t, startoff)
1260 __field(xfs_fsblock_t, startblock)
1261 __field(xfs_filblks_t, blockcount)
1262 ),
1263 TP_fast_assign(
1264 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1265 __entry->ino = ip->i_ino;
1266 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001267 __entry->offset = offset;
1268 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001269 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001270 __entry->startoff = irec ? irec->br_startoff : 0;
1271 __entry->startblock = irec ? irec->br_startblock : 0;
1272 __entry->blockcount = irec ? irec->br_blockcount : 0;
1273 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001274 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1275 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001276 MAJOR(__entry->dev), MINOR(__entry->dev),
1277 __entry->ino,
1278 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001279 __entry->offset,
1280 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001281 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001282 __entry->startoff,
1283 (__int64_t)__entry->startblock,
1284 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001285)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001286
1287#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001288DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001289 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001290 int type, struct xfs_bmbt_irec *irec), \
1291 TP_ARGS(ip, offset, count, type, irec))
1292DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1293DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1294DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1295DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001296DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001297DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1298DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001299
Li Zefanf8adb4d2010-05-24 08:25:57 +00001300DECLARE_EVENT_CLASS(xfs_simple_io_class,
1301 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1302 TP_ARGS(ip, offset, count),
1303 TP_STRUCT__entry(
1304 __field(dev_t, dev)
1305 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001306 __field(loff_t, isize)
1307 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001308 __field(loff_t, offset)
1309 __field(size_t, count)
1310 ),
1311 TP_fast_assign(
1312 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1313 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001314 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001315 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001316 __entry->offset = offset;
1317 __entry->count = count;
1318 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001319 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001320 "offset 0x%llx count %zd",
1321 MAJOR(__entry->dev), MINOR(__entry->dev),
1322 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001323 __entry->isize,
1324 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001325 __entry->offset,
1326 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001327);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001328
1329#define DEFINE_SIMPLE_IO_EVENT(name) \
1330DEFINE_EVENT(xfs_simple_io_class, name, \
1331 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1332 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001333DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1334DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001335DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001336DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001337DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001338DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1339DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1340DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001341
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001342DECLARE_EVENT_CLASS(xfs_itrunc_class,
1343 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1344 TP_ARGS(ip, new_size),
1345 TP_STRUCT__entry(
1346 __field(dev_t, dev)
1347 __field(xfs_ino_t, ino)
1348 __field(xfs_fsize_t, size)
1349 __field(xfs_fsize_t, new_size)
1350 ),
1351 TP_fast_assign(
1352 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1353 __entry->ino = ip->i_ino;
1354 __entry->size = ip->i_d.di_size;
1355 __entry->new_size = new_size;
1356 ),
1357 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1358 MAJOR(__entry->dev), MINOR(__entry->dev),
1359 __entry->ino,
1360 __entry->size,
1361 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001362)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001363
1364#define DEFINE_ITRUNC_EVENT(name) \
1365DEFINE_EVENT(xfs_itrunc_class, name, \
1366 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1367 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001368DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1369DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001370
1371TRACE_EVENT(xfs_pagecache_inval,
1372 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1373 TP_ARGS(ip, start, finish),
1374 TP_STRUCT__entry(
1375 __field(dev_t, dev)
1376 __field(xfs_ino_t, ino)
1377 __field(xfs_fsize_t, size)
1378 __field(xfs_off_t, start)
1379 __field(xfs_off_t, finish)
1380 ),
1381 TP_fast_assign(
1382 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1383 __entry->ino = ip->i_ino;
1384 __entry->size = ip->i_d.di_size;
1385 __entry->start = start;
1386 __entry->finish = finish;
1387 ),
1388 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1389 MAJOR(__entry->dev), MINOR(__entry->dev),
1390 __entry->ino,
1391 __entry->size,
1392 __entry->start,
1393 __entry->finish)
1394);
1395
1396TRACE_EVENT(xfs_bunmap,
1397 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1398 int flags, unsigned long caller_ip),
1399 TP_ARGS(ip, bno, len, flags, caller_ip),
1400 TP_STRUCT__entry(
1401 __field(dev_t, dev)
1402 __field(xfs_ino_t, ino)
1403 __field(xfs_fsize_t, size)
1404 __field(xfs_fileoff_t, bno)
1405 __field(xfs_filblks_t, len)
1406 __field(unsigned long, caller_ip)
1407 __field(int, flags)
1408 ),
1409 TP_fast_assign(
1410 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1411 __entry->ino = ip->i_ino;
1412 __entry->size = ip->i_d.di_size;
1413 __entry->bno = bno;
1414 __entry->len = len;
1415 __entry->caller_ip = caller_ip;
1416 __entry->flags = flags;
1417 ),
1418 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Scott Wood65dd2972015-03-25 14:56:21 +11001419 "flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001420 MAJOR(__entry->dev), MINOR(__entry->dev),
1421 __entry->ino,
1422 __entry->size,
1423 __entry->bno,
1424 __entry->len,
1425 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1426 (void *)__entry->caller_ip)
1427
1428);
1429
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001430DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001431 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1432 xfs_agblock_t agbno, xfs_extlen_t len),
1433 TP_ARGS(mp, agno, agbno, len),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001434 TP_STRUCT__entry(
1435 __field(dev_t, dev)
1436 __field(xfs_agnumber_t, agno)
1437 __field(xfs_agblock_t, agbno)
1438 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001439 ),
1440 TP_fast_assign(
1441 __entry->dev = mp->m_super->s_dev;
1442 __entry->agno = agno;
1443 __entry->agbno = agbno;
1444 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001445 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001446 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001447 MAJOR(__entry->dev), MINOR(__entry->dev),
1448 __entry->agno,
1449 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001450 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001451);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001452#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001453DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001454 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1455 xfs_agblock_t agbno, xfs_extlen_t len), \
1456 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001457DEFINE_BUSY_EVENT(xfs_extent_busy);
1458DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1459DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1460DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1461DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001462
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001463TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001464 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1465 xfs_agblock_t agbno, xfs_extlen_t len,
1466 xfs_agblock_t tbno, xfs_extlen_t tlen),
1467 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1468 TP_STRUCT__entry(
1469 __field(dev_t, dev)
1470 __field(xfs_agnumber_t, agno)
1471 __field(xfs_agblock_t, agbno)
1472 __field(xfs_extlen_t, len)
1473 __field(xfs_agblock_t, tbno)
1474 __field(xfs_extlen_t, tlen)
1475 ),
1476 TP_fast_assign(
1477 __entry->dev = mp->m_super->s_dev;
1478 __entry->agno = agno;
1479 __entry->agbno = agbno;
1480 __entry->len = len;
1481 __entry->tbno = tbno;
1482 __entry->tlen = tlen;
1483 ),
1484 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1485 MAJOR(__entry->dev), MINOR(__entry->dev),
1486 __entry->agno,
1487 __entry->agbno,
1488 __entry->len,
1489 __entry->tbno,
1490 __entry->tlen)
1491);
1492
Dave Chinnered3b4d62010-05-21 12:07:08 +10001493TRACE_EVENT(xfs_trans_commit_lsn,
1494 TP_PROTO(struct xfs_trans *trans),
1495 TP_ARGS(trans),
1496 TP_STRUCT__entry(
1497 __field(dev_t, dev)
1498 __field(struct xfs_trans *, tp)
1499 __field(xfs_lsn_t, lsn)
1500 ),
1501 TP_fast_assign(
1502 __entry->dev = trans->t_mountp->m_super->s_dev;
1503 __entry->tp = trans;
1504 __entry->lsn = trans->t_commit_lsn;
1505 ),
1506 TP_printk("dev %d:%d trans 0x%p commit_lsn 0x%llx",
1507 MAJOR(__entry->dev), MINOR(__entry->dev),
1508 __entry->tp,
Dave Chinnerfd45e4782010-01-02 02:38:56 +00001509 __entry->lsn)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001510);
1511
1512TRACE_EVENT(xfs_agf,
1513 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1514 unsigned long caller_ip),
1515 TP_ARGS(mp, agf, flags, caller_ip),
1516 TP_STRUCT__entry(
1517 __field(dev_t, dev)
1518 __field(xfs_agnumber_t, agno)
1519 __field(int, flags)
1520 __field(__u32, length)
1521 __field(__u32, bno_root)
1522 __field(__u32, cnt_root)
1523 __field(__u32, bno_level)
1524 __field(__u32, cnt_level)
1525 __field(__u32, flfirst)
1526 __field(__u32, fllast)
1527 __field(__u32, flcount)
1528 __field(__u32, freeblks)
1529 __field(__u32, longest)
1530 __field(unsigned long, caller_ip)
1531 ),
1532 TP_fast_assign(
1533 __entry->dev = mp->m_super->s_dev;
1534 __entry->agno = be32_to_cpu(agf->agf_seqno),
1535 __entry->flags = flags;
1536 __entry->length = be32_to_cpu(agf->agf_length),
1537 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1538 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1539 __entry->bno_level =
1540 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1541 __entry->cnt_level =
1542 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1543 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1544 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1545 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1546 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1547 __entry->longest = be32_to_cpu(agf->agf_longest);
1548 __entry->caller_ip = caller_ip;
1549 ),
1550 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1551 "levels b %u c %u flfirst %u fllast %u flcount %u "
Scott Wood65dd2972015-03-25 14:56:21 +11001552 "freeblks %u longest %u caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001553 MAJOR(__entry->dev), MINOR(__entry->dev),
1554 __entry->agno,
1555 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1556 __entry->length,
1557 __entry->bno_root,
1558 __entry->cnt_root,
1559 __entry->bno_level,
1560 __entry->cnt_level,
1561 __entry->flfirst,
1562 __entry->fllast,
1563 __entry->flcount,
1564 __entry->freeblks,
1565 __entry->longest,
1566 (void *)__entry->caller_ip)
1567);
1568
1569TRACE_EVENT(xfs_free_extent,
1570 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001571 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1572 int haveright),
1573 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001574 TP_STRUCT__entry(
1575 __field(dev_t, dev)
1576 __field(xfs_agnumber_t, agno)
1577 __field(xfs_agblock_t, agbno)
1578 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001579 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001580 __field(int, haveleft)
1581 __field(int, haveright)
1582 ),
1583 TP_fast_assign(
1584 __entry->dev = mp->m_super->s_dev;
1585 __entry->agno = agno;
1586 __entry->agbno = agbno;
1587 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001588 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001589 __entry->haveleft = haveleft;
1590 __entry->haveright = haveright;
1591 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001592 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001593 MAJOR(__entry->dev), MINOR(__entry->dev),
1594 __entry->agno,
1595 __entry->agbno,
1596 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001597 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001598 __entry->haveleft ?
1599 (__entry->haveright ? "both" : "left") :
1600 (__entry->haveright ? "right" : "none"))
1601
1602);
1603
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001604DECLARE_EVENT_CLASS(xfs_alloc_class,
1605 TP_PROTO(struct xfs_alloc_arg *args),
1606 TP_ARGS(args),
1607 TP_STRUCT__entry(
1608 __field(dev_t, dev)
1609 __field(xfs_agnumber_t, agno)
1610 __field(xfs_agblock_t, agbno)
1611 __field(xfs_extlen_t, minlen)
1612 __field(xfs_extlen_t, maxlen)
1613 __field(xfs_extlen_t, mod)
1614 __field(xfs_extlen_t, prod)
1615 __field(xfs_extlen_t, minleft)
1616 __field(xfs_extlen_t, total)
1617 __field(xfs_extlen_t, alignment)
1618 __field(xfs_extlen_t, minalignslop)
1619 __field(xfs_extlen_t, len)
1620 __field(short, type)
1621 __field(short, otype)
1622 __field(char, wasdel)
1623 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001624 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001625 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001626 __field(xfs_fsblock_t, firstblock)
1627 ),
1628 TP_fast_assign(
1629 __entry->dev = args->mp->m_super->s_dev;
1630 __entry->agno = args->agno;
1631 __entry->agbno = args->agbno;
1632 __entry->minlen = args->minlen;
1633 __entry->maxlen = args->maxlen;
1634 __entry->mod = args->mod;
1635 __entry->prod = args->prod;
1636 __entry->minleft = args->minleft;
1637 __entry->total = args->total;
1638 __entry->alignment = args->alignment;
1639 __entry->minalignslop = args->minalignslop;
1640 __entry->len = args->len;
1641 __entry->type = args->type;
1642 __entry->otype = args->otype;
1643 __entry->wasdel = args->wasdel;
1644 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001645 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001646 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001647 __entry->firstblock = args->firstblock;
1648 ),
1649 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1650 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001651 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001652 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001653 MAJOR(__entry->dev), MINOR(__entry->dev),
1654 __entry->agno,
1655 __entry->agbno,
1656 __entry->minlen,
1657 __entry->maxlen,
1658 __entry->mod,
1659 __entry->prod,
1660 __entry->minleft,
1661 __entry->total,
1662 __entry->alignment,
1663 __entry->minalignslop,
1664 __entry->len,
1665 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1666 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1667 __entry->wasdel,
1668 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001669 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001670 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001671 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001672)
1673
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001674#define DEFINE_ALLOC_EVENT(name) \
1675DEFINE_EVENT(xfs_alloc_class, name, \
1676 TP_PROTO(struct xfs_alloc_arg *args), \
1677 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001678DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001679DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001680DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1681DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1682DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1683DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1684DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1685DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001686DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1687DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001688DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1689DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1690DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1691DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1692DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001693DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001694DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1695DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1696DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1697DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1698DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1699DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1700DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1701DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1702DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1703
Dave Chinner5a5881c2012-03-22 05:15:13 +00001704DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001705 TP_PROTO(struct xfs_da_args *args),
1706 TP_ARGS(args),
1707 TP_STRUCT__entry(
1708 __field(dev_t, dev)
1709 __field(xfs_ino_t, ino)
1710 __dynamic_array(char, name, args->namelen)
1711 __field(int, namelen)
1712 __field(xfs_dahash_t, hashval)
1713 __field(xfs_ino_t, inumber)
1714 __field(int, op_flags)
1715 ),
1716 TP_fast_assign(
1717 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1718 __entry->ino = args->dp->i_ino;
1719 if (args->namelen)
1720 memcpy(__get_str(name), args->name, args->namelen);
1721 __entry->namelen = args->namelen;
1722 __entry->hashval = args->hashval;
1723 __entry->inumber = args->inumber;
1724 __entry->op_flags = args->op_flags;
1725 ),
1726 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1727 "inumber 0x%llx op_flags %s",
1728 MAJOR(__entry->dev), MINOR(__entry->dev),
1729 __entry->ino,
1730 __entry->namelen,
1731 __entry->namelen ? __get_str(name) : NULL,
1732 __entry->namelen,
1733 __entry->hashval,
1734 __entry->inumber,
1735 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001736)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001737
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001738#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001739DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001740 TP_PROTO(struct xfs_da_args *args), \
1741 TP_ARGS(args))
1742DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1743DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1744DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1745DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1746DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1747DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1748DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1749DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1750DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1751DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1752DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1753DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1754DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1755DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1756DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1757DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1758DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1759DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1760DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1761DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1762DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1763DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1764DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1765DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1766DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1767
Dave Chinneree732592012-11-12 22:53:53 +11001768DECLARE_EVENT_CLASS(xfs_attr_class,
1769 TP_PROTO(struct xfs_da_args *args),
1770 TP_ARGS(args),
1771 TP_STRUCT__entry(
1772 __field(dev_t, dev)
1773 __field(xfs_ino_t, ino)
1774 __dynamic_array(char, name, args->namelen)
1775 __field(int, namelen)
1776 __field(int, valuelen)
1777 __field(xfs_dahash_t, hashval)
1778 __field(int, op_flags)
1779 ),
1780 TP_fast_assign(
1781 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1782 __entry->ino = args->dp->i_ino;
1783 if (args->namelen)
1784 memcpy(__get_str(name), args->name, args->namelen);
1785 __entry->namelen = args->namelen;
1786 __entry->valuelen = args->valuelen;
1787 __entry->hashval = args->hashval;
1788 __entry->op_flags = args->op_flags;
1789 ),
1790 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1791 "hashval 0x%x op_flags %s",
1792 MAJOR(__entry->dev), MINOR(__entry->dev),
1793 __entry->ino,
1794 __entry->namelen,
1795 __entry->namelen ? __get_str(name) : NULL,
1796 __entry->namelen,
1797 __entry->valuelen,
1798 __entry->hashval,
1799 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1800)
1801
Dave Chinner5a5881c2012-03-22 05:15:13 +00001802#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001803DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001804 TP_PROTO(struct xfs_da_args *args), \
1805 TP_ARGS(args))
1806DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1807DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1808DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1809DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1810DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001811DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1812
1813DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1814DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1815DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001816DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001817DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1818DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001819DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1820DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001821DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001823DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001824DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1825DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1827DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1828DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1829DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1831DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1832DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1834DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001835DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001836
1837DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001838DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001839DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1840DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1841
Dave Chinneree732592012-11-12 22:53:53 +11001842DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1843DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1844
1845DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1846DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1847DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1848
Dave Chinner5a5881c2012-03-22 05:15:13 +00001849#define DEFINE_DA_EVENT(name) \
1850DEFINE_EVENT(xfs_da_class, name, \
1851 TP_PROTO(struct xfs_da_args *args), \
1852 TP_ARGS(args))
1853DEFINE_DA_EVENT(xfs_da_split);
1854DEFINE_DA_EVENT(xfs_da_join);
1855DEFINE_DA_EVENT(xfs_da_link_before);
1856DEFINE_DA_EVENT(xfs_da_link_after);
1857DEFINE_DA_EVENT(xfs_da_unlink_back);
1858DEFINE_DA_EVENT(xfs_da_unlink_forward);
1859DEFINE_DA_EVENT(xfs_da_root_split);
1860DEFINE_DA_EVENT(xfs_da_root_join);
1861DEFINE_DA_EVENT(xfs_da_node_add);
1862DEFINE_DA_EVENT(xfs_da_node_create);
1863DEFINE_DA_EVENT(xfs_da_node_split);
1864DEFINE_DA_EVENT(xfs_da_node_remove);
1865DEFINE_DA_EVENT(xfs_da_node_rebalance);
1866DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001867DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001868DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1869DEFINE_DA_EVENT(xfs_da_grow_inode);
1870DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001871DEFINE_DA_EVENT(xfs_da_fixhashpath);
1872DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001873
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001874DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1875 TP_PROTO(struct xfs_da_args *args, int idx),
1876 TP_ARGS(args, idx),
1877 TP_STRUCT__entry(
1878 __field(dev_t, dev)
1879 __field(xfs_ino_t, ino)
1880 __field(int, op_flags)
1881 __field(int, idx)
1882 ),
1883 TP_fast_assign(
1884 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1885 __entry->ino = args->dp->i_ino;
1886 __entry->op_flags = args->op_flags;
1887 __entry->idx = idx;
1888 ),
1889 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1890 MAJOR(__entry->dev), MINOR(__entry->dev),
1891 __entry->ino,
1892 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1893 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001894)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001895
1896#define DEFINE_DIR2_SPACE_EVENT(name) \
1897DEFINE_EVENT(xfs_dir2_space_class, name, \
1898 TP_PROTO(struct xfs_da_args *args, int idx), \
1899 TP_ARGS(args, idx))
1900DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1901DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1902DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1903DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001904
1905TRACE_EVENT(xfs_dir2_leafn_moveents,
1906 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1907 TP_ARGS(args, src_idx, dst_idx, count),
1908 TP_STRUCT__entry(
1909 __field(dev_t, dev)
1910 __field(xfs_ino_t, ino)
1911 __field(int, op_flags)
1912 __field(int, src_idx)
1913 __field(int, dst_idx)
1914 __field(int, count)
1915 ),
1916 TP_fast_assign(
1917 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1918 __entry->ino = args->dp->i_ino;
1919 __entry->op_flags = args->op_flags;
1920 __entry->src_idx = src_idx;
1921 __entry->dst_idx = dst_idx;
1922 __entry->count = count;
1923 ),
1924 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1925 "src_idx %d dst_idx %d count %d",
1926 MAJOR(__entry->dev), MINOR(__entry->dev),
1927 __entry->ino,
1928 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1929 __entry->src_idx,
1930 __entry->dst_idx,
1931 __entry->count)
1932);
1933
Dave Chinner3a85cd92010-01-14 01:33:55 +00001934#define XFS_SWAPEXT_INODES \
1935 { 0, "target" }, \
1936 { 1, "temp" }
1937
1938#define XFS_INODE_FORMAT_STR \
1939 { 0, "invalid" }, \
1940 { 1, "local" }, \
1941 { 2, "extent" }, \
1942 { 3, "btree" }
1943
1944DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1945 TP_PROTO(struct xfs_inode *ip, int which),
1946 TP_ARGS(ip, which),
1947 TP_STRUCT__entry(
1948 __field(dev_t, dev)
1949 __field(int, which)
1950 __field(xfs_ino_t, ino)
1951 __field(int, format)
1952 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001953 __field(int, broot_size)
1954 __field(int, fork_off)
1955 ),
1956 TP_fast_assign(
1957 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1958 __entry->which = which;
1959 __entry->ino = ip->i_ino;
1960 __entry->format = ip->i_d.di_format;
1961 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001962 __entry->broot_size = ip->i_df.if_broot_bytes;
1963 __entry->fork_off = XFS_IFORK_BOFF(ip);
1964 ),
1965 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001966 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001967 MAJOR(__entry->dev), MINOR(__entry->dev),
1968 __entry->ino,
1969 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1970 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1971 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001972 __entry->broot_size,
1973 __entry->fork_off)
1974)
1975
1976#define DEFINE_SWAPEXT_EVENT(name) \
1977DEFINE_EVENT(xfs_swap_extent_class, name, \
1978 TP_PROTO(struct xfs_inode *ip, int which), \
1979 TP_ARGS(ip, which))
1980
1981DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1982DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1983
Brian Foster5cd9cee2016-09-26 08:34:52 +10001984TRACE_EVENT(xfs_log_recover_record,
1985 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
1986 TP_ARGS(log, rhead, pass),
1987 TP_STRUCT__entry(
1988 __field(dev_t, dev)
1989 __field(xfs_lsn_t, lsn)
1990 __field(int, len)
1991 __field(int, num_logops)
1992 __field(int, pass)
1993 ),
1994 TP_fast_assign(
1995 __entry->dev = log->l_mp->m_super->s_dev;
1996 __entry->lsn = be64_to_cpu(rhead->h_lsn);
1997 __entry->len = be32_to_cpu(rhead->h_len);
1998 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
1999 __entry->pass = pass;
2000 ),
2001 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2002 MAJOR(__entry->dev), MINOR(__entry->dev),
2003 __entry->lsn, __entry->len, __entry->num_logops,
2004 __entry->pass)
2005)
2006
Dave Chinner9abbc532010-04-13 15:06:46 +10002007DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002008 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002009 struct xlog_recover_item *item, int pass),
2010 TP_ARGS(log, trans, item, pass),
2011 TP_STRUCT__entry(
2012 __field(dev_t, dev)
2013 __field(unsigned long, item)
2014 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002015 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002016 __field(int, type)
2017 __field(int, pass)
2018 __field(int, count)
2019 __field(int, total)
2020 ),
2021 TP_fast_assign(
2022 __entry->dev = log->l_mp->m_super->s_dev;
2023 __entry->item = (unsigned long)item;
2024 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002025 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002026 __entry->type = ITEM_TYPE(item);
2027 __entry->pass = pass;
2028 __entry->count = item->ri_cnt;
2029 __entry->total = item->ri_total;
2030 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002031 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2032 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002033 MAJOR(__entry->dev), MINOR(__entry->dev),
2034 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002035 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002036 __entry->pass,
2037 (void *)__entry->item,
2038 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2039 __entry->count,
2040 __entry->total)
2041)
2042
2043#define DEFINE_LOG_RECOVER_ITEM(name) \
2044DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002045 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002046 struct xlog_recover_item *item, int pass), \
2047 TP_ARGS(log, trans, item, pass))
2048
2049DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2050DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2051DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2052DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2053DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2054
2055DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002056 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002057 TP_ARGS(log, buf_f),
2058 TP_STRUCT__entry(
2059 __field(dev_t, dev)
2060 __field(__int64_t, blkno)
2061 __field(unsigned short, len)
2062 __field(unsigned short, flags)
2063 __field(unsigned short, size)
2064 __field(unsigned int, map_size)
2065 ),
2066 TP_fast_assign(
2067 __entry->dev = log->l_mp->m_super->s_dev;
2068 __entry->blkno = buf_f->blf_blkno;
2069 __entry->len = buf_f->blf_len;
2070 __entry->flags = buf_f->blf_flags;
2071 __entry->size = buf_f->blf_size;
2072 __entry->map_size = buf_f->blf_map_size;
2073 ),
2074 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2075 "map_size %d",
2076 MAJOR(__entry->dev), MINOR(__entry->dev),
2077 __entry->blkno,
2078 __entry->len,
2079 __entry->flags,
2080 __entry->size,
2081 __entry->map_size)
2082)
2083
2084#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2085DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002086 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002087 TP_ARGS(log, buf_f))
2088
2089DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2090DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2091DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2092DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2093DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002094DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002095DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2096DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2097DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2098
2099DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002100 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002101 TP_ARGS(log, in_f),
2102 TP_STRUCT__entry(
2103 __field(dev_t, dev)
2104 __field(xfs_ino_t, ino)
2105 __field(unsigned short, size)
2106 __field(int, fields)
2107 __field(unsigned short, asize)
2108 __field(unsigned short, dsize)
2109 __field(__int64_t, blkno)
2110 __field(int, len)
2111 __field(int, boffset)
2112 ),
2113 TP_fast_assign(
2114 __entry->dev = log->l_mp->m_super->s_dev;
2115 __entry->ino = in_f->ilf_ino;
2116 __entry->size = in_f->ilf_size;
2117 __entry->fields = in_f->ilf_fields;
2118 __entry->asize = in_f->ilf_asize;
2119 __entry->dsize = in_f->ilf_dsize;
2120 __entry->blkno = in_f->ilf_blkno;
2121 __entry->len = in_f->ilf_len;
2122 __entry->boffset = in_f->ilf_boffset;
2123 ),
2124 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2125 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2126 MAJOR(__entry->dev), MINOR(__entry->dev),
2127 __entry->ino,
2128 __entry->size,
2129 __entry->fields,
2130 __entry->asize,
2131 __entry->dsize,
2132 __entry->blkno,
2133 __entry->len,
2134 __entry->boffset)
2135)
2136#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2137DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002138 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002139 TP_ARGS(log, in_f))
2140
2141DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2142DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2143DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2144
Brian Foster78d57e42015-08-19 09:58:48 +10002145DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2146 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2147 TP_ARGS(log, in_f),
2148 TP_STRUCT__entry(
2149 __field(dev_t, dev)
2150 __field(xfs_agnumber_t, agno)
2151 __field(xfs_agblock_t, agbno)
2152 __field(unsigned int, count)
2153 __field(unsigned int, isize)
2154 __field(xfs_agblock_t, length)
2155 __field(unsigned int, gen)
2156 ),
2157 TP_fast_assign(
2158 __entry->dev = log->l_mp->m_super->s_dev;
2159 __entry->agno = be32_to_cpu(in_f->icl_ag);
2160 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2161 __entry->count = be32_to_cpu(in_f->icl_count);
2162 __entry->isize = be32_to_cpu(in_f->icl_isize);
2163 __entry->length = be32_to_cpu(in_f->icl_length);
2164 __entry->gen = be32_to_cpu(in_f->icl_gen);
2165 ),
2166 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2167 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2168 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2169 __entry->length, __entry->gen)
2170)
2171#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2172DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2173 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2174 TP_ARGS(log, in_f))
2175
2176DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2177DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2178
Christoph Hellwiga46db602011-01-07 13:02:04 +00002179DECLARE_EVENT_CLASS(xfs_discard_class,
2180 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2181 xfs_agblock_t agbno, xfs_extlen_t len),
2182 TP_ARGS(mp, agno, agbno, len),
2183 TP_STRUCT__entry(
2184 __field(dev_t, dev)
2185 __field(xfs_agnumber_t, agno)
2186 __field(xfs_agblock_t, agbno)
2187 __field(xfs_extlen_t, len)
2188 ),
2189 TP_fast_assign(
2190 __entry->dev = mp->m_super->s_dev;
2191 __entry->agno = agno;
2192 __entry->agbno = agbno;
2193 __entry->len = len;
2194 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002195 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002196 MAJOR(__entry->dev), MINOR(__entry->dev),
2197 __entry->agno,
2198 __entry->agbno,
2199 __entry->len)
2200)
2201
2202#define DEFINE_DISCARD_EVENT(name) \
2203DEFINE_EVENT(xfs_discard_class, name, \
2204 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2205 xfs_agblock_t agbno, xfs_extlen_t len), \
2206 TP_ARGS(mp, agno, agbno, len))
2207DEFINE_DISCARD_EVENT(xfs_discard_extent);
2208DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2209DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2210DEFINE_DISCARD_EVENT(xfs_discard_busy);
2211
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002212/* btree cursor events */
2213DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2214 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2215 TP_ARGS(cur, level, bp),
2216 TP_STRUCT__entry(
2217 __field(dev_t, dev)
2218 __field(xfs_btnum_t, btnum)
2219 __field(int, level)
2220 __field(int, nlevels)
2221 __field(int, ptr)
2222 __field(xfs_daddr_t, daddr)
2223 ),
2224 TP_fast_assign(
2225 __entry->dev = cur->bc_mp->m_super->s_dev;
2226 __entry->btnum = cur->bc_btnum;
2227 __entry->level = level;
2228 __entry->nlevels = cur->bc_nlevels;
2229 __entry->ptr = cur->bc_ptrs[level];
2230 __entry->daddr = bp ? bp->b_bn : -1;
2231 ),
2232 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2233 MAJOR(__entry->dev), MINOR(__entry->dev),
2234 __entry->btnum,
2235 __entry->level,
2236 __entry->nlevels,
2237 __entry->ptr,
2238 (unsigned long long)__entry->daddr)
2239)
2240
2241#define DEFINE_BTREE_CUR_EVENT(name) \
2242DEFINE_EVENT(xfs_btree_cur_class, name, \
2243 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2244 TP_ARGS(cur, level, bp))
2245DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002246DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002247
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002248/* deferred ops */
2249struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002250struct xfs_defer_ops;
2251
2252DECLARE_EVENT_CLASS(xfs_defer_class,
2253 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2254 TP_ARGS(mp, dop),
2255 TP_STRUCT__entry(
2256 __field(dev_t, dev)
2257 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002258 __field(char, committed)
2259 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002260 ),
2261 TP_fast_assign(
2262 __entry->dev = mp ? mp->m_super->s_dev : 0;
2263 __entry->dop = dop;
2264 __entry->committed = dop->dop_committed;
2265 __entry->low = dop->dop_low;
2266 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002267 TP_printk("dev %d:%d ops %p committed %d low %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002268 MAJOR(__entry->dev), MINOR(__entry->dev),
2269 __entry->dop,
2270 __entry->committed,
2271 __entry->low)
2272)
2273#define DEFINE_DEFER_EVENT(name) \
2274DEFINE_EVENT(xfs_defer_class, name, \
2275 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2276 TP_ARGS(mp, dop))
2277
2278DECLARE_EVENT_CLASS(xfs_defer_error_class,
2279 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2280 TP_ARGS(mp, dop, error),
2281 TP_STRUCT__entry(
2282 __field(dev_t, dev)
2283 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002284 __field(char, committed)
2285 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002286 __field(int, error)
2287 ),
2288 TP_fast_assign(
2289 __entry->dev = mp ? mp->m_super->s_dev : 0;
2290 __entry->dop = dop;
2291 __entry->committed = dop->dop_committed;
2292 __entry->low = dop->dop_low;
2293 __entry->error = error;
2294 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002295 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002296 MAJOR(__entry->dev), MINOR(__entry->dev),
2297 __entry->dop,
2298 __entry->committed,
2299 __entry->low,
2300 __entry->error)
2301)
2302#define DEFINE_DEFER_ERROR_EVENT(name) \
2303DEFINE_EVENT(xfs_defer_error_class, name, \
2304 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2305 TP_ARGS(mp, dop, error))
2306
2307DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2308 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2309 TP_ARGS(mp, dfp),
2310 TP_STRUCT__entry(
2311 __field(dev_t, dev)
2312 __field(int, type)
2313 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002314 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002315 __field(int, nr)
2316 ),
2317 TP_fast_assign(
2318 __entry->dev = mp ? mp->m_super->s_dev : 0;
2319 __entry->type = dfp->dfp_type->type;
2320 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002321 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002322 __entry->nr = dfp->dfp_count;
2323 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002324 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002325 MAJOR(__entry->dev), MINOR(__entry->dev),
2326 __entry->type,
2327 __entry->intent,
2328 __entry->committed,
2329 __entry->nr)
2330)
2331#define DEFINE_DEFER_PENDING_EVENT(name) \
2332DEFINE_EVENT(xfs_defer_pending_class, name, \
2333 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2334 TP_ARGS(mp, dfp))
2335
2336DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2337 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2338 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2339 TP_ARGS(mp, agno, type, agbno, len),
2340 TP_STRUCT__entry(
2341 __field(dev_t, dev)
2342 __field(xfs_agnumber_t, agno)
2343 __field(int, type)
2344 __field(xfs_agblock_t, agbno)
2345 __field(xfs_extlen_t, len)
2346 ),
2347 TP_fast_assign(
2348 __entry->dev = mp->m_super->s_dev;
2349 __entry->agno = agno;
2350 __entry->type = type;
2351 __entry->agbno = agbno;
2352 __entry->len = len;
2353 ),
2354 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2355 MAJOR(__entry->dev), MINOR(__entry->dev),
2356 __entry->type,
2357 __entry->agno,
2358 __entry->agbno,
2359 __entry->len)
2360);
2361#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2362DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2363 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2364 int type, \
2365 xfs_agblock_t bno, \
2366 xfs_extlen_t len), \
2367 TP_ARGS(mp, agno, type, bno, len))
2368
2369DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2370 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2371 int op,
2372 xfs_agblock_t agbno,
2373 xfs_ino_t ino,
2374 int whichfork,
2375 xfs_fileoff_t offset,
2376 xfs_filblks_t len,
2377 xfs_exntst_t state),
2378 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2379 TP_STRUCT__entry(
2380 __field(dev_t, dev)
2381 __field(xfs_agnumber_t, agno)
2382 __field(xfs_ino_t, ino)
2383 __field(xfs_agblock_t, agbno)
2384 __field(int, whichfork)
2385 __field(xfs_fileoff_t, l_loff)
2386 __field(xfs_filblks_t, l_len)
2387 __field(xfs_exntst_t, l_state)
2388 __field(int, op)
2389 ),
2390 TP_fast_assign(
2391 __entry->dev = mp->m_super->s_dev;
2392 __entry->agno = agno;
2393 __entry->ino = ino;
2394 __entry->agbno = agbno;
2395 __entry->whichfork = whichfork;
2396 __entry->l_loff = offset;
2397 __entry->l_len = len;
2398 __entry->l_state = state;
2399 __entry->op = op;
2400 ),
2401 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2402 MAJOR(__entry->dev), MINOR(__entry->dev),
2403 __entry->op,
2404 __entry->agno,
2405 __entry->agbno,
2406 __entry->ino,
2407 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2408 __entry->l_loff,
2409 __entry->l_len,
2410 __entry->l_state)
2411);
2412#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2413DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2414 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2415 int op, \
2416 xfs_agblock_t agbno, \
2417 xfs_ino_t ino, \
2418 int whichfork, \
2419 xfs_fileoff_t offset, \
2420 xfs_filblks_t len, \
2421 xfs_exntst_t state), \
2422 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2423
2424DEFINE_DEFER_EVENT(xfs_defer_init);
2425DEFINE_DEFER_EVENT(xfs_defer_cancel);
2426DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2427DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2428DEFINE_DEFER_EVENT(xfs_defer_finish);
2429DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2430
2431DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2432DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002433
2434DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2435DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002436DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2437DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2438DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2439
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002440#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2441DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2442DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2443
Darrick J. Wong673930c2016-08-03 11:33:43 +10002444/* rmap tracepoints */
2445DECLARE_EVENT_CLASS(xfs_rmap_class,
2446 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2447 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2448 struct xfs_owner_info *oinfo),
2449 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2450 TP_STRUCT__entry(
2451 __field(dev_t, dev)
2452 __field(xfs_agnumber_t, agno)
2453 __field(xfs_agblock_t, agbno)
2454 __field(xfs_extlen_t, len)
2455 __field(uint64_t, owner)
2456 __field(uint64_t, offset)
2457 __field(unsigned long, flags)
2458 ),
2459 TP_fast_assign(
2460 __entry->dev = mp->m_super->s_dev;
2461 __entry->agno = agno;
2462 __entry->agbno = agbno;
2463 __entry->len = len;
2464 __entry->owner = oinfo->oi_owner;
2465 __entry->offset = oinfo->oi_offset;
2466 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002467 if (unwritten)
2468 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002469 ),
2470 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2471 MAJOR(__entry->dev), MINOR(__entry->dev),
2472 __entry->agno,
2473 __entry->agbno,
2474 __entry->len,
2475 __entry->owner,
2476 __entry->offset,
2477 __entry->flags)
2478);
2479#define DEFINE_RMAP_EVENT(name) \
2480DEFINE_EVENT(xfs_rmap_class, name, \
2481 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2482 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2483 struct xfs_owner_info *oinfo), \
2484 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2485
2486/* simple AG-based error/%ip tracepoint class */
2487DECLARE_EVENT_CLASS(xfs_ag_error_class,
2488 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2489 unsigned long caller_ip),
2490 TP_ARGS(mp, agno, error, caller_ip),
2491 TP_STRUCT__entry(
2492 __field(dev_t, dev)
2493 __field(xfs_agnumber_t, agno)
2494 __field(int, error)
2495 __field(unsigned long, caller_ip)
2496 ),
2497 TP_fast_assign(
2498 __entry->dev = mp->m_super->s_dev;
2499 __entry->agno = agno;
2500 __entry->error = error;
2501 __entry->caller_ip = caller_ip;
2502 ),
2503 TP_printk("dev %d:%d agno %u error %d caller %ps",
2504 MAJOR(__entry->dev), MINOR(__entry->dev),
2505 __entry->agno,
2506 __entry->error,
2507 (char *)__entry->caller_ip)
2508);
2509
2510#define DEFINE_AG_ERROR_EVENT(name) \
2511DEFINE_EVENT(xfs_ag_error_class, name, \
2512 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2513 unsigned long caller_ip), \
2514 TP_ARGS(mp, agno, error, caller_ip))
2515
2516DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2517DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2518DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2519DEFINE_RMAP_EVENT(xfs_rmap_map);
2520DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2521DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002522DEFINE_RMAP_EVENT(xfs_rmap_convert);
2523DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2524DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2525DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002526
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002527DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2528 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2529 xfs_agblock_t agbno, xfs_extlen_t len,
2530 uint64_t owner, uint64_t offset, unsigned int flags),
2531 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2532 TP_STRUCT__entry(
2533 __field(dev_t, dev)
2534 __field(xfs_agnumber_t, agno)
2535 __field(xfs_agblock_t, agbno)
2536 __field(xfs_extlen_t, len)
2537 __field(uint64_t, owner)
2538 __field(uint64_t, offset)
2539 __field(unsigned int, flags)
2540 ),
2541 TP_fast_assign(
2542 __entry->dev = mp->m_super->s_dev;
2543 __entry->agno = agno;
2544 __entry->agbno = agbno;
2545 __entry->len = len;
2546 __entry->owner = owner;
2547 __entry->offset = offset;
2548 __entry->flags = flags;
2549 ),
2550 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2551 MAJOR(__entry->dev), MINOR(__entry->dev),
2552 __entry->agno,
2553 __entry->agbno,
2554 __entry->len,
2555 __entry->owner,
2556 __entry->offset,
2557 __entry->flags)
2558);
2559#define DEFINE_RMAPBT_EVENT(name) \
2560DEFINE_EVENT(xfs_rmapbt_class, name, \
2561 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2562 xfs_agblock_t agbno, xfs_extlen_t len, \
2563 uint64_t owner, uint64_t offset, unsigned int flags), \
2564 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2565
2566#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2567DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2568DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2569
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002570DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2571DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002572DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2573DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2574DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2575DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2576DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2577DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002578
2579DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2580DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2581DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2582DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002583DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2584DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002585DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002586
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002587/* deferred bmbt updates */
2588#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2589DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2590DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2591
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002592/* per-AG reservation */
2593DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2594 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2595 xfs_extlen_t len),
2596 TP_ARGS(pag, resv, len),
2597 TP_STRUCT__entry(
2598 __field(dev_t, dev)
2599 __field(xfs_agnumber_t, agno)
2600 __field(int, resv)
2601 __field(xfs_extlen_t, freeblks)
2602 __field(xfs_extlen_t, flcount)
2603 __field(xfs_extlen_t, reserved)
2604 __field(xfs_extlen_t, asked)
2605 __field(xfs_extlen_t, len)
2606 ),
2607 TP_fast_assign(
2608 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2609
2610 __entry->dev = pag->pag_mount->m_super->s_dev;
2611 __entry->agno = pag->pag_agno;
2612 __entry->resv = resv;
2613 __entry->freeblks = pag->pagf_freeblks;
2614 __entry->flcount = pag->pagf_flcount;
2615 __entry->reserved = r ? r->ar_reserved : 0;
2616 __entry->asked = r ? r->ar_asked : 0;
2617 __entry->len = len;
2618 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002619 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2620 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002621 MAJOR(__entry->dev), MINOR(__entry->dev),
2622 __entry->agno,
2623 __entry->resv,
2624 __entry->freeblks,
2625 __entry->flcount,
2626 __entry->reserved,
2627 __entry->asked,
2628 __entry->len)
2629)
2630#define DEFINE_AG_RESV_EVENT(name) \
2631DEFINE_EVENT(xfs_ag_resv_class, name, \
2632 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2633 xfs_extlen_t len), \
2634 TP_ARGS(pag, type, len))
2635
2636/* per-AG reservation tracepoints */
2637DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2638DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2639DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2640DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2641DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2642DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2643
2644DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2645DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2646
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002647/* refcount tracepoint classes */
2648
2649/* reuse the discard trace class for agbno/aglen-based traces */
2650#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2651
2652/* ag btree lookup tracepoint class */
2653#define XFS_AG_BTREE_CMP_FORMAT_STR \
2654 { XFS_LOOKUP_EQ, "eq" }, \
2655 { XFS_LOOKUP_LE, "le" }, \
2656 { XFS_LOOKUP_GE, "ge" }
2657DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2658 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2659 xfs_agblock_t agbno, xfs_lookup_t dir),
2660 TP_ARGS(mp, agno, agbno, dir),
2661 TP_STRUCT__entry(
2662 __field(dev_t, dev)
2663 __field(xfs_agnumber_t, agno)
2664 __field(xfs_agblock_t, agbno)
2665 __field(xfs_lookup_t, dir)
2666 ),
2667 TP_fast_assign(
2668 __entry->dev = mp->m_super->s_dev;
2669 __entry->agno = agno;
2670 __entry->agbno = agbno;
2671 __entry->dir = dir;
2672 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002673 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002674 MAJOR(__entry->dev), MINOR(__entry->dev),
2675 __entry->agno,
2676 __entry->agbno,
2677 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2678 __entry->dir)
2679)
2680
2681#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2682DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2683 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2684 xfs_agblock_t agbno, xfs_lookup_t dir), \
2685 TP_ARGS(mp, agno, agbno, dir))
2686
2687/* single-rcext tracepoint class */
2688DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2689 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2690 struct xfs_refcount_irec *irec),
2691 TP_ARGS(mp, agno, irec),
2692 TP_STRUCT__entry(
2693 __field(dev_t, dev)
2694 __field(xfs_agnumber_t, agno)
2695 __field(xfs_agblock_t, startblock)
2696 __field(xfs_extlen_t, blockcount)
2697 __field(xfs_nlink_t, refcount)
2698 ),
2699 TP_fast_assign(
2700 __entry->dev = mp->m_super->s_dev;
2701 __entry->agno = agno;
2702 __entry->startblock = irec->rc_startblock;
2703 __entry->blockcount = irec->rc_blockcount;
2704 __entry->refcount = irec->rc_refcount;
2705 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002706 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002707 MAJOR(__entry->dev), MINOR(__entry->dev),
2708 __entry->agno,
2709 __entry->startblock,
2710 __entry->blockcount,
2711 __entry->refcount)
2712)
2713
2714#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2715DEFINE_EVENT(xfs_refcount_extent_class, name, \
2716 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2717 struct xfs_refcount_irec *irec), \
2718 TP_ARGS(mp, agno, irec))
2719
2720/* single-rcext and an agbno tracepoint class */
2721DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2722 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2723 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2724 TP_ARGS(mp, agno, irec, agbno),
2725 TP_STRUCT__entry(
2726 __field(dev_t, dev)
2727 __field(xfs_agnumber_t, agno)
2728 __field(xfs_agblock_t, startblock)
2729 __field(xfs_extlen_t, blockcount)
2730 __field(xfs_nlink_t, refcount)
2731 __field(xfs_agblock_t, agbno)
2732 ),
2733 TP_fast_assign(
2734 __entry->dev = mp->m_super->s_dev;
2735 __entry->agno = agno;
2736 __entry->startblock = irec->rc_startblock;
2737 __entry->blockcount = irec->rc_blockcount;
2738 __entry->refcount = irec->rc_refcount;
2739 __entry->agbno = agbno;
2740 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002741 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002742 MAJOR(__entry->dev), MINOR(__entry->dev),
2743 __entry->agno,
2744 __entry->startblock,
2745 __entry->blockcount,
2746 __entry->refcount,
2747 __entry->agbno)
2748)
2749
2750#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2751DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2752 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2753 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2754 TP_ARGS(mp, agno, irec, agbno))
2755
2756/* double-rcext tracepoint class */
2757DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2758 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2759 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2760 TP_ARGS(mp, agno, i1, i2),
2761 TP_STRUCT__entry(
2762 __field(dev_t, dev)
2763 __field(xfs_agnumber_t, agno)
2764 __field(xfs_agblock_t, i1_startblock)
2765 __field(xfs_extlen_t, i1_blockcount)
2766 __field(xfs_nlink_t, i1_refcount)
2767 __field(xfs_agblock_t, i2_startblock)
2768 __field(xfs_extlen_t, i2_blockcount)
2769 __field(xfs_nlink_t, i2_refcount)
2770 ),
2771 TP_fast_assign(
2772 __entry->dev = mp->m_super->s_dev;
2773 __entry->agno = agno;
2774 __entry->i1_startblock = i1->rc_startblock;
2775 __entry->i1_blockcount = i1->rc_blockcount;
2776 __entry->i1_refcount = i1->rc_refcount;
2777 __entry->i2_startblock = i2->rc_startblock;
2778 __entry->i2_blockcount = i2->rc_blockcount;
2779 __entry->i2_refcount = i2->rc_refcount;
2780 ),
2781 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002782 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002783 MAJOR(__entry->dev), MINOR(__entry->dev),
2784 __entry->agno,
2785 __entry->i1_startblock,
2786 __entry->i1_blockcount,
2787 __entry->i1_refcount,
2788 __entry->i2_startblock,
2789 __entry->i2_blockcount,
2790 __entry->i2_refcount)
2791)
2792
2793#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2794DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2795 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2796 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2797 TP_ARGS(mp, agno, i1, i2))
2798
2799/* double-rcext and an agbno tracepoint class */
2800DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2801 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2802 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2803 xfs_agblock_t agbno),
2804 TP_ARGS(mp, agno, i1, i2, agbno),
2805 TP_STRUCT__entry(
2806 __field(dev_t, dev)
2807 __field(xfs_agnumber_t, agno)
2808 __field(xfs_agblock_t, i1_startblock)
2809 __field(xfs_extlen_t, i1_blockcount)
2810 __field(xfs_nlink_t, i1_refcount)
2811 __field(xfs_agblock_t, i2_startblock)
2812 __field(xfs_extlen_t, i2_blockcount)
2813 __field(xfs_nlink_t, i2_refcount)
2814 __field(xfs_agblock_t, agbno)
2815 ),
2816 TP_fast_assign(
2817 __entry->dev = mp->m_super->s_dev;
2818 __entry->agno = agno;
2819 __entry->i1_startblock = i1->rc_startblock;
2820 __entry->i1_blockcount = i1->rc_blockcount;
2821 __entry->i1_refcount = i1->rc_refcount;
2822 __entry->i2_startblock = i2->rc_startblock;
2823 __entry->i2_blockcount = i2->rc_blockcount;
2824 __entry->i2_refcount = i2->rc_refcount;
2825 __entry->agbno = agbno;
2826 ),
2827 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002828 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002829 MAJOR(__entry->dev), MINOR(__entry->dev),
2830 __entry->agno,
2831 __entry->i1_startblock,
2832 __entry->i1_blockcount,
2833 __entry->i1_refcount,
2834 __entry->i2_startblock,
2835 __entry->i2_blockcount,
2836 __entry->i2_refcount,
2837 __entry->agbno)
2838)
2839
2840#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2841DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2842 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2843 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2844 xfs_agblock_t agbno), \
2845 TP_ARGS(mp, agno, i1, i2, agbno))
2846
2847/* triple-rcext tracepoint class */
2848DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2849 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2850 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2851 struct xfs_refcount_irec *i3),
2852 TP_ARGS(mp, agno, i1, i2, i3),
2853 TP_STRUCT__entry(
2854 __field(dev_t, dev)
2855 __field(xfs_agnumber_t, agno)
2856 __field(xfs_agblock_t, i1_startblock)
2857 __field(xfs_extlen_t, i1_blockcount)
2858 __field(xfs_nlink_t, i1_refcount)
2859 __field(xfs_agblock_t, i2_startblock)
2860 __field(xfs_extlen_t, i2_blockcount)
2861 __field(xfs_nlink_t, i2_refcount)
2862 __field(xfs_agblock_t, i3_startblock)
2863 __field(xfs_extlen_t, i3_blockcount)
2864 __field(xfs_nlink_t, i3_refcount)
2865 ),
2866 TP_fast_assign(
2867 __entry->dev = mp->m_super->s_dev;
2868 __entry->agno = agno;
2869 __entry->i1_startblock = i1->rc_startblock;
2870 __entry->i1_blockcount = i1->rc_blockcount;
2871 __entry->i1_refcount = i1->rc_refcount;
2872 __entry->i2_startblock = i2->rc_startblock;
2873 __entry->i2_blockcount = i2->rc_blockcount;
2874 __entry->i2_refcount = i2->rc_refcount;
2875 __entry->i3_startblock = i3->rc_startblock;
2876 __entry->i3_blockcount = i3->rc_blockcount;
2877 __entry->i3_refcount = i3->rc_refcount;
2878 ),
2879 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2880 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002881 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002882 MAJOR(__entry->dev), MINOR(__entry->dev),
2883 __entry->agno,
2884 __entry->i1_startblock,
2885 __entry->i1_blockcount,
2886 __entry->i1_refcount,
2887 __entry->i2_startblock,
2888 __entry->i2_blockcount,
2889 __entry->i2_refcount,
2890 __entry->i3_startblock,
2891 __entry->i3_blockcount,
2892 __entry->i3_refcount)
2893);
2894
2895#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2896DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2897 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2898 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2899 struct xfs_refcount_irec *i3), \
2900 TP_ARGS(mp, agno, i1, i2, i3))
2901
2902/* refcount btree tracepoints */
2903DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2904DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2905DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2906DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2907DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2908DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2909DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2910DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2911DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2912DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2913
2914/* refcount adjustment tracepoints */
2915DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2916DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002917DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2918DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002919DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2920DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002921DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002922DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2923DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2924DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2925DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2926DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2927DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002928DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002929DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2930DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2931DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2932DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2933DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2934DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2935DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2936
2937/* reflink helpers */
2938DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2939DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2940DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba6122016-10-03 09:11:22 -07002941#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2942DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2943DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002944
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002945TRACE_EVENT(xfs_refcount_finish_one_leftover,
2946 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2947 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2948 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2949 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2950 TP_STRUCT__entry(
2951 __field(dev_t, dev)
2952 __field(xfs_agnumber_t, agno)
2953 __field(int, type)
2954 __field(xfs_agblock_t, agbno)
2955 __field(xfs_extlen_t, len)
2956 __field(xfs_agblock_t, new_agbno)
2957 __field(xfs_extlen_t, new_len)
2958 ),
2959 TP_fast_assign(
2960 __entry->dev = mp->m_super->s_dev;
2961 __entry->agno = agno;
2962 __entry->type = type;
2963 __entry->agbno = agbno;
2964 __entry->len = len;
2965 __entry->new_agbno = new_agbno;
2966 __entry->new_len = new_len;
2967 ),
2968 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2969 MAJOR(__entry->dev), MINOR(__entry->dev),
2970 __entry->type,
2971 __entry->agno,
2972 __entry->agbno,
2973 __entry->len,
2974 __entry->new_agbno,
2975 __entry->new_len)
2976);
2977
Darrick J. Wongf65306e2016-10-03 09:11:27 -07002978/* simple inode-based error/%ip tracepoint class */
2979DECLARE_EVENT_CLASS(xfs_inode_error_class,
2980 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
2981 TP_ARGS(ip, error, caller_ip),
2982 TP_STRUCT__entry(
2983 __field(dev_t, dev)
2984 __field(xfs_ino_t, ino)
2985 __field(int, error)
2986 __field(unsigned long, caller_ip)
2987 ),
2988 TP_fast_assign(
2989 __entry->dev = VFS_I(ip)->i_sb->s_dev;
2990 __entry->ino = ip->i_ino;
2991 __entry->error = error;
2992 __entry->caller_ip = caller_ip;
2993 ),
2994 TP_printk("dev %d:%d ino %llx error %d caller %ps",
2995 MAJOR(__entry->dev), MINOR(__entry->dev),
2996 __entry->ino,
2997 __entry->error,
2998 (char *)__entry->caller_ip)
2999);
3000
3001#define DEFINE_INODE_ERROR_EVENT(name) \
3002DEFINE_EVENT(xfs_inode_error_class, name, \
3003 TP_PROTO(struct xfs_inode *ip, int error, \
3004 unsigned long caller_ip), \
3005 TP_ARGS(ip, error, caller_ip))
3006
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003007/* reflink tracepoint classes */
3008
3009/* two-file io tracepoint class */
3010DECLARE_EVENT_CLASS(xfs_double_io_class,
3011 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3012 struct xfs_inode *dest, xfs_off_t doffset),
3013 TP_ARGS(src, soffset, len, dest, doffset),
3014 TP_STRUCT__entry(
3015 __field(dev_t, dev)
3016 __field(xfs_ino_t, src_ino)
3017 __field(loff_t, src_isize)
3018 __field(loff_t, src_disize)
3019 __field(loff_t, src_offset)
3020 __field(size_t, len)
3021 __field(xfs_ino_t, dest_ino)
3022 __field(loff_t, dest_isize)
3023 __field(loff_t, dest_disize)
3024 __field(loff_t, dest_offset)
3025 ),
3026 TP_fast_assign(
3027 __entry->dev = VFS_I(src)->i_sb->s_dev;
3028 __entry->src_ino = src->i_ino;
3029 __entry->src_isize = VFS_I(src)->i_size;
3030 __entry->src_disize = src->i_d.di_size;
3031 __entry->src_offset = soffset;
3032 __entry->len = len;
3033 __entry->dest_ino = dest->i_ino;
3034 __entry->dest_isize = VFS_I(dest)->i_size;
3035 __entry->dest_disize = dest->i_d.di_size;
3036 __entry->dest_offset = doffset;
3037 ),
3038 TP_printk("dev %d:%d count %zd "
3039 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3040 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3041 MAJOR(__entry->dev), MINOR(__entry->dev),
3042 __entry->len,
3043 __entry->src_ino,
3044 __entry->src_isize,
3045 __entry->src_disize,
3046 __entry->src_offset,
3047 __entry->dest_ino,
3048 __entry->dest_isize,
3049 __entry->dest_disize,
3050 __entry->dest_offset)
3051)
3052
3053#define DEFINE_DOUBLE_IO_EVENT(name) \
3054DEFINE_EVENT(xfs_double_io_class, name, \
3055 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3056 struct xfs_inode *dest, xfs_off_t doffset), \
3057 TP_ARGS(src, soffset, len, dest, doffset))
3058
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003059/* inode/irec events */
3060DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3061 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3062 TP_ARGS(ip, irec),
3063 TP_STRUCT__entry(
3064 __field(dev_t, dev)
3065 __field(xfs_ino_t, ino)
3066 __field(xfs_fileoff_t, lblk)
3067 __field(xfs_extlen_t, len)
3068 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003069 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003070 ),
3071 TP_fast_assign(
3072 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3073 __entry->ino = ip->i_ino;
3074 __entry->lblk = irec->br_startoff;
3075 __entry->len = irec->br_blockcount;
3076 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003077 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003078 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003079 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x pblk %llu st %d",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003080 MAJOR(__entry->dev), MINOR(__entry->dev),
3081 __entry->ino,
3082 __entry->lblk,
3083 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003084 __entry->pblk,
3085 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003086);
3087#define DEFINE_INODE_IREC_EVENT(name) \
3088DEFINE_EVENT(xfs_inode_irec_class, name, \
3089 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3090 TP_ARGS(ip, irec))
3091
3092/* refcount/reflink tracepoint definitions */
3093
3094/* reflink tracepoints */
3095DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3096DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3097DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3098DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3099TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3100 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3101 xfs_filblks_t len, struct xfs_inode *dest,
3102 xfs_fileoff_t doffset),
3103 TP_ARGS(src, soffset, len, dest, doffset),
3104 TP_STRUCT__entry(
3105 __field(dev_t, dev)
3106 __field(xfs_ino_t, src_ino)
3107 __field(xfs_fileoff_t, src_lblk)
3108 __field(xfs_filblks_t, len)
3109 __field(xfs_ino_t, dest_ino)
3110 __field(xfs_fileoff_t, dest_lblk)
3111 ),
3112 TP_fast_assign(
3113 __entry->dev = VFS_I(src)->i_sb->s_dev;
3114 __entry->src_ino = src->i_ino;
3115 __entry->src_lblk = soffset;
3116 __entry->len = len;
3117 __entry->dest_ino = dest->i_ino;
3118 __entry->dest_lblk = doffset;
3119 ),
3120 TP_printk("dev %d:%d len 0x%llx "
3121 "ino 0x%llx offset 0x%llx blocks -> "
3122 "ino 0x%llx offset 0x%llx blocks",
3123 MAJOR(__entry->dev), MINOR(__entry->dev),
3124 __entry->len,
3125 __entry->src_ino,
3126 __entry->src_lblk,
3127 __entry->dest_ino,
3128 __entry->dest_lblk)
3129);
3130TRACE_EVENT(xfs_reflink_punch_range,
3131 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3132 xfs_extlen_t len),
3133 TP_ARGS(ip, lblk, len),
3134 TP_STRUCT__entry(
3135 __field(dev_t, dev)
3136 __field(xfs_ino_t, ino)
3137 __field(xfs_fileoff_t, lblk)
3138 __field(xfs_extlen_t, len)
3139 ),
3140 TP_fast_assign(
3141 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3142 __entry->ino = ip->i_ino;
3143 __entry->lblk = lblk;
3144 __entry->len = len;
3145 ),
3146 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3147 MAJOR(__entry->dev), MINOR(__entry->dev),
3148 __entry->ino,
3149 __entry->lblk,
3150 __entry->len)
3151);
3152TRACE_EVENT(xfs_reflink_remap,
3153 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3154 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3155 TP_ARGS(ip, lblk, len, new_pblk),
3156 TP_STRUCT__entry(
3157 __field(dev_t, dev)
3158 __field(xfs_ino_t, ino)
3159 __field(xfs_fileoff_t, lblk)
3160 __field(xfs_extlen_t, len)
3161 __field(xfs_fsblock_t, new_pblk)
3162 ),
3163 TP_fast_assign(
3164 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3165 __entry->ino = ip->i_ino;
3166 __entry->lblk = lblk;
3167 __entry->len = len;
3168 __entry->new_pblk = new_pblk;
3169 ),
3170 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3171 MAJOR(__entry->dev), MINOR(__entry->dev),
3172 __entry->ino,
3173 __entry->lblk,
3174 __entry->len,
3175 __entry->new_pblk)
3176);
3177DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3178DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3179DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3180DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003181DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3182DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3183
3184/* dedupe tracepoints */
3185DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3186DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3187
3188/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003189TRACE_EVENT(xfs_ioctl_clone,
3190 TP_PROTO(struct inode *src, struct inode *dest),
3191 TP_ARGS(src, dest),
3192 TP_STRUCT__entry(
3193 __field(dev_t, dev)
3194 __field(unsigned long, src_ino)
3195 __field(loff_t, src_isize)
3196 __field(unsigned long, dest_ino)
3197 __field(loff_t, dest_isize)
3198 ),
3199 TP_fast_assign(
3200 __entry->dev = src->i_sb->s_dev;
3201 __entry->src_ino = src->i_ino;
3202 __entry->src_isize = i_size_read(src);
3203 __entry->dest_ino = dest->i_ino;
3204 __entry->dest_isize = i_size_read(dest);
3205 ),
3206 TP_printk("dev %d:%d "
3207 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003208 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003209 MAJOR(__entry->dev), MINOR(__entry->dev),
3210 __entry->src_ino,
3211 __entry->src_isize,
3212 __entry->dest_ino,
3213 __entry->dest_isize)
3214);
3215
3216/* unshare tracepoints */
3217DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003218DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003219
3220/* copy on write */
3221DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003222DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3223DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3224DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003225DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003226
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003227DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003228
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003229DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003230DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3231DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003232
3233DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3234DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3235DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003236
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003237DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3238DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3239
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003240
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003241DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003242
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003243/* rmap swapext tracepoints */
3244DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3245DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3246DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3247
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003248/* fsmap traces */
3249DECLARE_EVENT_CLASS(xfs_fsmap_class,
3250 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3251 struct xfs_rmap_irec *rmap),
3252 TP_ARGS(mp, keydev, agno, rmap),
3253 TP_STRUCT__entry(
3254 __field(dev_t, dev)
3255 __field(dev_t, keydev)
3256 __field(xfs_agnumber_t, agno)
3257 __field(xfs_fsblock_t, bno)
3258 __field(xfs_filblks_t, len)
3259 __field(__uint64_t, owner)
3260 __field(__uint64_t, offset)
3261 __field(unsigned int, flags)
3262 ),
3263 TP_fast_assign(
3264 __entry->dev = mp->m_super->s_dev;
3265 __entry->keydev = new_decode_dev(keydev);
3266 __entry->agno = agno;
3267 __entry->bno = rmap->rm_startblock;
3268 __entry->len = rmap->rm_blockcount;
3269 __entry->owner = rmap->rm_owner;
3270 __entry->offset = rmap->rm_offset;
3271 __entry->flags = rmap->rm_flags;
3272 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003273 TP_printk("dev %d:%d keydev %d:%d agno %u bno %llu len %llu owner %lld offset %llu flags 0x%x",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003274 MAJOR(__entry->dev), MINOR(__entry->dev),
3275 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3276 __entry->agno,
3277 __entry->bno,
3278 __entry->len,
3279 __entry->owner,
3280 __entry->offset,
3281 __entry->flags)
3282)
3283#define DEFINE_FSMAP_EVENT(name) \
3284DEFINE_EVENT(xfs_fsmap_class, name, \
3285 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3286 struct xfs_rmap_irec *rmap), \
3287 TP_ARGS(mp, keydev, agno, rmap))
3288DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3289DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3290DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3291
3292DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3293 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3294 TP_ARGS(mp, fsmap),
3295 TP_STRUCT__entry(
3296 __field(dev_t, dev)
3297 __field(dev_t, keydev)
3298 __field(xfs_daddr_t, block)
3299 __field(xfs_daddr_t, len)
3300 __field(__uint64_t, owner)
3301 __field(__uint64_t, offset)
3302 __field(__uint64_t, flags)
3303 ),
3304 TP_fast_assign(
3305 __entry->dev = mp->m_super->s_dev;
3306 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3307 __entry->block = fsmap->fmr_physical;
3308 __entry->len = fsmap->fmr_length;
3309 __entry->owner = fsmap->fmr_owner;
3310 __entry->offset = fsmap->fmr_offset;
3311 __entry->flags = fsmap->fmr_flags;
3312 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003313 TP_printk("dev %d:%d keydev %d:%d block %llu len %llu owner %lld offset %llu flags 0x%llx",
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003314 MAJOR(__entry->dev), MINOR(__entry->dev),
3315 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3316 __entry->block,
3317 __entry->len,
3318 __entry->owner,
3319 __entry->offset,
3320 __entry->flags)
3321)
3322#define DEFINE_GETFSMAP_EVENT(name) \
3323DEFINE_EVENT(xfs_getfsmap_class, name, \
3324 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3325 TP_ARGS(mp, fsmap))
3326DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3327DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3328DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3329
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003330#endif /* _TRACE_XFS_H */
3331
3332#undef TRACE_INCLUDE_PATH
3333#define TRACE_INCLUDE_PATH .
3334#define TRACE_INCLUDE_FILE xfs_trace
3335#include <trace/define_trace.h>