blob: bb5514688d470b046e0f125b2832ba2d30b3d34d [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,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700254 (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,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -0700298 (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);
Brian Foster7912e7f2017-06-14 21:21:45 -0700370DEFINE_BUF_EVENT(xfs_buf_delwri_pushbuf);
Dave Chinner686865f2010-09-24 20:07:47 +1000371DEFINE_BUF_EVENT(xfs_buf_get_uncached);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000372DEFINE_BUF_EVENT(xfs_buf_item_relse);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000373DEFINE_BUF_EVENT(xfs_buf_item_iodone_async);
374DEFINE_BUF_EVENT(xfs_buf_error_relse);
Dave Chinner9f878322013-01-21 23:53:55 +1100375DEFINE_BUF_EVENT(xfs_buf_wait_buftarg);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000376DEFINE_BUF_EVENT(xfs_trans_read_buf_shut);
377
378/* not really buffer traces, but the buf provides useful information */
379DEFINE_BUF_EVENT(xfs_btree_corrupt);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000380DEFINE_BUF_EVENT(xfs_reset_dqcounts);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000381
382/* pass flags explicitly */
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000383DECLARE_EVENT_CLASS(xfs_buf_flags_class,
384 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip),
385 TP_ARGS(bp, flags, caller_ip),
386 TP_STRUCT__entry(
387 __field(dev_t, dev)
388 __field(xfs_daddr_t, bno)
389 __field(size_t, buffer_length)
390 __field(int, hold)
391 __field(int, pincount)
392 __field(unsigned, lockval)
393 __field(unsigned, flags)
394 __field(unsigned long, caller_ip)
395 ),
396 TP_fast_assign(
397 __entry->dev = bp->b_target->bt_dev;
398 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000399 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000400 __entry->flags = flags;
401 __entry->hold = atomic_read(&bp->b_hold);
402 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200403 __entry->lockval = bp->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000404 __entry->caller_ip = caller_ip;
405 ),
406 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100407 "lock %d flags %s caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000408 MAJOR(__entry->dev), MINOR(__entry->dev),
409 (unsigned long long)__entry->bno,
410 __entry->buffer_length,
411 __entry->hold,
412 __entry->pincount,
413 __entry->lockval,
414 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
415 (void *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000416)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000417
418#define DEFINE_BUF_FLAGS_EVENT(name) \
419DEFINE_EVENT(xfs_buf_flags_class, name, \
420 TP_PROTO(struct xfs_buf *bp, unsigned flags, unsigned long caller_ip), \
421 TP_ARGS(bp, flags, caller_ip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000422DEFINE_BUF_FLAGS_EVENT(xfs_buf_find);
423DEFINE_BUF_FLAGS_EVENT(xfs_buf_get);
424DEFINE_BUF_FLAGS_EVENT(xfs_buf_read);
425
426TRACE_EVENT(xfs_buf_ioerror,
427 TP_PROTO(struct xfs_buf *bp, int error, unsigned long caller_ip),
428 TP_ARGS(bp, error, caller_ip),
429 TP_STRUCT__entry(
430 __field(dev_t, dev)
431 __field(xfs_daddr_t, bno)
432 __field(size_t, buffer_length)
433 __field(unsigned, flags)
434 __field(int, hold)
435 __field(int, pincount)
436 __field(unsigned, lockval)
437 __field(int, error)
438 __field(unsigned long, caller_ip)
439 ),
440 TP_fast_assign(
441 __entry->dev = bp->b_target->bt_dev;
442 __entry->bno = bp->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000443 __entry->buffer_length = BBTOB(bp->b_length);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000444 __entry->hold = atomic_read(&bp->b_hold);
445 __entry->pincount = atomic_read(&bp->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200446 __entry->lockval = bp->b_sema.count;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000447 __entry->error = error;
448 __entry->flags = bp->b_flags;
449 __entry->caller_ip = caller_ip;
450 ),
451 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
Scott Wood65dd2972015-03-25 14:56:21 +1100452 "lock %d error %d flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000453 MAJOR(__entry->dev), MINOR(__entry->dev),
454 (unsigned long long)__entry->bno,
455 __entry->buffer_length,
456 __entry->hold,
457 __entry->pincount,
458 __entry->lockval,
459 __entry->error,
460 __print_flags(__entry->flags, "|", XFS_BUF_FLAGS),
461 (void *)__entry->caller_ip)
462);
463
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000464DECLARE_EVENT_CLASS(xfs_buf_item_class,
465 TP_PROTO(struct xfs_buf_log_item *bip),
466 TP_ARGS(bip),
467 TP_STRUCT__entry(
468 __field(dev_t, dev)
469 __field(xfs_daddr_t, buf_bno)
470 __field(size_t, buf_len)
471 __field(int, buf_hold)
472 __field(int, buf_pincount)
473 __field(int, buf_lockval)
474 __field(unsigned, buf_flags)
475 __field(unsigned, bli_recur)
476 __field(int, bli_refcount)
477 __field(unsigned, bli_flags)
478 __field(void *, li_desc)
479 __field(unsigned, li_flags)
480 ),
481 TP_fast_assign(
482 __entry->dev = bip->bli_buf->b_target->bt_dev;
483 __entry->bli_flags = bip->bli_flags;
484 __entry->bli_recur = bip->bli_recur;
485 __entry->bli_refcount = atomic_read(&bip->bli_refcount);
486 __entry->buf_bno = bip->bli_buf->b_bn;
Dave Chinner4e94b712012-04-23 15:58:51 +1000487 __entry->buf_len = BBTOB(bip->bli_buf->b_length);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000488 __entry->buf_flags = bip->bli_buf->b_flags;
489 __entry->buf_hold = atomic_read(&bip->bli_buf->b_hold);
490 __entry->buf_pincount = atomic_read(&bip->bli_buf->b_pin_count);
Christoph Hellwig0c842ad2011-07-08 14:36:19 +0200491 __entry->buf_lockval = bip->bli_buf->b_sema.count;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000492 __entry->li_desc = bip->bli_item.li_desc;
493 __entry->li_flags = bip->bli_item.li_flags;
494 ),
495 TP_printk("dev %d:%d bno 0x%llx len 0x%zx hold %d pincount %d "
496 "lock %d flags %s recur %d refcount %d bliflags %s "
497 "lidesc 0x%p liflags %s",
498 MAJOR(__entry->dev), MINOR(__entry->dev),
499 (unsigned long long)__entry->buf_bno,
500 __entry->buf_len,
501 __entry->buf_hold,
502 __entry->buf_pincount,
503 __entry->buf_lockval,
504 __print_flags(__entry->buf_flags, "|", XFS_BUF_FLAGS),
505 __entry->bli_recur,
506 __entry->bli_refcount,
507 __print_flags(__entry->bli_flags, "|", XFS_BLI_FLAGS),
508 __entry->li_desc,
509 __print_flags(__entry->li_flags, "|", XFS_LI_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000510)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000511
512#define DEFINE_BUF_ITEM_EVENT(name) \
513DEFINE_EVENT(xfs_buf_item_class, name, \
514 TP_PROTO(struct xfs_buf_log_item *bip), \
515 TP_ARGS(bip))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000516DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size);
Dave Chinner5f6bed72013-06-27 16:04:52 +1000517DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_ordered);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000518DEFINE_BUF_ITEM_EVENT(xfs_buf_item_size_stale);
519DEFINE_BUF_ITEM_EVENT(xfs_buf_item_format);
520DEFINE_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 Chinner3af49282015-11-03 12:37:02 +1100691DEFINE_INODE_EVENT(xfs_filemap_pfn_mkwrite);
Dave Chinnerde0e8c22015-02-23 21:44:19 +1100692
Christoph Hellwigd522d562017-08-29 10:08:41 -0700693TRACE_EVENT(xfs_filemap_fault,
694 TP_PROTO(struct xfs_inode *ip, enum page_entry_size pe_size,
695 bool write_fault),
696 TP_ARGS(ip, pe_size, write_fault),
697 TP_STRUCT__entry(
698 __field(dev_t, dev)
699 __field(xfs_ino_t, ino)
700 __field(enum page_entry_size, pe_size)
701 __field(bool, write_fault)
702 ),
703 TP_fast_assign(
704 __entry->dev = VFS_I(ip)->i_sb->s_dev;
705 __entry->ino = ip->i_ino;
706 __entry->pe_size = pe_size;
707 __entry->write_fault = write_fault;
708 ),
709 TP_printk("dev %d:%d ino 0x%llx %s write_fault %d",
710 MAJOR(__entry->dev), MINOR(__entry->dev),
711 __entry->ino,
712 __print_symbolic(__entry->pe_size,
713 { PE_SIZE_PTE, "PTE" },
714 { PE_SIZE_PMD, "PMD" },
715 { PE_SIZE_PUD, "PUD" }),
716 __entry->write_fault)
717)
718
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000719DECLARE_EVENT_CLASS(xfs_iref_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000720 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip),
721 TP_ARGS(ip, caller_ip),
722 TP_STRUCT__entry(
723 __field(dev_t, dev)
724 __field(xfs_ino_t, ino)
725 __field(int, count)
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100726 __field(int, pincount)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000727 __field(unsigned long, caller_ip)
728 ),
729 TP_fast_assign(
730 __entry->dev = VFS_I(ip)->i_sb->s_dev;
731 __entry->ino = ip->i_ino;
732 __entry->count = atomic_read(&VFS_I(ip)->i_count);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100733 __entry->pincount = atomic_read(&ip->i_pincount);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000734 __entry->caller_ip = caller_ip;
735 ),
Scott Wood65dd2972015-03-25 14:56:21 +1100736 TP_printk("dev %d:%d ino 0x%llx count %d pincount %d caller %ps",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000737 MAJOR(__entry->dev), MINOR(__entry->dev),
738 __entry->ino,
739 __entry->count,
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100740 __entry->pincount,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000741 (char *)__entry->caller_ip)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000742)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000743
Brian Foster19cb7e32013-03-18 10:51:48 -0400744TRACE_EVENT(xfs_iomap_prealloc_size,
745 TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t blocks, int shift,
746 unsigned int writeio_blocks),
747 TP_ARGS(ip, blocks, shift, writeio_blocks),
748 TP_STRUCT__entry(
749 __field(dev_t, dev)
750 __field(xfs_ino_t, ino)
751 __field(xfs_fsblock_t, blocks)
752 __field(int, shift)
753 __field(unsigned int, writeio_blocks)
754 ),
755 TP_fast_assign(
756 __entry->dev = VFS_I(ip)->i_sb->s_dev;
757 __entry->ino = ip->i_ino;
758 __entry->blocks = blocks;
759 __entry->shift = shift;
760 __entry->writeio_blocks = writeio_blocks;
761 ),
762 TP_printk("dev %d:%d ino 0x%llx prealloc blocks %llu shift %d "
763 "m_writeio_blocks %u",
764 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino,
765 __entry->blocks, __entry->shift, __entry->writeio_blocks)
766)
767
Brian Foster56d11152015-05-29 09:18:32 +1000768TRACE_EVENT(xfs_irec_merge_pre,
769 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
770 uint16_t holemask, xfs_agino_t nagino, uint16_t nholemask),
771 TP_ARGS(mp, agno, agino, holemask, nagino, nholemask),
772 TP_STRUCT__entry(
773 __field(dev_t, dev)
774 __field(xfs_agnumber_t, agno)
775 __field(xfs_agino_t, agino)
776 __field(uint16_t, holemask)
777 __field(xfs_agino_t, nagino)
778 __field(uint16_t, nholemask)
779 ),
780 TP_fast_assign(
781 __entry->dev = mp->m_super->s_dev;
782 __entry->agno = agno;
783 __entry->agino = agino;
784 __entry->holemask = holemask;
785 __entry->nagino = nagino;
786 __entry->nholemask = holemask;
787 ),
788 TP_printk("dev %d:%d agno %d inobt (%u:0x%x) new (%u:0x%x)",
789 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->agno,
790 __entry->agino, __entry->holemask, __entry->nagino,
791 __entry->nholemask)
792)
793
794TRACE_EVENT(xfs_irec_merge_post,
795 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agino_t agino,
796 uint16_t holemask),
797 TP_ARGS(mp, agno, agino, holemask),
798 TP_STRUCT__entry(
799 __field(dev_t, dev)
800 __field(xfs_agnumber_t, agno)
801 __field(xfs_agino_t, agino)
802 __field(uint16_t, holemask)
803 ),
804 TP_fast_assign(
805 __entry->dev = mp->m_super->s_dev;
806 __entry->agno = agno;
807 __entry->agino = agino;
808 __entry->holemask = holemask;
809 ),
810 TP_printk("dev %d:%d agno %d inobt (%u:0x%x)", MAJOR(__entry->dev),
811 MINOR(__entry->dev), __entry->agno, __entry->agino,
812 __entry->holemask)
813)
814
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000815#define DEFINE_IREF_EVENT(name) \
816DEFINE_EVENT(xfs_iref_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000817 TP_PROTO(struct xfs_inode *ip, unsigned long caller_ip), \
818 TP_ARGS(ip, caller_ip))
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000819DEFINE_IREF_EVENT(xfs_irele);
820DEFINE_IREF_EVENT(xfs_inode_pin);
821DEFINE_IREF_EVENT(xfs_inode_unpin);
822DEFINE_IREF_EVENT(xfs_inode_unpin_nowait);
Dave Chinner4aaf15d2010-03-08 11:24:07 +1100823
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000824DECLARE_EVENT_CLASS(xfs_namespace_class,
825 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name),
826 TP_ARGS(dp, name),
827 TP_STRUCT__entry(
828 __field(dev_t, dev)
829 __field(xfs_ino_t, dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000830 __field(int, namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000831 __dynamic_array(char, name, name->len)
832 ),
833 TP_fast_assign(
834 __entry->dev = VFS_I(dp)->i_sb->s_dev;
835 __entry->dp_ino = dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000836 __entry->namelen = name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000837 memcpy(__get_str(name), name->name, name->len);
838 ),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000839 TP_printk("dev %d:%d dp ino 0x%llx name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000840 MAJOR(__entry->dev), MINOR(__entry->dev),
841 __entry->dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000842 __entry->namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000843 __get_str(name))
844)
845
846#define DEFINE_NAMESPACE_EVENT(name) \
847DEFINE_EVENT(xfs_namespace_class, name, \
848 TP_PROTO(struct xfs_inode *dp, struct xfs_name *name), \
849 TP_ARGS(dp, name))
850DEFINE_NAMESPACE_EVENT(xfs_remove);
851DEFINE_NAMESPACE_EVENT(xfs_link);
852DEFINE_NAMESPACE_EVENT(xfs_lookup);
853DEFINE_NAMESPACE_EVENT(xfs_create);
854DEFINE_NAMESPACE_EVENT(xfs_symlink);
855
856TRACE_EVENT(xfs_rename,
857 TP_PROTO(struct xfs_inode *src_dp, struct xfs_inode *target_dp,
858 struct xfs_name *src_name, struct xfs_name *target_name),
859 TP_ARGS(src_dp, target_dp, src_name, target_name),
860 TP_STRUCT__entry(
861 __field(dev_t, dev)
862 __field(xfs_ino_t, src_dp_ino)
863 __field(xfs_ino_t, target_dp_ino)
Christoph Hellwigf6161372012-02-28 11:01:40 +0000864 __field(int, src_namelen)
865 __field(int, target_namelen)
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000866 __dynamic_array(char, src_name, src_name->len)
867 __dynamic_array(char, target_name, target_name->len)
868 ),
869 TP_fast_assign(
870 __entry->dev = VFS_I(src_dp)->i_sb->s_dev;
871 __entry->src_dp_ino = src_dp->i_ino;
872 __entry->target_dp_ino = target_dp->i_ino;
Christoph Hellwigf6161372012-02-28 11:01:40 +0000873 __entry->src_namelen = src_name->len;
874 __entry->target_namelen = target_name->len;
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000875 memcpy(__get_str(src_name), src_name->name, src_name->len);
Christoph Hellwigf6161372012-02-28 11:01:40 +0000876 memcpy(__get_str(target_name), target_name->name,
877 target_name->len);
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000878 ),
879 TP_printk("dev %d:%d src dp ino 0x%llx target dp ino 0x%llx"
Christoph Hellwigf6161372012-02-28 11:01:40 +0000880 " src name %.*s target name %.*s",
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000881 MAJOR(__entry->dev), MINOR(__entry->dev),
882 __entry->src_dp_ino,
883 __entry->target_dp_ino,
Christoph Hellwigf6161372012-02-28 11:01:40 +0000884 __entry->src_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000885 __get_str(src_name),
Christoph Hellwigf6161372012-02-28 11:01:40 +0000886 __entry->target_namelen,
Christoph Hellwigcca28fb2010-06-24 11:57:09 +1000887 __get_str(target_name))
888)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000889
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000890DECLARE_EVENT_CLASS(xfs_dquot_class,
891 TP_PROTO(struct xfs_dquot *dqp),
892 TP_ARGS(dqp),
893 TP_STRUCT__entry(
894 __field(dev_t, dev)
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000895 __field(u32, id)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000896 __field(unsigned, flags)
897 __field(unsigned, nrefs)
898 __field(unsigned long long, res_bcount)
899 __field(unsigned long long, bcount)
900 __field(unsigned long long, icount)
901 __field(unsigned long long, blk_hardlimit)
902 __field(unsigned long long, blk_softlimit)
903 __field(unsigned long long, ino_hardlimit)
904 __field(unsigned long long, ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000905 ), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000906 TP_fast_assign(
907 __entry->dev = dqp->q_mount->m_super->s_dev;
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000908 __entry->id = be32_to_cpu(dqp->q_core.d_id);
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000909 __entry->flags = dqp->dq_flags;
910 __entry->nrefs = dqp->q_nrefs;
911 __entry->res_bcount = dqp->q_res_bcount;
912 __entry->bcount = be64_to_cpu(dqp->q_core.d_bcount);
913 __entry->icount = be64_to_cpu(dqp->q_core.d_icount);
914 __entry->blk_hardlimit =
915 be64_to_cpu(dqp->q_core.d_blk_hardlimit);
916 __entry->blk_softlimit =
917 be64_to_cpu(dqp->q_core.d_blk_softlimit);
918 __entry->ino_hardlimit =
919 be64_to_cpu(dqp->q_core.d_ino_hardlimit);
920 __entry->ino_softlimit =
921 be64_to_cpu(dqp->q_core.d_ino_softlimit);
922 ),
923 TP_printk("dev %d:%d id 0x%x flags %s nrefs %u res_bc 0x%llx "
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000924 "bcnt 0x%llx bhardlimit 0x%llx bsoftlimit 0x%llx "
925 "icnt 0x%llx ihardlimit 0x%llx isoftlimit 0x%llx]",
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000926 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigb262e5d2010-02-14 22:01:45 +0000927 __entry->id,
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000928 __print_flags(__entry->flags, "|", XFS_DQ_FLAGS),
929 __entry->nrefs,
930 __entry->res_bcount,
931 __entry->bcount,
932 __entry->blk_hardlimit,
933 __entry->blk_softlimit,
934 __entry->icount,
935 __entry->ino_hardlimit,
936 __entry->ino_softlimit)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000937)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000938
939#define DEFINE_DQUOT_EVENT(name) \
940DEFINE_EVENT(xfs_dquot_class, name, \
941 TP_PROTO(struct xfs_dquot *dqp), \
942 TP_ARGS(dqp))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000943DEFINE_DQUOT_EVENT(xfs_dqadjust);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000944DEFINE_DQUOT_EVENT(xfs_dqreclaim_want);
945DEFINE_DQUOT_EVENT(xfs_dqreclaim_dirty);
Christoph Hellwig92b2e5b2012-02-01 13:57:20 +0000946DEFINE_DQUOT_EVENT(xfs_dqreclaim_busy);
947DEFINE_DQUOT_EVENT(xfs_dqreclaim_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000948DEFINE_DQUOT_EVENT(xfs_dqattach_found);
949DEFINE_DQUOT_EVENT(xfs_dqattach_get);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000950DEFINE_DQUOT_EVENT(xfs_dqalloc);
951DEFINE_DQUOT_EVENT(xfs_dqtobp_read);
952DEFINE_DQUOT_EVENT(xfs_dqread);
953DEFINE_DQUOT_EVENT(xfs_dqread_fail);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000954DEFINE_DQUOT_EVENT(xfs_dqget_hit);
955DEFINE_DQUOT_EVENT(xfs_dqget_miss);
Christoph Hellwig9f920f12012-03-13 08:52:35 +0000956DEFINE_DQUOT_EVENT(xfs_dqget_freeing);
957DEFINE_DQUOT_EVENT(xfs_dqget_dup);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000958DEFINE_DQUOT_EVENT(xfs_dqput);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000959DEFINE_DQUOT_EVENT(xfs_dqput_free);
960DEFINE_DQUOT_EVENT(xfs_dqrele);
961DEFINE_DQUOT_EVENT(xfs_dqflush);
962DEFINE_DQUOT_EVENT(xfs_dqflush_force);
963DEFINE_DQUOT_EVENT(xfs_dqflush_done);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +0000964
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000965DECLARE_EVENT_CLASS(xfs_loggrant_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -0500966 TP_PROTO(struct xlog *log, struct xlog_ticket *tic),
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000967 TP_ARGS(log, tic),
968 TP_STRUCT__entry(
969 __field(dev_t, dev)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000970 __field(char, ocnt)
971 __field(char, cnt)
972 __field(int, curr_res)
973 __field(int, unit_res)
974 __field(unsigned int, flags)
Dave Chinner10547942010-12-21 12:02:25 +1100975 __field(int, reserveq)
976 __field(int, writeq)
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000977 __field(int, grant_reserve_cycle)
978 __field(int, grant_reserve_bytes)
979 __field(int, grant_write_cycle)
980 __field(int, grant_write_bytes)
981 __field(int, curr_cycle)
982 __field(int, curr_block)
983 __field(xfs_lsn_t, tail_lsn)
984 ),
985 TP_fast_assign(
986 __entry->dev = log->l_mp->m_super->s_dev;
Christoph Hellwigea9a4882009-12-21 14:03:03 +0000987 __entry->ocnt = tic->t_ocnt;
988 __entry->cnt = tic->t_cnt;
989 __entry->curr_res = tic->t_curr_res;
990 __entry->unit_res = tic->t_unit_res;
991 __entry->flags = tic->t_flags;
Christoph Hellwig28496962012-02-20 02:31:25 +0000992 __entry->reserveq = list_empty(&log->l_reserve_head.waiters);
993 __entry->writeq = list_empty(&log->l_write_head.waiters);
994 xlog_crack_grant_head(&log->l_reserve_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100995 &__entry->grant_reserve_cycle,
996 &__entry->grant_reserve_bytes);
Christoph Hellwig28496962012-02-20 02:31:25 +0000997 xlog_crack_grant_head(&log->l_write_head.grant,
Dave Chinnera69ed032010-12-21 12:08:20 +1100998 &__entry->grant_write_cycle,
999 &__entry->grant_write_bytes);
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001000 __entry->curr_cycle = log->l_curr_cycle;
1001 __entry->curr_block = log->l_curr_block;
Dave Chinner1c3cb9e2010-12-21 12:28:39 +11001002 __entry->tail_lsn = atomic64_read(&log->l_tail_lsn);
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001003 ),
Christoph Hellwig710b1e22016-04-06 09:20:36 +10001004 TP_printk("dev %d:%d t_ocnt %u t_cnt %u t_curr_res %u "
Dave Chinner10547942010-12-21 12:02:25 +11001005 "t_unit_res %u t_flags %s reserveq %s "
1006 "writeq %s grant_reserve_cycle %d "
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001007 "grant_reserve_bytes %d grant_write_cycle %d "
1008 "grant_write_bytes %d curr_cycle %d curr_block %d "
1009 "tail_cycle %d tail_block %d",
1010 MAJOR(__entry->dev), MINOR(__entry->dev),
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001011 __entry->ocnt,
1012 __entry->cnt,
1013 __entry->curr_res,
1014 __entry->unit_res,
1015 __print_flags(__entry->flags, "|", XLOG_TIC_FLAGS),
Dave Chinner10547942010-12-21 12:02:25 +11001016 __entry->reserveq ? "empty" : "active",
1017 __entry->writeq ? "empty" : "active",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001018 __entry->grant_reserve_cycle,
1019 __entry->grant_reserve_bytes,
1020 __entry->grant_write_cycle,
1021 __entry->grant_write_bytes,
1022 __entry->curr_cycle,
1023 __entry->curr_block,
1024 CYCLE_LSN(__entry->tail_lsn),
1025 BLOCK_LSN(__entry->tail_lsn)
1026 )
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001027)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001028
1029#define DEFINE_LOGGRANT_EVENT(name) \
1030DEFINE_EVENT(xfs_loggrant_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05001031 TP_PROTO(struct xlog *log, struct xlog_ticket *tic), \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001032 TP_ARGS(log, tic))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001033DEFINE_LOGGRANT_EVENT(xfs_log_done_nonperm);
1034DEFINE_LOGGRANT_EVENT(xfs_log_done_perm);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001035DEFINE_LOGGRANT_EVENT(xfs_log_umount_write);
Christoph Hellwig9f9c19e2011-11-28 08:17:36 +00001036DEFINE_LOGGRANT_EVENT(xfs_log_grant_sleep);
1037DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake);
Dave Chinner3f16b982010-12-21 12:29:01 +11001038DEFINE_LOGGRANT_EVENT(xfs_log_grant_wake_up);
Christoph Hellwig9006fb92012-02-20 02:31:31 +00001039DEFINE_LOGGRANT_EVENT(xfs_log_reserve);
1040DEFINE_LOGGRANT_EVENT(xfs_log_reserve_exit);
1041DEFINE_LOGGRANT_EVENT(xfs_log_regrant);
1042DEFINE_LOGGRANT_EVENT(xfs_log_regrant_exit);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001043DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_enter);
1044DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_exit);
1045DEFINE_LOGGRANT_EVENT(xfs_log_regrant_reserve_sub);
1046DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_enter);
1047DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_exit);
1048DEFINE_LOGGRANT_EVENT(xfs_log_ungrant_sub);
1049
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001050DECLARE_EVENT_CLASS(xfs_log_item_class,
1051 TP_PROTO(struct xfs_log_item *lip),
1052 TP_ARGS(lip),
1053 TP_STRUCT__entry(
1054 __field(dev_t, dev)
1055 __field(void *, lip)
1056 __field(uint, type)
1057 __field(uint, flags)
1058 __field(xfs_lsn_t, lsn)
1059 ),
1060 TP_fast_assign(
1061 __entry->dev = lip->li_mountp->m_super->s_dev;
1062 __entry->lip = lip;
1063 __entry->type = lip->li_type;
1064 __entry->flags = lip->li_flags;
1065 __entry->lsn = lip->li_lsn;
1066 ),
1067 TP_printk("dev %d:%d lip 0x%p lsn %d/%d type %s flags %s",
1068 MAJOR(__entry->dev), MINOR(__entry->dev),
1069 __entry->lip,
1070 CYCLE_LSN(__entry->lsn), BLOCK_LSN(__entry->lsn),
1071 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1072 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1073)
1074
Dave Chinner14c26c62012-04-24 16:33:31 +10001075TRACE_EVENT(xfs_log_force,
Carlos Maiolino9f278892016-04-06 09:46:30 +10001076 TP_PROTO(struct xfs_mount *mp, xfs_lsn_t lsn, unsigned long caller_ip),
1077 TP_ARGS(mp, lsn, caller_ip),
Dave Chinner14c26c62012-04-24 16:33:31 +10001078 TP_STRUCT__entry(
1079 __field(dev_t, dev)
1080 __field(xfs_lsn_t, lsn)
Carlos Maiolino9f278892016-04-06 09:46:30 +10001081 __field(unsigned long, caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001082 ),
1083 TP_fast_assign(
1084 __entry->dev = mp->m_super->s_dev;
1085 __entry->lsn = lsn;
Carlos Maiolino9f278892016-04-06 09:46:30 +10001086 __entry->caller_ip = caller_ip;
Dave Chinner14c26c62012-04-24 16:33:31 +10001087 ),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001088 TP_printk("dev %d:%d lsn 0x%llx caller %ps",
Dave Chinner14c26c62012-04-24 16:33:31 +10001089 MAJOR(__entry->dev), MINOR(__entry->dev),
Carlos Maiolino9f278892016-04-06 09:46:30 +10001090 __entry->lsn, (void *)__entry->caller_ip)
Dave Chinner14c26c62012-04-24 16:33:31 +10001091)
1092
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001093#define DEFINE_LOG_ITEM_EVENT(name) \
1094DEFINE_EVENT(xfs_log_item_class, name, \
1095 TP_PROTO(struct xfs_log_item *lip), \
1096 TP_ARGS(lip))
1097DEFINE_LOG_ITEM_EVENT(xfs_ail_push);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001098DEFINE_LOG_ITEM_EVENT(xfs_ail_pinned);
1099DEFINE_LOG_ITEM_EVENT(xfs_ail_locked);
Christoph Hellwig43ff2122012-04-23 15:58:39 +10001100DEFINE_LOG_ITEM_EVENT(xfs_ail_flushing);
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001101
Dave Chinner750b9c92013-11-01 15:27:18 +11001102DECLARE_EVENT_CLASS(xfs_ail_class,
1103 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn),
1104 TP_ARGS(lip, old_lsn, new_lsn),
1105 TP_STRUCT__entry(
1106 __field(dev_t, dev)
1107 __field(void *, lip)
1108 __field(uint, type)
1109 __field(uint, flags)
1110 __field(xfs_lsn_t, old_lsn)
1111 __field(xfs_lsn_t, new_lsn)
1112 ),
1113 TP_fast_assign(
1114 __entry->dev = lip->li_mountp->m_super->s_dev;
1115 __entry->lip = lip;
1116 __entry->type = lip->li_type;
1117 __entry->flags = lip->li_flags;
1118 __entry->old_lsn = old_lsn;
1119 __entry->new_lsn = new_lsn;
1120 ),
1121 TP_printk("dev %d:%d lip 0x%p old lsn %d/%d new lsn %d/%d type %s flags %s",
1122 MAJOR(__entry->dev), MINOR(__entry->dev),
1123 __entry->lip,
1124 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1125 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1126 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
1127 __print_flags(__entry->flags, "|", XFS_LI_FLAGS))
1128)
1129
1130#define DEFINE_AIL_EVENT(name) \
1131DEFINE_EVENT(xfs_ail_class, name, \
1132 TP_PROTO(struct xfs_log_item *lip, xfs_lsn_t old_lsn, xfs_lsn_t new_lsn), \
1133 TP_ARGS(lip, old_lsn, new_lsn))
1134DEFINE_AIL_EVENT(xfs_ail_insert);
1135DEFINE_AIL_EVENT(xfs_ail_move);
1136DEFINE_AIL_EVENT(xfs_ail_delete);
1137
1138TRACE_EVENT(xfs_log_assign_tail_lsn,
1139 TP_PROTO(struct xlog *log, xfs_lsn_t new_lsn),
1140 TP_ARGS(log, new_lsn),
1141 TP_STRUCT__entry(
1142 __field(dev_t, dev)
1143 __field(xfs_lsn_t, new_lsn)
1144 __field(xfs_lsn_t, old_lsn)
1145 __field(xfs_lsn_t, last_sync_lsn)
1146 ),
1147 TP_fast_assign(
1148 __entry->dev = log->l_mp->m_super->s_dev;
1149 __entry->new_lsn = new_lsn;
1150 __entry->old_lsn = atomic64_read(&log->l_tail_lsn);
1151 __entry->last_sync_lsn = atomic64_read(&log->l_last_sync_lsn);
1152 ),
1153 TP_printk("dev %d:%d new tail lsn %d/%d, old lsn %d/%d, last sync %d/%d",
1154 MAJOR(__entry->dev), MINOR(__entry->dev),
1155 CYCLE_LSN(__entry->new_lsn), BLOCK_LSN(__entry->new_lsn),
1156 CYCLE_LSN(__entry->old_lsn), BLOCK_LSN(__entry->old_lsn),
1157 CYCLE_LSN(__entry->last_sync_lsn), BLOCK_LSN(__entry->last_sync_lsn))
1158)
Christoph Hellwig9e4c1092011-10-11 15:14:11 +00001159
Li Zefanf8adb4d2010-05-24 08:25:57 +00001160DECLARE_EVENT_CLASS(xfs_file_class,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001161 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset),
1162 TP_ARGS(ip, count, offset),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001163 TP_STRUCT__entry(
1164 __field(dev_t, dev)
1165 __field(xfs_ino_t, ino)
1166 __field(xfs_fsize_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001167 __field(loff_t, offset)
1168 __field(size_t, count)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001169 ),
1170 TP_fast_assign(
1171 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1172 __entry->ino = ip->i_ino;
1173 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001174 __entry->offset = offset;
1175 __entry->count = count;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001176 ),
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001177 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count 0x%zx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001178 MAJOR(__entry->dev), MINOR(__entry->dev),
1179 __entry->ino,
1180 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001181 __entry->offset,
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001182 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001183)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001184
1185#define DEFINE_RW_EVENT(name) \
1186DEFINE_EVENT(xfs_file_class, name, \
Christoph Hellwig3176c3e2016-07-20 11:31:42 +10001187 TP_PROTO(struct xfs_inode *ip, size_t count, loff_t offset), \
1188 TP_ARGS(ip, count, offset))
1189DEFINE_RW_EVENT(xfs_file_buffered_read);
1190DEFINE_RW_EVENT(xfs_file_direct_read);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001191DEFINE_RW_EVENT(xfs_file_dax_read);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001192DEFINE_RW_EVENT(xfs_file_buffered_write);
1193DEFINE_RW_EVENT(xfs_file_direct_write);
Christoph Hellwig16d4d432016-07-20 11:38:55 +10001194DEFINE_RW_EVENT(xfs_file_dax_write);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001195
Li Zefanf8adb4d2010-05-24 08:25:57 +00001196DECLARE_EVENT_CLASS(xfs_page_class,
Lukas Czerner34097df2013-05-21 23:58:01 -04001197 TP_PROTO(struct inode *inode, struct page *page, unsigned long off,
1198 unsigned int len),
1199 TP_ARGS(inode, page, off, len),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001200 TP_STRUCT__entry(
1201 __field(dev_t, dev)
1202 __field(xfs_ino_t, ino)
1203 __field(pgoff_t, pgoff)
1204 __field(loff_t, size)
1205 __field(unsigned long, offset)
Lukas Czerner34097df2013-05-21 23:58:01 -04001206 __field(unsigned int, length)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001207 __field(int, delalloc)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001208 __field(int, unwritten)
1209 ),
1210 TP_fast_assign(
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001211 int delalloc = -1, unwritten = -1;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001212
Li Zefanf8adb4d2010-05-24 08:25:57 +00001213 if (page_has_buffers(page))
Christoph Hellwig20cb52e2010-06-24 09:46:01 +10001214 xfs_count_page_state(page, &delalloc, &unwritten);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001215 __entry->dev = inode->i_sb->s_dev;
1216 __entry->ino = XFS_I(inode)->i_ino;
1217 __entry->pgoff = page_offset(page);
1218 __entry->size = i_size_read(inode);
1219 __entry->offset = off;
Lukas Czerner34097df2013-05-21 23:58:01 -04001220 __entry->length = len;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001221 __entry->delalloc = delalloc;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001222 __entry->unwritten = unwritten;
1223 ),
1224 TP_printk("dev %d:%d ino 0x%llx pgoff 0x%lx size 0x%llx offset %lx "
Lukas Czerner34097df2013-05-21 23:58:01 -04001225 "length %x delalloc %d unwritten %d",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001226 MAJOR(__entry->dev), MINOR(__entry->dev),
1227 __entry->ino,
1228 __entry->pgoff,
1229 __entry->size,
1230 __entry->offset,
Lukas Czerner34097df2013-05-21 23:58:01 -04001231 __entry->length,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001232 __entry->delalloc,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001233 __entry->unwritten)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001234)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001235
1236#define DEFINE_PAGE_EVENT(name) \
1237DEFINE_EVENT(xfs_page_class, name, \
Lukas Czerner34097df2013-05-21 23:58:01 -04001238 TP_PROTO(struct inode *inode, struct page *page, unsigned long off, \
1239 unsigned int len), \
1240 TP_ARGS(inode, page, off, len))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001241DEFINE_PAGE_EVENT(xfs_writepage);
1242DEFINE_PAGE_EVENT(xfs_releasepage);
1243DEFINE_PAGE_EVENT(xfs_invalidatepage);
1244
Dave Chinner121e2132016-01-08 11:28:35 +11001245DECLARE_EVENT_CLASS(xfs_readpage_class,
1246 TP_PROTO(struct inode *inode, int nr_pages),
1247 TP_ARGS(inode, nr_pages),
1248 TP_STRUCT__entry(
1249 __field(dev_t, dev)
1250 __field(xfs_ino_t, ino)
1251 __field(int, nr_pages)
1252 ),
1253 TP_fast_assign(
1254 __entry->dev = inode->i_sb->s_dev;
1255 __entry->ino = inode->i_ino;
1256 __entry->nr_pages = nr_pages;
1257 ),
1258 TP_printk("dev %d:%d ino 0x%llx nr_pages %d",
1259 MAJOR(__entry->dev), MINOR(__entry->dev),
1260 __entry->ino,
1261 __entry->nr_pages)
1262)
1263
1264#define DEFINE_READPAGE_EVENT(name) \
1265DEFINE_EVENT(xfs_readpage_class, name, \
1266 TP_PROTO(struct inode *inode, int nr_pages), \
1267 TP_ARGS(inode, nr_pages))
1268DEFINE_READPAGE_EVENT(xfs_vm_readpage);
1269DEFINE_READPAGE_EVENT(xfs_vm_readpages);
1270
Christoph Hellwiga206c812010-12-10 08:42:20 +00001271DECLARE_EVENT_CLASS(xfs_imap_class,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001272 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001273 int type, struct xfs_bmbt_irec *irec),
1274 TP_ARGS(ip, offset, count, type, irec),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001275 TP_STRUCT__entry(
1276 __field(dev_t, dev)
1277 __field(xfs_ino_t, ino)
1278 __field(loff_t, size)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001279 __field(loff_t, offset)
1280 __field(size_t, count)
Christoph Hellwiga206c812010-12-10 08:42:20 +00001281 __field(int, type)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001282 __field(xfs_fileoff_t, startoff)
1283 __field(xfs_fsblock_t, startblock)
1284 __field(xfs_filblks_t, blockcount)
1285 ),
1286 TP_fast_assign(
1287 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1288 __entry->ino = ip->i_ino;
1289 __entry->size = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001290 __entry->offset = offset;
1291 __entry->count = count;
Christoph Hellwiga206c812010-12-10 08:42:20 +00001292 __entry->type = type;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001293 __entry->startoff = irec ? irec->br_startoff : 0;
1294 __entry->startblock = irec ? irec->br_startblock : 0;
1295 __entry->blockcount = irec ? irec->br_blockcount : 0;
1296 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001297 TP_printk("dev %d:%d ino 0x%llx size 0x%llx offset 0x%llx count %zd "
1298 "type %s startoff 0x%llx startblock %lld blockcount 0x%llx",
Li Zefanf8adb4d2010-05-24 08:25:57 +00001299 MAJOR(__entry->dev), MINOR(__entry->dev),
1300 __entry->ino,
1301 __entry->size,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001302 __entry->offset,
1303 __entry->count,
Christoph Hellwiga206c812010-12-10 08:42:20 +00001304 __print_symbolic(__entry->type, XFS_IO_TYPES),
Li Zefanf8adb4d2010-05-24 08:25:57 +00001305 __entry->startoff,
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07001306 (int64_t)__entry->startblock,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001307 __entry->blockcount)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001308)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001309
1310#define DEFINE_IOMAP_EVENT(name) \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001311DEFINE_EVENT(xfs_imap_class, name, \
Li Zefanf8adb4d2010-05-24 08:25:57 +00001312 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count, \
Christoph Hellwiga206c812010-12-10 08:42:20 +00001313 int type, struct xfs_bmbt_irec *irec), \
1314 TP_ARGS(ip, offset, count, type, irec))
1315DEFINE_IOMAP_EVENT(xfs_map_blocks_found);
1316DEFINE_IOMAP_EVENT(xfs_map_blocks_alloc);
1317DEFINE_IOMAP_EVENT(xfs_get_blocks_found);
1318DEFINE_IOMAP_EVENT(xfs_get_blocks_alloc);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001319DEFINE_IOMAP_EVENT(xfs_get_blocks_map_direct);
Christoph Hellwig68a9f5e2016-06-21 09:53:44 +10001320DEFINE_IOMAP_EVENT(xfs_iomap_alloc);
1321DEFINE_IOMAP_EVENT(xfs_iomap_found);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001322
Li Zefanf8adb4d2010-05-24 08:25:57 +00001323DECLARE_EVENT_CLASS(xfs_simple_io_class,
1324 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count),
1325 TP_ARGS(ip, offset, count),
1326 TP_STRUCT__entry(
1327 __field(dev_t, dev)
1328 __field(xfs_ino_t, ino)
Dave Chinner55fb25d52011-07-18 03:40:19 +00001329 __field(loff_t, isize)
1330 __field(loff_t, disize)
Li Zefanf8adb4d2010-05-24 08:25:57 +00001331 __field(loff_t, offset)
1332 __field(size_t, count)
1333 ),
1334 TP_fast_assign(
1335 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1336 __entry->ino = ip->i_ino;
Christoph Hellwigce7ae1512011-12-18 20:00:11 +00001337 __entry->isize = VFS_I(ip)->i_size;
Dave Chinner55fb25d52011-07-18 03:40:19 +00001338 __entry->disize = ip->i_d.di_size;
Li Zefanf8adb4d2010-05-24 08:25:57 +00001339 __entry->offset = offset;
1340 __entry->count = count;
1341 ),
Christoph Hellwig2813d682011-12-18 20:00:12 +00001342 TP_printk("dev %d:%d ino 0x%llx isize 0x%llx disize 0x%llx "
Li Zefanf8adb4d2010-05-24 08:25:57 +00001343 "offset 0x%llx count %zd",
1344 MAJOR(__entry->dev), MINOR(__entry->dev),
1345 __entry->ino,
Dave Chinner55fb25d52011-07-18 03:40:19 +00001346 __entry->isize,
1347 __entry->disize,
Li Zefanf8adb4d2010-05-24 08:25:57 +00001348 __entry->offset,
1349 __entry->count)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001350);
Li Zefanf8adb4d2010-05-24 08:25:57 +00001351
1352#define DEFINE_SIMPLE_IO_EVENT(name) \
1353DEFINE_EVENT(xfs_simple_io_class, name, \
1354 TP_PROTO(struct xfs_inode *ip, xfs_off_t offset, ssize_t count), \
1355 TP_ARGS(ip, offset, count))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001356DEFINE_SIMPLE_IO_EVENT(xfs_delalloc_enospc);
1357DEFINE_SIMPLE_IO_EVENT(xfs_unwritten_convert);
Christoph Hellwiga206c812010-12-10 08:42:20 +00001358DEFINE_SIMPLE_IO_EVENT(xfs_get_blocks_notfound);
Dave Chinner55fb25d52011-07-18 03:40:19 +00001359DEFINE_SIMPLE_IO_EVENT(xfs_setfilesize);
Brian Foster0a50f162015-10-12 16:02:08 +11001360DEFINE_SIMPLE_IO_EVENT(xfs_zero_eof);
Christoph Hellwig273dda72016-02-08 14:40:51 +11001361DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write);
1362DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_unwritten);
1363DEFINE_SIMPLE_IO_EVENT(xfs_end_io_direct_write_append);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001364
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001365DECLARE_EVENT_CLASS(xfs_itrunc_class,
1366 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size),
1367 TP_ARGS(ip, new_size),
1368 TP_STRUCT__entry(
1369 __field(dev_t, dev)
1370 __field(xfs_ino_t, ino)
1371 __field(xfs_fsize_t, size)
1372 __field(xfs_fsize_t, new_size)
1373 ),
1374 TP_fast_assign(
1375 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1376 __entry->ino = ip->i_ino;
1377 __entry->size = ip->i_d.di_size;
1378 __entry->new_size = new_size;
1379 ),
1380 TP_printk("dev %d:%d ino 0x%llx size 0x%llx new_size 0x%llx",
1381 MAJOR(__entry->dev), MINOR(__entry->dev),
1382 __entry->ino,
1383 __entry->size,
1384 __entry->new_size)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001385)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001386
1387#define DEFINE_ITRUNC_EVENT(name) \
1388DEFINE_EVENT(xfs_itrunc_class, name, \
1389 TP_PROTO(struct xfs_inode *ip, xfs_fsize_t new_size), \
1390 TP_ARGS(ip, new_size))
Christoph Hellwig673e8e52011-12-18 20:00:04 +00001391DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_start);
1392DEFINE_ITRUNC_EVENT(xfs_itruncate_extents_end);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001393
1394TRACE_EVENT(xfs_pagecache_inval,
1395 TP_PROTO(struct xfs_inode *ip, xfs_off_t start, xfs_off_t finish),
1396 TP_ARGS(ip, start, finish),
1397 TP_STRUCT__entry(
1398 __field(dev_t, dev)
1399 __field(xfs_ino_t, ino)
1400 __field(xfs_fsize_t, size)
1401 __field(xfs_off_t, start)
1402 __field(xfs_off_t, finish)
1403 ),
1404 TP_fast_assign(
1405 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1406 __entry->ino = ip->i_ino;
1407 __entry->size = ip->i_d.di_size;
1408 __entry->start = start;
1409 __entry->finish = finish;
1410 ),
1411 TP_printk("dev %d:%d ino 0x%llx size 0x%llx start 0x%llx finish 0x%llx",
1412 MAJOR(__entry->dev), MINOR(__entry->dev),
1413 __entry->ino,
1414 __entry->size,
1415 __entry->start,
1416 __entry->finish)
1417);
1418
1419TRACE_EVENT(xfs_bunmap,
1420 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t bno, xfs_filblks_t len,
1421 int flags, unsigned long caller_ip),
1422 TP_ARGS(ip, bno, len, flags, caller_ip),
1423 TP_STRUCT__entry(
1424 __field(dev_t, dev)
1425 __field(xfs_ino_t, ino)
1426 __field(xfs_fsize_t, size)
1427 __field(xfs_fileoff_t, bno)
1428 __field(xfs_filblks_t, len)
1429 __field(unsigned long, caller_ip)
1430 __field(int, flags)
1431 ),
1432 TP_fast_assign(
1433 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1434 __entry->ino = ip->i_ino;
1435 __entry->size = ip->i_d.di_size;
1436 __entry->bno = bno;
1437 __entry->len = len;
1438 __entry->caller_ip = caller_ip;
1439 __entry->flags = flags;
1440 ),
1441 TP_printk("dev %d:%d ino 0x%llx size 0x%llx bno 0x%llx len 0x%llx"
Scott Wood65dd2972015-03-25 14:56:21 +11001442 "flags %s caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001443 MAJOR(__entry->dev), MINOR(__entry->dev),
1444 __entry->ino,
1445 __entry->size,
1446 __entry->bno,
1447 __entry->len,
1448 __print_flags(__entry->flags, "|", XFS_BMAPI_FLAGS),
1449 (void *)__entry->caller_ip)
1450
1451);
1452
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001453DECLARE_EVENT_CLASS(xfs_extent_busy_class,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001454 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),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001457 TP_STRUCT__entry(
1458 __field(dev_t, dev)
1459 __field(xfs_agnumber_t, agno)
1460 __field(xfs_agblock_t, agbno)
1461 __field(xfs_extlen_t, len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001462 ),
1463 TP_fast_assign(
1464 __entry->dev = mp->m_super->s_dev;
1465 __entry->agno = agno;
1466 __entry->agbno = agbno;
1467 __entry->len = len;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001468 ),
Dave Chinnered3b4d62010-05-21 12:07:08 +10001469 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001470 MAJOR(__entry->dev), MINOR(__entry->dev),
1471 __entry->agno,
1472 __entry->agbno,
Dave Chinnered3b4d62010-05-21 12:07:08 +10001473 __entry->len)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001474);
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001475#define DEFINE_BUSY_EVENT(name) \
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001476DEFINE_EVENT(xfs_extent_busy_class, name, \
Christoph Hellwig97d3ac72011-04-24 19:06:16 +00001477 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1478 xfs_agblock_t agbno, xfs_extlen_t len), \
1479 TP_ARGS(mp, agno, agbno, len))
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001480DEFINE_BUSY_EVENT(xfs_extent_busy);
1481DEFINE_BUSY_EVENT(xfs_extent_busy_enomem);
1482DEFINE_BUSY_EVENT(xfs_extent_busy_force);
1483DEFINE_BUSY_EVENT(xfs_extent_busy_reuse);
1484DEFINE_BUSY_EVENT(xfs_extent_busy_clear);
Dave Chinnered3b4d62010-05-21 12:07:08 +10001485
Dave Chinner4ecbfe62012-04-29 10:41:10 +00001486TRACE_EVENT(xfs_extent_busy_trim,
Christoph Hellwige26f0502011-04-24 19:06:15 +00001487 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1488 xfs_agblock_t agbno, xfs_extlen_t len,
1489 xfs_agblock_t tbno, xfs_extlen_t tlen),
1490 TP_ARGS(mp, agno, agbno, len, tbno, tlen),
1491 TP_STRUCT__entry(
1492 __field(dev_t, dev)
1493 __field(xfs_agnumber_t, agno)
1494 __field(xfs_agblock_t, agbno)
1495 __field(xfs_extlen_t, len)
1496 __field(xfs_agblock_t, tbno)
1497 __field(xfs_extlen_t, tlen)
1498 ),
1499 TP_fast_assign(
1500 __entry->dev = mp->m_super->s_dev;
1501 __entry->agno = agno;
1502 __entry->agbno = agbno;
1503 __entry->len = len;
1504 __entry->tbno = tbno;
1505 __entry->tlen = tlen;
1506 ),
1507 TP_printk("dev %d:%d agno %u agbno %u len %u tbno %u tlen %u",
1508 MAJOR(__entry->dev), MINOR(__entry->dev),
1509 __entry->agno,
1510 __entry->agbno,
1511 __entry->len,
1512 __entry->tbno,
1513 __entry->tlen)
1514);
1515
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001516TRACE_EVENT(xfs_agf,
1517 TP_PROTO(struct xfs_mount *mp, struct xfs_agf *agf, int flags,
1518 unsigned long caller_ip),
1519 TP_ARGS(mp, agf, flags, caller_ip),
1520 TP_STRUCT__entry(
1521 __field(dev_t, dev)
1522 __field(xfs_agnumber_t, agno)
1523 __field(int, flags)
1524 __field(__u32, length)
1525 __field(__u32, bno_root)
1526 __field(__u32, cnt_root)
1527 __field(__u32, bno_level)
1528 __field(__u32, cnt_level)
1529 __field(__u32, flfirst)
1530 __field(__u32, fllast)
1531 __field(__u32, flcount)
1532 __field(__u32, freeblks)
1533 __field(__u32, longest)
1534 __field(unsigned long, caller_ip)
1535 ),
1536 TP_fast_assign(
1537 __entry->dev = mp->m_super->s_dev;
1538 __entry->agno = be32_to_cpu(agf->agf_seqno),
1539 __entry->flags = flags;
1540 __entry->length = be32_to_cpu(agf->agf_length),
1541 __entry->bno_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_BNO]),
1542 __entry->cnt_root = be32_to_cpu(agf->agf_roots[XFS_BTNUM_CNT]),
1543 __entry->bno_level =
1544 be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNO]),
1545 __entry->cnt_level =
1546 be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNT]),
1547 __entry->flfirst = be32_to_cpu(agf->agf_flfirst),
1548 __entry->fllast = be32_to_cpu(agf->agf_fllast),
1549 __entry->flcount = be32_to_cpu(agf->agf_flcount),
1550 __entry->freeblks = be32_to_cpu(agf->agf_freeblks),
1551 __entry->longest = be32_to_cpu(agf->agf_longest);
1552 __entry->caller_ip = caller_ip;
1553 ),
1554 TP_printk("dev %d:%d agno %u flags %s length %u roots b %u c %u "
1555 "levels b %u c %u flfirst %u fllast %u flcount %u "
Scott Wood65dd2972015-03-25 14:56:21 +11001556 "freeblks %u longest %u caller %ps",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001557 MAJOR(__entry->dev), MINOR(__entry->dev),
1558 __entry->agno,
1559 __print_flags(__entry->flags, "|", XFS_AGF_FLAGS),
1560 __entry->length,
1561 __entry->bno_root,
1562 __entry->cnt_root,
1563 __entry->bno_level,
1564 __entry->cnt_level,
1565 __entry->flfirst,
1566 __entry->fllast,
1567 __entry->flcount,
1568 __entry->freeblks,
1569 __entry->longest,
1570 (void *)__entry->caller_ip)
1571);
1572
1573TRACE_EVENT(xfs_free_extent,
1574 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001575 xfs_extlen_t len, enum xfs_ag_resv_type resv, int haveleft,
1576 int haveright),
1577 TP_ARGS(mp, agno, agbno, len, resv, haveleft, haveright),
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001578 TP_STRUCT__entry(
1579 __field(dev_t, dev)
1580 __field(xfs_agnumber_t, agno)
1581 __field(xfs_agblock_t, agbno)
1582 __field(xfs_extlen_t, len)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001583 __field(int, resv)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001584 __field(int, haveleft)
1585 __field(int, haveright)
1586 ),
1587 TP_fast_assign(
1588 __entry->dev = mp->m_super->s_dev;
1589 __entry->agno = agno;
1590 __entry->agbno = agbno;
1591 __entry->len = len;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001592 __entry->resv = resv;
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001593 __entry->haveleft = haveleft;
1594 __entry->haveright = haveright;
1595 ),
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001596 TP_printk("dev %d:%d agno %u agbno %u len %u resv %d %s",
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001597 MAJOR(__entry->dev), MINOR(__entry->dev),
1598 __entry->agno,
1599 __entry->agbno,
1600 __entry->len,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001601 __entry->resv,
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001602 __entry->haveleft ?
1603 (__entry->haveright ? "both" : "left") :
1604 (__entry->haveright ? "right" : "none"))
1605
1606);
1607
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001608DECLARE_EVENT_CLASS(xfs_alloc_class,
1609 TP_PROTO(struct xfs_alloc_arg *args),
1610 TP_ARGS(args),
1611 TP_STRUCT__entry(
1612 __field(dev_t, dev)
1613 __field(xfs_agnumber_t, agno)
1614 __field(xfs_agblock_t, agbno)
1615 __field(xfs_extlen_t, minlen)
1616 __field(xfs_extlen_t, maxlen)
1617 __field(xfs_extlen_t, mod)
1618 __field(xfs_extlen_t, prod)
1619 __field(xfs_extlen_t, minleft)
1620 __field(xfs_extlen_t, total)
1621 __field(xfs_extlen_t, alignment)
1622 __field(xfs_extlen_t, minalignslop)
1623 __field(xfs_extlen_t, len)
1624 __field(short, type)
1625 __field(short, otype)
1626 __field(char, wasdel)
1627 __field(char, wasfromfl)
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001628 __field(int, resv)
Dave Chinner292378e2016-09-26 08:21:28 +10001629 __field(int, datatype)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001630 __field(xfs_fsblock_t, firstblock)
1631 ),
1632 TP_fast_assign(
1633 __entry->dev = args->mp->m_super->s_dev;
1634 __entry->agno = args->agno;
1635 __entry->agbno = args->agbno;
1636 __entry->minlen = args->minlen;
1637 __entry->maxlen = args->maxlen;
1638 __entry->mod = args->mod;
1639 __entry->prod = args->prod;
1640 __entry->minleft = args->minleft;
1641 __entry->total = args->total;
1642 __entry->alignment = args->alignment;
1643 __entry->minalignslop = args->minalignslop;
1644 __entry->len = args->len;
1645 __entry->type = args->type;
1646 __entry->otype = args->otype;
1647 __entry->wasdel = args->wasdel;
1648 __entry->wasfromfl = args->wasfromfl;
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001649 __entry->resv = args->resv;
Dave Chinner292378e2016-09-26 08:21:28 +10001650 __entry->datatype = args->datatype;
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001651 __entry->firstblock = args->firstblock;
1652 ),
1653 TP_printk("dev %d:%d agno %u agbno %u minlen %u maxlen %u mod %u "
1654 "prod %u minleft %u total %u alignment %u minalignslop %u "
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001655 "len %u type %s otype %s wasdel %d wasfromfl %d resv %d "
Dave Chinner292378e2016-09-26 08:21:28 +10001656 "datatype 0x%x firstblock 0x%llx",
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001657 MAJOR(__entry->dev), MINOR(__entry->dev),
1658 __entry->agno,
1659 __entry->agbno,
1660 __entry->minlen,
1661 __entry->maxlen,
1662 __entry->mod,
1663 __entry->prod,
1664 __entry->minleft,
1665 __entry->total,
1666 __entry->alignment,
1667 __entry->minalignslop,
1668 __entry->len,
1669 __print_symbolic(__entry->type, XFS_ALLOC_TYPES),
1670 __print_symbolic(__entry->otype, XFS_ALLOC_TYPES),
1671 __entry->wasdel,
1672 __entry->wasfromfl,
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10001673 __entry->resv,
Dave Chinner292378e2016-09-26 08:21:28 +10001674 __entry->datatype,
Christoph Hellwig1a18a292011-04-24 19:02:58 +00001675 (unsigned long long)__entry->firstblock)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001676)
1677
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001678#define DEFINE_ALLOC_EVENT(name) \
1679DEFINE_EVENT(xfs_alloc_class, name, \
1680 TP_PROTO(struct xfs_alloc_arg *args), \
1681 TP_ARGS(args))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001682DEFINE_ALLOC_EVENT(xfs_alloc_exact_done);
Christoph Hellwig9f9baab2010-12-10 15:03:57 +00001683DEFINE_ALLOC_EVENT(xfs_alloc_exact_notfound);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001684DEFINE_ALLOC_EVENT(xfs_alloc_exact_error);
1685DEFINE_ALLOC_EVENT(xfs_alloc_near_nominleft);
1686DEFINE_ALLOC_EVENT(xfs_alloc_near_first);
1687DEFINE_ALLOC_EVENT(xfs_alloc_near_greater);
1688DEFINE_ALLOC_EVENT(xfs_alloc_near_lesser);
1689DEFINE_ALLOC_EVENT(xfs_alloc_near_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001690DEFINE_ALLOC_EVENT(xfs_alloc_near_noentry);
1691DEFINE_ALLOC_EVENT(xfs_alloc_near_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001692DEFINE_ALLOC_EVENT(xfs_alloc_size_neither);
1693DEFINE_ALLOC_EVENT(xfs_alloc_size_noentry);
1694DEFINE_ALLOC_EVENT(xfs_alloc_size_nominleft);
1695DEFINE_ALLOC_EVENT(xfs_alloc_size_done);
1696DEFINE_ALLOC_EVENT(xfs_alloc_size_error);
Christoph Hellwige26f0502011-04-24 19:06:15 +00001697DEFINE_ALLOC_EVENT(xfs_alloc_size_busy);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001698DEFINE_ALLOC_EVENT(xfs_alloc_small_freelist);
1699DEFINE_ALLOC_EVENT(xfs_alloc_small_notenough);
1700DEFINE_ALLOC_EVENT(xfs_alloc_small_done);
1701DEFINE_ALLOC_EVENT(xfs_alloc_small_error);
1702DEFINE_ALLOC_EVENT(xfs_alloc_vextent_badargs);
1703DEFINE_ALLOC_EVENT(xfs_alloc_vextent_nofix);
1704DEFINE_ALLOC_EVENT(xfs_alloc_vextent_noagbp);
1705DEFINE_ALLOC_EVENT(xfs_alloc_vextent_loopfailed);
1706DEFINE_ALLOC_EVENT(xfs_alloc_vextent_allfailed);
1707
Dave Chinner5a5881c2012-03-22 05:15:13 +00001708DECLARE_EVENT_CLASS(xfs_da_class,
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001709 TP_PROTO(struct xfs_da_args *args),
1710 TP_ARGS(args),
1711 TP_STRUCT__entry(
1712 __field(dev_t, dev)
1713 __field(xfs_ino_t, ino)
1714 __dynamic_array(char, name, args->namelen)
1715 __field(int, namelen)
1716 __field(xfs_dahash_t, hashval)
1717 __field(xfs_ino_t, inumber)
1718 __field(int, op_flags)
1719 ),
1720 TP_fast_assign(
1721 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1722 __entry->ino = args->dp->i_ino;
1723 if (args->namelen)
1724 memcpy(__get_str(name), args->name, args->namelen);
1725 __entry->namelen = args->namelen;
1726 __entry->hashval = args->hashval;
1727 __entry->inumber = args->inumber;
1728 __entry->op_flags = args->op_flags;
1729 ),
1730 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d hashval 0x%x "
1731 "inumber 0x%llx op_flags %s",
1732 MAJOR(__entry->dev), MINOR(__entry->dev),
1733 __entry->ino,
1734 __entry->namelen,
1735 __entry->namelen ? __get_str(name) : NULL,
1736 __entry->namelen,
1737 __entry->hashval,
1738 __entry->inumber,
1739 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001740)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001741
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001742#define DEFINE_DIR2_EVENT(name) \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001743DEFINE_EVENT(xfs_da_class, name, \
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001744 TP_PROTO(struct xfs_da_args *args), \
1745 TP_ARGS(args))
1746DEFINE_DIR2_EVENT(xfs_dir2_sf_addname);
1747DEFINE_DIR2_EVENT(xfs_dir2_sf_create);
1748DEFINE_DIR2_EVENT(xfs_dir2_sf_lookup);
1749DEFINE_DIR2_EVENT(xfs_dir2_sf_replace);
1750DEFINE_DIR2_EVENT(xfs_dir2_sf_removename);
1751DEFINE_DIR2_EVENT(xfs_dir2_sf_toino4);
1752DEFINE_DIR2_EVENT(xfs_dir2_sf_toino8);
1753DEFINE_DIR2_EVENT(xfs_dir2_sf_to_block);
1754DEFINE_DIR2_EVENT(xfs_dir2_block_addname);
1755DEFINE_DIR2_EVENT(xfs_dir2_block_lookup);
1756DEFINE_DIR2_EVENT(xfs_dir2_block_replace);
1757DEFINE_DIR2_EVENT(xfs_dir2_block_removename);
1758DEFINE_DIR2_EVENT(xfs_dir2_block_to_sf);
1759DEFINE_DIR2_EVENT(xfs_dir2_block_to_leaf);
1760DEFINE_DIR2_EVENT(xfs_dir2_leaf_addname);
1761DEFINE_DIR2_EVENT(xfs_dir2_leaf_lookup);
1762DEFINE_DIR2_EVENT(xfs_dir2_leaf_replace);
1763DEFINE_DIR2_EVENT(xfs_dir2_leaf_removename);
1764DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_block);
1765DEFINE_DIR2_EVENT(xfs_dir2_leaf_to_node);
1766DEFINE_DIR2_EVENT(xfs_dir2_node_addname);
1767DEFINE_DIR2_EVENT(xfs_dir2_node_lookup);
1768DEFINE_DIR2_EVENT(xfs_dir2_node_replace);
1769DEFINE_DIR2_EVENT(xfs_dir2_node_removename);
1770DEFINE_DIR2_EVENT(xfs_dir2_node_to_leaf);
1771
Dave Chinneree732592012-11-12 22:53:53 +11001772DECLARE_EVENT_CLASS(xfs_attr_class,
1773 TP_PROTO(struct xfs_da_args *args),
1774 TP_ARGS(args),
1775 TP_STRUCT__entry(
1776 __field(dev_t, dev)
1777 __field(xfs_ino_t, ino)
1778 __dynamic_array(char, name, args->namelen)
1779 __field(int, namelen)
1780 __field(int, valuelen)
1781 __field(xfs_dahash_t, hashval)
1782 __field(int, op_flags)
1783 ),
1784 TP_fast_assign(
1785 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1786 __entry->ino = args->dp->i_ino;
1787 if (args->namelen)
1788 memcpy(__get_str(name), args->name, args->namelen);
1789 __entry->namelen = args->namelen;
1790 __entry->valuelen = args->valuelen;
1791 __entry->hashval = args->hashval;
1792 __entry->op_flags = args->op_flags;
1793 ),
1794 TP_printk("dev %d:%d ino 0x%llx name %.*s namelen %d valuelen %d "
1795 "hashval 0x%x op_flags %s",
1796 MAJOR(__entry->dev), MINOR(__entry->dev),
1797 __entry->ino,
1798 __entry->namelen,
1799 __entry->namelen ? __get_str(name) : NULL,
1800 __entry->namelen,
1801 __entry->valuelen,
1802 __entry->hashval,
1803 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS))
1804)
1805
Dave Chinner5a5881c2012-03-22 05:15:13 +00001806#define DEFINE_ATTR_EVENT(name) \
Dave Chinneree732592012-11-12 22:53:53 +11001807DEFINE_EVENT(xfs_attr_class, name, \
Dave Chinner5a5881c2012-03-22 05:15:13 +00001808 TP_PROTO(struct xfs_da_args *args), \
1809 TP_ARGS(args))
1810DEFINE_ATTR_EVENT(xfs_attr_sf_add);
1811DEFINE_ATTR_EVENT(xfs_attr_sf_addname);
1812DEFINE_ATTR_EVENT(xfs_attr_sf_create);
1813DEFINE_ATTR_EVENT(xfs_attr_sf_lookup);
1814DEFINE_ATTR_EVENT(xfs_attr_sf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001815DEFINE_ATTR_EVENT(xfs_attr_sf_to_leaf);
1816
1817DEFINE_ATTR_EVENT(xfs_attr_leaf_add);
1818DEFINE_ATTR_EVENT(xfs_attr_leaf_add_old);
1819DEFINE_ATTR_EVENT(xfs_attr_leaf_add_new);
Dave Chinneree732592012-11-12 22:53:53 +11001820DEFINE_ATTR_EVENT(xfs_attr_leaf_add_work);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001821DEFINE_ATTR_EVENT(xfs_attr_leaf_addname);
1822DEFINE_ATTR_EVENT(xfs_attr_leaf_create);
Dave Chinneree732592012-11-12 22:53:53 +11001823DEFINE_ATTR_EVENT(xfs_attr_leaf_compact);
1824DEFINE_ATTR_EVENT(xfs_attr_leaf_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001825DEFINE_ATTR_EVENT(xfs_attr_leaf_lookup);
1826DEFINE_ATTR_EVENT(xfs_attr_leaf_replace);
Dave Chinneree732592012-11-12 22:53:53 +11001827DEFINE_ATTR_EVENT(xfs_attr_leaf_remove);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001828DEFINE_ATTR_EVENT(xfs_attr_leaf_removename);
1829DEFINE_ATTR_EVENT(xfs_attr_leaf_split);
1830DEFINE_ATTR_EVENT(xfs_attr_leaf_split_before);
1831DEFINE_ATTR_EVENT(xfs_attr_leaf_split_after);
1832DEFINE_ATTR_EVENT(xfs_attr_leaf_clearflag);
1833DEFINE_ATTR_EVENT(xfs_attr_leaf_setflag);
1834DEFINE_ATTR_EVENT(xfs_attr_leaf_flipflags);
1835DEFINE_ATTR_EVENT(xfs_attr_leaf_to_sf);
1836DEFINE_ATTR_EVENT(xfs_attr_leaf_to_node);
1837DEFINE_ATTR_EVENT(xfs_attr_leaf_rebalance);
1838DEFINE_ATTR_EVENT(xfs_attr_leaf_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001839DEFINE_ATTR_EVENT(xfs_attr_leaf_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001840
1841DEFINE_ATTR_EVENT(xfs_attr_node_addname);
Dave Chinneree732592012-11-12 22:53:53 +11001842DEFINE_ATTR_EVENT(xfs_attr_node_get);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001843DEFINE_ATTR_EVENT(xfs_attr_node_replace);
1844DEFINE_ATTR_EVENT(xfs_attr_node_removename);
1845
Dave Chinneree732592012-11-12 22:53:53 +11001846DEFINE_ATTR_EVENT(xfs_attr_fillstate);
1847DEFINE_ATTR_EVENT(xfs_attr_refillstate);
1848
1849DEFINE_ATTR_EVENT(xfs_attr_rmtval_get);
1850DEFINE_ATTR_EVENT(xfs_attr_rmtval_set);
1851DEFINE_ATTR_EVENT(xfs_attr_rmtval_remove);
1852
Dave Chinner5a5881c2012-03-22 05:15:13 +00001853#define DEFINE_DA_EVENT(name) \
1854DEFINE_EVENT(xfs_da_class, name, \
1855 TP_PROTO(struct xfs_da_args *args), \
1856 TP_ARGS(args))
1857DEFINE_DA_EVENT(xfs_da_split);
1858DEFINE_DA_EVENT(xfs_da_join);
1859DEFINE_DA_EVENT(xfs_da_link_before);
1860DEFINE_DA_EVENT(xfs_da_link_after);
1861DEFINE_DA_EVENT(xfs_da_unlink_back);
1862DEFINE_DA_EVENT(xfs_da_unlink_forward);
1863DEFINE_DA_EVENT(xfs_da_root_split);
1864DEFINE_DA_EVENT(xfs_da_root_join);
1865DEFINE_DA_EVENT(xfs_da_node_add);
1866DEFINE_DA_EVENT(xfs_da_node_create);
1867DEFINE_DA_EVENT(xfs_da_node_split);
1868DEFINE_DA_EVENT(xfs_da_node_remove);
1869DEFINE_DA_EVENT(xfs_da_node_rebalance);
1870DEFINE_DA_EVENT(xfs_da_node_unbalance);
Dave Chinneree732592012-11-12 22:53:53 +11001871DEFINE_DA_EVENT(xfs_da_node_toosmall);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001872DEFINE_DA_EVENT(xfs_da_swap_lastblock);
1873DEFINE_DA_EVENT(xfs_da_grow_inode);
1874DEFINE_DA_EVENT(xfs_da_shrink_inode);
Dave Chinneree732592012-11-12 22:53:53 +11001875DEFINE_DA_EVENT(xfs_da_fixhashpath);
1876DEFINE_DA_EVENT(xfs_da_path_shift);
Dave Chinner5a5881c2012-03-22 05:15:13 +00001877
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001878DECLARE_EVENT_CLASS(xfs_dir2_space_class,
1879 TP_PROTO(struct xfs_da_args *args, int idx),
1880 TP_ARGS(args, idx),
1881 TP_STRUCT__entry(
1882 __field(dev_t, dev)
1883 __field(xfs_ino_t, ino)
1884 __field(int, op_flags)
1885 __field(int, idx)
1886 ),
1887 TP_fast_assign(
1888 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1889 __entry->ino = args->dp->i_ino;
1890 __entry->op_flags = args->op_flags;
1891 __entry->idx = idx;
1892 ),
1893 TP_printk("dev %d:%d ino 0x%llx op_flags %s index %d",
1894 MAJOR(__entry->dev), MINOR(__entry->dev),
1895 __entry->ino,
1896 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1897 __entry->idx)
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001898)
Christoph Hellwigea9a4882009-12-21 14:03:03 +00001899
1900#define DEFINE_DIR2_SPACE_EVENT(name) \
1901DEFINE_EVENT(xfs_dir2_space_class, name, \
1902 TP_PROTO(struct xfs_da_args *args, int idx), \
1903 TP_ARGS(args, idx))
1904DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_add);
1905DEFINE_DIR2_SPACE_EVENT(xfs_dir2_leafn_remove);
1906DEFINE_DIR2_SPACE_EVENT(xfs_dir2_grow_inode);
1907DEFINE_DIR2_SPACE_EVENT(xfs_dir2_shrink_inode);
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00001908
1909TRACE_EVENT(xfs_dir2_leafn_moveents,
1910 TP_PROTO(struct xfs_da_args *args, int src_idx, int dst_idx, int count),
1911 TP_ARGS(args, src_idx, dst_idx, count),
1912 TP_STRUCT__entry(
1913 __field(dev_t, dev)
1914 __field(xfs_ino_t, ino)
1915 __field(int, op_flags)
1916 __field(int, src_idx)
1917 __field(int, dst_idx)
1918 __field(int, count)
1919 ),
1920 TP_fast_assign(
1921 __entry->dev = VFS_I(args->dp)->i_sb->s_dev;
1922 __entry->ino = args->dp->i_ino;
1923 __entry->op_flags = args->op_flags;
1924 __entry->src_idx = src_idx;
1925 __entry->dst_idx = dst_idx;
1926 __entry->count = count;
1927 ),
1928 TP_printk("dev %d:%d ino 0x%llx op_flags %s "
1929 "src_idx %d dst_idx %d count %d",
1930 MAJOR(__entry->dev), MINOR(__entry->dev),
1931 __entry->ino,
1932 __print_flags(__entry->op_flags, "|", XFS_DA_OP_FLAGS),
1933 __entry->src_idx,
1934 __entry->dst_idx,
1935 __entry->count)
1936);
1937
Dave Chinner3a85cd92010-01-14 01:33:55 +00001938#define XFS_SWAPEXT_INODES \
1939 { 0, "target" }, \
1940 { 1, "temp" }
1941
1942#define XFS_INODE_FORMAT_STR \
1943 { 0, "invalid" }, \
1944 { 1, "local" }, \
1945 { 2, "extent" }, \
1946 { 3, "btree" }
1947
1948DECLARE_EVENT_CLASS(xfs_swap_extent_class,
1949 TP_PROTO(struct xfs_inode *ip, int which),
1950 TP_ARGS(ip, which),
1951 TP_STRUCT__entry(
1952 __field(dev_t, dev)
1953 __field(int, which)
1954 __field(xfs_ino_t, ino)
1955 __field(int, format)
1956 __field(int, nex)
Dave Chinner3a85cd92010-01-14 01:33:55 +00001957 __field(int, broot_size)
1958 __field(int, fork_off)
1959 ),
1960 TP_fast_assign(
1961 __entry->dev = VFS_I(ip)->i_sb->s_dev;
1962 __entry->which = which;
1963 __entry->ino = ip->i_ino;
1964 __entry->format = ip->i_d.di_format;
1965 __entry->nex = ip->i_d.di_nextents;
Dave Chinner3a85cd92010-01-14 01:33:55 +00001966 __entry->broot_size = ip->i_df.if_broot_bytes;
1967 __entry->fork_off = XFS_IFORK_BOFF(ip);
1968 ),
1969 TP_printk("dev %d:%d ino 0x%llx (%s), %s format, num_extents %d, "
Christoph Hellwig8096b1e2011-12-18 20:00:07 +00001970 "broot size %d, fork offset %d",
Dave Chinner3a85cd92010-01-14 01:33:55 +00001971 MAJOR(__entry->dev), MINOR(__entry->dev),
1972 __entry->ino,
1973 __print_symbolic(__entry->which, XFS_SWAPEXT_INODES),
1974 __print_symbolic(__entry->format, XFS_INODE_FORMAT_STR),
1975 __entry->nex,
Dave Chinner3a85cd92010-01-14 01:33:55 +00001976 __entry->broot_size,
1977 __entry->fork_off)
1978)
1979
1980#define DEFINE_SWAPEXT_EVENT(name) \
1981DEFINE_EVENT(xfs_swap_extent_class, name, \
1982 TP_PROTO(struct xfs_inode *ip, int which), \
1983 TP_ARGS(ip, which))
1984
1985DEFINE_SWAPEXT_EVENT(xfs_swap_extent_before);
1986DEFINE_SWAPEXT_EVENT(xfs_swap_extent_after);
1987
Brian Fostere67d3d42017-08-08 18:21:53 -07001988TRACE_EVENT(xfs_log_recover,
1989 TP_PROTO(struct xlog *log, xfs_daddr_t headblk, xfs_daddr_t tailblk),
1990 TP_ARGS(log, headblk, tailblk),
1991 TP_STRUCT__entry(
1992 __field(dev_t, dev)
1993 __field(xfs_daddr_t, headblk)
1994 __field(xfs_daddr_t, tailblk)
1995 ),
1996 TP_fast_assign(
1997 __entry->dev = log->l_mp->m_super->s_dev;
1998 __entry->headblk = headblk;
1999 __entry->tailblk = tailblk;
2000 ),
2001 TP_printk("dev %d:%d headblk 0x%llx tailblk 0x%llx",
2002 MAJOR(__entry->dev), MINOR(__entry->dev), __entry->headblk,
2003 __entry->tailblk)
2004)
2005
Brian Foster5cd9cee2016-09-26 08:34:52 +10002006TRACE_EVENT(xfs_log_recover_record,
2007 TP_PROTO(struct xlog *log, struct xlog_rec_header *rhead, int pass),
2008 TP_ARGS(log, rhead, pass),
2009 TP_STRUCT__entry(
2010 __field(dev_t, dev)
2011 __field(xfs_lsn_t, lsn)
2012 __field(int, len)
2013 __field(int, num_logops)
2014 __field(int, pass)
2015 ),
2016 TP_fast_assign(
2017 __entry->dev = log->l_mp->m_super->s_dev;
2018 __entry->lsn = be64_to_cpu(rhead->h_lsn);
2019 __entry->len = be32_to_cpu(rhead->h_len);
2020 __entry->num_logops = be32_to_cpu(rhead->h_num_logops);
2021 __entry->pass = pass;
2022 ),
2023 TP_printk("dev %d:%d lsn 0x%llx len 0x%x num_logops 0x%x pass %d",
2024 MAJOR(__entry->dev), MINOR(__entry->dev),
2025 __entry->lsn, __entry->len, __entry->num_logops,
2026 __entry->pass)
2027)
2028
Dave Chinner9abbc532010-04-13 15:06:46 +10002029DECLARE_EVENT_CLASS(xfs_log_recover_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002030 TP_PROTO(struct xlog *log, struct xlog_recover *trans,
Dave Chinner9abbc532010-04-13 15:06:46 +10002031 struct xlog_recover_item *item, int pass),
2032 TP_ARGS(log, trans, item, pass),
2033 TP_STRUCT__entry(
2034 __field(dev_t, dev)
2035 __field(unsigned long, item)
2036 __field(xlog_tid_t, tid)
Brian Foster5cd9cee2016-09-26 08:34:52 +10002037 __field(xfs_lsn_t, lsn)
Dave Chinner9abbc532010-04-13 15:06:46 +10002038 __field(int, type)
2039 __field(int, pass)
2040 __field(int, count)
2041 __field(int, total)
2042 ),
2043 TP_fast_assign(
2044 __entry->dev = log->l_mp->m_super->s_dev;
2045 __entry->item = (unsigned long)item;
2046 __entry->tid = trans->r_log_tid;
Brian Foster5cd9cee2016-09-26 08:34:52 +10002047 __entry->lsn = trans->r_lsn;
Dave Chinner9abbc532010-04-13 15:06:46 +10002048 __entry->type = ITEM_TYPE(item);
2049 __entry->pass = pass;
2050 __entry->count = item->ri_cnt;
2051 __entry->total = item->ri_total;
2052 ),
Brian Foster5cd9cee2016-09-26 08:34:52 +10002053 TP_printk("dev %d:%d tid 0x%x lsn 0x%llx, pass %d, item 0x%p, "
2054 "item type %s item region count/total %d/%d",
Dave Chinner9abbc532010-04-13 15:06:46 +10002055 MAJOR(__entry->dev), MINOR(__entry->dev),
2056 __entry->tid,
Brian Foster5cd9cee2016-09-26 08:34:52 +10002057 __entry->lsn,
Dave Chinner9abbc532010-04-13 15:06:46 +10002058 __entry->pass,
2059 (void *)__entry->item,
2060 __print_symbolic(__entry->type, XFS_LI_TYPE_DESC),
2061 __entry->count,
2062 __entry->total)
2063)
2064
2065#define DEFINE_LOG_RECOVER_ITEM(name) \
2066DEFINE_EVENT(xfs_log_recover_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002067 TP_PROTO(struct xlog *log, struct xlog_recover *trans, \
Dave Chinner9abbc532010-04-13 15:06:46 +10002068 struct xlog_recover_item *item, int pass), \
2069 TP_ARGS(log, trans, item, pass))
2070
2071DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add);
2072DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_add_cont);
2073DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_head);
2074DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_reorder_tail);
2075DEFINE_LOG_RECOVER_ITEM(xfs_log_recover_item_recover);
2076
2077DECLARE_EVENT_CLASS(xfs_log_recover_buf_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002078 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002079 TP_ARGS(log, buf_f),
2080 TP_STRUCT__entry(
2081 __field(dev_t, dev)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002082 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002083 __field(unsigned short, len)
2084 __field(unsigned short, flags)
2085 __field(unsigned short, size)
2086 __field(unsigned int, map_size)
2087 ),
2088 TP_fast_assign(
2089 __entry->dev = log->l_mp->m_super->s_dev;
2090 __entry->blkno = buf_f->blf_blkno;
2091 __entry->len = buf_f->blf_len;
2092 __entry->flags = buf_f->blf_flags;
2093 __entry->size = buf_f->blf_size;
2094 __entry->map_size = buf_f->blf_map_size;
2095 ),
2096 TP_printk("dev %d:%d blkno 0x%llx, len %u, flags 0x%x, size %d, "
2097 "map_size %d",
2098 MAJOR(__entry->dev), MINOR(__entry->dev),
2099 __entry->blkno,
2100 __entry->len,
2101 __entry->flags,
2102 __entry->size,
2103 __entry->map_size)
2104)
2105
2106#define DEFINE_LOG_RECOVER_BUF_ITEM(name) \
2107DEFINE_EVENT(xfs_log_recover_buf_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002108 TP_PROTO(struct xlog *log, struct xfs_buf_log_format *buf_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002109 TP_ARGS(log, buf_f))
2110
2111DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_not_cancel);
2112DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel);
2113DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_add);
2114DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_cancel_ref_inc);
2115DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_recover);
Brian Foster5cd9cee2016-09-26 08:34:52 +10002116DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_skip);
Dave Chinner9abbc532010-04-13 15:06:46 +10002117DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_inode_buf);
2118DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_reg_buf);
2119DEFINE_LOG_RECOVER_BUF_ITEM(xfs_log_recover_buf_dquot_buf);
2120
2121DECLARE_EVENT_CLASS(xfs_log_recover_ino_item_class,
Mark Tinguelyad223e62012-06-14 09:22:15 -05002122 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f),
Dave Chinner9abbc532010-04-13 15:06:46 +10002123 TP_ARGS(log, in_f),
2124 TP_STRUCT__entry(
2125 __field(dev_t, dev)
2126 __field(xfs_ino_t, ino)
2127 __field(unsigned short, size)
2128 __field(int, fields)
2129 __field(unsigned short, asize)
2130 __field(unsigned short, dsize)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07002131 __field(int64_t, blkno)
Dave Chinner9abbc532010-04-13 15:06:46 +10002132 __field(int, len)
2133 __field(int, boffset)
2134 ),
2135 TP_fast_assign(
2136 __entry->dev = log->l_mp->m_super->s_dev;
2137 __entry->ino = in_f->ilf_ino;
2138 __entry->size = in_f->ilf_size;
2139 __entry->fields = in_f->ilf_fields;
2140 __entry->asize = in_f->ilf_asize;
2141 __entry->dsize = in_f->ilf_dsize;
2142 __entry->blkno = in_f->ilf_blkno;
2143 __entry->len = in_f->ilf_len;
2144 __entry->boffset = in_f->ilf_boffset;
2145 ),
2146 TP_printk("dev %d:%d ino 0x%llx, size %u, fields 0x%x, asize %d, "
2147 "dsize %d, blkno 0x%llx, len %d, boffset %d",
2148 MAJOR(__entry->dev), MINOR(__entry->dev),
2149 __entry->ino,
2150 __entry->size,
2151 __entry->fields,
2152 __entry->asize,
2153 __entry->dsize,
2154 __entry->blkno,
2155 __entry->len,
2156 __entry->boffset)
2157)
2158#define DEFINE_LOG_RECOVER_INO_ITEM(name) \
2159DEFINE_EVENT(xfs_log_recover_ino_item_class, name, \
Mark Tinguelyad223e62012-06-14 09:22:15 -05002160 TP_PROTO(struct xlog *log, struct xfs_inode_log_format *in_f), \
Dave Chinner9abbc532010-04-13 15:06:46 +10002161 TP_ARGS(log, in_f))
2162
2163DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_recover);
2164DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_cancel);
2165DEFINE_LOG_RECOVER_INO_ITEM(xfs_log_recover_inode_skip);
2166
Brian Foster78d57e42015-08-19 09:58:48 +10002167DECLARE_EVENT_CLASS(xfs_log_recover_icreate_item_class,
2168 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f),
2169 TP_ARGS(log, in_f),
2170 TP_STRUCT__entry(
2171 __field(dev_t, dev)
2172 __field(xfs_agnumber_t, agno)
2173 __field(xfs_agblock_t, agbno)
2174 __field(unsigned int, count)
2175 __field(unsigned int, isize)
2176 __field(xfs_agblock_t, length)
2177 __field(unsigned int, gen)
2178 ),
2179 TP_fast_assign(
2180 __entry->dev = log->l_mp->m_super->s_dev;
2181 __entry->agno = be32_to_cpu(in_f->icl_ag);
2182 __entry->agbno = be32_to_cpu(in_f->icl_agbno);
2183 __entry->count = be32_to_cpu(in_f->icl_count);
2184 __entry->isize = be32_to_cpu(in_f->icl_isize);
2185 __entry->length = be32_to_cpu(in_f->icl_length);
2186 __entry->gen = be32_to_cpu(in_f->icl_gen);
2187 ),
2188 TP_printk("dev %d:%d agno %u agbno %u count %u isize %u length %u "
2189 "gen %u", MAJOR(__entry->dev), MINOR(__entry->dev),
2190 __entry->agno, __entry->agbno, __entry->count, __entry->isize,
2191 __entry->length, __entry->gen)
2192)
2193#define DEFINE_LOG_RECOVER_ICREATE_ITEM(name) \
2194DEFINE_EVENT(xfs_log_recover_icreate_item_class, name, \
2195 TP_PROTO(struct xlog *log, struct xfs_icreate_log *in_f), \
2196 TP_ARGS(log, in_f))
2197
2198DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_cancel);
2199DEFINE_LOG_RECOVER_ICREATE_ITEM(xfs_log_recover_icreate_recover);
2200
Christoph Hellwiga46db602011-01-07 13:02:04 +00002201DECLARE_EVENT_CLASS(xfs_discard_class,
2202 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2203 xfs_agblock_t agbno, xfs_extlen_t len),
2204 TP_ARGS(mp, agno, agbno, len),
2205 TP_STRUCT__entry(
2206 __field(dev_t, dev)
2207 __field(xfs_agnumber_t, agno)
2208 __field(xfs_agblock_t, agbno)
2209 __field(xfs_extlen_t, len)
2210 ),
2211 TP_fast_assign(
2212 __entry->dev = mp->m_super->s_dev;
2213 __entry->agno = agno;
2214 __entry->agbno = agbno;
2215 __entry->len = len;
2216 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002217 TP_printk("dev %d:%d agno %u agbno %u len %u",
Christoph Hellwiga46db602011-01-07 13:02:04 +00002218 MAJOR(__entry->dev), MINOR(__entry->dev),
2219 __entry->agno,
2220 __entry->agbno,
2221 __entry->len)
2222)
2223
2224#define DEFINE_DISCARD_EVENT(name) \
2225DEFINE_EVENT(xfs_discard_class, name, \
2226 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2227 xfs_agblock_t agbno, xfs_extlen_t len), \
2228 TP_ARGS(mp, agno, agbno, len))
2229DEFINE_DISCARD_EVENT(xfs_discard_extent);
2230DEFINE_DISCARD_EVENT(xfs_discard_toosmall);
2231DEFINE_DISCARD_EVENT(xfs_discard_exclude);
2232DEFINE_DISCARD_EVENT(xfs_discard_busy);
2233
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002234/* btree cursor events */
2235DECLARE_EVENT_CLASS(xfs_btree_cur_class,
2236 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp),
2237 TP_ARGS(cur, level, bp),
2238 TP_STRUCT__entry(
2239 __field(dev_t, dev)
2240 __field(xfs_btnum_t, btnum)
2241 __field(int, level)
2242 __field(int, nlevels)
2243 __field(int, ptr)
2244 __field(xfs_daddr_t, daddr)
2245 ),
2246 TP_fast_assign(
2247 __entry->dev = cur->bc_mp->m_super->s_dev;
2248 __entry->btnum = cur->bc_btnum;
2249 __entry->level = level;
2250 __entry->nlevels = cur->bc_nlevels;
2251 __entry->ptr = cur->bc_ptrs[level];
2252 __entry->daddr = bp ? bp->b_bn : -1;
2253 ),
2254 TP_printk("dev %d:%d btnum %d level %d/%d ptr %d daddr 0x%llx",
2255 MAJOR(__entry->dev), MINOR(__entry->dev),
2256 __entry->btnum,
2257 __entry->level,
2258 __entry->nlevels,
2259 __entry->ptr,
2260 (unsigned long long)__entry->daddr)
2261)
2262
2263#define DEFINE_BTREE_CUR_EVENT(name) \
2264DEFINE_EVENT(xfs_btree_cur_class, name, \
2265 TP_PROTO(struct xfs_btree_cur *cur, int level, struct xfs_buf *bp), \
2266 TP_ARGS(cur, level, bp))
2267DEFINE_BTREE_CUR_EVENT(xfs_btree_updkeys);
Darrick J. Wong105f7d82016-08-03 11:10:21 +10002268DEFINE_BTREE_CUR_EVENT(xfs_btree_overlapped_query_range);
Darrick J. Wong2c813ad2016-08-03 11:08:36 +10002269
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002270/* deferred ops */
2271struct xfs_defer_pending;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002272struct xfs_defer_ops;
2273
2274DECLARE_EVENT_CLASS(xfs_defer_class,
2275 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop),
2276 TP_ARGS(mp, dop),
2277 TP_STRUCT__entry(
2278 __field(dev_t, dev)
2279 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002280 __field(char, committed)
2281 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002282 ),
2283 TP_fast_assign(
2284 __entry->dev = mp ? mp->m_super->s_dev : 0;
2285 __entry->dop = dop;
2286 __entry->committed = dop->dop_committed;
2287 __entry->low = dop->dop_low;
2288 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002289 TP_printk("dev %d:%d ops %p committed %d low %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002290 MAJOR(__entry->dev), MINOR(__entry->dev),
2291 __entry->dop,
2292 __entry->committed,
2293 __entry->low)
2294)
2295#define DEFINE_DEFER_EVENT(name) \
2296DEFINE_EVENT(xfs_defer_class, name, \
2297 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop), \
2298 TP_ARGS(mp, dop))
2299
2300DECLARE_EVENT_CLASS(xfs_defer_error_class,
2301 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error),
2302 TP_ARGS(mp, dop, error),
2303 TP_STRUCT__entry(
2304 __field(dev_t, dev)
2305 __field(void *, dop)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002306 __field(char, committed)
2307 __field(char, low)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002308 __field(int, error)
2309 ),
2310 TP_fast_assign(
2311 __entry->dev = mp ? mp->m_super->s_dev : 0;
2312 __entry->dop = dop;
2313 __entry->committed = dop->dop_committed;
2314 __entry->low = dop->dop_low;
2315 __entry->error = error;
2316 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002317 TP_printk("dev %d:%d ops %p committed %d low %d err %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002318 MAJOR(__entry->dev), MINOR(__entry->dev),
2319 __entry->dop,
2320 __entry->committed,
2321 __entry->low,
2322 __entry->error)
2323)
2324#define DEFINE_DEFER_ERROR_EVENT(name) \
2325DEFINE_EVENT(xfs_defer_error_class, name, \
2326 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_ops *dop, int error), \
2327 TP_ARGS(mp, dop, error))
2328
2329DECLARE_EVENT_CLASS(xfs_defer_pending_class,
2330 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp),
2331 TP_ARGS(mp, dfp),
2332 TP_STRUCT__entry(
2333 __field(dev_t, dev)
2334 __field(int, type)
2335 __field(void *, intent)
Christoph Hellwig3f88a152017-04-21 11:24:42 -07002336 __field(char, committed)
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002337 __field(int, nr)
2338 ),
2339 TP_fast_assign(
2340 __entry->dev = mp ? mp->m_super->s_dev : 0;
2341 __entry->type = dfp->dfp_type->type;
2342 __entry->intent = dfp->dfp_intent;
Darrick J. Wongea78d802016-08-30 13:51:39 +10002343 __entry->committed = dfp->dfp_done != NULL;
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002344 __entry->nr = dfp->dfp_count;
2345 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002346 TP_printk("dev %d:%d optype %d intent %p committed %d nr %d",
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002347 MAJOR(__entry->dev), MINOR(__entry->dev),
2348 __entry->type,
2349 __entry->intent,
2350 __entry->committed,
2351 __entry->nr)
2352)
2353#define DEFINE_DEFER_PENDING_EVENT(name) \
2354DEFINE_EVENT(xfs_defer_pending_class, name, \
2355 TP_PROTO(struct xfs_mount *mp, struct xfs_defer_pending *dfp), \
2356 TP_ARGS(mp, dfp))
2357
2358DECLARE_EVENT_CLASS(xfs_phys_extent_deferred_class,
2359 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2360 int type, xfs_agblock_t agbno, xfs_extlen_t len),
2361 TP_ARGS(mp, agno, type, agbno, len),
2362 TP_STRUCT__entry(
2363 __field(dev_t, dev)
2364 __field(xfs_agnumber_t, agno)
2365 __field(int, type)
2366 __field(xfs_agblock_t, agbno)
2367 __field(xfs_extlen_t, len)
2368 ),
2369 TP_fast_assign(
2370 __entry->dev = mp->m_super->s_dev;
2371 __entry->agno = agno;
2372 __entry->type = type;
2373 __entry->agbno = agbno;
2374 __entry->len = len;
2375 ),
2376 TP_printk("dev %d:%d op %d agno %u agbno %u len %u",
2377 MAJOR(__entry->dev), MINOR(__entry->dev),
2378 __entry->type,
2379 __entry->agno,
2380 __entry->agbno,
2381 __entry->len)
2382);
2383#define DEFINE_PHYS_EXTENT_DEFERRED_EVENT(name) \
2384DEFINE_EVENT(xfs_phys_extent_deferred_class, name, \
2385 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2386 int type, \
2387 xfs_agblock_t bno, \
2388 xfs_extlen_t len), \
2389 TP_ARGS(mp, agno, type, bno, len))
2390
2391DECLARE_EVENT_CLASS(xfs_map_extent_deferred_class,
2392 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2393 int op,
2394 xfs_agblock_t agbno,
2395 xfs_ino_t ino,
2396 int whichfork,
2397 xfs_fileoff_t offset,
2398 xfs_filblks_t len,
2399 xfs_exntst_t state),
2400 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state),
2401 TP_STRUCT__entry(
2402 __field(dev_t, dev)
2403 __field(xfs_agnumber_t, agno)
2404 __field(xfs_ino_t, ino)
2405 __field(xfs_agblock_t, agbno)
2406 __field(int, whichfork)
2407 __field(xfs_fileoff_t, l_loff)
2408 __field(xfs_filblks_t, l_len)
2409 __field(xfs_exntst_t, l_state)
2410 __field(int, op)
2411 ),
2412 TP_fast_assign(
2413 __entry->dev = mp->m_super->s_dev;
2414 __entry->agno = agno;
2415 __entry->ino = ino;
2416 __entry->agbno = agbno;
2417 __entry->whichfork = whichfork;
2418 __entry->l_loff = offset;
2419 __entry->l_len = len;
2420 __entry->l_state = state;
2421 __entry->op = op;
2422 ),
2423 TP_printk("dev %d:%d op %d agno %u agbno %u owner %lld %s offset %llu len %llu state %d",
2424 MAJOR(__entry->dev), MINOR(__entry->dev),
2425 __entry->op,
2426 __entry->agno,
2427 __entry->agbno,
2428 __entry->ino,
2429 __entry->whichfork == XFS_ATTR_FORK ? "attr" : "data",
2430 __entry->l_loff,
2431 __entry->l_len,
2432 __entry->l_state)
2433);
2434#define DEFINE_MAP_EXTENT_DEFERRED_EVENT(name) \
2435DEFINE_EVENT(xfs_map_extent_deferred_class, name, \
2436 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2437 int op, \
2438 xfs_agblock_t agbno, \
2439 xfs_ino_t ino, \
2440 int whichfork, \
2441 xfs_fileoff_t offset, \
2442 xfs_filblks_t len, \
2443 xfs_exntst_t state), \
2444 TP_ARGS(mp, agno, op, agbno, ino, whichfork, offset, len, state))
2445
2446DEFINE_DEFER_EVENT(xfs_defer_init);
2447DEFINE_DEFER_EVENT(xfs_defer_cancel);
2448DEFINE_DEFER_EVENT(xfs_defer_trans_roll);
2449DEFINE_DEFER_EVENT(xfs_defer_trans_abort);
2450DEFINE_DEFER_EVENT(xfs_defer_finish);
2451DEFINE_DEFER_EVENT(xfs_defer_finish_done);
2452
2453DEFINE_DEFER_ERROR_EVENT(xfs_defer_trans_roll_error);
2454DEFINE_DEFER_ERROR_EVENT(xfs_defer_finish_error);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002455
2456DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_work);
2457DEFINE_DEFER_PENDING_EVENT(xfs_defer_intake_cancel);
Darrick J. Wong3cd48ab2016-08-03 11:13:02 +10002458DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_cancel);
2459DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_finish);
2460DEFINE_DEFER_PENDING_EVENT(xfs_defer_pending_abort);
2461
Darrick J. Wongba9e7802016-08-03 11:26:33 +10002462#define DEFINE_BMAP_FREE_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2463DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_defer);
2464DEFINE_BMAP_FREE_DEFERRED_EVENT(xfs_bmap_free_deferred);
2465
Darrick J. Wong673930c2016-08-03 11:33:43 +10002466/* rmap tracepoints */
2467DECLARE_EVENT_CLASS(xfs_rmap_class,
2468 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2469 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten,
2470 struct xfs_owner_info *oinfo),
2471 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo),
2472 TP_STRUCT__entry(
2473 __field(dev_t, dev)
2474 __field(xfs_agnumber_t, agno)
2475 __field(xfs_agblock_t, agbno)
2476 __field(xfs_extlen_t, len)
2477 __field(uint64_t, owner)
2478 __field(uint64_t, offset)
2479 __field(unsigned long, flags)
2480 ),
2481 TP_fast_assign(
2482 __entry->dev = mp->m_super->s_dev;
2483 __entry->agno = agno;
2484 __entry->agbno = agbno;
2485 __entry->len = len;
2486 __entry->owner = oinfo->oi_owner;
2487 __entry->offset = oinfo->oi_offset;
2488 __entry->flags = oinfo->oi_flags;
Darrick J. Wong035e00a2016-08-03 11:36:07 +10002489 if (unwritten)
2490 __entry->flags |= XFS_RMAP_UNWRITTEN;
Darrick J. Wong673930c2016-08-03 11:33:43 +10002491 ),
2492 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%lx",
2493 MAJOR(__entry->dev), MINOR(__entry->dev),
2494 __entry->agno,
2495 __entry->agbno,
2496 __entry->len,
2497 __entry->owner,
2498 __entry->offset,
2499 __entry->flags)
2500);
2501#define DEFINE_RMAP_EVENT(name) \
2502DEFINE_EVENT(xfs_rmap_class, name, \
2503 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2504 xfs_agblock_t agbno, xfs_extlen_t len, bool unwritten, \
2505 struct xfs_owner_info *oinfo), \
2506 TP_ARGS(mp, agno, agbno, len, unwritten, oinfo))
2507
2508/* simple AG-based error/%ip tracepoint class */
2509DECLARE_EVENT_CLASS(xfs_ag_error_class,
2510 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error,
2511 unsigned long caller_ip),
2512 TP_ARGS(mp, agno, error, caller_ip),
2513 TP_STRUCT__entry(
2514 __field(dev_t, dev)
2515 __field(xfs_agnumber_t, agno)
2516 __field(int, error)
2517 __field(unsigned long, caller_ip)
2518 ),
2519 TP_fast_assign(
2520 __entry->dev = mp->m_super->s_dev;
2521 __entry->agno = agno;
2522 __entry->error = error;
2523 __entry->caller_ip = caller_ip;
2524 ),
2525 TP_printk("dev %d:%d agno %u error %d caller %ps",
2526 MAJOR(__entry->dev), MINOR(__entry->dev),
2527 __entry->agno,
2528 __entry->error,
2529 (char *)__entry->caller_ip)
2530);
2531
2532#define DEFINE_AG_ERROR_EVENT(name) \
2533DEFINE_EVENT(xfs_ag_error_class, name, \
2534 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, int error, \
2535 unsigned long caller_ip), \
2536 TP_ARGS(mp, agno, error, caller_ip))
2537
2538DEFINE_RMAP_EVENT(xfs_rmap_unmap);
2539DEFINE_RMAP_EVENT(xfs_rmap_unmap_done);
2540DEFINE_AG_ERROR_EVENT(xfs_rmap_unmap_error);
2541DEFINE_RMAP_EVENT(xfs_rmap_map);
2542DEFINE_RMAP_EVENT(xfs_rmap_map_done);
2543DEFINE_AG_ERROR_EVENT(xfs_rmap_map_error);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002544DEFINE_RMAP_EVENT(xfs_rmap_convert);
2545DEFINE_RMAP_EVENT(xfs_rmap_convert_done);
2546DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_error);
2547DEFINE_AG_ERROR_EVENT(xfs_rmap_convert_state);
Darrick J. Wong673930c2016-08-03 11:33:43 +10002548
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002549DECLARE_EVENT_CLASS(xfs_rmapbt_class,
2550 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2551 xfs_agblock_t agbno, xfs_extlen_t len,
2552 uint64_t owner, uint64_t offset, unsigned int flags),
2553 TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
2554 TP_STRUCT__entry(
2555 __field(dev_t, dev)
2556 __field(xfs_agnumber_t, agno)
2557 __field(xfs_agblock_t, agbno)
2558 __field(xfs_extlen_t, len)
2559 __field(uint64_t, owner)
2560 __field(uint64_t, offset)
2561 __field(unsigned int, flags)
2562 ),
2563 TP_fast_assign(
2564 __entry->dev = mp->m_super->s_dev;
2565 __entry->agno = agno;
2566 __entry->agbno = agbno;
2567 __entry->len = len;
2568 __entry->owner = owner;
2569 __entry->offset = offset;
2570 __entry->flags = flags;
2571 ),
2572 TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
2573 MAJOR(__entry->dev), MINOR(__entry->dev),
2574 __entry->agno,
2575 __entry->agbno,
2576 __entry->len,
2577 __entry->owner,
2578 __entry->offset,
2579 __entry->flags)
2580);
2581#define DEFINE_RMAPBT_EVENT(name) \
2582DEFINE_EVENT(xfs_rmapbt_class, name, \
2583 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2584 xfs_agblock_t agbno, xfs_extlen_t len, \
2585 uint64_t owner, uint64_t offset, unsigned int flags), \
2586 TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2587
2588#define DEFINE_RMAP_DEFERRED_EVENT DEFINE_MAP_EXTENT_DEFERRED_EVENT
2589DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_defer);
2590DEFINE_RMAP_DEFERRED_EVENT(xfs_rmap_deferred);
2591
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002592DEFINE_BUSY_EVENT(xfs_rmapbt_alloc_block);
2593DEFINE_BUSY_EVENT(xfs_rmapbt_free_block);
Darrick J. Wongaa966d82016-08-03 11:43:24 +10002594DEFINE_RMAPBT_EVENT(xfs_rmap_update);
2595DEFINE_RMAPBT_EVENT(xfs_rmap_insert);
2596DEFINE_RMAPBT_EVENT(xfs_rmap_delete);
2597DEFINE_AG_ERROR_EVENT(xfs_rmap_insert_error);
2598DEFINE_AG_ERROR_EVENT(xfs_rmap_delete_error);
2599DEFINE_AG_ERROR_EVENT(xfs_rmap_update_error);
Darrick J. Wongceeb9c82016-10-03 09:11:48 -07002600
2601DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_candidate);
2602DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_query);
2603DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_candidate);
2604DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range);
Darrick J. Wong0a1b0b32016-08-03 11:44:21 +10002605DEFINE_RMAPBT_EVENT(xfs_rmap_lookup_le_range_result);
2606DEFINE_RMAPBT_EVENT(xfs_rmap_find_right_neighbor_result);
Darrick J. Wongfb7d9262016-08-03 12:03:19 +10002607DEFINE_RMAPBT_EVENT(xfs_rmap_find_left_neighbor_result);
Darrick J. Wong4b8ed672016-08-03 11:39:05 +10002608
Darrick J. Wong9f3afb52016-10-03 09:11:28 -07002609/* deferred bmbt updates */
2610#define DEFINE_BMAP_DEFERRED_EVENT DEFINE_RMAP_DEFERRED_EVENT
2611DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_defer);
2612DEFINE_BMAP_DEFERRED_EVENT(xfs_bmap_deferred);
2613
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002614/* per-AG reservation */
2615DECLARE_EVENT_CLASS(xfs_ag_resv_class,
2616 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type resv,
2617 xfs_extlen_t len),
2618 TP_ARGS(pag, resv, len),
2619 TP_STRUCT__entry(
2620 __field(dev_t, dev)
2621 __field(xfs_agnumber_t, agno)
2622 __field(int, resv)
2623 __field(xfs_extlen_t, freeblks)
2624 __field(xfs_extlen_t, flcount)
2625 __field(xfs_extlen_t, reserved)
2626 __field(xfs_extlen_t, asked)
2627 __field(xfs_extlen_t, len)
2628 ),
2629 TP_fast_assign(
2630 struct xfs_ag_resv *r = xfs_perag_resv(pag, resv);
2631
2632 __entry->dev = pag->pag_mount->m_super->s_dev;
2633 __entry->agno = pag->pag_agno;
2634 __entry->resv = resv;
2635 __entry->freeblks = pag->pagf_freeblks;
2636 __entry->flcount = pag->pagf_flcount;
2637 __entry->reserved = r ? r->ar_reserved : 0;
2638 __entry->asked = r ? r->ar_asked : 0;
2639 __entry->len = len;
2640 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002641 TP_printk("dev %d:%d agno %u resv %d freeblks %u flcount %u "
2642 "resv %u ask %u len %u",
Darrick J. Wong3fd129b2016-09-19 10:30:52 +10002643 MAJOR(__entry->dev), MINOR(__entry->dev),
2644 __entry->agno,
2645 __entry->resv,
2646 __entry->freeblks,
2647 __entry->flcount,
2648 __entry->reserved,
2649 __entry->asked,
2650 __entry->len)
2651)
2652#define DEFINE_AG_RESV_EVENT(name) \
2653DEFINE_EVENT(xfs_ag_resv_class, name, \
2654 TP_PROTO(struct xfs_perag *pag, enum xfs_ag_resv_type type, \
2655 xfs_extlen_t len), \
2656 TP_ARGS(pag, type, len))
2657
2658/* per-AG reservation tracepoints */
2659DEFINE_AG_RESV_EVENT(xfs_ag_resv_init);
2660DEFINE_AG_RESV_EVENT(xfs_ag_resv_free);
2661DEFINE_AG_RESV_EVENT(xfs_ag_resv_alloc_extent);
2662DEFINE_AG_RESV_EVENT(xfs_ag_resv_free_extent);
2663DEFINE_AG_RESV_EVENT(xfs_ag_resv_critical);
2664DEFINE_AG_RESV_EVENT(xfs_ag_resv_needed);
2665
2666DEFINE_AG_ERROR_EVENT(xfs_ag_resv_free_error);
2667DEFINE_AG_ERROR_EVENT(xfs_ag_resv_init_error);
2668
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002669/* refcount tracepoint classes */
2670
2671/* reuse the discard trace class for agbno/aglen-based traces */
2672#define DEFINE_AG_EXTENT_EVENT(name) DEFINE_DISCARD_EVENT(name)
2673
2674/* ag btree lookup tracepoint class */
2675#define XFS_AG_BTREE_CMP_FORMAT_STR \
2676 { XFS_LOOKUP_EQ, "eq" }, \
2677 { XFS_LOOKUP_LE, "le" }, \
2678 { XFS_LOOKUP_GE, "ge" }
2679DECLARE_EVENT_CLASS(xfs_ag_btree_lookup_class,
2680 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2681 xfs_agblock_t agbno, xfs_lookup_t dir),
2682 TP_ARGS(mp, agno, agbno, dir),
2683 TP_STRUCT__entry(
2684 __field(dev_t, dev)
2685 __field(xfs_agnumber_t, agno)
2686 __field(xfs_agblock_t, agbno)
2687 __field(xfs_lookup_t, dir)
2688 ),
2689 TP_fast_assign(
2690 __entry->dev = mp->m_super->s_dev;
2691 __entry->agno = agno;
2692 __entry->agbno = agbno;
2693 __entry->dir = dir;
2694 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002695 TP_printk("dev %d:%d agno %u agbno %u cmp %s(%d)",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002696 MAJOR(__entry->dev), MINOR(__entry->dev),
2697 __entry->agno,
2698 __entry->agbno,
2699 __print_symbolic(__entry->dir, XFS_AG_BTREE_CMP_FORMAT_STR),
2700 __entry->dir)
2701)
2702
2703#define DEFINE_AG_BTREE_LOOKUP_EVENT(name) \
2704DEFINE_EVENT(xfs_ag_btree_lookup_class, name, \
2705 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2706 xfs_agblock_t agbno, xfs_lookup_t dir), \
2707 TP_ARGS(mp, agno, agbno, dir))
2708
2709/* single-rcext tracepoint class */
2710DECLARE_EVENT_CLASS(xfs_refcount_extent_class,
2711 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2712 struct xfs_refcount_irec *irec),
2713 TP_ARGS(mp, agno, irec),
2714 TP_STRUCT__entry(
2715 __field(dev_t, dev)
2716 __field(xfs_agnumber_t, agno)
2717 __field(xfs_agblock_t, startblock)
2718 __field(xfs_extlen_t, blockcount)
2719 __field(xfs_nlink_t, refcount)
2720 ),
2721 TP_fast_assign(
2722 __entry->dev = mp->m_super->s_dev;
2723 __entry->agno = agno;
2724 __entry->startblock = irec->rc_startblock;
2725 __entry->blockcount = irec->rc_blockcount;
2726 __entry->refcount = irec->rc_refcount;
2727 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002728 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002729 MAJOR(__entry->dev), MINOR(__entry->dev),
2730 __entry->agno,
2731 __entry->startblock,
2732 __entry->blockcount,
2733 __entry->refcount)
2734)
2735
2736#define DEFINE_REFCOUNT_EXTENT_EVENT(name) \
2737DEFINE_EVENT(xfs_refcount_extent_class, name, \
2738 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2739 struct xfs_refcount_irec *irec), \
2740 TP_ARGS(mp, agno, irec))
2741
2742/* single-rcext and an agbno tracepoint class */
2743DECLARE_EVENT_CLASS(xfs_refcount_extent_at_class,
2744 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2745 struct xfs_refcount_irec *irec, xfs_agblock_t agbno),
2746 TP_ARGS(mp, agno, irec, agbno),
2747 TP_STRUCT__entry(
2748 __field(dev_t, dev)
2749 __field(xfs_agnumber_t, agno)
2750 __field(xfs_agblock_t, startblock)
2751 __field(xfs_extlen_t, blockcount)
2752 __field(xfs_nlink_t, refcount)
2753 __field(xfs_agblock_t, agbno)
2754 ),
2755 TP_fast_assign(
2756 __entry->dev = mp->m_super->s_dev;
2757 __entry->agno = agno;
2758 __entry->startblock = irec->rc_startblock;
2759 __entry->blockcount = irec->rc_blockcount;
2760 __entry->refcount = irec->rc_refcount;
2761 __entry->agbno = agbno;
2762 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07002763 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002764 MAJOR(__entry->dev), MINOR(__entry->dev),
2765 __entry->agno,
2766 __entry->startblock,
2767 __entry->blockcount,
2768 __entry->refcount,
2769 __entry->agbno)
2770)
2771
2772#define DEFINE_REFCOUNT_EXTENT_AT_EVENT(name) \
2773DEFINE_EVENT(xfs_refcount_extent_at_class, name, \
2774 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2775 struct xfs_refcount_irec *irec, xfs_agblock_t agbno), \
2776 TP_ARGS(mp, agno, irec, agbno))
2777
2778/* double-rcext tracepoint class */
2779DECLARE_EVENT_CLASS(xfs_refcount_double_extent_class,
2780 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2781 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2),
2782 TP_ARGS(mp, agno, i1, i2),
2783 TP_STRUCT__entry(
2784 __field(dev_t, dev)
2785 __field(xfs_agnumber_t, agno)
2786 __field(xfs_agblock_t, i1_startblock)
2787 __field(xfs_extlen_t, i1_blockcount)
2788 __field(xfs_nlink_t, i1_refcount)
2789 __field(xfs_agblock_t, i2_startblock)
2790 __field(xfs_extlen_t, i2_blockcount)
2791 __field(xfs_nlink_t, i2_refcount)
2792 ),
2793 TP_fast_assign(
2794 __entry->dev = mp->m_super->s_dev;
2795 __entry->agno = agno;
2796 __entry->i1_startblock = i1->rc_startblock;
2797 __entry->i1_blockcount = i1->rc_blockcount;
2798 __entry->i1_refcount = i1->rc_refcount;
2799 __entry->i2_startblock = i2->rc_startblock;
2800 __entry->i2_blockcount = i2->rc_blockcount;
2801 __entry->i2_refcount = i2->rc_refcount;
2802 ),
2803 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002804 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002805 MAJOR(__entry->dev), MINOR(__entry->dev),
2806 __entry->agno,
2807 __entry->i1_startblock,
2808 __entry->i1_blockcount,
2809 __entry->i1_refcount,
2810 __entry->i2_startblock,
2811 __entry->i2_blockcount,
2812 __entry->i2_refcount)
2813)
2814
2815#define DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(name) \
2816DEFINE_EVENT(xfs_refcount_double_extent_class, name, \
2817 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2818 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2), \
2819 TP_ARGS(mp, agno, i1, i2))
2820
2821/* double-rcext and an agbno tracepoint class */
2822DECLARE_EVENT_CLASS(xfs_refcount_double_extent_at_class,
2823 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2824 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2825 xfs_agblock_t agbno),
2826 TP_ARGS(mp, agno, i1, i2, agbno),
2827 TP_STRUCT__entry(
2828 __field(dev_t, dev)
2829 __field(xfs_agnumber_t, agno)
2830 __field(xfs_agblock_t, i1_startblock)
2831 __field(xfs_extlen_t, i1_blockcount)
2832 __field(xfs_nlink_t, i1_refcount)
2833 __field(xfs_agblock_t, i2_startblock)
2834 __field(xfs_extlen_t, i2_blockcount)
2835 __field(xfs_nlink_t, i2_refcount)
2836 __field(xfs_agblock_t, agbno)
2837 ),
2838 TP_fast_assign(
2839 __entry->dev = mp->m_super->s_dev;
2840 __entry->agno = agno;
2841 __entry->i1_startblock = i1->rc_startblock;
2842 __entry->i1_blockcount = i1->rc_blockcount;
2843 __entry->i1_refcount = i1->rc_refcount;
2844 __entry->i2_startblock = i2->rc_startblock;
2845 __entry->i2_blockcount = i2->rc_blockcount;
2846 __entry->i2_refcount = i2->rc_refcount;
2847 __entry->agbno = agbno;
2848 ),
2849 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002850 "agbno %u len %u refcount %u @ agbno %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002851 MAJOR(__entry->dev), MINOR(__entry->dev),
2852 __entry->agno,
2853 __entry->i1_startblock,
2854 __entry->i1_blockcount,
2855 __entry->i1_refcount,
2856 __entry->i2_startblock,
2857 __entry->i2_blockcount,
2858 __entry->i2_refcount,
2859 __entry->agbno)
2860)
2861
2862#define DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(name) \
2863DEFINE_EVENT(xfs_refcount_double_extent_at_class, name, \
2864 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2865 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2866 xfs_agblock_t agbno), \
2867 TP_ARGS(mp, agno, i1, i2, agbno))
2868
2869/* triple-rcext tracepoint class */
2870DECLARE_EVENT_CLASS(xfs_refcount_triple_extent_class,
2871 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2872 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2,
2873 struct xfs_refcount_irec *i3),
2874 TP_ARGS(mp, agno, i1, i2, i3),
2875 TP_STRUCT__entry(
2876 __field(dev_t, dev)
2877 __field(xfs_agnumber_t, agno)
2878 __field(xfs_agblock_t, i1_startblock)
2879 __field(xfs_extlen_t, i1_blockcount)
2880 __field(xfs_nlink_t, i1_refcount)
2881 __field(xfs_agblock_t, i2_startblock)
2882 __field(xfs_extlen_t, i2_blockcount)
2883 __field(xfs_nlink_t, i2_refcount)
2884 __field(xfs_agblock_t, i3_startblock)
2885 __field(xfs_extlen_t, i3_blockcount)
2886 __field(xfs_nlink_t, i3_refcount)
2887 ),
2888 TP_fast_assign(
2889 __entry->dev = mp->m_super->s_dev;
2890 __entry->agno = agno;
2891 __entry->i1_startblock = i1->rc_startblock;
2892 __entry->i1_blockcount = i1->rc_blockcount;
2893 __entry->i1_refcount = i1->rc_refcount;
2894 __entry->i2_startblock = i2->rc_startblock;
2895 __entry->i2_blockcount = i2->rc_blockcount;
2896 __entry->i2_refcount = i2->rc_refcount;
2897 __entry->i3_startblock = i3->rc_startblock;
2898 __entry->i3_blockcount = i3->rc_blockcount;
2899 __entry->i3_refcount = i3->rc_refcount;
2900 ),
2901 TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u -- "
2902 "agbno %u len %u refcount %u -- "
Hou Tao42bf9db2017-04-14 11:43:27 -07002903 "agbno %u len %u refcount %u",
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002904 MAJOR(__entry->dev), MINOR(__entry->dev),
2905 __entry->agno,
2906 __entry->i1_startblock,
2907 __entry->i1_blockcount,
2908 __entry->i1_refcount,
2909 __entry->i2_startblock,
2910 __entry->i2_blockcount,
2911 __entry->i2_refcount,
2912 __entry->i3_startblock,
2913 __entry->i3_blockcount,
2914 __entry->i3_refcount)
2915);
2916
2917#define DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(name) \
2918DEFINE_EVENT(xfs_refcount_triple_extent_class, name, \
2919 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2920 struct xfs_refcount_irec *i1, struct xfs_refcount_irec *i2, \
2921 struct xfs_refcount_irec *i3), \
2922 TP_ARGS(mp, agno, i1, i2, i3))
2923
2924/* refcount btree tracepoints */
2925DEFINE_BUSY_EVENT(xfs_refcountbt_alloc_block);
2926DEFINE_BUSY_EVENT(xfs_refcountbt_free_block);
2927DEFINE_AG_BTREE_LOOKUP_EVENT(xfs_refcount_lookup);
2928DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_get);
2929DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_update);
2930DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_insert);
2931DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_delete);
2932DEFINE_AG_ERROR_EVENT(xfs_refcount_insert_error);
2933DEFINE_AG_ERROR_EVENT(xfs_refcount_delete_error);
2934DEFINE_AG_ERROR_EVENT(xfs_refcount_update_error);
2935
2936/* refcount adjustment tracepoints */
2937DEFINE_AG_EXTENT_EVENT(xfs_refcount_increase);
2938DEFINE_AG_EXTENT_EVENT(xfs_refcount_decrease);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002939DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_increase);
2940DEFINE_AG_EXTENT_EVENT(xfs_refcount_cow_decrease);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002941DEFINE_REFCOUNT_TRIPLE_EXTENT_EVENT(xfs_refcount_merge_center_extents);
2942DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_modify_extent);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002943DEFINE_REFCOUNT_EXTENT_EVENT(xfs_refcount_recover_extent);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002944DEFINE_REFCOUNT_EXTENT_AT_EVENT(xfs_refcount_split_extent);
2945DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_left_extent);
2946DEFINE_REFCOUNT_DOUBLE_EXTENT_EVENT(xfs_refcount_merge_right_extent);
2947DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_left_extent);
2948DEFINE_REFCOUNT_DOUBLE_EXTENT_AT_EVENT(xfs_refcount_find_right_extent);
2949DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_error);
Darrick J. Wong174edb02016-10-03 09:11:39 -07002950DEFINE_AG_ERROR_EVENT(xfs_refcount_adjust_cow_error);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002951DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_center_extents_error);
2952DEFINE_AG_ERROR_EVENT(xfs_refcount_modify_extent_error);
2953DEFINE_AG_ERROR_EVENT(xfs_refcount_split_extent_error);
2954DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_left_extent_error);
2955DEFINE_AG_ERROR_EVENT(xfs_refcount_merge_right_extent_error);
2956DEFINE_AG_ERROR_EVENT(xfs_refcount_find_left_extent_error);
2957DEFINE_AG_ERROR_EVENT(xfs_refcount_find_right_extent_error);
2958
2959/* reflink helpers */
2960DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared);
2961DEFINE_AG_EXTENT_EVENT(xfs_refcount_find_shared_result);
2962DEFINE_AG_ERROR_EVENT(xfs_refcount_find_shared_error);
Darrick J. Wong33ba61292016-10-03 09:11:22 -07002963#define DEFINE_REFCOUNT_DEFERRED_EVENT DEFINE_PHYS_EXTENT_DEFERRED_EVENT
2964DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_defer);
2965DEFINE_REFCOUNT_DEFERRED_EVENT(xfs_refcount_deferred);
Darrick J. Wongc75c7522016-10-03 09:11:15 -07002966
Darrick J. Wongf997ee22016-10-03 09:11:21 -07002967TRACE_EVENT(xfs_refcount_finish_one_leftover,
2968 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2969 int type, xfs_agblock_t agbno, xfs_extlen_t len,
2970 xfs_agblock_t new_agbno, xfs_extlen_t new_len),
2971 TP_ARGS(mp, agno, type, agbno, len, new_agbno, new_len),
2972 TP_STRUCT__entry(
2973 __field(dev_t, dev)
2974 __field(xfs_agnumber_t, agno)
2975 __field(int, type)
2976 __field(xfs_agblock_t, agbno)
2977 __field(xfs_extlen_t, len)
2978 __field(xfs_agblock_t, new_agbno)
2979 __field(xfs_extlen_t, new_len)
2980 ),
2981 TP_fast_assign(
2982 __entry->dev = mp->m_super->s_dev;
2983 __entry->agno = agno;
2984 __entry->type = type;
2985 __entry->agbno = agbno;
2986 __entry->len = len;
2987 __entry->new_agbno = new_agbno;
2988 __entry->new_len = new_len;
2989 ),
2990 TP_printk("dev %d:%d type %d agno %u agbno %u len %u new_agbno %u new_len %u",
2991 MAJOR(__entry->dev), MINOR(__entry->dev),
2992 __entry->type,
2993 __entry->agno,
2994 __entry->agbno,
2995 __entry->len,
2996 __entry->new_agbno,
2997 __entry->new_len)
2998);
2999
Darrick J. Wongf65306e2016-10-03 09:11:27 -07003000/* simple inode-based error/%ip tracepoint class */
3001DECLARE_EVENT_CLASS(xfs_inode_error_class,
3002 TP_PROTO(struct xfs_inode *ip, int error, unsigned long caller_ip),
3003 TP_ARGS(ip, error, caller_ip),
3004 TP_STRUCT__entry(
3005 __field(dev_t, dev)
3006 __field(xfs_ino_t, ino)
3007 __field(int, error)
3008 __field(unsigned long, caller_ip)
3009 ),
3010 TP_fast_assign(
3011 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3012 __entry->ino = ip->i_ino;
3013 __entry->error = error;
3014 __entry->caller_ip = caller_ip;
3015 ),
3016 TP_printk("dev %d:%d ino %llx error %d caller %ps",
3017 MAJOR(__entry->dev), MINOR(__entry->dev),
3018 __entry->ino,
3019 __entry->error,
3020 (char *)__entry->caller_ip)
3021);
3022
3023#define DEFINE_INODE_ERROR_EVENT(name) \
3024DEFINE_EVENT(xfs_inode_error_class, name, \
3025 TP_PROTO(struct xfs_inode *ip, int error, \
3026 unsigned long caller_ip), \
3027 TP_ARGS(ip, error, caller_ip))
3028
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003029/* reflink tracepoint classes */
3030
3031/* two-file io tracepoint class */
3032DECLARE_EVENT_CLASS(xfs_double_io_class,
3033 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len,
3034 struct xfs_inode *dest, xfs_off_t doffset),
3035 TP_ARGS(src, soffset, len, dest, doffset),
3036 TP_STRUCT__entry(
3037 __field(dev_t, dev)
3038 __field(xfs_ino_t, src_ino)
3039 __field(loff_t, src_isize)
3040 __field(loff_t, src_disize)
3041 __field(loff_t, src_offset)
3042 __field(size_t, len)
3043 __field(xfs_ino_t, dest_ino)
3044 __field(loff_t, dest_isize)
3045 __field(loff_t, dest_disize)
3046 __field(loff_t, dest_offset)
3047 ),
3048 TP_fast_assign(
3049 __entry->dev = VFS_I(src)->i_sb->s_dev;
3050 __entry->src_ino = src->i_ino;
3051 __entry->src_isize = VFS_I(src)->i_size;
3052 __entry->src_disize = src->i_d.di_size;
3053 __entry->src_offset = soffset;
3054 __entry->len = len;
3055 __entry->dest_ino = dest->i_ino;
3056 __entry->dest_isize = VFS_I(dest)->i_size;
3057 __entry->dest_disize = dest->i_d.di_size;
3058 __entry->dest_offset = doffset;
3059 ),
3060 TP_printk("dev %d:%d count %zd "
3061 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx -> "
3062 "ino 0x%llx isize 0x%llx disize 0x%llx offset 0x%llx",
3063 MAJOR(__entry->dev), MINOR(__entry->dev),
3064 __entry->len,
3065 __entry->src_ino,
3066 __entry->src_isize,
3067 __entry->src_disize,
3068 __entry->src_offset,
3069 __entry->dest_ino,
3070 __entry->dest_isize,
3071 __entry->dest_disize,
3072 __entry->dest_offset)
3073)
3074
3075#define DEFINE_DOUBLE_IO_EVENT(name) \
3076DEFINE_EVENT(xfs_double_io_class, name, \
3077 TP_PROTO(struct xfs_inode *src, xfs_off_t soffset, xfs_off_t len, \
3078 struct xfs_inode *dest, xfs_off_t doffset), \
3079 TP_ARGS(src, soffset, len, dest, doffset))
3080
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003081/* inode/irec events */
3082DECLARE_EVENT_CLASS(xfs_inode_irec_class,
3083 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec),
3084 TP_ARGS(ip, irec),
3085 TP_STRUCT__entry(
3086 __field(dev_t, dev)
3087 __field(xfs_ino_t, ino)
3088 __field(xfs_fileoff_t, lblk)
3089 __field(xfs_extlen_t, len)
3090 __field(xfs_fsblock_t, pblk)
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003091 __field(int, state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003092 ),
3093 TP_fast_assign(
3094 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3095 __entry->ino = ip->i_ino;
3096 __entry->lblk = irec->br_startoff;
3097 __entry->len = irec->br_blockcount;
3098 __entry->pblk = irec->br_startblock;
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003099 __entry->state = irec->br_state;
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003100 ),
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003101 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 -07003102 MAJOR(__entry->dev), MINOR(__entry->dev),
3103 __entry->ino,
3104 __entry->lblk,
3105 __entry->len,
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003106 __entry->pblk,
3107 __entry->state)
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003108);
3109#define DEFINE_INODE_IREC_EVENT(name) \
3110DEFINE_EVENT(xfs_inode_irec_class, name, \
3111 TP_PROTO(struct xfs_inode *ip, struct xfs_bmbt_irec *irec), \
3112 TP_ARGS(ip, irec))
3113
3114/* refcount/reflink tracepoint definitions */
3115
3116/* reflink tracepoints */
3117DEFINE_INODE_EVENT(xfs_reflink_set_inode_flag);
3118DEFINE_INODE_EVENT(xfs_reflink_unset_inode_flag);
3119DEFINE_ITRUNC_EVENT(xfs_reflink_update_inode_size);
3120DEFINE_IOMAP_EVENT(xfs_reflink_remap_imap);
3121TRACE_EVENT(xfs_reflink_remap_blocks_loop,
3122 TP_PROTO(struct xfs_inode *src, xfs_fileoff_t soffset,
3123 xfs_filblks_t len, struct xfs_inode *dest,
3124 xfs_fileoff_t doffset),
3125 TP_ARGS(src, soffset, len, dest, doffset),
3126 TP_STRUCT__entry(
3127 __field(dev_t, dev)
3128 __field(xfs_ino_t, src_ino)
3129 __field(xfs_fileoff_t, src_lblk)
3130 __field(xfs_filblks_t, len)
3131 __field(xfs_ino_t, dest_ino)
3132 __field(xfs_fileoff_t, dest_lblk)
3133 ),
3134 TP_fast_assign(
3135 __entry->dev = VFS_I(src)->i_sb->s_dev;
3136 __entry->src_ino = src->i_ino;
3137 __entry->src_lblk = soffset;
3138 __entry->len = len;
3139 __entry->dest_ino = dest->i_ino;
3140 __entry->dest_lblk = doffset;
3141 ),
3142 TP_printk("dev %d:%d len 0x%llx "
3143 "ino 0x%llx offset 0x%llx blocks -> "
3144 "ino 0x%llx offset 0x%llx blocks",
3145 MAJOR(__entry->dev), MINOR(__entry->dev),
3146 __entry->len,
3147 __entry->src_ino,
3148 __entry->src_lblk,
3149 __entry->dest_ino,
3150 __entry->dest_lblk)
3151);
3152TRACE_EVENT(xfs_reflink_punch_range,
3153 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3154 xfs_extlen_t len),
3155 TP_ARGS(ip, lblk, len),
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 ),
3162 TP_fast_assign(
3163 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3164 __entry->ino = ip->i_ino;
3165 __entry->lblk = lblk;
3166 __entry->len = len;
3167 ),
3168 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x",
3169 MAJOR(__entry->dev), MINOR(__entry->dev),
3170 __entry->ino,
3171 __entry->lblk,
3172 __entry->len)
3173);
3174TRACE_EVENT(xfs_reflink_remap,
3175 TP_PROTO(struct xfs_inode *ip, xfs_fileoff_t lblk,
3176 xfs_extlen_t len, xfs_fsblock_t new_pblk),
3177 TP_ARGS(ip, lblk, len, new_pblk),
3178 TP_STRUCT__entry(
3179 __field(dev_t, dev)
3180 __field(xfs_ino_t, ino)
3181 __field(xfs_fileoff_t, lblk)
3182 __field(xfs_extlen_t, len)
3183 __field(xfs_fsblock_t, new_pblk)
3184 ),
3185 TP_fast_assign(
3186 __entry->dev = VFS_I(ip)->i_sb->s_dev;
3187 __entry->ino = ip->i_ino;
3188 __entry->lblk = lblk;
3189 __entry->len = len;
3190 __entry->new_pblk = new_pblk;
3191 ),
3192 TP_printk("dev %d:%d ino 0x%llx lblk 0x%llx len 0x%x new_pblk %llu",
3193 MAJOR(__entry->dev), MINOR(__entry->dev),
3194 __entry->ino,
3195 __entry->lblk,
3196 __entry->len,
3197 __entry->new_pblk)
3198);
3199DEFINE_DOUBLE_IO_EVENT(xfs_reflink_remap_range);
3200DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_range_error);
3201DEFINE_INODE_ERROR_EVENT(xfs_reflink_set_inode_flag_error);
3202DEFINE_INODE_ERROR_EVENT(xfs_reflink_update_inode_size_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003203DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_blocks_error);
3204DEFINE_INODE_ERROR_EVENT(xfs_reflink_remap_extent_error);
3205
3206/* dedupe tracepoints */
3207DEFINE_DOUBLE_IO_EVENT(xfs_reflink_compare_extents);
3208DEFINE_INODE_ERROR_EVENT(xfs_reflink_compare_extents_error);
3209
3210/* ioctl tracepoints */
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003211TRACE_EVENT(xfs_ioctl_clone,
3212 TP_PROTO(struct inode *src, struct inode *dest),
3213 TP_ARGS(src, dest),
3214 TP_STRUCT__entry(
3215 __field(dev_t, dev)
3216 __field(unsigned long, src_ino)
3217 __field(loff_t, src_isize)
3218 __field(unsigned long, dest_ino)
3219 __field(loff_t, dest_isize)
3220 ),
3221 TP_fast_assign(
3222 __entry->dev = src->i_sb->s_dev;
3223 __entry->src_ino = src->i_ino;
3224 __entry->src_isize = i_size_read(src);
3225 __entry->dest_ino = dest->i_ino;
3226 __entry->dest_isize = i_size_read(dest);
3227 ),
3228 TP_printk("dev %d:%d "
3229 "ino 0x%lx isize 0x%llx -> "
Hou Tao42bf9db2017-04-14 11:43:27 -07003230 "ino 0x%lx isize 0x%llx",
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003231 MAJOR(__entry->dev), MINOR(__entry->dev),
3232 __entry->src_ino,
3233 __entry->src_isize,
3234 __entry->dest_ino,
3235 __entry->dest_isize)
3236);
3237
3238/* unshare tracepoints */
3239DEFINE_SIMPLE_IO_EVENT(xfs_reflink_unshare);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003240DEFINE_INODE_ERROR_EVENT(xfs_reflink_unshare_error);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003241
3242/* copy on write */
3243DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_around_shared);
Darrick J. Wongbe51f812016-10-03 09:11:32 -07003244DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_alloc);
3245DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_found);
3246DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_enospc);
Darrick J. Wong5eda4302017-02-02 15:14:02 -08003247DEFINE_INODE_IREC_EVENT(xfs_reflink_convert_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003248
Christoph Hellwig3ba020b2016-10-20 15:53:50 +11003249DEFINE_RW_EVENT(xfs_reflink_reserve_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003250
Christoph Hellwig54a4ef82017-02-06 13:00:54 -08003251DEFINE_SIMPLE_IO_EVENT(xfs_reflink_bounce_dio_write);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003252DEFINE_IOMAP_EVENT(xfs_reflink_find_cow_mapping);
3253DEFINE_INODE_IREC_EVENT(xfs_reflink_trim_irec);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003254
3255DEFINE_SIMPLE_IO_EVENT(xfs_reflink_cancel_cow_range);
3256DEFINE_SIMPLE_IO_EVENT(xfs_reflink_end_cow);
3257DEFINE_INODE_IREC_EVENT(xfs_reflink_cow_remap);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003258
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003259DEFINE_INODE_ERROR_EVENT(xfs_reflink_cancel_cow_range_error);
3260DEFINE_INODE_ERROR_EVENT(xfs_reflink_end_cow_error);
3261
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003262
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003263DEFINE_INODE_IREC_EVENT(xfs_reflink_cancel_cow);
Darrick J. Wong53aa1c32016-10-03 09:11:30 -07003264
Darrick J. Wong1f08af52016-10-03 09:11:53 -07003265/* rmap swapext tracepoints */
3266DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap);
3267DEFINE_INODE_IREC_EVENT(xfs_swap_extent_rmap_remap_piece);
3268DEFINE_INODE_ERROR_EVENT(xfs_swap_extent_rmap_error);
3269
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003270/* fsmap traces */
3271DECLARE_EVENT_CLASS(xfs_fsmap_class,
3272 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno,
3273 struct xfs_rmap_irec *rmap),
3274 TP_ARGS(mp, keydev, agno, rmap),
3275 TP_STRUCT__entry(
3276 __field(dev_t, dev)
3277 __field(dev_t, keydev)
3278 __field(xfs_agnumber_t, agno)
3279 __field(xfs_fsblock_t, bno)
3280 __field(xfs_filblks_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003281 __field(uint64_t, owner)
3282 __field(uint64_t, offset)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003283 __field(unsigned int, flags)
3284 ),
3285 TP_fast_assign(
3286 __entry->dev = mp->m_super->s_dev;
3287 __entry->keydev = new_decode_dev(keydev);
3288 __entry->agno = agno;
3289 __entry->bno = rmap->rm_startblock;
3290 __entry->len = rmap->rm_blockcount;
3291 __entry->owner = rmap->rm_owner;
3292 __entry->offset = rmap->rm_offset;
3293 __entry->flags = rmap->rm_flags;
3294 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003295 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 -07003296 MAJOR(__entry->dev), MINOR(__entry->dev),
3297 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3298 __entry->agno,
3299 __entry->bno,
3300 __entry->len,
3301 __entry->owner,
3302 __entry->offset,
3303 __entry->flags)
3304)
3305#define DEFINE_FSMAP_EVENT(name) \
3306DEFINE_EVENT(xfs_fsmap_class, name, \
3307 TP_PROTO(struct xfs_mount *mp, u32 keydev, xfs_agnumber_t agno, \
3308 struct xfs_rmap_irec *rmap), \
3309 TP_ARGS(mp, keydev, agno, rmap))
3310DEFINE_FSMAP_EVENT(xfs_fsmap_low_key);
3311DEFINE_FSMAP_EVENT(xfs_fsmap_high_key);
3312DEFINE_FSMAP_EVENT(xfs_fsmap_mapping);
3313
3314DECLARE_EVENT_CLASS(xfs_getfsmap_class,
3315 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap),
3316 TP_ARGS(mp, fsmap),
3317 TP_STRUCT__entry(
3318 __field(dev_t, dev)
3319 __field(dev_t, keydev)
3320 __field(xfs_daddr_t, block)
3321 __field(xfs_daddr_t, len)
Darrick J. Wongc8ce5402017-06-16 11:00:05 -07003322 __field(uint64_t, owner)
3323 __field(uint64_t, offset)
3324 __field(uint64_t, flags)
Darrick J. Wonge89c0412017-03-28 14:56:37 -07003325 ),
3326 TP_fast_assign(
3327 __entry->dev = mp->m_super->s_dev;
3328 __entry->keydev = new_decode_dev(fsmap->fmr_device);
3329 __entry->block = fsmap->fmr_physical;
3330 __entry->len = fsmap->fmr_length;
3331 __entry->owner = fsmap->fmr_owner;
3332 __entry->offset = fsmap->fmr_offset;
3333 __entry->flags = fsmap->fmr_flags;
3334 ),
Hou Tao42bf9db2017-04-14 11:43:27 -07003335 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 -07003336 MAJOR(__entry->dev), MINOR(__entry->dev),
3337 MAJOR(__entry->keydev), MINOR(__entry->keydev),
3338 __entry->block,
3339 __entry->len,
3340 __entry->owner,
3341 __entry->offset,
3342 __entry->flags)
3343)
3344#define DEFINE_GETFSMAP_EVENT(name) \
3345DEFINE_EVENT(xfs_getfsmap_class, name, \
3346 TP_PROTO(struct xfs_mount *mp, struct xfs_fsmap *fsmap), \
3347 TP_ARGS(mp, fsmap))
3348DEFINE_GETFSMAP_EVENT(xfs_getfsmap_low_key);
3349DEFINE_GETFSMAP_EVENT(xfs_getfsmap_high_key);
3350DEFINE_GETFSMAP_EVENT(xfs_getfsmap_mapping);
3351
Christoph Hellwig0b1b2132009-12-14 23:14:59 +00003352#endif /* _TRACE_XFS_H */
3353
3354#undef TRACE_INCLUDE_PATH
3355#define TRACE_INCLUDE_PATH .
3356#define TRACE_INCLUDE_FILE xfs_trace
3357#include <trace/define_trace.h>