xref: /openbmc/linux/fs/xfs/scrub/trace.h (revision 9be08a27)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2017 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <darrick.wong@oracle.com>
5  */
6 #undef TRACE_SYSTEM
7 #define TRACE_SYSTEM xfs_scrub
8 
9 #if !defined(_TRACE_XFS_SCRUB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
10 #define _TRACE_XFS_SCRUB_TRACE_H
11 
12 #include <linux/tracepoint.h>
13 #include "xfs_bit.h"
14 
15 DECLARE_EVENT_CLASS(xchk_class,
16 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm,
17 		 int error),
18 	TP_ARGS(ip, sm, error),
19 	TP_STRUCT__entry(
20 		__field(dev_t, dev)
21 		__field(xfs_ino_t, ino)
22 		__field(unsigned int, type)
23 		__field(xfs_agnumber_t, agno)
24 		__field(xfs_ino_t, inum)
25 		__field(unsigned int, gen)
26 		__field(unsigned int, flags)
27 		__field(int, error)
28 	),
29 	TP_fast_assign(
30 		__entry->dev = ip->i_mount->m_super->s_dev;
31 		__entry->ino = ip->i_ino;
32 		__entry->type = sm->sm_type;
33 		__entry->agno = sm->sm_agno;
34 		__entry->inum = sm->sm_ino;
35 		__entry->gen = sm->sm_gen;
36 		__entry->flags = sm->sm_flags;
37 		__entry->error = error;
38 	),
39 	TP_printk("dev %d:%d ino 0x%llx type %u agno %u inum %llu gen %u flags 0x%x error %d",
40 		  MAJOR(__entry->dev), MINOR(__entry->dev),
41 		  __entry->ino,
42 		  __entry->type,
43 		  __entry->agno,
44 		  __entry->inum,
45 		  __entry->gen,
46 		  __entry->flags,
47 		  __entry->error)
48 )
49 #define DEFINE_SCRUB_EVENT(name) \
50 DEFINE_EVENT(xchk_class, name, \
51 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \
52 		 int error), \
53 	TP_ARGS(ip, sm, error))
54 
55 DEFINE_SCRUB_EVENT(xchk_start);
56 DEFINE_SCRUB_EVENT(xchk_done);
57 DEFINE_SCRUB_EVENT(xchk_deadlock_retry);
58 DEFINE_SCRUB_EVENT(xrep_attempt);
59 DEFINE_SCRUB_EVENT(xrep_done);
60 
61 TRACE_EVENT(xchk_op_error,
62 	TP_PROTO(struct xfs_scrub *sc, xfs_agnumber_t agno,
63 		 xfs_agblock_t bno, int error, void *ret_ip),
64 	TP_ARGS(sc, agno, bno, error, ret_ip),
65 	TP_STRUCT__entry(
66 		__field(dev_t, dev)
67 		__field(unsigned int, type)
68 		__field(xfs_agnumber_t, agno)
69 		__field(xfs_agblock_t, bno)
70 		__field(int, error)
71 		__field(void *, ret_ip)
72 	),
73 	TP_fast_assign(
74 		__entry->dev = sc->mp->m_super->s_dev;
75 		__entry->type = sc->sm->sm_type;
76 		__entry->agno = agno;
77 		__entry->bno = bno;
78 		__entry->error = error;
79 		__entry->ret_ip = ret_ip;
80 	),
81 	TP_printk("dev %d:%d type %u agno %u agbno %u error %d ret_ip %pS",
82 		  MAJOR(__entry->dev), MINOR(__entry->dev),
83 		  __entry->type,
84 		  __entry->agno,
85 		  __entry->bno,
86 		  __entry->error,
87 		  __entry->ret_ip)
88 );
89 
90 TRACE_EVENT(xchk_file_op_error,
91 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
92 		 xfs_fileoff_t offset, int error, void *ret_ip),
93 	TP_ARGS(sc, whichfork, offset, error, ret_ip),
94 	TP_STRUCT__entry(
95 		__field(dev_t, dev)
96 		__field(xfs_ino_t, ino)
97 		__field(int, whichfork)
98 		__field(unsigned int, type)
99 		__field(xfs_fileoff_t, offset)
100 		__field(int, error)
101 		__field(void *, ret_ip)
102 	),
103 	TP_fast_assign(
104 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
105 		__entry->ino = sc->ip->i_ino;
106 		__entry->whichfork = whichfork;
107 		__entry->type = sc->sm->sm_type;
108 		__entry->offset = offset;
109 		__entry->error = error;
110 		__entry->ret_ip = ret_ip;
111 	),
112 	TP_printk("dev %d:%d ino 0x%llx fork %d type %u offset %llu error %d ret_ip %pS",
113 		  MAJOR(__entry->dev), MINOR(__entry->dev),
114 		  __entry->ino,
115 		  __entry->whichfork,
116 		  __entry->type,
117 		  __entry->offset,
118 		  __entry->error,
119 		  __entry->ret_ip)
120 );
121 
122 DECLARE_EVENT_CLASS(xchk_block_error_class,
123 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, void *ret_ip),
124 	TP_ARGS(sc, daddr, ret_ip),
125 	TP_STRUCT__entry(
126 		__field(dev_t, dev)
127 		__field(unsigned int, type)
128 		__field(xfs_agnumber_t, agno)
129 		__field(xfs_agblock_t, bno)
130 		__field(void *, ret_ip)
131 	),
132 	TP_fast_assign(
133 		xfs_fsblock_t	fsbno;
134 		xfs_agnumber_t	agno;
135 		xfs_agblock_t	bno;
136 
137 		fsbno = XFS_DADDR_TO_FSB(sc->mp, daddr);
138 		agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
139 		bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
140 
141 		__entry->dev = sc->mp->m_super->s_dev;
142 		__entry->type = sc->sm->sm_type;
143 		__entry->agno = agno;
144 		__entry->bno = bno;
145 		__entry->ret_ip = ret_ip;
146 	),
147 	TP_printk("dev %d:%d type %u agno %u agbno %u ret_ip %pS",
148 		  MAJOR(__entry->dev), MINOR(__entry->dev),
149 		  __entry->type,
150 		  __entry->agno,
151 		  __entry->bno,
152 		  __entry->ret_ip)
153 )
154 
155 #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \
156 DEFINE_EVENT(xchk_block_error_class, name, \
157 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, \
158 		 void *ret_ip), \
159 	TP_ARGS(sc, daddr, ret_ip))
160 
161 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_error);
162 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_preen);
163 
164 DECLARE_EVENT_CLASS(xchk_ino_error_class,
165 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, void *ret_ip),
166 	TP_ARGS(sc, ino, ret_ip),
167 	TP_STRUCT__entry(
168 		__field(dev_t, dev)
169 		__field(xfs_ino_t, ino)
170 		__field(unsigned int, type)
171 		__field(void *, ret_ip)
172 	),
173 	TP_fast_assign(
174 		__entry->dev = sc->mp->m_super->s_dev;
175 		__entry->ino = ino;
176 		__entry->type = sc->sm->sm_type;
177 		__entry->ret_ip = ret_ip;
178 	),
179 	TP_printk("dev %d:%d ino 0x%llx type %u ret_ip %pS",
180 		  MAJOR(__entry->dev), MINOR(__entry->dev),
181 		  __entry->ino,
182 		  __entry->type,
183 		  __entry->ret_ip)
184 )
185 
186 #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \
187 DEFINE_EVENT(xchk_ino_error_class, name, \
188 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, \
189 		 void *ret_ip), \
190 	TP_ARGS(sc, ino, ret_ip))
191 
192 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_error);
193 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_preen);
194 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_warning);
195 
196 DECLARE_EVENT_CLASS(xchk_fblock_error_class,
197 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
198 		 xfs_fileoff_t offset, void *ret_ip),
199 	TP_ARGS(sc, whichfork, offset, ret_ip),
200 	TP_STRUCT__entry(
201 		__field(dev_t, dev)
202 		__field(xfs_ino_t, ino)
203 		__field(int, whichfork)
204 		__field(unsigned int, type)
205 		__field(xfs_fileoff_t, offset)
206 		__field(void *, ret_ip)
207 	),
208 	TP_fast_assign(
209 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
210 		__entry->ino = sc->ip->i_ino;
211 		__entry->whichfork = whichfork;
212 		__entry->type = sc->sm->sm_type;
213 		__entry->offset = offset;
214 		__entry->ret_ip = ret_ip;
215 	),
216 	TP_printk("dev %d:%d ino 0x%llx fork %d type %u offset %llu ret_ip %pS",
217 		  MAJOR(__entry->dev), MINOR(__entry->dev),
218 		  __entry->ino,
219 		  __entry->whichfork,
220 		  __entry->type,
221 		  __entry->offset,
222 		  __entry->ret_ip)
223 );
224 
225 #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \
226 DEFINE_EVENT(xchk_fblock_error_class, name, \
227 	TP_PROTO(struct xfs_scrub *sc, int whichfork, \
228 		 xfs_fileoff_t offset, void *ret_ip), \
229 	TP_ARGS(sc, whichfork, offset, ret_ip))
230 
231 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_error);
232 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_warning);
233 
234 TRACE_EVENT(xchk_incomplete,
235 	TP_PROTO(struct xfs_scrub *sc, void *ret_ip),
236 	TP_ARGS(sc, ret_ip),
237 	TP_STRUCT__entry(
238 		__field(dev_t, dev)
239 		__field(unsigned int, type)
240 		__field(void *, ret_ip)
241 	),
242 	TP_fast_assign(
243 		__entry->dev = sc->mp->m_super->s_dev;
244 		__entry->type = sc->sm->sm_type;
245 		__entry->ret_ip = ret_ip;
246 	),
247 	TP_printk("dev %d:%d type %u ret_ip %pS",
248 		  MAJOR(__entry->dev), MINOR(__entry->dev),
249 		  __entry->type,
250 		  __entry->ret_ip)
251 );
252 
253 TRACE_EVENT(xchk_btree_op_error,
254 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
255 		 int level, int error, void *ret_ip),
256 	TP_ARGS(sc, cur, level, error, ret_ip),
257 	TP_STRUCT__entry(
258 		__field(dev_t, dev)
259 		__field(unsigned int, type)
260 		__field(xfs_btnum_t, btnum)
261 		__field(int, level)
262 		__field(xfs_agnumber_t, agno)
263 		__field(xfs_agblock_t, bno)
264 		__field(int, ptr);
265 		__field(int, error)
266 		__field(void *, ret_ip)
267 	),
268 	TP_fast_assign(
269 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
270 
271 		__entry->dev = sc->mp->m_super->s_dev;
272 		__entry->type = sc->sm->sm_type;
273 		__entry->btnum = cur->bc_btnum;
274 		__entry->level = level;
275 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
276 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
277 		__entry->ptr = cur->bc_ptrs[level];
278 		__entry->error = error;
279 		__entry->ret_ip = ret_ip;
280 	),
281 	TP_printk("dev %d:%d type %u btnum %d level %d ptr %d agno %u agbno %u error %d ret_ip %pS",
282 		  MAJOR(__entry->dev), MINOR(__entry->dev),
283 		  __entry->type,
284 		  __entry->btnum,
285 		  __entry->level,
286 		  __entry->ptr,
287 		  __entry->agno,
288 		  __entry->bno,
289 		  __entry->error,
290 		  __entry->ret_ip)
291 );
292 
293 TRACE_EVENT(xchk_ifork_btree_op_error,
294 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
295 		 int level, int error, void *ret_ip),
296 	TP_ARGS(sc, cur, level, error, ret_ip),
297 	TP_STRUCT__entry(
298 		__field(dev_t, dev)
299 		__field(xfs_ino_t, ino)
300 		__field(int, whichfork)
301 		__field(unsigned int, type)
302 		__field(xfs_btnum_t, btnum)
303 		__field(int, level)
304 		__field(int, ptr)
305 		__field(xfs_agnumber_t, agno)
306 		__field(xfs_agblock_t, bno)
307 		__field(int, error)
308 		__field(void *, ret_ip)
309 	),
310 	TP_fast_assign(
311 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
312 		__entry->dev = sc->mp->m_super->s_dev;
313 		__entry->ino = sc->ip->i_ino;
314 		__entry->whichfork = cur->bc_private.b.whichfork;
315 		__entry->type = sc->sm->sm_type;
316 		__entry->btnum = cur->bc_btnum;
317 		__entry->level = level;
318 		__entry->ptr = cur->bc_ptrs[level];
319 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
320 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
321 		__entry->error = error;
322 		__entry->ret_ip = ret_ip;
323 	),
324 	TP_printk("dev %d:%d ino 0x%llx fork %d type %u btnum %d level %d ptr %d agno %u agbno %u error %d ret_ip %pS",
325 		  MAJOR(__entry->dev), MINOR(__entry->dev),
326 		  __entry->ino,
327 		  __entry->whichfork,
328 		  __entry->type,
329 		  __entry->btnum,
330 		  __entry->level,
331 		  __entry->ptr,
332 		  __entry->agno,
333 		  __entry->bno,
334 		  __entry->error,
335 		  __entry->ret_ip)
336 );
337 
338 TRACE_EVENT(xchk_btree_error,
339 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
340 		 int level, void *ret_ip),
341 	TP_ARGS(sc, cur, level, ret_ip),
342 	TP_STRUCT__entry(
343 		__field(dev_t, dev)
344 		__field(unsigned int, type)
345 		__field(xfs_btnum_t, btnum)
346 		__field(int, level)
347 		__field(xfs_agnumber_t, agno)
348 		__field(xfs_agblock_t, bno)
349 		__field(int, ptr);
350 		__field(void *, ret_ip)
351 	),
352 	TP_fast_assign(
353 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
354 		__entry->dev = sc->mp->m_super->s_dev;
355 		__entry->type = sc->sm->sm_type;
356 		__entry->btnum = cur->bc_btnum;
357 		__entry->level = level;
358 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
359 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
360 		__entry->ptr = cur->bc_ptrs[level];
361 		__entry->ret_ip = ret_ip;
362 	),
363 	TP_printk("dev %d:%d type %u btnum %d level %d ptr %d agno %u agbno %u ret_ip %pS",
364 		  MAJOR(__entry->dev), MINOR(__entry->dev),
365 		  __entry->type,
366 		  __entry->btnum,
367 		  __entry->level,
368 		  __entry->ptr,
369 		  __entry->agno,
370 		  __entry->bno,
371 		  __entry->ret_ip)
372 );
373 
374 TRACE_EVENT(xchk_ifork_btree_error,
375 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
376 		 int level, void *ret_ip),
377 	TP_ARGS(sc, cur, level, ret_ip),
378 	TP_STRUCT__entry(
379 		__field(dev_t, dev)
380 		__field(xfs_ino_t, ino)
381 		__field(int, whichfork)
382 		__field(unsigned int, type)
383 		__field(xfs_btnum_t, btnum)
384 		__field(int, level)
385 		__field(xfs_agnumber_t, agno)
386 		__field(xfs_agblock_t, bno)
387 		__field(int, ptr);
388 		__field(void *, ret_ip)
389 	),
390 	TP_fast_assign(
391 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
392 		__entry->dev = sc->mp->m_super->s_dev;
393 		__entry->ino = sc->ip->i_ino;
394 		__entry->whichfork = cur->bc_private.b.whichfork;
395 		__entry->type = sc->sm->sm_type;
396 		__entry->btnum = cur->bc_btnum;
397 		__entry->level = level;
398 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
399 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
400 		__entry->ptr = cur->bc_ptrs[level];
401 		__entry->ret_ip = ret_ip;
402 	),
403 	TP_printk("dev %d:%d ino 0x%llx fork %d type %u btnum %d level %d ptr %d agno %u agbno %u ret_ip %pS",
404 		  MAJOR(__entry->dev), MINOR(__entry->dev),
405 		  __entry->ino,
406 		  __entry->whichfork,
407 		  __entry->type,
408 		  __entry->btnum,
409 		  __entry->level,
410 		  __entry->ptr,
411 		  __entry->agno,
412 		  __entry->bno,
413 		  __entry->ret_ip)
414 );
415 
416 DECLARE_EVENT_CLASS(xchk_sbtree_class,
417 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
418 		 int level),
419 	TP_ARGS(sc, cur, level),
420 	TP_STRUCT__entry(
421 		__field(dev_t, dev)
422 		__field(int, type)
423 		__field(xfs_btnum_t, btnum)
424 		__field(xfs_agnumber_t, agno)
425 		__field(xfs_agblock_t, bno)
426 		__field(int, level)
427 		__field(int, nlevels)
428 		__field(int, ptr)
429 	),
430 	TP_fast_assign(
431 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
432 
433 		__entry->dev = sc->mp->m_super->s_dev;
434 		__entry->type = sc->sm->sm_type;
435 		__entry->btnum = cur->bc_btnum;
436 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
437 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
438 		__entry->level = level;
439 		__entry->nlevels = cur->bc_nlevels;
440 		__entry->ptr = cur->bc_ptrs[level];
441 	),
442 	TP_printk("dev %d:%d type %u btnum %d agno %u agbno %u level %d nlevels %d ptr %d",
443 		  MAJOR(__entry->dev), MINOR(__entry->dev),
444 		  __entry->type,
445 		  __entry->btnum,
446 		  __entry->agno,
447 		  __entry->bno,
448 		  __entry->level,
449 		  __entry->nlevels,
450 		  __entry->ptr)
451 )
452 #define DEFINE_SCRUB_SBTREE_EVENT(name) \
453 DEFINE_EVENT(xchk_sbtree_class, name, \
454 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, \
455 		 int level), \
456 	TP_ARGS(sc, cur, level))
457 
458 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_rec);
459 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_key);
460 
461 TRACE_EVENT(xchk_xref_error,
462 	TP_PROTO(struct xfs_scrub *sc, int error, void *ret_ip),
463 	TP_ARGS(sc, error, ret_ip),
464 	TP_STRUCT__entry(
465 		__field(dev_t, dev)
466 		__field(int, type)
467 		__field(int, error)
468 		__field(void *, ret_ip)
469 	),
470 	TP_fast_assign(
471 		__entry->dev = sc->mp->m_super->s_dev;
472 		__entry->type = sc->sm->sm_type;
473 		__entry->error = error;
474 		__entry->ret_ip = ret_ip;
475 	),
476 	TP_printk("dev %d:%d type %u xref error %d ret_ip %pF",
477 		  MAJOR(__entry->dev), MINOR(__entry->dev),
478 		  __entry->type,
479 		  __entry->error,
480 		  __entry->ret_ip)
481 );
482 
483 /* repair tracepoints */
484 #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR)
485 
486 DECLARE_EVENT_CLASS(xrep_extent_class,
487 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
488 		 xfs_agblock_t agbno, xfs_extlen_t len),
489 	TP_ARGS(mp, agno, agbno, len),
490 	TP_STRUCT__entry(
491 		__field(dev_t, dev)
492 		__field(xfs_agnumber_t, agno)
493 		__field(xfs_agblock_t, agbno)
494 		__field(xfs_extlen_t, len)
495 	),
496 	TP_fast_assign(
497 		__entry->dev = mp->m_super->s_dev;
498 		__entry->agno = agno;
499 		__entry->agbno = agbno;
500 		__entry->len = len;
501 	),
502 	TP_printk("dev %d:%d agno %u agbno %u len %u",
503 		  MAJOR(__entry->dev), MINOR(__entry->dev),
504 		  __entry->agno,
505 		  __entry->agbno,
506 		  __entry->len)
507 );
508 #define DEFINE_REPAIR_EXTENT_EVENT(name) \
509 DEFINE_EVENT(xrep_extent_class, name, \
510 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
511 		 xfs_agblock_t agbno, xfs_extlen_t len), \
512 	TP_ARGS(mp, agno, agbno, len))
513 DEFINE_REPAIR_EXTENT_EVENT(xrep_dispose_btree_extent);
514 DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert);
515 
516 DECLARE_EVENT_CLASS(xrep_rmap_class,
517 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
518 		 xfs_agblock_t agbno, xfs_extlen_t len,
519 		 uint64_t owner, uint64_t offset, unsigned int flags),
520 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
521 	TP_STRUCT__entry(
522 		__field(dev_t, dev)
523 		__field(xfs_agnumber_t, agno)
524 		__field(xfs_agblock_t, agbno)
525 		__field(xfs_extlen_t, len)
526 		__field(uint64_t, owner)
527 		__field(uint64_t, offset)
528 		__field(unsigned int, flags)
529 	),
530 	TP_fast_assign(
531 		__entry->dev = mp->m_super->s_dev;
532 		__entry->agno = agno;
533 		__entry->agbno = agbno;
534 		__entry->len = len;
535 		__entry->owner = owner;
536 		__entry->offset = offset;
537 		__entry->flags = flags;
538 	),
539 	TP_printk("dev %d:%d agno %u agbno %u len %u owner %lld offset %llu flags 0x%x",
540 		  MAJOR(__entry->dev), MINOR(__entry->dev),
541 		  __entry->agno,
542 		  __entry->agbno,
543 		  __entry->len,
544 		  __entry->owner,
545 		  __entry->offset,
546 		  __entry->flags)
547 );
548 #define DEFINE_REPAIR_RMAP_EVENT(name) \
549 DEFINE_EVENT(xrep_rmap_class, name, \
550 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
551 		 xfs_agblock_t agbno, xfs_extlen_t len, \
552 		 uint64_t owner, uint64_t offset, unsigned int flags), \
553 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
554 DEFINE_REPAIR_RMAP_EVENT(xrep_alloc_extent_fn);
555 DEFINE_REPAIR_RMAP_EVENT(xrep_ialloc_extent_fn);
556 DEFINE_REPAIR_RMAP_EVENT(xrep_rmap_extent_fn);
557 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_extent_fn);
558 
559 TRACE_EVENT(xrep_refcount_extent_fn,
560 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
561 		 struct xfs_refcount_irec *irec),
562 	TP_ARGS(mp, agno, irec),
563 	TP_STRUCT__entry(
564 		__field(dev_t, dev)
565 		__field(xfs_agnumber_t, agno)
566 		__field(xfs_agblock_t, startblock)
567 		__field(xfs_extlen_t, blockcount)
568 		__field(xfs_nlink_t, refcount)
569 	),
570 	TP_fast_assign(
571 		__entry->dev = mp->m_super->s_dev;
572 		__entry->agno = agno;
573 		__entry->startblock = irec->rc_startblock;
574 		__entry->blockcount = irec->rc_blockcount;
575 		__entry->refcount = irec->rc_refcount;
576 	),
577 	TP_printk("dev %d:%d agno %u agbno %u len %u refcount %u",
578 		  MAJOR(__entry->dev), MINOR(__entry->dev),
579 		  __entry->agno,
580 		  __entry->startblock,
581 		  __entry->blockcount,
582 		  __entry->refcount)
583 )
584 
585 TRACE_EVENT(xrep_init_btblock,
586 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
587 		 xfs_btnum_t btnum),
588 	TP_ARGS(mp, agno, agbno, btnum),
589 	TP_STRUCT__entry(
590 		__field(dev_t, dev)
591 		__field(xfs_agnumber_t, agno)
592 		__field(xfs_agblock_t, agbno)
593 		__field(uint32_t, btnum)
594 	),
595 	TP_fast_assign(
596 		__entry->dev = mp->m_super->s_dev;
597 		__entry->agno = agno;
598 		__entry->agbno = agbno;
599 		__entry->btnum = btnum;
600 	),
601 	TP_printk("dev %d:%d agno %u agbno %u btnum %d",
602 		  MAJOR(__entry->dev), MINOR(__entry->dev),
603 		  __entry->agno,
604 		  __entry->agbno,
605 		  __entry->btnum)
606 )
607 TRACE_EVENT(xrep_findroot_block,
608 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
609 		 uint32_t magic, uint16_t level),
610 	TP_ARGS(mp, agno, agbno, magic, level),
611 	TP_STRUCT__entry(
612 		__field(dev_t, dev)
613 		__field(xfs_agnumber_t, agno)
614 		__field(xfs_agblock_t, agbno)
615 		__field(uint32_t, magic)
616 		__field(uint16_t, level)
617 	),
618 	TP_fast_assign(
619 		__entry->dev = mp->m_super->s_dev;
620 		__entry->agno = agno;
621 		__entry->agbno = agbno;
622 		__entry->magic = magic;
623 		__entry->level = level;
624 	),
625 	TP_printk("dev %d:%d agno %u agbno %u magic 0x%x level %u",
626 		  MAJOR(__entry->dev), MINOR(__entry->dev),
627 		  __entry->agno,
628 		  __entry->agbno,
629 		  __entry->magic,
630 		  __entry->level)
631 )
632 TRACE_EVENT(xrep_calc_ag_resblks,
633 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
634 		 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen,
635 		 xfs_agblock_t usedlen),
636 	TP_ARGS(mp, agno, icount, aglen, freelen, usedlen),
637 	TP_STRUCT__entry(
638 		__field(dev_t, dev)
639 		__field(xfs_agnumber_t, agno)
640 		__field(xfs_agino_t, icount)
641 		__field(xfs_agblock_t, aglen)
642 		__field(xfs_agblock_t, freelen)
643 		__field(xfs_agblock_t, usedlen)
644 	),
645 	TP_fast_assign(
646 		__entry->dev = mp->m_super->s_dev;
647 		__entry->agno = agno;
648 		__entry->icount = icount;
649 		__entry->aglen = aglen;
650 		__entry->freelen = freelen;
651 		__entry->usedlen = usedlen;
652 	),
653 	TP_printk("dev %d:%d agno %d icount %u aglen %u freelen %u usedlen %u",
654 		  MAJOR(__entry->dev), MINOR(__entry->dev),
655 		  __entry->agno,
656 		  __entry->icount,
657 		  __entry->aglen,
658 		  __entry->freelen,
659 		  __entry->usedlen)
660 )
661 TRACE_EVENT(xrep_calc_ag_resblks_btsize,
662 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
663 		 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz,
664 		 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz),
665 	TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz),
666 	TP_STRUCT__entry(
667 		__field(dev_t, dev)
668 		__field(xfs_agnumber_t, agno)
669 		__field(xfs_agblock_t, bnobt_sz)
670 		__field(xfs_agblock_t, inobt_sz)
671 		__field(xfs_agblock_t, rmapbt_sz)
672 		__field(xfs_agblock_t, refcbt_sz)
673 	),
674 	TP_fast_assign(
675 		__entry->dev = mp->m_super->s_dev;
676 		__entry->agno = agno;
677 		__entry->bnobt_sz = bnobt_sz;
678 		__entry->inobt_sz = inobt_sz;
679 		__entry->rmapbt_sz = rmapbt_sz;
680 		__entry->refcbt_sz = refcbt_sz;
681 	),
682 	TP_printk("dev %d:%d agno %d bno %u ino %u rmap %u refcount %u",
683 		  MAJOR(__entry->dev), MINOR(__entry->dev),
684 		  __entry->agno,
685 		  __entry->bnobt_sz,
686 		  __entry->inobt_sz,
687 		  __entry->rmapbt_sz,
688 		  __entry->refcbt_sz)
689 )
690 TRACE_EVENT(xrep_reset_counters,
691 	TP_PROTO(struct xfs_mount *mp),
692 	TP_ARGS(mp),
693 	TP_STRUCT__entry(
694 		__field(dev_t, dev)
695 	),
696 	TP_fast_assign(
697 		__entry->dev = mp->m_super->s_dev;
698 	),
699 	TP_printk("dev %d:%d",
700 		  MAJOR(__entry->dev), MINOR(__entry->dev))
701 )
702 
703 TRACE_EVENT(xrep_ialloc_insert,
704 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
705 		 xfs_agino_t startino, uint16_t holemask, uint8_t count,
706 		 uint8_t freecount, uint64_t freemask),
707 	TP_ARGS(mp, agno, startino, holemask, count, freecount, freemask),
708 	TP_STRUCT__entry(
709 		__field(dev_t, dev)
710 		__field(xfs_agnumber_t, agno)
711 		__field(xfs_agino_t, startino)
712 		__field(uint16_t, holemask)
713 		__field(uint8_t, count)
714 		__field(uint8_t, freecount)
715 		__field(uint64_t, freemask)
716 	),
717 	TP_fast_assign(
718 		__entry->dev = mp->m_super->s_dev;
719 		__entry->agno = agno;
720 		__entry->startino = startino;
721 		__entry->holemask = holemask;
722 		__entry->count = count;
723 		__entry->freecount = freecount;
724 		__entry->freemask = freemask;
725 	),
726 	TP_printk("dev %d:%d agno %d startino %u holemask 0x%x count %u freecount %u freemask 0x%llx",
727 		  MAJOR(__entry->dev), MINOR(__entry->dev),
728 		  __entry->agno,
729 		  __entry->startino,
730 		  __entry->holemask,
731 		  __entry->count,
732 		  __entry->freecount,
733 		  __entry->freemask)
734 )
735 
736 #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */
737 
738 #endif /* _TRACE_XFS_SCRUB_TRACE_H */
739 
740 #undef TRACE_INCLUDE_PATH
741 #define TRACE_INCLUDE_PATH .
742 #define TRACE_INCLUDE_FILE scrub/trace
743 #include <trace/define_trace.h>
744