xref: /linux/fs/xfs/scrub/trace.h (revision 55d0969c451159cff86949b38c39171cab962069)
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3  * Copyright (C) 2017-2023 Oracle.  All Rights Reserved.
4  * Author: Darrick J. Wong <djwong@kernel.org>
5  *
6  * NOTE: none of these tracepoints shall be considered a stable kernel ABI
7  * as they can change at any time.  See xfs_trace.h for documentation of
8  * specific units found in tracepoint output.
9  */
10 #undef TRACE_SYSTEM
11 #define TRACE_SYSTEM xfs_scrub
12 
13 #if !defined(_TRACE_XFS_SCRUB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
14 #define _TRACE_XFS_SCRUB_TRACE_H
15 
16 #include <linux/tracepoint.h>
17 #include "xfs_bit.h"
18 #include "xfs_quota_defs.h"
19 
20 struct xfs_scrub;
21 struct xfile;
22 struct xfarray;
23 struct xfarray_sortinfo;
24 struct xchk_dqiter;
25 struct xchk_iscan;
26 struct xchk_nlink;
27 struct xchk_fscounters;
28 struct xfs_rmap_update_params;
29 struct xfs_parent_rec;
30 enum xchk_dirpath_outcome;
31 struct xchk_dirtree;
32 struct xchk_dirtree_outcomes;
33 
34 /*
35  * ftrace's __print_symbolic requires that all enum values be wrapped in the
36  * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
37  * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
38  * code.
39  */
40 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
41 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
42 
43 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PROBE);
44 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SB);
45 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGF);
46 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGFL);
47 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGI);
48 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BNOBT);
49 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_CNTBT);
50 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INOBT);
51 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FINOBT);
52 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RMAPBT);
53 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_REFCNTBT);
54 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INODE);
55 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTD);
56 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTA);
57 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTC);
58 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_DIR);
59 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_XATTR);
60 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SYMLINK);
61 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PARENT);
62 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTBITMAP);
63 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTSUM);
64 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_UQUOTA);
65 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_GQUOTA);
66 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PQUOTA);
67 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS);
68 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_QUOTACHECK);
69 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_NLINKS);
70 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_HEALTHY);
71 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_DIRTREE);
72 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BARRIER);
73 
74 #define XFS_SCRUB_TYPE_STRINGS \
75 	{ XFS_SCRUB_TYPE_PROBE,		"probe" }, \
76 	{ XFS_SCRUB_TYPE_SB,		"sb" }, \
77 	{ XFS_SCRUB_TYPE_AGF,		"agf" }, \
78 	{ XFS_SCRUB_TYPE_AGFL,		"agfl" }, \
79 	{ XFS_SCRUB_TYPE_AGI,		"agi" }, \
80 	{ XFS_SCRUB_TYPE_BNOBT,		"bnobt" }, \
81 	{ XFS_SCRUB_TYPE_CNTBT,		"cntbt" }, \
82 	{ XFS_SCRUB_TYPE_INOBT,		"inobt" }, \
83 	{ XFS_SCRUB_TYPE_FINOBT,	"finobt" }, \
84 	{ XFS_SCRUB_TYPE_RMAPBT,	"rmapbt" }, \
85 	{ XFS_SCRUB_TYPE_REFCNTBT,	"refcountbt" }, \
86 	{ XFS_SCRUB_TYPE_INODE,		"inode" }, \
87 	{ XFS_SCRUB_TYPE_BMBTD,		"bmapbtd" }, \
88 	{ XFS_SCRUB_TYPE_BMBTA,		"bmapbta" }, \
89 	{ XFS_SCRUB_TYPE_BMBTC,		"bmapbtc" }, \
90 	{ XFS_SCRUB_TYPE_DIR,		"directory" }, \
91 	{ XFS_SCRUB_TYPE_XATTR,		"xattr" }, \
92 	{ XFS_SCRUB_TYPE_SYMLINK,	"symlink" }, \
93 	{ XFS_SCRUB_TYPE_PARENT,	"parent" }, \
94 	{ XFS_SCRUB_TYPE_RTBITMAP,	"rtbitmap" }, \
95 	{ XFS_SCRUB_TYPE_RTSUM,		"rtsummary" }, \
96 	{ XFS_SCRUB_TYPE_UQUOTA,	"usrquota" }, \
97 	{ XFS_SCRUB_TYPE_GQUOTA,	"grpquota" }, \
98 	{ XFS_SCRUB_TYPE_PQUOTA,	"prjquota" }, \
99 	{ XFS_SCRUB_TYPE_FSCOUNTERS,	"fscounters" }, \
100 	{ XFS_SCRUB_TYPE_QUOTACHECK,	"quotacheck" }, \
101 	{ XFS_SCRUB_TYPE_NLINKS,	"nlinks" }, \
102 	{ XFS_SCRUB_TYPE_HEALTHY,	"healthy" }, \
103 	{ XFS_SCRUB_TYPE_DIRTREE,	"dirtree" }, \
104 	{ XFS_SCRUB_TYPE_BARRIER,	"barrier" }
105 
106 #define XFS_SCRUB_FLAG_STRINGS \
107 	{ XFS_SCRUB_IFLAG_REPAIR,		"repair" }, \
108 	{ XFS_SCRUB_OFLAG_CORRUPT,		"corrupt" }, \
109 	{ XFS_SCRUB_OFLAG_PREEN,		"preen" }, \
110 	{ XFS_SCRUB_OFLAG_XFAIL,		"xfail" }, \
111 	{ XFS_SCRUB_OFLAG_XCORRUPT,		"xcorrupt" }, \
112 	{ XFS_SCRUB_OFLAG_INCOMPLETE,		"incomplete" }, \
113 	{ XFS_SCRUB_OFLAG_WARNING,		"warning" }, \
114 	{ XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED,	"norepair" }, \
115 	{ XFS_SCRUB_IFLAG_FORCE_REBUILD,	"rebuild" }
116 
117 #define XFS_SCRUB_STATE_STRINGS \
118 	{ XCHK_TRY_HARDER,			"try_harder" }, \
119 	{ XCHK_HAVE_FREEZE_PROT,		"nofreeze" }, \
120 	{ XCHK_FSGATES_DRAIN,			"fsgates_drain" }, \
121 	{ XCHK_NEED_DRAIN,			"need_drain" }, \
122 	{ XCHK_FSGATES_QUOTA,			"fsgates_quota" }, \
123 	{ XCHK_FSGATES_DIRENTS,			"fsgates_dirents" }, \
124 	{ XCHK_FSGATES_RMAP,			"fsgates_rmap" }, \
125 	{ XREP_RESET_PERAG_RESV,		"reset_perag_resv" }, \
126 	{ XREP_ALREADY_FIXED,			"already_fixed" }
127 
128 TRACE_DEFINE_ENUM(XFS_RMAP_MAP);
129 TRACE_DEFINE_ENUM(XFS_RMAP_MAP_SHARED);
130 TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP);
131 TRACE_DEFINE_ENUM(XFS_RMAP_UNMAP_SHARED);
132 TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT);
133 TRACE_DEFINE_ENUM(XFS_RMAP_CONVERT_SHARED);
134 TRACE_DEFINE_ENUM(XFS_RMAP_ALLOC);
135 TRACE_DEFINE_ENUM(XFS_RMAP_FREE);
136 
137 DECLARE_EVENT_CLASS(xchk_class,
138 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm,
139 		 int error),
140 	TP_ARGS(ip, sm, error),
141 	TP_STRUCT__entry(
142 		__field(dev_t, dev)
143 		__field(xfs_ino_t, ino)
144 		__field(unsigned int, type)
145 		__field(xfs_agnumber_t, agno)
146 		__field(xfs_ino_t, inum)
147 		__field(unsigned int, gen)
148 		__field(unsigned int, flags)
149 		__field(int, error)
150 	),
151 	TP_fast_assign(
152 		__entry->dev = ip->i_mount->m_super->s_dev;
153 		__entry->ino = ip->i_ino;
154 		__entry->type = sm->sm_type;
155 		__entry->agno = sm->sm_agno;
156 		__entry->inum = sm->sm_ino;
157 		__entry->gen = sm->sm_gen;
158 		__entry->flags = sm->sm_flags;
159 		__entry->error = error;
160 	),
161 	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d",
162 		  MAJOR(__entry->dev), MINOR(__entry->dev),
163 		  __entry->ino,
164 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
165 		  __entry->agno,
166 		  __entry->inum,
167 		  __entry->gen,
168 		  __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS),
169 		  __entry->error)
170 )
171 #define DEFINE_SCRUB_EVENT(name) \
172 DEFINE_EVENT(xchk_class, name, \
173 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \
174 		 int error), \
175 	TP_ARGS(ip, sm, error))
176 
177 DEFINE_SCRUB_EVENT(xchk_start);
178 DEFINE_SCRUB_EVENT(xchk_done);
179 DEFINE_SCRUB_EVENT(xchk_deadlock_retry);
180 DEFINE_SCRUB_EVENT(xchk_dirtree_start);
181 DEFINE_SCRUB_EVENT(xchk_dirtree_done);
182 DEFINE_SCRUB_EVENT(xrep_attempt);
183 DEFINE_SCRUB_EVENT(xrep_done);
184 
185 DECLARE_EVENT_CLASS(xchk_fsgate_class,
186 	TP_PROTO(struct xfs_scrub *sc, unsigned int fsgate_flags),
187 	TP_ARGS(sc, fsgate_flags),
188 	TP_STRUCT__entry(
189 		__field(dev_t, dev)
190 		__field(unsigned int, type)
191 		__field(unsigned int, fsgate_flags)
192 	),
193 	TP_fast_assign(
194 		__entry->dev = sc->mp->m_super->s_dev;
195 		__entry->type = sc->sm->sm_type;
196 		__entry->fsgate_flags = fsgate_flags;
197 	),
198 	TP_printk("dev %d:%d type %s fsgates '%s'",
199 		  MAJOR(__entry->dev), MINOR(__entry->dev),
200 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
201 		  __print_flags(__entry->fsgate_flags, "|", XFS_SCRUB_STATE_STRINGS))
202 )
203 
204 #define DEFINE_SCRUB_FSHOOK_EVENT(name) \
205 DEFINE_EVENT(xchk_fsgate_class, name, \
206 	TP_PROTO(struct xfs_scrub *sc, unsigned int fsgates_flags), \
207 	TP_ARGS(sc, fsgates_flags))
208 
209 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_enable);
210 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_disable);
211 
212 DECLARE_EVENT_CLASS(xchk_vector_head_class,
213 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_vec_head *vhead),
214 	TP_ARGS(ip, vhead),
215 	TP_STRUCT__entry(
216 		__field(dev_t, dev)
217 		__field(xfs_ino_t, ino)
218 		__field(xfs_agnumber_t, agno)
219 		__field(xfs_ino_t, inum)
220 		__field(unsigned int, gen)
221 		__field(unsigned int, flags)
222 		__field(unsigned short, rest_us)
223 		__field(unsigned short, nr_vecs)
224 	),
225 	TP_fast_assign(
226 		__entry->dev = ip->i_mount->m_super->s_dev;
227 		__entry->ino = ip->i_ino;
228 		__entry->agno = vhead->svh_agno;
229 		__entry->inum = vhead->svh_ino;
230 		__entry->gen = vhead->svh_gen;
231 		__entry->flags = vhead->svh_flags;
232 		__entry->rest_us = vhead->svh_rest_us;
233 		__entry->nr_vecs = vhead->svh_nr;
234 	),
235 	TP_printk("dev %d:%d ino 0x%llx agno 0x%x inum 0x%llx gen 0x%x flags 0x%x rest_us %u nr_vecs %u",
236 		  MAJOR(__entry->dev), MINOR(__entry->dev),
237 		  __entry->ino,
238 		  __entry->agno,
239 		  __entry->inum,
240 		  __entry->gen,
241 		  __entry->flags,
242 		  __entry->rest_us,
243 		  __entry->nr_vecs)
244 )
245 #define DEFINE_SCRUBV_HEAD_EVENT(name) \
246 DEFINE_EVENT(xchk_vector_head_class, name, \
247 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_vec_head *vhead), \
248 	TP_ARGS(ip, vhead))
249 
250 DEFINE_SCRUBV_HEAD_EVENT(xchk_scrubv_start);
251 
252 DECLARE_EVENT_CLASS(xchk_vector_class,
253 	TP_PROTO(struct xfs_mount *mp, struct xfs_scrub_vec_head *vhead,
254 		 unsigned int vec_nr, struct xfs_scrub_vec *v),
255 	TP_ARGS(mp, vhead, vec_nr, v),
256 	TP_STRUCT__entry(
257 		__field(dev_t, dev)
258 		__field(unsigned int, vec_nr)
259 		__field(unsigned int, vec_type)
260 		__field(unsigned int, vec_flags)
261 		__field(int, vec_ret)
262 	),
263 	TP_fast_assign(
264 		__entry->dev = mp->m_super->s_dev;
265 		__entry->vec_nr = vec_nr;
266 		__entry->vec_type = v->sv_type;
267 		__entry->vec_flags = v->sv_flags;
268 		__entry->vec_ret = v->sv_ret;
269 	),
270 	TP_printk("dev %d:%d vec[%u] type %s flags %s ret %d",
271 		  MAJOR(__entry->dev), MINOR(__entry->dev),
272 		  __entry->vec_nr,
273 		  __print_symbolic(__entry->vec_type, XFS_SCRUB_TYPE_STRINGS),
274 		  __print_flags(__entry->vec_flags, "|", XFS_SCRUB_FLAG_STRINGS),
275 		  __entry->vec_ret)
276 )
277 #define DEFINE_SCRUBV_EVENT(name) \
278 DEFINE_EVENT(xchk_vector_class, name, \
279 	TP_PROTO(struct xfs_mount *mp, struct xfs_scrub_vec_head *vhead, \
280 		 unsigned int vec_nr, struct xfs_scrub_vec *v), \
281 	TP_ARGS(mp, vhead, vec_nr, v))
282 
283 DEFINE_SCRUBV_EVENT(xchk_scrubv_barrier_fail);
284 DEFINE_SCRUBV_EVENT(xchk_scrubv_item);
285 DEFINE_SCRUBV_EVENT(xchk_scrubv_outcome);
286 
287 TRACE_EVENT(xchk_op_error,
288 	TP_PROTO(struct xfs_scrub *sc, xfs_agnumber_t agno,
289 		 xfs_agblock_t bno, int error, void *ret_ip),
290 	TP_ARGS(sc, agno, bno, error, ret_ip),
291 	TP_STRUCT__entry(
292 		__field(dev_t, dev)
293 		__field(unsigned int, type)
294 		__field(xfs_agnumber_t, agno)
295 		__field(xfs_agblock_t, bno)
296 		__field(int, error)
297 		__field(void *, ret_ip)
298 	),
299 	TP_fast_assign(
300 		__entry->dev = sc->mp->m_super->s_dev;
301 		__entry->type = sc->sm->sm_type;
302 		__entry->agno = agno;
303 		__entry->bno = bno;
304 		__entry->error = error;
305 		__entry->ret_ip = ret_ip;
306 	),
307 	TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x error %d ret_ip %pS",
308 		  MAJOR(__entry->dev), MINOR(__entry->dev),
309 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
310 		  __entry->agno,
311 		  __entry->bno,
312 		  __entry->error,
313 		  __entry->ret_ip)
314 );
315 
316 TRACE_EVENT(xchk_file_op_error,
317 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
318 		 xfs_fileoff_t offset, int error, void *ret_ip),
319 	TP_ARGS(sc, whichfork, offset, error, ret_ip),
320 	TP_STRUCT__entry(
321 		__field(dev_t, dev)
322 		__field(xfs_ino_t, ino)
323 		__field(int, whichfork)
324 		__field(unsigned int, type)
325 		__field(xfs_fileoff_t, offset)
326 		__field(int, error)
327 		__field(void *, ret_ip)
328 	),
329 	TP_fast_assign(
330 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
331 		__entry->ino = sc->ip->i_ino;
332 		__entry->whichfork = whichfork;
333 		__entry->type = sc->sm->sm_type;
334 		__entry->offset = offset;
335 		__entry->error = error;
336 		__entry->ret_ip = ret_ip;
337 	),
338 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx error %d ret_ip %pS",
339 		  MAJOR(__entry->dev), MINOR(__entry->dev),
340 		  __entry->ino,
341 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
342 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
343 		  __entry->offset,
344 		  __entry->error,
345 		  __entry->ret_ip)
346 );
347 
348 DECLARE_EVENT_CLASS(xchk_block_error_class,
349 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, void *ret_ip),
350 	TP_ARGS(sc, daddr, ret_ip),
351 	TP_STRUCT__entry(
352 		__field(dev_t, dev)
353 		__field(unsigned int, type)
354 		__field(xfs_agnumber_t, agno)
355 		__field(xfs_agblock_t, agbno)
356 		__field(void *, ret_ip)
357 	),
358 	TP_fast_assign(
359 		__entry->dev = sc->mp->m_super->s_dev;
360 		__entry->type = sc->sm->sm_type;
361 		__entry->agno = xfs_daddr_to_agno(sc->mp, daddr);
362 		__entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr);
363 		__entry->ret_ip = ret_ip;
364 	),
365 	TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x ret_ip %pS",
366 		  MAJOR(__entry->dev), MINOR(__entry->dev),
367 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
368 		  __entry->agno,
369 		  __entry->agbno,
370 		  __entry->ret_ip)
371 )
372 
373 #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \
374 DEFINE_EVENT(xchk_block_error_class, name, \
375 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, \
376 		 void *ret_ip), \
377 	TP_ARGS(sc, daddr, ret_ip))
378 
379 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_fs_error);
380 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_error);
381 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_preen);
382 
383 DECLARE_EVENT_CLASS(xchk_ino_error_class,
384 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, void *ret_ip),
385 	TP_ARGS(sc, ino, ret_ip),
386 	TP_STRUCT__entry(
387 		__field(dev_t, dev)
388 		__field(xfs_ino_t, ino)
389 		__field(unsigned int, type)
390 		__field(void *, ret_ip)
391 	),
392 	TP_fast_assign(
393 		__entry->dev = sc->mp->m_super->s_dev;
394 		__entry->ino = ino;
395 		__entry->type = sc->sm->sm_type;
396 		__entry->ret_ip = ret_ip;
397 	),
398 	TP_printk("dev %d:%d ino 0x%llx type %s ret_ip %pS",
399 		  MAJOR(__entry->dev), MINOR(__entry->dev),
400 		  __entry->ino,
401 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
402 		  __entry->ret_ip)
403 )
404 
405 #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \
406 DEFINE_EVENT(xchk_ino_error_class, name, \
407 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, \
408 		 void *ret_ip), \
409 	TP_ARGS(sc, ino, ret_ip))
410 
411 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_error);
412 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_preen);
413 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_warning);
414 
415 DECLARE_EVENT_CLASS(xchk_fblock_error_class,
416 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
417 		 xfs_fileoff_t offset, void *ret_ip),
418 	TP_ARGS(sc, whichfork, offset, ret_ip),
419 	TP_STRUCT__entry(
420 		__field(dev_t, dev)
421 		__field(xfs_ino_t, ino)
422 		__field(int, whichfork)
423 		__field(unsigned int, type)
424 		__field(xfs_fileoff_t, offset)
425 		__field(void *, ret_ip)
426 	),
427 	TP_fast_assign(
428 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
429 		__entry->ino = sc->ip->i_ino;
430 		__entry->whichfork = whichfork;
431 		__entry->type = sc->sm->sm_type;
432 		__entry->offset = offset;
433 		__entry->ret_ip = ret_ip;
434 	),
435 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx ret_ip %pS",
436 		  MAJOR(__entry->dev), MINOR(__entry->dev),
437 		  __entry->ino,
438 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
439 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
440 		  __entry->offset,
441 		  __entry->ret_ip)
442 );
443 
444 #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \
445 DEFINE_EVENT(xchk_fblock_error_class, name, \
446 	TP_PROTO(struct xfs_scrub *sc, int whichfork, \
447 		 xfs_fileoff_t offset, void *ret_ip), \
448 	TP_ARGS(sc, whichfork, offset, ret_ip))
449 
450 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_error);
451 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_warning);
452 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_preen);
453 
454 #ifdef CONFIG_XFS_QUOTA
455 DECLARE_EVENT_CLASS(xchk_dqiter_class,
456 	TP_PROTO(struct xchk_dqiter *cursor, uint64_t id),
457 	TP_ARGS(cursor, id),
458 	TP_STRUCT__entry(
459 		__field(dev_t, dev)
460 		__field(xfs_dqtype_t, dqtype)
461 		__field(xfs_ino_t, ino)
462 		__field(unsigned long long, cur_id)
463 		__field(unsigned long long, id)
464 		__field(xfs_fileoff_t, startoff)
465 		__field(xfs_fsblock_t, startblock)
466 		__field(xfs_filblks_t, blockcount)
467 		__field(xfs_exntst_t, state)
468 	),
469 	TP_fast_assign(
470 		__entry->dev = cursor->sc->ip->i_mount->m_super->s_dev;
471 		__entry->dqtype = cursor->dqtype;
472 		__entry->ino = cursor->quota_ip->i_ino;
473 		__entry->cur_id = cursor->id;
474 		__entry->startoff = cursor->bmap.br_startoff;
475 		__entry->startblock = cursor->bmap.br_startblock;
476 		__entry->blockcount = cursor->bmap.br_blockcount;
477 		__entry->state = cursor->bmap.br_state;
478 		__entry->id = id;
479 	),
480 	TP_printk("dev %d:%d dquot type %s ino 0x%llx cursor_id 0x%llx startoff 0x%llx startblock 0x%llx blockcount 0x%llx state %u id 0x%llx",
481 		  MAJOR(__entry->dev), MINOR(__entry->dev),
482 		  __print_symbolic(__entry->dqtype, XFS_DQTYPE_STRINGS),
483 		  __entry->ino,
484 		  __entry->cur_id,
485 		  __entry->startoff,
486 		  __entry->startblock,
487 		  __entry->blockcount,
488 		  __entry->state,
489 		  __entry->id)
490 );
491 
492 #define DEFINE_SCRUB_DQITER_EVENT(name) \
493 DEFINE_EVENT(xchk_dqiter_class, name, \
494 	TP_PROTO(struct xchk_dqiter *cursor, uint64_t id), \
495 	TP_ARGS(cursor, id))
496 DEFINE_SCRUB_DQITER_EVENT(xchk_dquot_iter_revalidate_bmap);
497 DEFINE_SCRUB_DQITER_EVENT(xchk_dquot_iter_advance_bmap);
498 DEFINE_SCRUB_DQITER_EVENT(xchk_dquot_iter_advance_incore);
499 DEFINE_SCRUB_DQITER_EVENT(xchk_dquot_iter);
500 
501 TRACE_EVENT(xchk_qcheck_error,
502 	TP_PROTO(struct xfs_scrub *sc, xfs_dqtype_t dqtype, xfs_dqid_t id,
503 		 void *ret_ip),
504 	TP_ARGS(sc, dqtype, id, ret_ip),
505 	TP_STRUCT__entry(
506 		__field(dev_t, dev)
507 		__field(xfs_dqtype_t, dqtype)
508 		__field(xfs_dqid_t, id)
509 		__field(void *, ret_ip)
510 	),
511 	TP_fast_assign(
512 		__entry->dev = sc->mp->m_super->s_dev;
513 		__entry->dqtype = dqtype;
514 		__entry->id = id;
515 		__entry->ret_ip = ret_ip;
516 	),
517 	TP_printk("dev %d:%d dquot type %s id 0x%x ret_ip %pS",
518 		  MAJOR(__entry->dev), MINOR(__entry->dev),
519 		  __print_symbolic(__entry->dqtype, XFS_DQTYPE_STRINGS),
520 		  __entry->id,
521 		  __entry->ret_ip)
522 );
523 #endif /* CONFIG_XFS_QUOTA */
524 
525 TRACE_EVENT(xchk_incomplete,
526 	TP_PROTO(struct xfs_scrub *sc, void *ret_ip),
527 	TP_ARGS(sc, ret_ip),
528 	TP_STRUCT__entry(
529 		__field(dev_t, dev)
530 		__field(unsigned int, type)
531 		__field(void *, ret_ip)
532 	),
533 	TP_fast_assign(
534 		__entry->dev = sc->mp->m_super->s_dev;
535 		__entry->type = sc->sm->sm_type;
536 		__entry->ret_ip = ret_ip;
537 	),
538 	TP_printk("dev %d:%d type %s ret_ip %pS",
539 		  MAJOR(__entry->dev), MINOR(__entry->dev),
540 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
541 		  __entry->ret_ip)
542 );
543 
544 TRACE_EVENT(xchk_btree_op_error,
545 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
546 		 int level, int error, void *ret_ip),
547 	TP_ARGS(sc, cur, level, error, ret_ip),
548 	TP_STRUCT__entry(
549 		__field(dev_t, dev)
550 		__field(unsigned int, type)
551 		__string(name, cur->bc_ops->name)
552 		__field(int, level)
553 		__field(xfs_agnumber_t, agno)
554 		__field(xfs_agblock_t, bno)
555 		__field(int, ptr)
556 		__field(int, error)
557 		__field(void *, ret_ip)
558 	),
559 	TP_fast_assign(
560 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
561 
562 		__entry->dev = sc->mp->m_super->s_dev;
563 		__entry->type = sc->sm->sm_type;
564 		__assign_str(name);
565 		__entry->level = level;
566 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
567 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
568 		__entry->ptr = cur->bc_levels[level].ptr;
569 		__entry->error = error;
570 		__entry->ret_ip = ret_ip;
571 	),
572 	TP_printk("dev %d:%d type %s %sbt level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
573 		  MAJOR(__entry->dev), MINOR(__entry->dev),
574 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
575 		  __get_str(name),
576 		  __entry->level,
577 		  __entry->ptr,
578 		  __entry->agno,
579 		  __entry->bno,
580 		  __entry->error,
581 		  __entry->ret_ip)
582 );
583 
584 TRACE_EVENT(xchk_ifork_btree_op_error,
585 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
586 		 int level, int error, void *ret_ip),
587 	TP_ARGS(sc, cur, level, error, ret_ip),
588 	TP_STRUCT__entry(
589 		__field(dev_t, dev)
590 		__field(xfs_ino_t, ino)
591 		__field(int, whichfork)
592 		__field(unsigned int, type)
593 		__string(name, cur->bc_ops->name)
594 		__field(int, level)
595 		__field(int, ptr)
596 		__field(xfs_agnumber_t, agno)
597 		__field(xfs_agblock_t, bno)
598 		__field(int, error)
599 		__field(void *, ret_ip)
600 	),
601 	TP_fast_assign(
602 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
603 		__entry->dev = sc->mp->m_super->s_dev;
604 		__entry->ino = sc->ip->i_ino;
605 		__entry->whichfork = cur->bc_ino.whichfork;
606 		__entry->type = sc->sm->sm_type;
607 		__assign_str(name);
608 		__entry->level = level;
609 		__entry->ptr = cur->bc_levels[level].ptr;
610 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
611 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
612 		__entry->error = error;
613 		__entry->ret_ip = ret_ip;
614 	),
615 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s %sbt level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
616 		  MAJOR(__entry->dev), MINOR(__entry->dev),
617 		  __entry->ino,
618 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
619 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
620 		  __get_str(name),
621 		  __entry->level,
622 		  __entry->ptr,
623 		  __entry->agno,
624 		  __entry->bno,
625 		  __entry->error,
626 		  __entry->ret_ip)
627 );
628 
629 TRACE_EVENT(xchk_btree_error,
630 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
631 		 int level, void *ret_ip),
632 	TP_ARGS(sc, cur, level, ret_ip),
633 	TP_STRUCT__entry(
634 		__field(dev_t, dev)
635 		__field(unsigned int, type)
636 		__string(name, cur->bc_ops->name)
637 		__field(int, level)
638 		__field(xfs_agnumber_t, agno)
639 		__field(xfs_agblock_t, bno)
640 		__field(int, ptr)
641 		__field(void *, ret_ip)
642 	),
643 	TP_fast_assign(
644 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
645 		__entry->dev = sc->mp->m_super->s_dev;
646 		__entry->type = sc->sm->sm_type;
647 		__assign_str(name);
648 		__entry->level = level;
649 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
650 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
651 		__entry->ptr = cur->bc_levels[level].ptr;
652 		__entry->ret_ip = ret_ip;
653 	),
654 	TP_printk("dev %d:%d type %s %sbt level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
655 		  MAJOR(__entry->dev), MINOR(__entry->dev),
656 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
657 		  __get_str(name),
658 		  __entry->level,
659 		  __entry->ptr,
660 		  __entry->agno,
661 		  __entry->bno,
662 		  __entry->ret_ip)
663 );
664 
665 TRACE_EVENT(xchk_ifork_btree_error,
666 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
667 		 int level, void *ret_ip),
668 	TP_ARGS(sc, cur, level, ret_ip),
669 	TP_STRUCT__entry(
670 		__field(dev_t, dev)
671 		__field(xfs_ino_t, ino)
672 		__field(int, whichfork)
673 		__field(unsigned int, type)
674 		__string(name, cur->bc_ops->name)
675 		__field(int, level)
676 		__field(xfs_agnumber_t, agno)
677 		__field(xfs_agblock_t, bno)
678 		__field(int, ptr)
679 		__field(void *, ret_ip)
680 	),
681 	TP_fast_assign(
682 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
683 		__entry->dev = sc->mp->m_super->s_dev;
684 		__entry->ino = sc->ip->i_ino;
685 		__entry->whichfork = cur->bc_ino.whichfork;
686 		__entry->type = sc->sm->sm_type;
687 		__assign_str(name);
688 		__entry->level = level;
689 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
690 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
691 		__entry->ptr = cur->bc_levels[level].ptr;
692 		__entry->ret_ip = ret_ip;
693 	),
694 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s %sbt level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
695 		  MAJOR(__entry->dev), MINOR(__entry->dev),
696 		  __entry->ino,
697 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
698 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
699 		  __get_str(name),
700 		  __entry->level,
701 		  __entry->ptr,
702 		  __entry->agno,
703 		  __entry->bno,
704 		  __entry->ret_ip)
705 );
706 
707 DECLARE_EVENT_CLASS(xchk_sbtree_class,
708 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
709 		 int level),
710 	TP_ARGS(sc, cur, level),
711 	TP_STRUCT__entry(
712 		__field(dev_t, dev)
713 		__field(int, type)
714 		__string(name, cur->bc_ops->name)
715 		__field(xfs_agnumber_t, agno)
716 		__field(xfs_agblock_t, bno)
717 		__field(int, level)
718 		__field(int, nlevels)
719 		__field(int, ptr)
720 	),
721 	TP_fast_assign(
722 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
723 
724 		__entry->dev = sc->mp->m_super->s_dev;
725 		__entry->type = sc->sm->sm_type;
726 		__assign_str(name);
727 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
728 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
729 		__entry->level = level;
730 		__entry->nlevels = cur->bc_nlevels;
731 		__entry->ptr = cur->bc_levels[level].ptr;
732 	),
733 	TP_printk("dev %d:%d type %s %sbt agno 0x%x agbno 0x%x level %d nlevels %d ptr %d",
734 		  MAJOR(__entry->dev), MINOR(__entry->dev),
735 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
736 		  __get_str(name),
737 		  __entry->agno,
738 		  __entry->bno,
739 		  __entry->level,
740 		  __entry->nlevels,
741 		  __entry->ptr)
742 )
743 #define DEFINE_SCRUB_SBTREE_EVENT(name) \
744 DEFINE_EVENT(xchk_sbtree_class, name, \
745 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, \
746 		 int level), \
747 	TP_ARGS(sc, cur, level))
748 
749 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_rec);
750 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_key);
751 
752 TRACE_EVENT(xchk_xref_error,
753 	TP_PROTO(struct xfs_scrub *sc, int error, void *ret_ip),
754 	TP_ARGS(sc, error, ret_ip),
755 	TP_STRUCT__entry(
756 		__field(dev_t, dev)
757 		__field(int, type)
758 		__field(int, error)
759 		__field(void *, ret_ip)
760 	),
761 	TP_fast_assign(
762 		__entry->dev = sc->mp->m_super->s_dev;
763 		__entry->type = sc->sm->sm_type;
764 		__entry->error = error;
765 		__entry->ret_ip = ret_ip;
766 	),
767 	TP_printk("dev %d:%d type %s xref error %d ret_ip %pS",
768 		  MAJOR(__entry->dev), MINOR(__entry->dev),
769 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
770 		  __entry->error,
771 		  __entry->ret_ip)
772 );
773 
774 TRACE_EVENT(xchk_iallocbt_check_cluster,
775 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
776 		 xfs_agino_t startino, xfs_daddr_t map_daddr,
777 		 unsigned short map_len, unsigned int chunk_ino,
778 		 unsigned int nr_inodes, uint16_t cluster_mask,
779 		 uint16_t holemask, unsigned int cluster_ino),
780 	TP_ARGS(mp, agno, startino, map_daddr, map_len, chunk_ino, nr_inodes,
781 		cluster_mask, holemask, cluster_ino),
782 	TP_STRUCT__entry(
783 		__field(dev_t, dev)
784 		__field(xfs_agnumber_t, agno)
785 		__field(xfs_agino_t, startino)
786 		__field(xfs_daddr_t, map_daddr)
787 		__field(unsigned short, map_len)
788 		__field(unsigned int, chunk_ino)
789 		__field(unsigned int, nr_inodes)
790 		__field(unsigned int, cluster_ino)
791 		__field(uint16_t, cluster_mask)
792 		__field(uint16_t, holemask)
793 	),
794 	TP_fast_assign(
795 		__entry->dev = mp->m_super->s_dev;
796 		__entry->agno = agno;
797 		__entry->startino = startino;
798 		__entry->map_daddr = map_daddr;
799 		__entry->map_len = map_len;
800 		__entry->chunk_ino = chunk_ino;
801 		__entry->nr_inodes = nr_inodes;
802 		__entry->cluster_mask = cluster_mask;
803 		__entry->holemask = holemask;
804 		__entry->cluster_ino = cluster_ino;
805 	),
806 	TP_printk("dev %d:%d agno 0x%x startino 0x%x daddr 0x%llx bbcount 0x%x chunkino 0x%x nr_inodes %u cluster_mask 0x%x holemask 0x%x cluster_ino 0x%x",
807 		  MAJOR(__entry->dev), MINOR(__entry->dev),
808 		  __entry->agno,
809 		  __entry->startino,
810 		  __entry->map_daddr,
811 		  __entry->map_len,
812 		  __entry->chunk_ino,
813 		  __entry->nr_inodes,
814 		  __entry->cluster_mask,
815 		  __entry->holemask,
816 		  __entry->cluster_ino)
817 )
818 
819 TRACE_EVENT(xchk_inode_is_allocated,
820 	TP_PROTO(struct xfs_inode *ip),
821 	TP_ARGS(ip),
822 	TP_STRUCT__entry(
823 		__field(dev_t, dev)
824 		__field(xfs_ino_t, ino)
825 		__field(unsigned long, iflags)
826 		__field(umode_t, mode)
827 	),
828 	TP_fast_assign(
829 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
830 		__entry->ino = ip->i_ino;
831 		__entry->iflags = ip->i_flags;
832 		__entry->mode = VFS_I(ip)->i_mode;
833 	),
834 	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx mode 0x%x",
835 		  MAJOR(__entry->dev), MINOR(__entry->dev),
836 		  __entry->ino,
837 		  __entry->iflags,
838 		  __entry->mode)
839 );
840 
841 TRACE_EVENT(xchk_fscounters_calc,
842 	TP_PROTO(struct xfs_mount *mp, uint64_t icount, uint64_t ifree,
843 		 uint64_t fdblocks, uint64_t delalloc),
844 	TP_ARGS(mp, icount, ifree, fdblocks, delalloc),
845 	TP_STRUCT__entry(
846 		__field(dev_t, dev)
847 		__field(int64_t, icount_sb)
848 		__field(uint64_t, icount_calculated)
849 		__field(int64_t, ifree_sb)
850 		__field(uint64_t, ifree_calculated)
851 		__field(int64_t, fdblocks_sb)
852 		__field(uint64_t, fdblocks_calculated)
853 		__field(uint64_t, delalloc)
854 	),
855 	TP_fast_assign(
856 		__entry->dev = mp->m_super->s_dev;
857 		__entry->icount_sb = mp->m_sb.sb_icount;
858 		__entry->icount_calculated = icount;
859 		__entry->ifree_sb = mp->m_sb.sb_ifree;
860 		__entry->ifree_calculated = ifree;
861 		__entry->fdblocks_sb = mp->m_sb.sb_fdblocks;
862 		__entry->fdblocks_calculated = fdblocks;
863 		__entry->delalloc = delalloc;
864 	),
865 	TP_printk("dev %d:%d icount %lld:%llu ifree %lld::%llu fdblocks %lld::%llu delalloc %llu",
866 		  MAJOR(__entry->dev), MINOR(__entry->dev),
867 		  __entry->icount_sb,
868 		  __entry->icount_calculated,
869 		  __entry->ifree_sb,
870 		  __entry->ifree_calculated,
871 		  __entry->fdblocks_sb,
872 		  __entry->fdblocks_calculated,
873 		  __entry->delalloc)
874 )
875 
876 TRACE_EVENT(xchk_fscounters_within_range,
877 	TP_PROTO(struct xfs_mount *mp, uint64_t expected, int64_t curr_value,
878 		 int64_t old_value),
879 	TP_ARGS(mp, expected, curr_value, old_value),
880 	TP_STRUCT__entry(
881 		__field(dev_t, dev)
882 		__field(uint64_t, expected)
883 		__field(int64_t, curr_value)
884 		__field(int64_t, old_value)
885 	),
886 	TP_fast_assign(
887 		__entry->dev = mp->m_super->s_dev;
888 		__entry->expected = expected;
889 		__entry->curr_value = curr_value;
890 		__entry->old_value = old_value;
891 	),
892 	TP_printk("dev %d:%d expected %llu curr_value %lld old_value %lld",
893 		  MAJOR(__entry->dev), MINOR(__entry->dev),
894 		  __entry->expected,
895 		  __entry->curr_value,
896 		  __entry->old_value)
897 )
898 
899 DECLARE_EVENT_CLASS(xchk_fsfreeze_class,
900 	TP_PROTO(struct xfs_scrub *sc, int error),
901 	TP_ARGS(sc, error),
902 	TP_STRUCT__entry(
903 		__field(dev_t, dev)
904 		__field(unsigned int, type)
905 		__field(int, error)
906 	),
907 	TP_fast_assign(
908 		__entry->dev = sc->mp->m_super->s_dev;
909 		__entry->type = sc->sm->sm_type;
910 		__entry->error = error;
911 	),
912 	TP_printk("dev %d:%d type %s error %d",
913 		  MAJOR(__entry->dev), MINOR(__entry->dev),
914 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
915 		  __entry->error)
916 );
917 #define DEFINE_XCHK_FSFREEZE_EVENT(name) \
918 DEFINE_EVENT(xchk_fsfreeze_class, name, \
919 	TP_PROTO(struct xfs_scrub *sc, int error), \
920 	TP_ARGS(sc, error))
921 DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsfreeze);
922 DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsthaw);
923 
924 TRACE_EVENT(xchk_refcount_incorrect,
925 	TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *irec,
926 		 xfs_nlink_t seen),
927 	TP_ARGS(pag, irec, seen),
928 	TP_STRUCT__entry(
929 		__field(dev_t, dev)
930 		__field(xfs_agnumber_t, agno)
931 		__field(enum xfs_refc_domain, domain)
932 		__field(xfs_agblock_t, startblock)
933 		__field(xfs_extlen_t, blockcount)
934 		__field(xfs_nlink_t, refcount)
935 		__field(xfs_nlink_t, seen)
936 	),
937 	TP_fast_assign(
938 		__entry->dev = pag->pag_mount->m_super->s_dev;
939 		__entry->agno = pag->pag_agno;
940 		__entry->domain = irec->rc_domain;
941 		__entry->startblock = irec->rc_startblock;
942 		__entry->blockcount = irec->rc_blockcount;
943 		__entry->refcount = irec->rc_refcount;
944 		__entry->seen = seen;
945 	),
946 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u seen %u",
947 		  MAJOR(__entry->dev), MINOR(__entry->dev),
948 		  __entry->agno,
949 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
950 		  __entry->startblock,
951 		  __entry->blockcount,
952 		  __entry->refcount,
953 		  __entry->seen)
954 )
955 
956 TRACE_EVENT(xfile_create,
957 	TP_PROTO(struct xfile *xf),
958 	TP_ARGS(xf),
959 	TP_STRUCT__entry(
960 		__field(dev_t, dev)
961 		__field(unsigned long, ino)
962 		__array(char, pathname, MAXNAMELEN)
963 	),
964 	TP_fast_assign(
965 		char		*path;
966 
967 		__entry->ino = file_inode(xf->file)->i_ino;
968 		path = file_path(xf->file, __entry->pathname, MAXNAMELEN);
969 		if (IS_ERR(path))
970 			strncpy(__entry->pathname, "(unknown)",
971 					sizeof(__entry->pathname));
972 	),
973 	TP_printk("xfino 0x%lx path '%s'",
974 		  __entry->ino,
975 		  __entry->pathname)
976 );
977 
978 TRACE_EVENT(xfile_destroy,
979 	TP_PROTO(struct xfile *xf),
980 	TP_ARGS(xf),
981 	TP_STRUCT__entry(
982 		__field(unsigned long, ino)
983 		__field(unsigned long long, bytes)
984 		__field(loff_t, size)
985 	),
986 	TP_fast_assign(
987 		struct inode		*inode = file_inode(xf->file);
988 
989 		__entry->ino = inode->i_ino;
990 		__entry->bytes = inode->i_blocks << SECTOR_SHIFT;
991 		__entry->size = i_size_read(inode);
992 	),
993 	TP_printk("xfino 0x%lx mem_bytes 0x%llx isize 0x%llx",
994 		  __entry->ino,
995 		  __entry->bytes,
996 		  __entry->size)
997 );
998 
999 DECLARE_EVENT_CLASS(xfile_class,
1000 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount),
1001 	TP_ARGS(xf, pos, bytecount),
1002 	TP_STRUCT__entry(
1003 		__field(unsigned long, ino)
1004 		__field(unsigned long long, bytes_used)
1005 		__field(loff_t, pos)
1006 		__field(loff_t, size)
1007 		__field(unsigned long long, bytecount)
1008 	),
1009 	TP_fast_assign(
1010 		struct inode		*inode = file_inode(xf->file);
1011 
1012 		__entry->ino = inode->i_ino;
1013 		__entry->bytes_used = inode->i_blocks << SECTOR_SHIFT;
1014 		__entry->pos = pos;
1015 		__entry->size = i_size_read(inode);
1016 		__entry->bytecount = bytecount;
1017 	),
1018 	TP_printk("xfino 0x%lx mem_bytes 0x%llx pos 0x%llx bytecount 0x%llx isize 0x%llx",
1019 		  __entry->ino,
1020 		  __entry->bytes_used,
1021 		  __entry->pos,
1022 		  __entry->bytecount,
1023 		  __entry->size)
1024 );
1025 #define DEFINE_XFILE_EVENT(name) \
1026 DEFINE_EVENT(xfile_class, name, \
1027 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount), \
1028 	TP_ARGS(xf, pos, bytecount))
1029 DEFINE_XFILE_EVENT(xfile_load);
1030 DEFINE_XFILE_EVENT(xfile_store);
1031 DEFINE_XFILE_EVENT(xfile_seek_data);
1032 DEFINE_XFILE_EVENT(xfile_get_folio);
1033 DEFINE_XFILE_EVENT(xfile_put_folio);
1034 DEFINE_XFILE_EVENT(xfile_discard);
1035 
1036 TRACE_EVENT(xfarray_create,
1037 	TP_PROTO(struct xfarray *xfa, unsigned long long required_capacity),
1038 	TP_ARGS(xfa, required_capacity),
1039 	TP_STRUCT__entry(
1040 		__field(unsigned long, ino)
1041 		__field(uint64_t, max_nr)
1042 		__field(size_t, obj_size)
1043 		__field(int, obj_size_log)
1044 		__field(unsigned long long, required_capacity)
1045 	),
1046 	TP_fast_assign(
1047 		__entry->max_nr = xfa->max_nr;
1048 		__entry->obj_size = xfa->obj_size;
1049 		__entry->obj_size_log = xfa->obj_size_log;
1050 		__entry->ino = file_inode(xfa->xfile->file)->i_ino;
1051 		__entry->required_capacity = required_capacity;
1052 	),
1053 	TP_printk("xfino 0x%lx max_nr %llu reqd_nr %llu objsz %zu objszlog %d",
1054 		  __entry->ino,
1055 		  __entry->max_nr,
1056 		  __entry->required_capacity,
1057 		  __entry->obj_size,
1058 		  __entry->obj_size_log)
1059 );
1060 
1061 TRACE_EVENT(xfarray_isort,
1062 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1063 	TP_ARGS(si, lo, hi),
1064 	TP_STRUCT__entry(
1065 		__field(unsigned long, ino)
1066 		__field(unsigned long long, lo)
1067 		__field(unsigned long long, hi)
1068 	),
1069 	TP_fast_assign(
1070 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1071 		__entry->lo = lo;
1072 		__entry->hi = hi;
1073 	),
1074 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
1075 		  __entry->ino,
1076 		  __entry->lo,
1077 		  __entry->hi,
1078 		  __entry->hi - __entry->lo)
1079 );
1080 
1081 TRACE_EVENT(xfarray_foliosort,
1082 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1083 	TP_ARGS(si, lo, hi),
1084 	TP_STRUCT__entry(
1085 		__field(unsigned long, ino)
1086 		__field(unsigned long long, lo)
1087 		__field(unsigned long long, hi)
1088 	),
1089 	TP_fast_assign(
1090 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1091 		__entry->lo = lo;
1092 		__entry->hi = hi;
1093 	),
1094 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
1095 		  __entry->ino,
1096 		  __entry->lo,
1097 		  __entry->hi,
1098 		  __entry->hi - __entry->lo)
1099 );
1100 
1101 TRACE_EVENT(xfarray_qsort,
1102 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1103 	TP_ARGS(si, lo, hi),
1104 	TP_STRUCT__entry(
1105 		__field(unsigned long, ino)
1106 		__field(unsigned long long, lo)
1107 		__field(unsigned long long, hi)
1108 		__field(int, stack_depth)
1109 		__field(int, max_stack_depth)
1110 	),
1111 	TP_fast_assign(
1112 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1113 		__entry->lo = lo;
1114 		__entry->hi = hi;
1115 		__entry->stack_depth = si->stack_depth;
1116 		__entry->max_stack_depth = si->max_stack_depth;
1117 	),
1118 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu stack %d/%d",
1119 		  __entry->ino,
1120 		  __entry->lo,
1121 		  __entry->hi,
1122 		  __entry->hi - __entry->lo,
1123 		  __entry->stack_depth,
1124 		  __entry->max_stack_depth)
1125 );
1126 
1127 TRACE_EVENT(xfarray_sort,
1128 	TP_PROTO(struct xfarray_sortinfo *si, size_t bytes),
1129 	TP_ARGS(si, bytes),
1130 	TP_STRUCT__entry(
1131 		__field(unsigned long, ino)
1132 		__field(unsigned long long, nr)
1133 		__field(size_t, obj_size)
1134 		__field(size_t, bytes)
1135 		__field(unsigned int, max_stack_depth)
1136 	),
1137 	TP_fast_assign(
1138 		__entry->nr = si->array->nr;
1139 		__entry->obj_size = si->array->obj_size;
1140 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1141 		__entry->bytes = bytes;
1142 		__entry->max_stack_depth = si->max_stack_depth;
1143 	),
1144 	TP_printk("xfino 0x%lx nr %llu objsz %zu stack %u bytes %zu",
1145 		  __entry->ino,
1146 		  __entry->nr,
1147 		  __entry->obj_size,
1148 		  __entry->max_stack_depth,
1149 		  __entry->bytes)
1150 );
1151 
1152 TRACE_EVENT(xfarray_sort_scan,
1153 	TP_PROTO(struct xfarray_sortinfo *si, unsigned long long idx),
1154 	TP_ARGS(si, idx),
1155 	TP_STRUCT__entry(
1156 		__field(unsigned long, ino)
1157 		__field(unsigned long long, nr)
1158 		__field(size_t, obj_size)
1159 		__field(unsigned long long, idx)
1160 		__field(unsigned long long, folio_pos)
1161 		__field(unsigned long, folio_bytes)
1162 		__field(unsigned long long, first_idx)
1163 		__field(unsigned long long, last_idx)
1164 	),
1165 	TP_fast_assign(
1166 		__entry->nr = si->array->nr;
1167 		__entry->obj_size = si->array->obj_size;
1168 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1169 		__entry->idx = idx;
1170 		if (si->folio) {
1171 			__entry->folio_pos = folio_pos(si->folio);
1172 			__entry->folio_bytes = folio_size(si->folio);
1173 			__entry->first_idx = si->first_folio_idx;
1174 			__entry->last_idx = si->last_folio_idx;
1175 		} else {
1176 			__entry->folio_pos = 0;
1177 			__entry->folio_bytes = 0;
1178 			__entry->first_idx = 0;
1179 			__entry->last_idx = 0;
1180 		}
1181 	),
1182 	TP_printk("xfino 0x%lx nr %llu objsz %zu idx %llu folio_pos 0x%llx folio_bytes 0x%lx first_idx %llu last_idx %llu",
1183 		  __entry->ino,
1184 		  __entry->nr,
1185 		  __entry->obj_size,
1186 		  __entry->idx,
1187 		  __entry->folio_pos,
1188 		  __entry->folio_bytes,
1189 		  __entry->first_idx,
1190 		  __entry->last_idx)
1191 );
1192 
1193 TRACE_EVENT(xfarray_sort_stats,
1194 	TP_PROTO(struct xfarray_sortinfo *si, int error),
1195 	TP_ARGS(si, error),
1196 	TP_STRUCT__entry(
1197 		__field(unsigned long, ino)
1198 #ifdef DEBUG
1199 		__field(unsigned long long, loads)
1200 		__field(unsigned long long, stores)
1201 		__field(unsigned long long, compares)
1202 		__field(unsigned long long, heapsorts)
1203 #endif
1204 		__field(unsigned int, max_stack_depth)
1205 		__field(unsigned int, max_stack_used)
1206 		__field(int, error)
1207 	),
1208 	TP_fast_assign(
1209 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1210 #ifdef DEBUG
1211 		__entry->loads = si->loads;
1212 		__entry->stores = si->stores;
1213 		__entry->compares = si->compares;
1214 		__entry->heapsorts = si->heapsorts;
1215 #endif
1216 		__entry->max_stack_depth = si->max_stack_depth;
1217 		__entry->max_stack_used = si->max_stack_used;
1218 		__entry->error = error;
1219 	),
1220 	TP_printk(
1221 #ifdef DEBUG
1222 		  "xfino 0x%lx loads %llu stores %llu compares %llu heapsorts %llu stack_depth %u/%u error %d",
1223 #else
1224 		  "xfino 0x%lx stack_depth %u/%u error %d",
1225 #endif
1226 		  __entry->ino,
1227 #ifdef DEBUG
1228 		  __entry->loads,
1229 		  __entry->stores,
1230 		  __entry->compares,
1231 		  __entry->heapsorts,
1232 #endif
1233 		  __entry->max_stack_used,
1234 		  __entry->max_stack_depth,
1235 		  __entry->error)
1236 );
1237 
1238 #ifdef CONFIG_XFS_RT
1239 TRACE_EVENT(xchk_rtsum_record_free,
1240 	TP_PROTO(struct xfs_mount *mp, xfs_rtxnum_t start,
1241 		 xfs_rtbxlen_t len, unsigned int log, loff_t pos,
1242 		 xfs_suminfo_t value),
1243 	TP_ARGS(mp, start, len, log, pos, value),
1244 	TP_STRUCT__entry(
1245 		__field(dev_t, dev)
1246 		__field(dev_t, rtdev)
1247 		__field(xfs_rtxnum_t, start)
1248 		__field(unsigned long long, len)
1249 		__field(unsigned int, log)
1250 		__field(loff_t, pos)
1251 		__field(xfs_suminfo_t, value)
1252 	),
1253 	TP_fast_assign(
1254 		__entry->dev = mp->m_super->s_dev;
1255 		__entry->rtdev = mp->m_rtdev_targp->bt_dev;
1256 		__entry->start = start;
1257 		__entry->len = len;
1258 		__entry->log = log;
1259 		__entry->pos = pos;
1260 		__entry->value = value;
1261 	),
1262 	TP_printk("dev %d:%d rtdev %d:%d rtx 0x%llx rtxcount 0x%llx log %u rsumpos 0x%llx sumcount %u",
1263 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1264 		  MAJOR(__entry->rtdev), MINOR(__entry->rtdev),
1265 		  __entry->start,
1266 		  __entry->len,
1267 		  __entry->log,
1268 		  __entry->pos,
1269 		  __entry->value)
1270 );
1271 #endif /* CONFIG_XFS_RT */
1272 
1273 DECLARE_EVENT_CLASS(xchk_iscan_class,
1274 	TP_PROTO(struct xchk_iscan *iscan),
1275 	TP_ARGS(iscan),
1276 	TP_STRUCT__entry(
1277 		__field(dev_t, dev)
1278 		__field(xfs_ino_t, cursor)
1279 		__field(xfs_ino_t, visited)
1280 	),
1281 	TP_fast_assign(
1282 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1283 		__entry->cursor = iscan->cursor_ino;
1284 		__entry->visited = iscan->__visited_ino;
1285 	),
1286 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx",
1287 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1288 		  __entry->cursor,
1289 		  __entry->visited)
1290 )
1291 #define DEFINE_ISCAN_EVENT(name) \
1292 DEFINE_EVENT(xchk_iscan_class, name, \
1293 	TP_PROTO(struct xchk_iscan *iscan), \
1294 	TP_ARGS(iscan))
1295 DEFINE_ISCAN_EVENT(xchk_iscan_move_cursor);
1296 DEFINE_ISCAN_EVENT(xchk_iscan_visit);
1297 DEFINE_ISCAN_EVENT(xchk_iscan_skip);
1298 DEFINE_ISCAN_EVENT(xchk_iscan_advance_ag);
1299 
1300 DECLARE_EVENT_CLASS(xchk_iscan_ino_class,
1301 	TP_PROTO(struct xchk_iscan *iscan, xfs_ino_t ino),
1302 	TP_ARGS(iscan, ino),
1303 	TP_STRUCT__entry(
1304 		__field(dev_t, dev)
1305 		__field(xfs_ino_t, startino)
1306 		__field(xfs_ino_t, cursor)
1307 		__field(xfs_ino_t, visited)
1308 		__field(xfs_ino_t, ino)
1309 	),
1310 	TP_fast_assign(
1311 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1312 		__entry->startino = iscan->scan_start_ino;
1313 		__entry->cursor = iscan->cursor_ino;
1314 		__entry->visited = iscan->__visited_ino;
1315 		__entry->ino = ino;
1316 	),
1317 	TP_printk("dev %d:%d iscan start 0x%llx cursor 0x%llx visited 0x%llx ino 0x%llx",
1318 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1319 		  __entry->startino,
1320 		  __entry->cursor,
1321 		  __entry->visited,
1322 		  __entry->ino)
1323 )
1324 #define DEFINE_ISCAN_INO_EVENT(name) \
1325 DEFINE_EVENT(xchk_iscan_ino_class, name, \
1326 	TP_PROTO(struct xchk_iscan *iscan, xfs_ino_t ino), \
1327 	TP_ARGS(iscan, ino))
1328 DEFINE_ISCAN_INO_EVENT(xchk_iscan_want_live_update);
1329 DEFINE_ISCAN_INO_EVENT(xchk_iscan_start);
1330 
1331 TRACE_EVENT(xchk_iscan_iget,
1332 	TP_PROTO(struct xchk_iscan *iscan, int error),
1333 	TP_ARGS(iscan, error),
1334 	TP_STRUCT__entry(
1335 		__field(dev_t, dev)
1336 		__field(xfs_ino_t, cursor)
1337 		__field(xfs_ino_t, visited)
1338 		__field(int, error)
1339 	),
1340 	TP_fast_assign(
1341 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1342 		__entry->cursor = iscan->cursor_ino;
1343 		__entry->visited = iscan->__visited_ino;
1344 		__entry->error = error;
1345 	),
1346 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx error %d",
1347 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1348 		  __entry->cursor,
1349 		  __entry->visited,
1350 		  __entry->error)
1351 );
1352 
1353 TRACE_EVENT(xchk_iscan_iget_batch,
1354 	TP_PROTO(struct xfs_mount *mp, struct xchk_iscan *iscan,
1355 		 unsigned int nr, unsigned int avail),
1356 	TP_ARGS(mp, iscan, nr, avail),
1357 	TP_STRUCT__entry(
1358 		__field(dev_t, dev)
1359 		__field(xfs_ino_t, cursor)
1360 		__field(xfs_ino_t, visited)
1361 		__field(unsigned int, nr)
1362 		__field(unsigned int, avail)
1363 		__field(unsigned int, unavail)
1364 		__field(xfs_ino_t, batch_ino)
1365 		__field(unsigned long long, skipmask)
1366 	),
1367 	TP_fast_assign(
1368 		__entry->dev = mp->m_super->s_dev;
1369 		__entry->cursor = iscan->cursor_ino;
1370 		__entry->visited = iscan->__visited_ino;
1371 		__entry->nr = nr;
1372 		__entry->avail = avail;
1373 		__entry->unavail = hweight64(iscan->__skipped_inomask);
1374 		__entry->batch_ino = iscan->__batch_ino;
1375 		__entry->skipmask = iscan->__skipped_inomask;
1376 	),
1377 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx batchino 0x%llx skipmask 0x%llx nr %u avail %u unavail %u",
1378 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1379 		  __entry->cursor,
1380 		  __entry->visited,
1381 		  __entry->batch_ino,
1382 		  __entry->skipmask,
1383 		  __entry->nr,
1384 		  __entry->avail,
1385 		  __entry->unavail)
1386 );
1387 
1388 DECLARE_EVENT_CLASS(xchk_iscan_retry_wait_class,
1389 	TP_PROTO(struct xchk_iscan *iscan),
1390 	TP_ARGS(iscan),
1391 	TP_STRUCT__entry(
1392 		__field(dev_t, dev)
1393 		__field(xfs_ino_t, cursor)
1394 		__field(xfs_ino_t, visited)
1395 		__field(unsigned int, retry_delay)
1396 		__field(unsigned long, remaining)
1397 		__field(unsigned int, iget_timeout)
1398 	),
1399 	TP_fast_assign(
1400 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1401 		__entry->cursor = iscan->cursor_ino;
1402 		__entry->visited = iscan->__visited_ino;
1403 		__entry->retry_delay = iscan->iget_retry_delay;
1404 		__entry->remaining = jiffies_to_msecs(iscan->__iget_deadline - jiffies);
1405 		__entry->iget_timeout = iscan->iget_timeout;
1406 	),
1407 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx remaining %lu timeout %u delay %u",
1408 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1409 		  __entry->cursor,
1410 		  __entry->visited,
1411 		  __entry->remaining,
1412 		  __entry->iget_timeout,
1413 		  __entry->retry_delay)
1414 )
1415 #define DEFINE_ISCAN_RETRY_WAIT_EVENT(name) \
1416 DEFINE_EVENT(xchk_iscan_retry_wait_class, name, \
1417 	TP_PROTO(struct xchk_iscan *iscan), \
1418 	TP_ARGS(iscan))
1419 DEFINE_ISCAN_RETRY_WAIT_EVENT(xchk_iscan_iget_retry_wait);
1420 DEFINE_ISCAN_RETRY_WAIT_EVENT(xchk_iscan_agi_retry_wait);
1421 
1422 TRACE_EVENT(xchk_nlinks_collect_dirent,
1423 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *dp,
1424 		 xfs_ino_t ino, const struct xfs_name *name),
1425 	TP_ARGS(mp, dp, ino, name),
1426 	TP_STRUCT__entry(
1427 		__field(dev_t, dev)
1428 		__field(xfs_ino_t, dir)
1429 		__field(xfs_ino_t, ino)
1430 		__field(unsigned int, namelen)
1431 		__dynamic_array(char, name, name->len)
1432 	),
1433 	TP_fast_assign(
1434 		__entry->dev = mp->m_super->s_dev;
1435 		__entry->dir = dp->i_ino;
1436 		__entry->ino = ino;
1437 		__entry->namelen = name->len;
1438 		memcpy(__get_str(name), name->name, name->len);
1439 	),
1440 	TP_printk("dev %d:%d dir 0x%llx -> ino 0x%llx name '%.*s'",
1441 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1442 		  __entry->dir,
1443 		  __entry->ino,
1444 		  __entry->namelen,
1445 		  __get_str(name))
1446 );
1447 
1448 TRACE_EVENT(xchk_nlinks_collect_pptr,
1449 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *dp,
1450 		 const struct xfs_name *name,
1451 		 const struct xfs_parent_rec *pptr),
1452 	TP_ARGS(mp, dp, name, pptr),
1453 	TP_STRUCT__entry(
1454 		__field(dev_t, dev)
1455 		__field(xfs_ino_t, dir)
1456 		__field(xfs_ino_t, ino)
1457 		__field(unsigned int, namelen)
1458 		__dynamic_array(char, name, name->len)
1459 	),
1460 	TP_fast_assign(
1461 		__entry->dev = mp->m_super->s_dev;
1462 		__entry->dir = dp->i_ino;
1463 		__entry->ino = be64_to_cpu(pptr->p_ino);
1464 		__entry->namelen = name->len;
1465 		memcpy(__get_str(name), name->name, name->len);
1466 	),
1467 	TP_printk("dev %d:%d dir 0x%llx -> ino 0x%llx name '%.*s'",
1468 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1469 		  __entry->dir,
1470 		  __entry->ino,
1471 		  __entry->namelen,
1472 		  __get_str(name))
1473 );
1474 
1475 TRACE_EVENT(xchk_nlinks_collect_metafile,
1476 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino),
1477 	TP_ARGS(mp, ino),
1478 	TP_STRUCT__entry(
1479 		__field(dev_t, dev)
1480 		__field(xfs_ino_t, ino)
1481 	),
1482 	TP_fast_assign(
1483 		__entry->dev = mp->m_super->s_dev;
1484 		__entry->ino = ino;
1485 	),
1486 	TP_printk("dev %d:%d ino 0x%llx",
1487 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1488 		  __entry->ino)
1489 );
1490 
1491 TRACE_EVENT(xchk_nlinks_live_update,
1492 	TP_PROTO(struct xfs_mount *mp, const struct xfs_inode *dp,
1493 		 int action, xfs_ino_t ino, int delta,
1494 		 const char *name, unsigned int namelen),
1495 	TP_ARGS(mp, dp, action, ino, delta, name, namelen),
1496 	TP_STRUCT__entry(
1497 		__field(dev_t, dev)
1498 		__field(xfs_ino_t, dir)
1499 		__field(int, action)
1500 		__field(xfs_ino_t, ino)
1501 		__field(int, delta)
1502 		__field(unsigned int, namelen)
1503 		__dynamic_array(char, name, namelen)
1504 	),
1505 	TP_fast_assign(
1506 		__entry->dev = mp->m_super->s_dev;
1507 		__entry->dir = dp ? dp->i_ino : NULLFSINO;
1508 		__entry->action = action;
1509 		__entry->ino = ino;
1510 		__entry->delta = delta;
1511 		__entry->namelen = namelen;
1512 		memcpy(__get_str(name), name, namelen);
1513 	),
1514 	TP_printk("dev %d:%d dir 0x%llx ino 0x%llx nlink_delta %d name '%.*s'",
1515 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1516 		  __entry->dir,
1517 		  __entry->ino,
1518 		  __entry->delta,
1519 		  __entry->namelen,
1520 		  __get_str(name))
1521 );
1522 
1523 TRACE_EVENT(xchk_nlinks_check_zero,
1524 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
1525 		 const struct xchk_nlink *live),
1526 	TP_ARGS(mp, ino, live),
1527 	TP_STRUCT__entry(
1528 		__field(dev_t, dev)
1529 		__field(xfs_ino_t, ino)
1530 		__field(xfs_nlink_t, parents)
1531 		__field(xfs_nlink_t, backrefs)
1532 		__field(xfs_nlink_t, children)
1533 	),
1534 	TP_fast_assign(
1535 		__entry->dev = mp->m_super->s_dev;
1536 		__entry->ino = ino;
1537 		__entry->parents = live->parents;
1538 		__entry->backrefs = live->backrefs;
1539 		__entry->children = live->children;
1540 	),
1541 	TP_printk("dev %d:%d ino 0x%llx parents %u backrefs %u children %u",
1542 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1543 		  __entry->ino,
1544 		  __entry->parents,
1545 		  __entry->backrefs,
1546 		  __entry->children)
1547 );
1548 
1549 TRACE_EVENT(xchk_nlinks_update_incore,
1550 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
1551 		 const struct xchk_nlink *live, int parents_delta,
1552 		 int backrefs_delta, int children_delta),
1553 	TP_ARGS(mp, ino, live, parents_delta, backrefs_delta, children_delta),
1554 	TP_STRUCT__entry(
1555 		__field(dev_t, dev)
1556 		__field(xfs_ino_t, ino)
1557 		__field(xfs_nlink_t, parents)
1558 		__field(xfs_nlink_t, backrefs)
1559 		__field(xfs_nlink_t, children)
1560 		__field(int, parents_delta)
1561 		__field(int, backrefs_delta)
1562 		__field(int, children_delta)
1563 	),
1564 	TP_fast_assign(
1565 		__entry->dev = mp->m_super->s_dev;
1566 		__entry->ino = ino;
1567 		__entry->parents = live->parents;
1568 		__entry->backrefs = live->backrefs;
1569 		__entry->children = live->children;
1570 		__entry->parents_delta = parents_delta;
1571 		__entry->backrefs_delta = backrefs_delta;
1572 		__entry->children_delta = children_delta;
1573 	),
1574 	TP_printk("dev %d:%d ino 0x%llx parents %d:%u backrefs %d:%u children %d:%u",
1575 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1576 		  __entry->ino,
1577 		  __entry->parents_delta,
1578 		  __entry->parents,
1579 		  __entry->backrefs_delta,
1580 		  __entry->backrefs,
1581 		  __entry->children_delta,
1582 		  __entry->children)
1583 );
1584 
1585 DECLARE_EVENT_CLASS(xchk_nlinks_diff_class,
1586 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *ip,
1587 		 const struct xchk_nlink *live),
1588 	TP_ARGS(mp, ip, live),
1589 	TP_STRUCT__entry(
1590 		__field(dev_t, dev)
1591 		__field(xfs_ino_t, ino)
1592 		__field(uint8_t, ftype)
1593 		__field(xfs_nlink_t, nlink)
1594 		__field(xfs_nlink_t, parents)
1595 		__field(xfs_nlink_t, backrefs)
1596 		__field(xfs_nlink_t, children)
1597 	),
1598 	TP_fast_assign(
1599 		__entry->dev = mp->m_super->s_dev;
1600 		__entry->ino = ip->i_ino;
1601 		__entry->ftype = xfs_mode_to_ftype(VFS_I(ip)->i_mode);
1602 		__entry->nlink = VFS_I(ip)->i_nlink;
1603 		__entry->parents = live->parents;
1604 		__entry->backrefs = live->backrefs;
1605 		__entry->children = live->children;
1606 	),
1607 	TP_printk("dev %d:%d ino 0x%llx ftype %s nlink %u parents %u backrefs %u children %u",
1608 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1609 		  __entry->ino,
1610 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
1611 		  __entry->nlink,
1612 		  __entry->parents,
1613 		  __entry->backrefs,
1614 		  __entry->children)
1615 );
1616 #define DEFINE_SCRUB_NLINKS_DIFF_EVENT(name) \
1617 DEFINE_EVENT(xchk_nlinks_diff_class, name, \
1618 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *ip, \
1619 		 const struct xchk_nlink *live), \
1620 	TP_ARGS(mp, ip, live))
1621 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xchk_nlinks_compare_inode);
1622 
1623 DECLARE_EVENT_CLASS(xchk_pptr_class,
1624 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name,
1625 		 xfs_ino_t far_ino),
1626 	TP_ARGS(ip, name, far_ino),
1627 	TP_STRUCT__entry(
1628 		__field(dev_t, dev)
1629 		__field(xfs_ino_t, ino)
1630 		__field(unsigned int, namelen)
1631 		__dynamic_array(char, name, name->len)
1632 		__field(xfs_ino_t, far_ino)
1633 	),
1634 	TP_fast_assign(
1635 		__entry->dev = ip->i_mount->m_super->s_dev;
1636 		__entry->ino = ip->i_ino;
1637 		__entry->namelen = name->len;
1638 		memcpy(__get_str(name), name, name->len);
1639 		__entry->far_ino = far_ino;
1640 	),
1641 	TP_printk("dev %d:%d ino 0x%llx name '%.*s' far_ino 0x%llx",
1642 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1643 		  __entry->ino,
1644 		  __entry->namelen,
1645 		  __get_str(name),
1646 		  __entry->far_ino)
1647 )
1648 #define DEFINE_XCHK_PPTR_EVENT(name) \
1649 DEFINE_EVENT(xchk_pptr_class, name, \
1650 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name, \
1651 		 xfs_ino_t far_ino), \
1652 	TP_ARGS(ip, name, far_ino))
1653 DEFINE_XCHK_PPTR_EVENT(xchk_dir_defer);
1654 DEFINE_XCHK_PPTR_EVENT(xchk_dir_slowpath);
1655 DEFINE_XCHK_PPTR_EVENT(xchk_dir_ultraslowpath);
1656 DEFINE_XCHK_PPTR_EVENT(xchk_parent_defer);
1657 DEFINE_XCHK_PPTR_EVENT(xchk_parent_slowpath);
1658 DEFINE_XCHK_PPTR_EVENT(xchk_parent_ultraslowpath);
1659 
1660 DECLARE_EVENT_CLASS(xchk_dirtree_class,
1661 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip,
1662 		 unsigned int path_nr, const struct xfs_name *name,
1663 		 const struct xfs_parent_rec *pptr),
1664 	TP_ARGS(sc, ip, path_nr, name, pptr),
1665 	TP_STRUCT__entry(
1666 		__field(dev_t, dev)
1667 		__field(unsigned int, path_nr)
1668 		__field(xfs_ino_t, child_ino)
1669 		__field(unsigned int, child_gen)
1670 		__field(xfs_ino_t, parent_ino)
1671 		__field(unsigned int, parent_gen)
1672 		__field(unsigned int, namelen)
1673 		__dynamic_array(char, name, name->len)
1674 	),
1675 	TP_fast_assign(
1676 		__entry->dev = sc->mp->m_super->s_dev;
1677 		__entry->path_nr = path_nr;
1678 		__entry->child_ino = ip->i_ino;
1679 		__entry->child_gen = VFS_I(ip)->i_generation;
1680 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
1681 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
1682 		__entry->namelen = name->len;
1683 		memcpy(__get_str(name), name->name, name->len);
1684 	),
1685 	TP_printk("dev %d:%d path %u child_ino 0x%llx child_gen 0x%x parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
1686 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1687 		  __entry->path_nr,
1688 		  __entry->child_ino,
1689 		  __entry->child_gen,
1690 		  __entry->parent_ino,
1691 		  __entry->parent_gen,
1692 		  __entry->namelen,
1693 		  __get_str(name))
1694 );
1695 #define DEFINE_XCHK_DIRTREE_EVENT(name) \
1696 DEFINE_EVENT(xchk_dirtree_class, name, \
1697 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, \
1698 		 unsigned int path_nr, const struct xfs_name *name, \
1699 		 const struct xfs_parent_rec *pptr), \
1700 	TP_ARGS(sc, ip, path_nr, name, pptr))
1701 DEFINE_XCHK_DIRTREE_EVENT(xchk_dirtree_create_path);
1702 DEFINE_XCHK_DIRTREE_EVENT(xchk_dirpath_walk_upwards);
1703 
1704 DECLARE_EVENT_CLASS(xchk_dirpath_class,
1705 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip,
1706 		 unsigned int path_nr, unsigned int step_nr,
1707 		 const struct xfs_name *name,
1708 		 const struct xfs_parent_rec *pptr),
1709 	TP_ARGS(sc, ip, path_nr, step_nr, name, pptr),
1710 	TP_STRUCT__entry(
1711 		__field(dev_t, dev)
1712 		__field(unsigned int, path_nr)
1713 		__field(unsigned int, step_nr)
1714 		__field(xfs_ino_t, child_ino)
1715 		__field(unsigned int, child_gen)
1716 		__field(xfs_ino_t, parent_ino)
1717 		__field(unsigned int, parent_gen)
1718 		__field(unsigned int, namelen)
1719 		__dynamic_array(char, name, name->len)
1720 	),
1721 	TP_fast_assign(
1722 		__entry->dev = sc->mp->m_super->s_dev;
1723 		__entry->path_nr = path_nr;
1724 		__entry->step_nr = step_nr;
1725 		__entry->child_ino = ip->i_ino;
1726 		__entry->child_gen = VFS_I(ip)->i_generation;
1727 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
1728 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
1729 		__entry->namelen = name->len;
1730 		memcpy(__get_str(name), name->name, name->len);
1731 	),
1732 	TP_printk("dev %d:%d path %u step %u child_ino 0x%llx child_gen 0x%x parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
1733 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1734 		  __entry->path_nr,
1735 		  __entry->step_nr,
1736 		  __entry->child_ino,
1737 		  __entry->child_gen,
1738 		  __entry->parent_ino,
1739 		  __entry->parent_gen,
1740 		  __entry->namelen,
1741 		  __get_str(name))
1742 );
1743 #define DEFINE_XCHK_DIRPATH_EVENT(name) \
1744 DEFINE_EVENT(xchk_dirpath_class, name, \
1745 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, \
1746 		 unsigned int path_nr, unsigned int step_nr, \
1747 		 const struct xfs_name *name, \
1748 		 const struct xfs_parent_rec *pptr), \
1749 	TP_ARGS(sc, ip, path_nr, step_nr, name, pptr))
1750 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_disappeared);
1751 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_badgen);
1752 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_nondir_parent);
1753 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_unlinked_parent);
1754 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_found_next_step);
1755 
1756 TRACE_DEFINE_ENUM(XCHK_DIRPATH_SCANNING);
1757 TRACE_DEFINE_ENUM(XCHK_DIRPATH_DELETE);
1758 TRACE_DEFINE_ENUM(XCHK_DIRPATH_CORRUPT);
1759 TRACE_DEFINE_ENUM(XCHK_DIRPATH_LOOP);
1760 TRACE_DEFINE_ENUM(XCHK_DIRPATH_STALE);
1761 TRACE_DEFINE_ENUM(XCHK_DIRPATH_OK);
1762 TRACE_DEFINE_ENUM(XREP_DIRPATH_DELETING);
1763 TRACE_DEFINE_ENUM(XREP_DIRPATH_DELETED);
1764 TRACE_DEFINE_ENUM(XREP_DIRPATH_ADOPTING);
1765 TRACE_DEFINE_ENUM(XREP_DIRPATH_ADOPTED);
1766 
1767 #define XCHK_DIRPATH_OUTCOME_STRINGS \
1768 	{ XCHK_DIRPATH_SCANNING,	"scanning" }, \
1769 	{ XCHK_DIRPATH_DELETE,		"delete" }, \
1770 	{ XCHK_DIRPATH_CORRUPT,		"corrupt" }, \
1771 	{ XCHK_DIRPATH_LOOP,		"loop" }, \
1772 	{ XCHK_DIRPATH_STALE,		"stale" }, \
1773 	{ XCHK_DIRPATH_OK,		"ok" }, \
1774 	{ XREP_DIRPATH_DELETING,	"deleting" }, \
1775 	{ XREP_DIRPATH_DELETED,		"deleted" }, \
1776 	{ XREP_DIRPATH_ADOPTING,	"adopting" }, \
1777 	{ XREP_DIRPATH_ADOPTED,		"adopted" }
1778 
1779 DECLARE_EVENT_CLASS(xchk_dirpath_outcome_class,
1780 	TP_PROTO(struct xfs_scrub *sc, unsigned long long path_nr,
1781 		 unsigned int nr_steps, \
1782 		 unsigned int outcome),
1783 	TP_ARGS(sc, path_nr, nr_steps, outcome),
1784 	TP_STRUCT__entry(
1785 		__field(dev_t, dev)
1786 		__field(unsigned long long, path_nr)
1787 		__field(unsigned int, nr_steps)
1788 		__field(unsigned int, outcome)
1789 	),
1790 	TP_fast_assign(
1791 		__entry->dev = sc->mp->m_super->s_dev;
1792 		__entry->path_nr = path_nr;
1793 		__entry->nr_steps = nr_steps;
1794 		__entry->outcome = outcome;
1795 	),
1796 	TP_printk("dev %d:%d path %llu steps %u outcome %s",
1797 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1798 		  __entry->path_nr,
1799 		  __entry->nr_steps,
1800 		  __print_symbolic(__entry->outcome, XCHK_DIRPATH_OUTCOME_STRINGS))
1801 );
1802 #define DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(name) \
1803 DEFINE_EVENT(xchk_dirpath_outcome_class, name, \
1804 	TP_PROTO(struct xfs_scrub *sc, unsigned long long path_nr, \
1805 		 unsigned int nr_steps, \
1806 		 unsigned int outcome), \
1807 	TP_ARGS(sc, path_nr, nr_steps, outcome))
1808 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xchk_dirpath_set_outcome);
1809 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xchk_dirpath_evaluate_path);
1810 
1811 DECLARE_EVENT_CLASS(xchk_dirtree_evaluate_class,
1812 	TP_PROTO(const struct xchk_dirtree *dl,
1813 		 const struct xchk_dirtree_outcomes *oc),
1814 	TP_ARGS(dl, oc),
1815 	TP_STRUCT__entry(
1816 		__field(dev_t, dev)
1817 		__field(xfs_ino_t, ino)
1818 		__field(xfs_ino_t, rootino)
1819 		__field(unsigned int, nr_paths)
1820 		__field(unsigned int, bad)
1821 		__field(unsigned int, suspect)
1822 		__field(unsigned int, good)
1823 		__field(bool, needs_adoption)
1824 	),
1825 	TP_fast_assign(
1826 		__entry->dev = dl->sc->mp->m_super->s_dev;
1827 		__entry->ino = dl->sc->ip->i_ino;
1828 		__entry->rootino = dl->root_ino;
1829 		__entry->nr_paths = dl->nr_paths;
1830 		__entry->bad = oc->bad;
1831 		__entry->suspect = oc->suspect;
1832 		__entry->good = oc->good;
1833 		__entry->needs_adoption = oc->needs_adoption ? 1 : 0;
1834 	),
1835 	TP_printk("dev %d:%d ino 0x%llx rootino 0x%llx nr_paths %u bad %u suspect %u good %u adopt? %d",
1836 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1837 		  __entry->ino,
1838 		  __entry->rootino,
1839 		  __entry->nr_paths,
1840 		  __entry->bad,
1841 		  __entry->suspect,
1842 		  __entry->good,
1843 		  __entry->needs_adoption)
1844 );
1845 #define DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(name) \
1846 DEFINE_EVENT(xchk_dirtree_evaluate_class, name, \
1847 	TP_PROTO(const struct xchk_dirtree *dl, \
1848 		 const struct xchk_dirtree_outcomes *oc), \
1849 	TP_ARGS(dl, oc))
1850 DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(xchk_dirtree_evaluate);
1851 
1852 TRACE_EVENT(xchk_dirpath_changed,
1853 	TP_PROTO(struct xfs_scrub *sc, unsigned int path_nr,
1854 		 unsigned int step_nr, const struct xfs_inode *dp,
1855 		 const struct xfs_inode *ip, const struct xfs_name *xname),
1856 	TP_ARGS(sc, path_nr, step_nr, dp, ip, xname),
1857 	TP_STRUCT__entry(
1858 		__field(dev_t, dev)
1859 		__field(unsigned int, path_nr)
1860 		__field(unsigned int, step_nr)
1861 		__field(xfs_ino_t, child_ino)
1862 		__field(xfs_ino_t, parent_ino)
1863 		__field(unsigned int, namelen)
1864 		__dynamic_array(char, name, xname->len)
1865 	),
1866 	TP_fast_assign(
1867 		__entry->dev = sc->mp->m_super->s_dev;
1868 		__entry->path_nr = path_nr;
1869 		__entry->step_nr = step_nr;
1870 		__entry->child_ino = ip->i_ino;
1871 		__entry->parent_ino = dp->i_ino;
1872 		__entry->namelen = xname->len;
1873 		memcpy(__get_str(name), xname->name, xname->len);
1874 	),
1875 	TP_printk("dev %d:%d path %u step %u child_ino 0x%llx parent_ino 0x%llx name '%.*s'",
1876 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1877 		  __entry->path_nr,
1878 		  __entry->step_nr,
1879 		  __entry->child_ino,
1880 		  __entry->parent_ino,
1881 		  __entry->namelen,
1882 		  __get_str(name))
1883 );
1884 
1885 TRACE_EVENT(xchk_dirtree_live_update,
1886 	TP_PROTO(struct xfs_scrub *sc, const struct xfs_inode *dp,
1887 		 int action, const struct xfs_inode *ip, int delta,
1888 		 const struct xfs_name *xname),
1889 	TP_ARGS(sc, dp, action, ip, delta, xname),
1890 	TP_STRUCT__entry(
1891 		__field(dev_t, dev)
1892 		__field(xfs_ino_t, parent_ino)
1893 		__field(int, action)
1894 		__field(xfs_ino_t, child_ino)
1895 		__field(int, delta)
1896 		__field(unsigned int, namelen)
1897 		__dynamic_array(char, name, xname->len)
1898 	),
1899 	TP_fast_assign(
1900 		__entry->dev = sc->mp->m_super->s_dev;
1901 		__entry->parent_ino = dp->i_ino;
1902 		__entry->action = action;
1903 		__entry->child_ino = ip->i_ino;
1904 		__entry->delta = delta;
1905 		__entry->namelen = xname->len;
1906 		memcpy(__get_str(name), xname->name, xname->len);
1907 	),
1908 	TP_printk("dev %d:%d parent_ino 0x%llx child_ino 0x%llx nlink_delta %d name '%.*s'",
1909 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1910 		  __entry->parent_ino,
1911 		  __entry->child_ino,
1912 		  __entry->delta,
1913 		  __entry->namelen,
1914 		  __get_str(name))
1915 );
1916 
1917 /* repair tracepoints */
1918 #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR)
1919 
1920 DECLARE_EVENT_CLASS(xrep_extent_class,
1921 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len),
1922 	TP_ARGS(pag, agbno, len),
1923 	TP_STRUCT__entry(
1924 		__field(dev_t, dev)
1925 		__field(xfs_agnumber_t, agno)
1926 		__field(xfs_agblock_t, agbno)
1927 		__field(xfs_extlen_t, len)
1928 	),
1929 	TP_fast_assign(
1930 		__entry->dev = pag->pag_mount->m_super->s_dev;
1931 		__entry->agno = pag->pag_agno;
1932 		__entry->agbno = agbno;
1933 		__entry->len = len;
1934 	),
1935 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
1936 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1937 		  __entry->agno,
1938 		  __entry->agbno,
1939 		  __entry->len)
1940 );
1941 #define DEFINE_REPAIR_EXTENT_EVENT(name) \
1942 DEFINE_EVENT(xrep_extent_class, name, \
1943 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len), \
1944 	TP_ARGS(pag, agbno, len))
1945 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_unmap_extent);
1946 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_free_extent);
1947 DEFINE_REPAIR_EXTENT_EVENT(xreap_agextent_binval);
1948 DEFINE_REPAIR_EXTENT_EVENT(xreap_bmapi_binval);
1949 DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert);
1950 
1951 DECLARE_EVENT_CLASS(xrep_reap_find_class,
1952 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len,
1953 		bool crosslinked),
1954 	TP_ARGS(pag, agbno, len, crosslinked),
1955 	TP_STRUCT__entry(
1956 		__field(dev_t, dev)
1957 		__field(xfs_agnumber_t, agno)
1958 		__field(xfs_agblock_t, agbno)
1959 		__field(xfs_extlen_t, len)
1960 		__field(bool, crosslinked)
1961 	),
1962 	TP_fast_assign(
1963 		__entry->dev = pag->pag_mount->m_super->s_dev;
1964 		__entry->agno = pag->pag_agno;
1965 		__entry->agbno = agbno;
1966 		__entry->len = len;
1967 		__entry->crosslinked = crosslinked;
1968 	),
1969 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x crosslinked %d",
1970 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1971 		  __entry->agno,
1972 		  __entry->agbno,
1973 		  __entry->len,
1974 		  __entry->crosslinked ? 1 : 0)
1975 );
1976 #define DEFINE_REPAIR_REAP_FIND_EVENT(name) \
1977 DEFINE_EVENT(xrep_reap_find_class, name, \
1978 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \
1979 		 bool crosslinked), \
1980 	TP_ARGS(pag, agbno, len, crosslinked))
1981 DEFINE_REPAIR_REAP_FIND_EVENT(xreap_agextent_select);
1982 DEFINE_REPAIR_REAP_FIND_EVENT(xreap_bmapi_select);
1983 
1984 DECLARE_EVENT_CLASS(xrep_rmap_class,
1985 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1986 		 xfs_agblock_t agbno, xfs_extlen_t len,
1987 		 uint64_t owner, uint64_t offset, unsigned int flags),
1988 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
1989 	TP_STRUCT__entry(
1990 		__field(dev_t, dev)
1991 		__field(xfs_agnumber_t, agno)
1992 		__field(xfs_agblock_t, agbno)
1993 		__field(xfs_extlen_t, len)
1994 		__field(uint64_t, owner)
1995 		__field(uint64_t, offset)
1996 		__field(unsigned int, flags)
1997 	),
1998 	TP_fast_assign(
1999 		__entry->dev = mp->m_super->s_dev;
2000 		__entry->agno = agno;
2001 		__entry->agbno = agbno;
2002 		__entry->len = len;
2003 		__entry->owner = owner;
2004 		__entry->offset = offset;
2005 		__entry->flags = flags;
2006 	),
2007 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2008 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2009 		  __entry->agno,
2010 		  __entry->agbno,
2011 		  __entry->len,
2012 		  __entry->owner,
2013 		  __entry->offset,
2014 		  __entry->flags)
2015 );
2016 #define DEFINE_REPAIR_RMAP_EVENT(name) \
2017 DEFINE_EVENT(xrep_rmap_class, name, \
2018 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2019 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2020 		 uint64_t owner, uint64_t offset, unsigned int flags), \
2021 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2022 DEFINE_REPAIR_RMAP_EVENT(xrep_ibt_walk_rmap);
2023 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_walk_rmap);
2024 
2025 TRACE_EVENT(xrep_abt_found,
2026 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2027 		 const struct xfs_alloc_rec_incore *rec),
2028 	TP_ARGS(mp, agno, rec),
2029 	TP_STRUCT__entry(
2030 		__field(dev_t, dev)
2031 		__field(xfs_agnumber_t, agno)
2032 		__field(xfs_agblock_t, startblock)
2033 		__field(xfs_extlen_t, blockcount)
2034 	),
2035 	TP_fast_assign(
2036 		__entry->dev = mp->m_super->s_dev;
2037 		__entry->agno = agno;
2038 		__entry->startblock = rec->ar_startblock;
2039 		__entry->blockcount = rec->ar_blockcount;
2040 	),
2041 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2042 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2043 		  __entry->agno,
2044 		  __entry->startblock,
2045 		  __entry->blockcount)
2046 )
2047 
2048 TRACE_EVENT(xrep_ibt_found,
2049 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2050 		 const struct xfs_inobt_rec_incore *rec),
2051 	TP_ARGS(mp, agno, rec),
2052 	TP_STRUCT__entry(
2053 		__field(dev_t, dev)
2054 		__field(xfs_agnumber_t, agno)
2055 		__field(xfs_agino_t, startino)
2056 		__field(uint16_t, holemask)
2057 		__field(uint8_t, count)
2058 		__field(uint8_t, freecount)
2059 		__field(uint64_t, freemask)
2060 	),
2061 	TP_fast_assign(
2062 		__entry->dev = mp->m_super->s_dev;
2063 		__entry->agno = agno;
2064 		__entry->startino = rec->ir_startino;
2065 		__entry->holemask = rec->ir_holemask;
2066 		__entry->count = rec->ir_count;
2067 		__entry->freecount = rec->ir_freecount;
2068 		__entry->freemask = rec->ir_free;
2069 	),
2070 	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x count 0x%x freecount 0x%x freemask 0x%llx",
2071 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2072 		  __entry->agno,
2073 		  __entry->startino,
2074 		  __entry->holemask,
2075 		  __entry->count,
2076 		  __entry->freecount,
2077 		  __entry->freemask)
2078 )
2079 
2080 TRACE_EVENT(xrep_refc_found,
2081 	TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *rec),
2082 	TP_ARGS(pag, rec),
2083 	TP_STRUCT__entry(
2084 		__field(dev_t, dev)
2085 		__field(xfs_agnumber_t, agno)
2086 		__field(enum xfs_refc_domain, domain)
2087 		__field(xfs_agblock_t, startblock)
2088 		__field(xfs_extlen_t, blockcount)
2089 		__field(xfs_nlink_t, refcount)
2090 	),
2091 	TP_fast_assign(
2092 		__entry->dev = pag->pag_mount->m_super->s_dev;
2093 		__entry->agno = pag->pag_agno;
2094 		__entry->domain = rec->rc_domain;
2095 		__entry->startblock = rec->rc_startblock;
2096 		__entry->blockcount = rec->rc_blockcount;
2097 		__entry->refcount = rec->rc_refcount;
2098 	),
2099 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
2100 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2101 		  __entry->agno,
2102 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
2103 		  __entry->startblock,
2104 		  __entry->blockcount,
2105 		  __entry->refcount)
2106 )
2107 
2108 TRACE_EVENT(xrep_bmap_found,
2109 	TP_PROTO(struct xfs_inode *ip, int whichfork,
2110 		 struct xfs_bmbt_irec *irec),
2111 	TP_ARGS(ip, whichfork, irec),
2112 	TP_STRUCT__entry(
2113 		__field(dev_t, dev)
2114 		__field(xfs_ino_t, ino)
2115 		__field(int, whichfork)
2116 		__field(xfs_fileoff_t, lblk)
2117 		__field(xfs_filblks_t, len)
2118 		__field(xfs_fsblock_t, pblk)
2119 		__field(int, state)
2120 	),
2121 	TP_fast_assign(
2122 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2123 		__entry->ino = ip->i_ino;
2124 		__entry->whichfork = whichfork;
2125 		__entry->lblk = irec->br_startoff;
2126 		__entry->len = irec->br_blockcount;
2127 		__entry->pblk = irec->br_startblock;
2128 		__entry->state = irec->br_state;
2129 	),
2130 	TP_printk("dev %d:%d ino 0x%llx whichfork %s fileoff 0x%llx fsbcount 0x%llx startblock 0x%llx state %d",
2131 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2132 		  __entry->ino,
2133 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2134 		  __entry->lblk,
2135 		  __entry->len,
2136 		  __entry->pblk,
2137 		  __entry->state)
2138 );
2139 
2140 TRACE_EVENT(xrep_rmap_found,
2141 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2142 		 const struct xfs_rmap_irec *rec),
2143 	TP_ARGS(mp, agno, rec),
2144 	TP_STRUCT__entry(
2145 		__field(dev_t, dev)
2146 		__field(xfs_agnumber_t, agno)
2147 		__field(xfs_agblock_t, agbno)
2148 		__field(xfs_extlen_t, len)
2149 		__field(uint64_t, owner)
2150 		__field(uint64_t, offset)
2151 		__field(unsigned int, flags)
2152 	),
2153 	TP_fast_assign(
2154 		__entry->dev = mp->m_super->s_dev;
2155 		__entry->agno = agno;
2156 		__entry->agbno = rec->rm_startblock;
2157 		__entry->len = rec->rm_blockcount;
2158 		__entry->owner = rec->rm_owner;
2159 		__entry->offset = rec->rm_offset;
2160 		__entry->flags = rec->rm_flags;
2161 	),
2162 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2163 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2164 		  __entry->agno,
2165 		  __entry->agbno,
2166 		  __entry->len,
2167 		  __entry->owner,
2168 		  __entry->offset,
2169 		  __entry->flags)
2170 );
2171 
2172 TRACE_EVENT(xrep_findroot_block,
2173 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
2174 		 uint32_t magic, uint16_t level),
2175 	TP_ARGS(mp, agno, agbno, magic, level),
2176 	TP_STRUCT__entry(
2177 		__field(dev_t, dev)
2178 		__field(xfs_agnumber_t, agno)
2179 		__field(xfs_agblock_t, agbno)
2180 		__field(uint32_t, magic)
2181 		__field(uint16_t, level)
2182 	),
2183 	TP_fast_assign(
2184 		__entry->dev = mp->m_super->s_dev;
2185 		__entry->agno = agno;
2186 		__entry->agbno = agbno;
2187 		__entry->magic = magic;
2188 		__entry->level = level;
2189 	),
2190 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x magic 0x%x level %u",
2191 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2192 		  __entry->agno,
2193 		  __entry->agbno,
2194 		  __entry->magic,
2195 		  __entry->level)
2196 )
2197 TRACE_EVENT(xrep_calc_ag_resblks,
2198 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2199 		 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen,
2200 		 xfs_agblock_t usedlen),
2201 	TP_ARGS(mp, agno, icount, aglen, freelen, usedlen),
2202 	TP_STRUCT__entry(
2203 		__field(dev_t, dev)
2204 		__field(xfs_agnumber_t, agno)
2205 		__field(xfs_agino_t, icount)
2206 		__field(xfs_agblock_t, aglen)
2207 		__field(xfs_agblock_t, freelen)
2208 		__field(xfs_agblock_t, usedlen)
2209 	),
2210 	TP_fast_assign(
2211 		__entry->dev = mp->m_super->s_dev;
2212 		__entry->agno = agno;
2213 		__entry->icount = icount;
2214 		__entry->aglen = aglen;
2215 		__entry->freelen = freelen;
2216 		__entry->usedlen = usedlen;
2217 	),
2218 	TP_printk("dev %d:%d agno 0x%x icount %u aglen %u freelen %u usedlen %u",
2219 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2220 		  __entry->agno,
2221 		  __entry->icount,
2222 		  __entry->aglen,
2223 		  __entry->freelen,
2224 		  __entry->usedlen)
2225 )
2226 TRACE_EVENT(xrep_calc_ag_resblks_btsize,
2227 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2228 		 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz,
2229 		 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz),
2230 	TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz),
2231 	TP_STRUCT__entry(
2232 		__field(dev_t, dev)
2233 		__field(xfs_agnumber_t, agno)
2234 		__field(xfs_agblock_t, bnobt_sz)
2235 		__field(xfs_agblock_t, inobt_sz)
2236 		__field(xfs_agblock_t, rmapbt_sz)
2237 		__field(xfs_agblock_t, refcbt_sz)
2238 	),
2239 	TP_fast_assign(
2240 		__entry->dev = mp->m_super->s_dev;
2241 		__entry->agno = agno;
2242 		__entry->bnobt_sz = bnobt_sz;
2243 		__entry->inobt_sz = inobt_sz;
2244 		__entry->rmapbt_sz = rmapbt_sz;
2245 		__entry->refcbt_sz = refcbt_sz;
2246 	),
2247 	TP_printk("dev %d:%d agno 0x%x bnobt %u inobt %u rmapbt %u refcountbt %u",
2248 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2249 		  __entry->agno,
2250 		  __entry->bnobt_sz,
2251 		  __entry->inobt_sz,
2252 		  __entry->rmapbt_sz,
2253 		  __entry->refcbt_sz)
2254 )
2255 TRACE_EVENT(xrep_reset_counters,
2256 	TP_PROTO(struct xfs_mount *mp, struct xchk_fscounters *fsc),
2257 	TP_ARGS(mp, fsc),
2258 	TP_STRUCT__entry(
2259 		__field(dev_t, dev)
2260 		__field(uint64_t, icount)
2261 		__field(uint64_t, ifree)
2262 		__field(uint64_t, fdblocks)
2263 		__field(uint64_t, frextents)
2264 	),
2265 	TP_fast_assign(
2266 		__entry->dev = mp->m_super->s_dev;
2267 		__entry->icount = fsc->icount;
2268 		__entry->ifree = fsc->ifree;
2269 		__entry->fdblocks = fsc->fdblocks;
2270 		__entry->frextents = fsc->frextents;
2271 	),
2272 	TP_printk("dev %d:%d icount %llu ifree %llu fdblocks %llu frextents %llu",
2273 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2274 		  __entry->icount,
2275 		  __entry->ifree,
2276 		  __entry->fdblocks,
2277 		  __entry->frextents)
2278 )
2279 
2280 DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
2281 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2282 		 xfs_agblock_t agbno, xfs_extlen_t len,
2283 		 int64_t owner),
2284 	TP_ARGS(mp, agno, agbno, len, owner),
2285 	TP_STRUCT__entry(
2286 		__field(dev_t, dev)
2287 		__field(xfs_agnumber_t, agno)
2288 		__field(xfs_agblock_t, agbno)
2289 		__field(xfs_extlen_t, len)
2290 		__field(int64_t, owner)
2291 	),
2292 	TP_fast_assign(
2293 		__entry->dev = mp->m_super->s_dev;
2294 		__entry->agno = agno;
2295 		__entry->agbno = agbno;
2296 		__entry->len = len;
2297 		__entry->owner = owner;
2298 	),
2299 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx",
2300 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2301 		  __entry->agno,
2302 		  __entry->agbno,
2303 		  __entry->len,
2304 		  __entry->owner)
2305 );
2306 #define DEFINE_NEWBT_EXTENT_EVENT(name) \
2307 DEFINE_EVENT(xrep_newbt_extent_class, name, \
2308 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2309 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2310 		 int64_t owner), \
2311 	TP_ARGS(mp, agno, agbno, len, owner))
2312 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_ag_blocks);
2313 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_file_blocks);
2314 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_free_blocks);
2315 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_claim_block);
2316 
2317 DECLARE_EVENT_CLASS(xrep_dinode_class,
2318 	TP_PROTO(struct xfs_scrub *sc, struct xfs_dinode *dip),
2319 	TP_ARGS(sc, dip),
2320 	TP_STRUCT__entry(
2321 		__field(dev_t, dev)
2322 		__field(xfs_ino_t, ino)
2323 		__field(uint16_t, mode)
2324 		__field(uint8_t, version)
2325 		__field(uint8_t, format)
2326 		__field(uint32_t, uid)
2327 		__field(uint32_t, gid)
2328 		__field(uint64_t, size)
2329 		__field(uint64_t, nblocks)
2330 		__field(uint32_t, extsize)
2331 		__field(uint32_t, nextents)
2332 		__field(uint16_t, anextents)
2333 		__field(uint8_t, forkoff)
2334 		__field(uint8_t, aformat)
2335 		__field(uint16_t, flags)
2336 		__field(uint32_t, gen)
2337 		__field(uint64_t, flags2)
2338 		__field(uint32_t, cowextsize)
2339 	),
2340 	TP_fast_assign(
2341 		__entry->dev = sc->mp->m_super->s_dev;
2342 		__entry->ino = sc->sm->sm_ino;
2343 		__entry->mode = be16_to_cpu(dip->di_mode);
2344 		__entry->version = dip->di_version;
2345 		__entry->format = dip->di_format;
2346 		__entry->uid = be32_to_cpu(dip->di_uid);
2347 		__entry->gid = be32_to_cpu(dip->di_gid);
2348 		__entry->size = be64_to_cpu(dip->di_size);
2349 		__entry->nblocks = be64_to_cpu(dip->di_nblocks);
2350 		__entry->extsize = be32_to_cpu(dip->di_extsize);
2351 		__entry->nextents = be32_to_cpu(dip->di_nextents);
2352 		__entry->anextents = be16_to_cpu(dip->di_anextents);
2353 		__entry->forkoff = dip->di_forkoff;
2354 		__entry->aformat = dip->di_aformat;
2355 		__entry->flags = be16_to_cpu(dip->di_flags);
2356 		__entry->gen = be32_to_cpu(dip->di_gen);
2357 		__entry->flags2 = be64_to_cpu(dip->di_flags2);
2358 		__entry->cowextsize = be32_to_cpu(dip->di_cowextsize);
2359 	),
2360 	TP_printk("dev %d:%d ino 0x%llx mode 0x%x version %u format %u uid %u gid %u disize 0x%llx nblocks 0x%llx extsize %u nextents %u anextents %u forkoff 0x%x aformat %u flags 0x%x gen 0x%x flags2 0x%llx cowextsize %u",
2361 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2362 		  __entry->ino,
2363 		  __entry->mode,
2364 		  __entry->version,
2365 		  __entry->format,
2366 		  __entry->uid,
2367 		  __entry->gid,
2368 		  __entry->size,
2369 		  __entry->nblocks,
2370 		  __entry->extsize,
2371 		  __entry->nextents,
2372 		  __entry->anextents,
2373 		  __entry->forkoff,
2374 		  __entry->aformat,
2375 		  __entry->flags,
2376 		  __entry->gen,
2377 		  __entry->flags2,
2378 		  __entry->cowextsize)
2379 )
2380 
2381 #define DEFINE_REPAIR_DINODE_EVENT(name) \
2382 DEFINE_EVENT(xrep_dinode_class, name, \
2383 	TP_PROTO(struct xfs_scrub *sc, struct xfs_dinode *dip), \
2384 	TP_ARGS(sc, dip))
2385 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_header);
2386 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_mode);
2387 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_flags);
2388 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_size);
2389 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_extsize_hints);
2390 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_symlink);
2391 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_dir);
2392 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_fixed);
2393 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_forks);
2394 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_dfork);
2395 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_afork);
2396 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_ensure_forkoff);
2397 
2398 DECLARE_EVENT_CLASS(xrep_inode_class,
2399 	TP_PROTO(struct xfs_scrub *sc),
2400 	TP_ARGS(sc),
2401 	TP_STRUCT__entry(
2402 		__field(dev_t, dev)
2403 		__field(xfs_ino_t, ino)
2404 		__field(xfs_fsize_t, size)
2405 		__field(xfs_rfsblock_t, nblocks)
2406 		__field(uint16_t, flags)
2407 		__field(uint64_t, flags2)
2408 		__field(uint32_t, nextents)
2409 		__field(uint8_t, format)
2410 		__field(uint32_t, anextents)
2411 		__field(uint8_t, aformat)
2412 	),
2413 	TP_fast_assign(
2414 		__entry->dev = sc->mp->m_super->s_dev;
2415 		__entry->ino = sc->sm->sm_ino;
2416 		__entry->size = sc->ip->i_disk_size;
2417 		__entry->nblocks = sc->ip->i_nblocks;
2418 		__entry->flags = sc->ip->i_diflags;
2419 		__entry->flags2 = sc->ip->i_diflags2;
2420 		__entry->nextents = sc->ip->i_df.if_nextents;
2421 		__entry->format = sc->ip->i_df.if_format;
2422 		__entry->anextents = sc->ip->i_af.if_nextents;
2423 		__entry->aformat = sc->ip->i_af.if_format;
2424 	),
2425 	TP_printk("dev %d:%d ino 0x%llx disize 0x%llx nblocks 0x%llx flags 0x%x flags2 0x%llx nextents %u format %u anextents %u aformat %u",
2426 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2427 		  __entry->ino,
2428 		  __entry->size,
2429 		  __entry->nblocks,
2430 		  __entry->flags,
2431 		  __entry->flags2,
2432 		  __entry->nextents,
2433 		  __entry->format,
2434 		  __entry->anextents,
2435 		  __entry->aformat)
2436 )
2437 
2438 #define DEFINE_REPAIR_INODE_EVENT(name) \
2439 DEFINE_EVENT(xrep_inode_class, name, \
2440 	TP_PROTO(struct xfs_scrub *sc), \
2441 	TP_ARGS(sc))
2442 DEFINE_REPAIR_INODE_EVENT(xrep_inode_blockcounts);
2443 DEFINE_REPAIR_INODE_EVENT(xrep_inode_ids);
2444 DEFINE_REPAIR_INODE_EVENT(xrep_inode_flags);
2445 DEFINE_REPAIR_INODE_EVENT(xrep_inode_blockdir_size);
2446 DEFINE_REPAIR_INODE_EVENT(xrep_inode_sfdir_size);
2447 DEFINE_REPAIR_INODE_EVENT(xrep_inode_dir_size);
2448 DEFINE_REPAIR_INODE_EVENT(xrep_inode_fixed);
2449 
2450 TRACE_EVENT(xrep_dinode_count_rmaps,
2451 	TP_PROTO(struct xfs_scrub *sc, xfs_rfsblock_t data_blocks,
2452 		xfs_rfsblock_t rt_blocks, xfs_rfsblock_t attr_blocks,
2453 		xfs_extnum_t data_extents, xfs_extnum_t rt_extents,
2454 		xfs_aextnum_t attr_extents),
2455 	TP_ARGS(sc, data_blocks, rt_blocks, attr_blocks, data_extents,
2456 		rt_extents, attr_extents),
2457 	TP_STRUCT__entry(
2458 		__field(dev_t, dev)
2459 		__field(xfs_ino_t, ino)
2460 		__field(xfs_rfsblock_t, data_blocks)
2461 		__field(xfs_rfsblock_t, rt_blocks)
2462 		__field(xfs_rfsblock_t, attr_blocks)
2463 		__field(xfs_extnum_t, data_extents)
2464 		__field(xfs_extnum_t, rt_extents)
2465 		__field(xfs_aextnum_t, attr_extents)
2466 	),
2467 	TP_fast_assign(
2468 		__entry->dev = sc->mp->m_super->s_dev;
2469 		__entry->ino = sc->sm->sm_ino;
2470 		__entry->data_blocks = data_blocks;
2471 		__entry->rt_blocks = rt_blocks;
2472 		__entry->attr_blocks = attr_blocks;
2473 		__entry->data_extents = data_extents;
2474 		__entry->rt_extents = rt_extents;
2475 		__entry->attr_extents = attr_extents;
2476 	),
2477 	TP_printk("dev %d:%d ino 0x%llx dblocks 0x%llx rtblocks 0x%llx ablocks 0x%llx dextents %llu rtextents %llu aextents %u",
2478 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2479 		  __entry->ino,
2480 		  __entry->data_blocks,
2481 		  __entry->rt_blocks,
2482 		  __entry->attr_blocks,
2483 		  __entry->data_extents,
2484 		  __entry->rt_extents,
2485 		  __entry->attr_extents)
2486 );
2487 
2488 TRACE_EVENT(xrep_dinode_findmode_dirent,
2489 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *dp,
2490 		 unsigned int ftype),
2491 	TP_ARGS(sc, dp, ftype),
2492 	TP_STRUCT__entry(
2493 		__field(dev_t, dev)
2494 		__field(xfs_ino_t, ino)
2495 		__field(xfs_ino_t, parent_ino)
2496 		__field(unsigned int, ftype)
2497 	),
2498 	TP_fast_assign(
2499 		__entry->dev = sc->mp->m_super->s_dev;
2500 		__entry->ino = sc->sm->sm_ino;
2501 		__entry->parent_ino = dp->i_ino;
2502 		__entry->ftype = ftype;
2503 	),
2504 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx ftype '%s'",
2505 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2506 		  __entry->ino,
2507 		  __entry->parent_ino,
2508 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR))
2509 );
2510 
2511 TRACE_EVENT(xrep_dinode_findmode_dirent_inval,
2512 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *dp,
2513 		 unsigned int ftype, unsigned int found_ftype),
2514 	TP_ARGS(sc, dp, ftype, found_ftype),
2515 	TP_STRUCT__entry(
2516 		__field(dev_t, dev)
2517 		__field(xfs_ino_t, ino)
2518 		__field(xfs_ino_t, parent_ino)
2519 		__field(unsigned int, ftype)
2520 		__field(unsigned int, found_ftype)
2521 	),
2522 	TP_fast_assign(
2523 		__entry->dev = sc->mp->m_super->s_dev;
2524 		__entry->ino = sc->sm->sm_ino;
2525 		__entry->parent_ino = dp->i_ino;
2526 		__entry->ftype = ftype;
2527 		__entry->found_ftype = found_ftype;
2528 	),
2529 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx ftype '%s' found_ftype '%s'",
2530 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2531 		  __entry->ino,
2532 		  __entry->parent_ino,
2533 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
2534 		  __print_symbolic(__entry->found_ftype, XFS_DIR3_FTYPE_STR))
2535 );
2536 
2537 TRACE_EVENT(xrep_cow_mark_file_range,
2538 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t startblock,
2539 		 xfs_fileoff_t startoff, xfs_filblks_t blockcount),
2540 	TP_ARGS(ip, startblock, startoff, blockcount),
2541 	TP_STRUCT__entry(
2542 		__field(dev_t, dev)
2543 		__field(xfs_ino_t, ino)
2544 		__field(xfs_fsblock_t, startblock)
2545 		__field(xfs_fileoff_t, startoff)
2546 		__field(xfs_filblks_t, blockcount)
2547 	),
2548 	TP_fast_assign(
2549 		__entry->dev = ip->i_mount->m_super->s_dev;
2550 		__entry->ino = ip->i_ino;
2551 		__entry->startoff = startoff;
2552 		__entry->startblock = startblock;
2553 		__entry->blockcount = blockcount;
2554 	),
2555 	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
2556 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2557 		  __entry->ino,
2558 		  __entry->startoff,
2559 		  __entry->startblock,
2560 		  __entry->blockcount)
2561 );
2562 
2563 TRACE_EVENT(xrep_cow_replace_mapping,
2564 	TP_PROTO(struct xfs_inode *ip, const struct xfs_bmbt_irec *irec,
2565 		 xfs_fsblock_t new_startblock, xfs_extlen_t new_blockcount),
2566 	TP_ARGS(ip, irec, new_startblock, new_blockcount),
2567 	TP_STRUCT__entry(
2568 		__field(dev_t, dev)
2569 		__field(xfs_ino_t, ino)
2570 		__field(xfs_fsblock_t, startblock)
2571 		__field(xfs_fileoff_t, startoff)
2572 		__field(xfs_filblks_t, blockcount)
2573 		__field(xfs_exntst_t, state)
2574 		__field(xfs_fsblock_t, new_startblock)
2575 		__field(xfs_extlen_t, new_blockcount)
2576 	),
2577 	TP_fast_assign(
2578 		__entry->dev = ip->i_mount->m_super->s_dev;
2579 		__entry->ino = ip->i_ino;
2580 		__entry->startoff = irec->br_startoff;
2581 		__entry->startblock = irec->br_startblock;
2582 		__entry->blockcount = irec->br_blockcount;
2583 		__entry->state = irec->br_state;
2584 		__entry->new_startblock = new_startblock;
2585 		__entry->new_blockcount = new_blockcount;
2586 	),
2587 	TP_printk("dev %d:%d ino 0x%llx startoff 0x%llx startblock 0x%llx fsbcount 0x%llx state 0x%x new_startblock 0x%llx new_fsbcount 0x%x",
2588 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2589 		  __entry->ino,
2590 		  __entry->startoff,
2591 		  __entry->startblock,
2592 		  __entry->blockcount,
2593 		  __entry->state,
2594 		  __entry->new_startblock,
2595 		  __entry->new_blockcount)
2596 );
2597 
2598 TRACE_EVENT(xrep_cow_free_staging,
2599 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno,
2600 		 xfs_extlen_t blockcount),
2601 	TP_ARGS(pag, agbno, blockcount),
2602 	TP_STRUCT__entry(
2603 		__field(dev_t, dev)
2604 		__field(xfs_agnumber_t, agno)
2605 		__field(xfs_agblock_t, agbno)
2606 		__field(xfs_extlen_t, blockcount)
2607 	),
2608 	TP_fast_assign(
2609 		__entry->dev = pag->pag_mount->m_super->s_dev;
2610 		__entry->agno = pag->pag_agno;
2611 		__entry->agbno = agbno;
2612 		__entry->blockcount = blockcount;
2613 	),
2614 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2615 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2616 		  __entry->agno,
2617 		  __entry->agbno,
2618 		  __entry->blockcount)
2619 );
2620 
2621 #ifdef CONFIG_XFS_QUOTA
2622 DECLARE_EVENT_CLASS(xrep_dquot_class,
2623 	TP_PROTO(struct xfs_mount *mp, uint8_t type, uint32_t id),
2624 	TP_ARGS(mp, type, id),
2625 	TP_STRUCT__entry(
2626 		__field(dev_t, dev)
2627 		__field(uint8_t, type)
2628 		__field(uint32_t, id)
2629 	),
2630 	TP_fast_assign(
2631 		__entry->dev = mp->m_super->s_dev;
2632 		__entry->id = id;
2633 		__entry->type = type;
2634 	),
2635 	TP_printk("dev %d:%d type %s id 0x%x",
2636 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2637 		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
2638 		  __entry->id)
2639 );
2640 
2641 #define DEFINE_XREP_DQUOT_EVENT(name) \
2642 DEFINE_EVENT(xrep_dquot_class, name, \
2643 	TP_PROTO(struct xfs_mount *mp, uint8_t type, uint32_t id), \
2644 	TP_ARGS(mp, type, id))
2645 DEFINE_XREP_DQUOT_EVENT(xrep_dquot_item);
2646 DEFINE_XREP_DQUOT_EVENT(xrep_disk_dquot);
2647 DEFINE_XREP_DQUOT_EVENT(xrep_dquot_item_fill_bmap_hole);
2648 DEFINE_XREP_DQUOT_EVENT(xrep_quotacheck_dquot);
2649 #endif /* CONFIG_XFS_QUOTA */
2650 
2651 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_update_inode);
2652 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_unfixable_inode);
2653 
2654 TRACE_EVENT(xrep_rmap_live_update,
2655 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int op,
2656 		 const struct xfs_rmap_update_params *p),
2657 	TP_ARGS(mp, agno, op, p),
2658 	TP_STRUCT__entry(
2659 		__field(dev_t, dev)
2660 		__field(xfs_agnumber_t, agno)
2661 		__field(unsigned int, op)
2662 		__field(xfs_agblock_t, agbno)
2663 		__field(xfs_extlen_t, len)
2664 		__field(uint64_t, owner)
2665 		__field(uint64_t, offset)
2666 		__field(unsigned int, flags)
2667 	),
2668 	TP_fast_assign(
2669 		__entry->dev = mp->m_super->s_dev;
2670 		__entry->agno = agno;
2671 		__entry->op = op;
2672 		__entry->agbno = p->startblock;
2673 		__entry->len = p->blockcount;
2674 		xfs_owner_info_unpack(&p->oinfo, &__entry->owner,
2675 				&__entry->offset, &__entry->flags);
2676 		if (p->unwritten)
2677 			__entry->flags |= XFS_RMAP_UNWRITTEN;
2678 	),
2679 	TP_printk("dev %d:%d agno 0x%x op %d agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2680 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2681 		  __entry->agno,
2682 		  __entry->op,
2683 		  __entry->agbno,
2684 		  __entry->len,
2685 		  __entry->owner,
2686 		  __entry->offset,
2687 		  __entry->flags)
2688 );
2689 
2690 TRACE_EVENT(xrep_tempfile_create,
2691 	TP_PROTO(struct xfs_scrub *sc),
2692 	TP_ARGS(sc),
2693 	TP_STRUCT__entry(
2694 		__field(dev_t, dev)
2695 		__field(xfs_ino_t, ino)
2696 		__field(unsigned int, type)
2697 		__field(xfs_agnumber_t, agno)
2698 		__field(xfs_ino_t, inum)
2699 		__field(unsigned int, gen)
2700 		__field(unsigned int, flags)
2701 		__field(xfs_ino_t, temp_inum)
2702 	),
2703 	TP_fast_assign(
2704 		__entry->dev = sc->mp->m_super->s_dev;
2705 		__entry->ino = sc->file ? XFS_I(file_inode(sc->file))->i_ino : 0;
2706 		__entry->type = sc->sm->sm_type;
2707 		__entry->agno = sc->sm->sm_agno;
2708 		__entry->inum = sc->sm->sm_ino;
2709 		__entry->gen = sc->sm->sm_gen;
2710 		__entry->flags = sc->sm->sm_flags;
2711 		__entry->temp_inum = sc->tempip->i_ino;
2712 	),
2713 	TP_printk("dev %d:%d ino 0x%llx type %s inum 0x%llx gen 0x%x flags 0x%x temp_inum 0x%llx",
2714 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2715 		  __entry->ino,
2716 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2717 		  __entry->inum,
2718 		  __entry->gen,
2719 		  __entry->flags,
2720 		  __entry->temp_inum)
2721 );
2722 
2723 DECLARE_EVENT_CLASS(xrep_tempfile_class,
2724 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
2725 		 struct xfs_bmbt_irec *irec),
2726 	TP_ARGS(sc, whichfork, irec),
2727 	TP_STRUCT__entry(
2728 		__field(dev_t, dev)
2729 		__field(xfs_ino_t, ino)
2730 		__field(int, whichfork)
2731 		__field(xfs_fileoff_t, lblk)
2732 		__field(xfs_filblks_t, len)
2733 		__field(xfs_fsblock_t, pblk)
2734 		__field(int, state)
2735 	),
2736 	TP_fast_assign(
2737 		__entry->dev = sc->mp->m_super->s_dev;
2738 		__entry->ino = sc->tempip->i_ino;
2739 		__entry->whichfork = whichfork;
2740 		__entry->lblk = irec->br_startoff;
2741 		__entry->len = irec->br_blockcount;
2742 		__entry->pblk = irec->br_startblock;
2743 		__entry->state = irec->br_state;
2744 	),
2745 	TP_printk("dev %d:%d ino 0x%llx whichfork %s fileoff 0x%llx fsbcount 0x%llx startblock 0x%llx state %d",
2746 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2747 		  __entry->ino,
2748 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2749 		  __entry->lblk,
2750 		  __entry->len,
2751 		  __entry->pblk,
2752 		  __entry->state)
2753 );
2754 #define DEFINE_XREP_TEMPFILE_EVENT(name) \
2755 DEFINE_EVENT(xrep_tempfile_class, name, \
2756 	TP_PROTO(struct xfs_scrub *sc, int whichfork, \
2757 		 struct xfs_bmbt_irec *irec), \
2758 	TP_ARGS(sc, whichfork, irec))
2759 DEFINE_XREP_TEMPFILE_EVENT(xrep_tempfile_prealloc);
2760 DEFINE_XREP_TEMPFILE_EVENT(xrep_tempfile_copyin);
2761 
2762 TRACE_EVENT(xreap_ifork_extent,
2763 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, int whichfork,
2764 		 const struct xfs_bmbt_irec *irec),
2765 	TP_ARGS(sc, ip, whichfork, irec),
2766 	TP_STRUCT__entry(
2767 		__field(dev_t, dev)
2768 		__field(xfs_ino_t, ino)
2769 		__field(int, whichfork)
2770 		__field(xfs_fileoff_t, fileoff)
2771 		__field(xfs_filblks_t, len)
2772 		__field(xfs_agnumber_t, agno)
2773 		__field(xfs_agblock_t, agbno)
2774 		__field(int, state)
2775 	),
2776 	TP_fast_assign(
2777 		__entry->dev = sc->mp->m_super->s_dev;
2778 		__entry->ino = ip->i_ino;
2779 		__entry->whichfork = whichfork;
2780 		__entry->fileoff = irec->br_startoff;
2781 		__entry->len = irec->br_blockcount;
2782 		__entry->agno = XFS_FSB_TO_AGNO(sc->mp, irec->br_startblock);
2783 		__entry->agbno = XFS_FSB_TO_AGBNO(sc->mp, irec->br_startblock);
2784 		__entry->state = irec->br_state;
2785 	),
2786 	TP_printk("dev %d:%d ip 0x%llx whichfork %s agno 0x%x agbno 0x%x fileoff 0x%llx fsbcount 0x%llx state 0x%x",
2787 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2788 		  __entry->ino,
2789 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2790 		  __entry->agno,
2791 		  __entry->agbno,
2792 		  __entry->fileoff,
2793 		  __entry->len,
2794 		  __entry->state)
2795 );
2796 
2797 TRACE_EVENT(xreap_bmapi_binval_scan,
2798 	TP_PROTO(struct xfs_scrub *sc, const struct xfs_bmbt_irec *irec,
2799 		 xfs_extlen_t scan_blocks),
2800 	TP_ARGS(sc, irec, scan_blocks),
2801 	TP_STRUCT__entry(
2802 		__field(dev_t, dev)
2803 		__field(xfs_filblks_t, len)
2804 		__field(xfs_agnumber_t, agno)
2805 		__field(xfs_agblock_t, agbno)
2806 		__field(xfs_extlen_t, scan_blocks)
2807 	),
2808 	TP_fast_assign(
2809 		__entry->dev = sc->mp->m_super->s_dev;
2810 		__entry->len = irec->br_blockcount;
2811 		__entry->agno = XFS_FSB_TO_AGNO(sc->mp, irec->br_startblock);
2812 		__entry->agbno = XFS_FSB_TO_AGBNO(sc->mp, irec->br_startblock);
2813 		__entry->scan_blocks = scan_blocks;
2814 	),
2815 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%llx scan_blocks 0x%x",
2816 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2817 		  __entry->agno,
2818 		  __entry->agbno,
2819 		  __entry->len,
2820 		  __entry->scan_blocks)
2821 );
2822 
2823 TRACE_EVENT(xrep_xattr_recover_leafblock,
2824 	TP_PROTO(struct xfs_inode *ip, xfs_dablk_t dabno, uint16_t magic),
2825 	TP_ARGS(ip, dabno, magic),
2826 	TP_STRUCT__entry(
2827 		__field(dev_t, dev)
2828 		__field(xfs_ino_t, ino)
2829 		__field(xfs_dablk_t, dabno)
2830 		__field(uint16_t, magic)
2831 	),
2832 	TP_fast_assign(
2833 		__entry->dev = ip->i_mount->m_super->s_dev;
2834 		__entry->ino = ip->i_ino;
2835 		__entry->dabno = dabno;
2836 		__entry->magic = magic;
2837 	),
2838 	TP_printk("dev %d:%d ino 0x%llx dablk 0x%x magic 0x%x",
2839 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2840 		  __entry->ino,
2841 		  __entry->dabno,
2842 		  __entry->magic)
2843 );
2844 
2845 DECLARE_EVENT_CLASS(xrep_xattr_salvage_class,
2846 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, char *name,
2847 		 unsigned int namelen, unsigned int valuelen),
2848 	TP_ARGS(ip, flags, name, namelen, valuelen),
2849 	TP_STRUCT__entry(
2850 		__field(dev_t, dev)
2851 		__field(xfs_ino_t, ino)
2852 		__field(unsigned int, flags)
2853 		__field(unsigned int, namelen)
2854 		__dynamic_array(char, name, namelen)
2855 		__field(unsigned int, valuelen)
2856 	),
2857 	TP_fast_assign(
2858 		__entry->dev = ip->i_mount->m_super->s_dev;
2859 		__entry->ino = ip->i_ino;
2860 		__entry->flags = flags;
2861 		__entry->namelen = namelen;
2862 		memcpy(__get_str(name), name, namelen);
2863 		__entry->valuelen = valuelen;
2864 	),
2865 	TP_printk("dev %d:%d ino 0x%llx flags %s name '%.*s' valuelen 0x%x",
2866 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2867 		  __entry->ino,
2868 		   __print_flags(__entry->flags, "|", XFS_ATTR_NAMESPACE_STR),
2869 		  __entry->namelen,
2870 		  __get_str(name),
2871 		  __entry->valuelen)
2872 );
2873 #define DEFINE_XREP_XATTR_SALVAGE_EVENT(name) \
2874 DEFINE_EVENT(xrep_xattr_salvage_class, name, \
2875 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, char *name, \
2876 		 unsigned int namelen, unsigned int valuelen), \
2877 	TP_ARGS(ip, flags, name, namelen, valuelen))
2878 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_xattr_salvage_rec);
2879 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_xattr_insert_rec);
2880 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_parent_stash_xattr);
2881 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_parent_insert_xattr);
2882 
2883 DECLARE_EVENT_CLASS(xrep_pptr_salvage_class,
2884 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, const void *name,
2885 		 unsigned int namelen, const void *value, unsigned int valuelen),
2886 	TP_ARGS(ip, flags, name, namelen, value, valuelen),
2887 	TP_STRUCT__entry(
2888 		__field(dev_t, dev)
2889 		__field(xfs_ino_t, ino)
2890 		__field(xfs_ino_t, parent_ino)
2891 		__field(unsigned int, parent_gen)
2892 		__field(unsigned int, namelen)
2893 		__dynamic_array(char, name, namelen)
2894 	),
2895 	TP_fast_assign(
2896 		const struct xfs_parent_rec	*rec = value;
2897 
2898 		__entry->dev = ip->i_mount->m_super->s_dev;
2899 		__entry->ino = ip->i_ino;
2900 		__entry->parent_ino = be64_to_cpu(rec->p_ino);
2901 		__entry->parent_gen = be32_to_cpu(rec->p_gen);
2902 		__entry->namelen = namelen;
2903 		memcpy(__get_str(name), name, namelen);
2904 	),
2905 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
2906 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2907 		  __entry->ino,
2908 		  __entry->parent_ino,
2909 		  __entry->parent_gen,
2910 		  __entry->namelen,
2911 		  __get_str(name))
2912 )
2913 #define DEFINE_XREP_PPTR_SALVAGE_EVENT(name) \
2914 DEFINE_EVENT(xrep_pptr_salvage_class, name, \
2915 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, const void *name, \
2916 		 unsigned int namelen, const void *value, unsigned int valuelen), \
2917 	TP_ARGS(ip, flags, name, namelen, value, valuelen))
2918 DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_salvage_pptr);
2919 DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_insert_pptr);
2920 
2921 TRACE_EVENT(xrep_xattr_class,
2922 	TP_PROTO(struct xfs_inode *ip, struct xfs_inode *arg_ip),
2923 	TP_ARGS(ip, arg_ip),
2924 	TP_STRUCT__entry(
2925 		__field(dev_t, dev)
2926 		__field(xfs_ino_t, ino)
2927 		__field(xfs_ino_t, src_ino)
2928 	),
2929 	TP_fast_assign(
2930 		__entry->dev = ip->i_mount->m_super->s_dev;
2931 		__entry->ino = ip->i_ino;
2932 		__entry->src_ino = arg_ip->i_ino;
2933 	),
2934 	TP_printk("dev %d:%d ino 0x%llx src 0x%llx",
2935 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2936 		  __entry->ino,
2937 		  __entry->src_ino)
2938 )
2939 #define DEFINE_XREP_XATTR_EVENT(name) \
2940 DEFINE_EVENT(xrep_xattr_class, name, \
2941 	TP_PROTO(struct xfs_inode *ip, struct xfs_inode *arg_ip), \
2942 	TP_ARGS(ip, arg_ip))
2943 DEFINE_XREP_XATTR_EVENT(xrep_xattr_rebuild_tree);
2944 DEFINE_XREP_XATTR_EVENT(xrep_xattr_reset_fork);
2945 DEFINE_XREP_XATTR_EVENT(xrep_xattr_full_reset);
2946 
2947 DECLARE_EVENT_CLASS(xrep_xattr_pptr_scan_class,
2948 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp,
2949 		 const struct xfs_name *name),
2950 	TP_ARGS(ip, dp, name),
2951 	TP_STRUCT__entry(
2952 		__field(dev_t, dev)
2953 		__field(xfs_ino_t, ino)
2954 		__field(xfs_ino_t, parent_ino)
2955 		__field(unsigned int, parent_gen)
2956 		__field(unsigned int, namelen)
2957 		__dynamic_array(char, name, name->len)
2958 	),
2959 	TP_fast_assign(
2960 		__entry->dev = ip->i_mount->m_super->s_dev;
2961 		__entry->ino = ip->i_ino;
2962 		__entry->parent_ino = dp->i_ino;
2963 		__entry->parent_gen = VFS_IC(dp)->i_generation;
2964 		__entry->namelen = name->len;
2965 		memcpy(__get_str(name), name->name, name->len);
2966 	),
2967 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
2968 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2969 		  __entry->ino,
2970 		  __entry->parent_ino,
2971 		  __entry->parent_gen,
2972 		  __entry->namelen,
2973 		  __get_str(name))
2974 )
2975 #define DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(name) \
2976 DEFINE_EVENT(xrep_xattr_pptr_scan_class, name, \
2977 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp, \
2978 		 const struct xfs_name *name), \
2979 	TP_ARGS(ip, dp, name))
2980 DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(xrep_xattr_stash_parentadd);
2981 DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(xrep_xattr_stash_parentremove);
2982 
2983 TRACE_EVENT(xrep_dir_recover_dirblock,
2984 	TP_PROTO(struct xfs_inode *dp, xfs_dablk_t dabno, uint32_t magic,
2985 		 uint32_t magic_guess),
2986 	TP_ARGS(dp, dabno, magic, magic_guess),
2987 	TP_STRUCT__entry(
2988 		__field(dev_t, dev)
2989 		__field(xfs_ino_t, dir_ino)
2990 		__field(xfs_dablk_t, dabno)
2991 		__field(uint32_t, magic)
2992 		__field(uint32_t, magic_guess)
2993 	),
2994 	TP_fast_assign(
2995 		__entry->dev = dp->i_mount->m_super->s_dev;
2996 		__entry->dir_ino = dp->i_ino;
2997 		__entry->dabno = dabno;
2998 		__entry->magic = magic;
2999 		__entry->magic_guess = magic_guess;
3000 	),
3001 	TP_printk("dev %d:%d dir 0x%llx dablk 0x%x magic 0x%x magic_guess 0x%x",
3002 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3003 		  __entry->dir_ino,
3004 		  __entry->dabno,
3005 		  __entry->magic,
3006 		  __entry->magic_guess)
3007 );
3008 
3009 DECLARE_EVENT_CLASS(xrep_dir_class,
3010 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t parent_ino),
3011 	TP_ARGS(dp, parent_ino),
3012 	TP_STRUCT__entry(
3013 		__field(dev_t, dev)
3014 		__field(xfs_ino_t, dir_ino)
3015 		__field(xfs_ino_t, parent_ino)
3016 	),
3017 	TP_fast_assign(
3018 		__entry->dev = dp->i_mount->m_super->s_dev;
3019 		__entry->dir_ino = dp->i_ino;
3020 		__entry->parent_ino = parent_ino;
3021 	),
3022 	TP_printk("dev %d:%d dir 0x%llx parent 0x%llx",
3023 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3024 		  __entry->dir_ino,
3025 		  __entry->parent_ino)
3026 )
3027 #define DEFINE_XREP_DIR_EVENT(name) \
3028 DEFINE_EVENT(xrep_dir_class, name, \
3029 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t parent_ino), \
3030 	TP_ARGS(dp, parent_ino))
3031 DEFINE_XREP_DIR_EVENT(xrep_dir_rebuild_tree);
3032 DEFINE_XREP_DIR_EVENT(xrep_dir_reset_fork);
3033 DEFINE_XREP_DIR_EVENT(xrep_parent_reset_dotdot);
3034 
3035 DECLARE_EVENT_CLASS(xrep_dirent_class,
3036 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name,
3037 		 xfs_ino_t ino),
3038 	TP_ARGS(dp, name, ino),
3039 	TP_STRUCT__entry(
3040 		__field(dev_t, dev)
3041 		__field(xfs_ino_t, dir_ino)
3042 		__field(unsigned int, namelen)
3043 		__dynamic_array(char, name, name->len)
3044 		__field(xfs_ino_t, ino)
3045 		__field(uint8_t, ftype)
3046 	),
3047 	TP_fast_assign(
3048 		__entry->dev = dp->i_mount->m_super->s_dev;
3049 		__entry->dir_ino = dp->i_ino;
3050 		__entry->namelen = name->len;
3051 		memcpy(__get_str(name), name->name, name->len);
3052 		__entry->ino = ino;
3053 		__entry->ftype = name->type;
3054 	),
3055 	TP_printk("dev %d:%d dir 0x%llx ftype %s name '%.*s' ino 0x%llx",
3056 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3057 		  __entry->dir_ino,
3058 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
3059 		  __entry->namelen,
3060 		  __get_str(name),
3061 		  __entry->ino)
3062 )
3063 #define DEFINE_XREP_DIRENT_EVENT(name) \
3064 DEFINE_EVENT(xrep_dirent_class, name, \
3065 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name, \
3066 		 xfs_ino_t ino), \
3067 	TP_ARGS(dp, name, ino))
3068 DEFINE_XREP_DIRENT_EVENT(xrep_dir_salvage_entry);
3069 DEFINE_XREP_DIRENT_EVENT(xrep_dir_stash_createname);
3070 DEFINE_XREP_DIRENT_EVENT(xrep_dir_replay_createname);
3071 DEFINE_XREP_DIRENT_EVENT(xrep_adoption_reparent);
3072 DEFINE_XREP_DIRENT_EVENT(xrep_dir_stash_removename);
3073 DEFINE_XREP_DIRENT_EVENT(xrep_dir_replay_removename);
3074 
3075 DECLARE_EVENT_CLASS(xrep_adoption_class,
3076 	TP_PROTO(struct xfs_inode *dp, struct xfs_inode *ip, bool moved),
3077 	TP_ARGS(dp, ip, moved),
3078 	TP_STRUCT__entry(
3079 		__field(dev_t, dev)
3080 		__field(xfs_ino_t, dir_ino)
3081 		__field(xfs_ino_t, child_ino)
3082 		__field(bool, moved)
3083 	),
3084 	TP_fast_assign(
3085 		__entry->dev = dp->i_mount->m_super->s_dev;
3086 		__entry->dir_ino = dp->i_ino;
3087 		__entry->child_ino = ip->i_ino;
3088 		__entry->moved = moved;
3089 	),
3090 	TP_printk("dev %d:%d dir 0x%llx child 0x%llx moved? %d",
3091 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3092 		  __entry->dir_ino,
3093 		  __entry->child_ino,
3094 		  __entry->moved)
3095 );
3096 #define DEFINE_XREP_ADOPTION_EVENT(name) \
3097 DEFINE_EVENT(xrep_adoption_class, name, \
3098 	TP_PROTO(struct xfs_inode *dp, struct xfs_inode *ip, bool moved), \
3099 	TP_ARGS(dp, ip, moved))
3100 DEFINE_XREP_ADOPTION_EVENT(xrep_adoption_trans_roll);
3101 
3102 DECLARE_EVENT_CLASS(xrep_parent_salvage_class,
3103 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t ino),
3104 	TP_ARGS(dp, ino),
3105 	TP_STRUCT__entry(
3106 		__field(dev_t, dev)
3107 		__field(xfs_ino_t, dir_ino)
3108 		__field(xfs_ino_t, ino)
3109 	),
3110 	TP_fast_assign(
3111 		__entry->dev = dp->i_mount->m_super->s_dev;
3112 		__entry->dir_ino = dp->i_ino;
3113 		__entry->ino = ino;
3114 	),
3115 	TP_printk("dev %d:%d dir 0x%llx parent 0x%llx",
3116 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3117 		  __entry->dir_ino,
3118 		  __entry->ino)
3119 )
3120 #define DEFINE_XREP_PARENT_SALVAGE_EVENT(name) \
3121 DEFINE_EVENT(xrep_parent_salvage_class, name, \
3122 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t ino), \
3123 	TP_ARGS(dp, ino))
3124 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_dir_salvaged_parent);
3125 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_findparent_dirent);
3126 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_findparent_from_dcache);
3127 
3128 DECLARE_EVENT_CLASS(xrep_pptr_class,
3129 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name,
3130 		 const struct xfs_parent_rec *pptr),
3131 	TP_ARGS(ip, name, pptr),
3132 	TP_STRUCT__entry(
3133 		__field(dev_t, dev)
3134 		__field(xfs_ino_t, ino)
3135 		__field(xfs_ino_t, parent_ino)
3136 		__field(unsigned int, parent_gen)
3137 		__field(unsigned int, namelen)
3138 		__dynamic_array(char, name, name->len)
3139 	),
3140 	TP_fast_assign(
3141 		__entry->dev = ip->i_mount->m_super->s_dev;
3142 		__entry->ino = ip->i_ino;
3143 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
3144 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
3145 		__entry->namelen = name->len;
3146 		memcpy(__get_str(name), name->name, name->len);
3147 	),
3148 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
3149 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3150 		  __entry->ino,
3151 		  __entry->parent_ino,
3152 		  __entry->parent_gen,
3153 		  __entry->namelen,
3154 		  __get_str(name))
3155 )
3156 #define DEFINE_XREP_PPTR_EVENT(name) \
3157 DEFINE_EVENT(xrep_pptr_class, name, \
3158 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name, \
3159 		 const struct xfs_parent_rec *pptr), \
3160 	TP_ARGS(ip, name, pptr))
3161 DEFINE_XREP_PPTR_EVENT(xrep_xattr_replay_parentadd);
3162 DEFINE_XREP_PPTR_EVENT(xrep_xattr_replay_parentremove);
3163 DEFINE_XREP_PPTR_EVENT(xrep_parent_replay_parentadd);
3164 DEFINE_XREP_PPTR_EVENT(xrep_parent_replay_parentremove);
3165 
3166 DECLARE_EVENT_CLASS(xrep_pptr_scan_class,
3167 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp,
3168 		 const struct xfs_name *name),
3169 	TP_ARGS(ip, dp, name),
3170 	TP_STRUCT__entry(
3171 		__field(dev_t, dev)
3172 		__field(xfs_ino_t, ino)
3173 		__field(xfs_ino_t, parent_ino)
3174 		__field(unsigned int, parent_gen)
3175 		__field(unsigned int, namelen)
3176 		__dynamic_array(char, name, name->len)
3177 	),
3178 	TP_fast_assign(
3179 		__entry->dev = ip->i_mount->m_super->s_dev;
3180 		__entry->ino = ip->i_ino;
3181 		__entry->parent_ino = dp->i_ino;
3182 		__entry->parent_gen = VFS_IC(dp)->i_generation;
3183 		__entry->namelen = name->len;
3184 		memcpy(__get_str(name), name->name, name->len);
3185 	),
3186 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
3187 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3188 		  __entry->ino,
3189 		  __entry->parent_ino,
3190 		  __entry->parent_gen,
3191 		  __entry->namelen,
3192 		  __get_str(name))
3193 )
3194 #define DEFINE_XREP_PPTR_SCAN_EVENT(name) \
3195 DEFINE_EVENT(xrep_pptr_scan_class, name, \
3196 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp, \
3197 		 const struct xfs_name *name), \
3198 	TP_ARGS(ip, dp, name))
3199 DEFINE_XREP_PPTR_SCAN_EVENT(xrep_parent_stash_parentadd);
3200 DEFINE_XREP_PPTR_SCAN_EVENT(xrep_parent_stash_parentremove);
3201 
3202 TRACE_EVENT(xrep_nlinks_set_record,
3203 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
3204 		 const struct xchk_nlink *obs),
3205 	TP_ARGS(mp, ino, obs),
3206 	TP_STRUCT__entry(
3207 		__field(dev_t, dev)
3208 		__field(xfs_ino_t, ino)
3209 		__field(xfs_nlink_t, parents)
3210 		__field(xfs_nlink_t, backrefs)
3211 		__field(xfs_nlink_t, children)
3212 	),
3213 	TP_fast_assign(
3214 		__entry->dev = mp->m_super->s_dev;
3215 		__entry->ino = ino;
3216 		__entry->parents = obs->parents;
3217 		__entry->backrefs = obs->backrefs;
3218 		__entry->children = obs->children;
3219 	),
3220 	TP_printk("dev %d:%d ino 0x%llx parents %u backrefs %u children %u",
3221 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3222 		  __entry->ino,
3223 		  __entry->parents,
3224 		  __entry->backrefs,
3225 		  __entry->children)
3226 );
3227 
3228 DECLARE_EVENT_CLASS(xrep_dentry_class,
3229 	TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry),
3230 	TP_ARGS(mp, dentry),
3231 	TP_STRUCT__entry(
3232 		__field(dev_t, dev)
3233 		__field(unsigned int, flags)
3234 		__field(unsigned long, ino)
3235 		__field(bool, positive)
3236 		__field(unsigned long, parent_ino)
3237 		__field(unsigned int, namelen)
3238 		__dynamic_array(char, name, dentry->d_name.len)
3239 	),
3240 	TP_fast_assign(
3241 		__entry->dev = mp->m_super->s_dev;
3242 		__entry->flags = dentry->d_flags;
3243 		__entry->positive = d_is_positive(dentry);
3244 		if (dentry->d_parent && d_inode(dentry->d_parent))
3245 			__entry->parent_ino = d_inode(dentry->d_parent)->i_ino;
3246 		else
3247 			__entry->parent_ino = -1UL;
3248 		__entry->ino = d_inode(dentry) ? d_inode(dentry)->i_ino : 0;
3249 		__entry->namelen = dentry->d_name.len;
3250 		memcpy(__get_str(name), dentry->d_name.name, dentry->d_name.len);
3251 	),
3252 	TP_printk("dev %d:%d flags 0x%x positive? %d parent_ino 0x%lx ino 0x%lx name '%.*s'",
3253 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3254 		  __entry->flags,
3255 		  __entry->positive,
3256 		  __entry->parent_ino,
3257 		  __entry->ino,
3258 		  __entry->namelen,
3259 		  __get_str(name))
3260 );
3261 #define DEFINE_REPAIR_DENTRY_EVENT(name) \
3262 DEFINE_EVENT(xrep_dentry_class, name, \
3263 	TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry), \
3264 	TP_ARGS(mp, dentry))
3265 DEFINE_REPAIR_DENTRY_EVENT(xrep_adoption_check_child);
3266 DEFINE_REPAIR_DENTRY_EVENT(xrep_adoption_invalidate_child);
3267 DEFINE_REPAIR_DENTRY_EVENT(xrep_dirtree_delete_child);
3268 
3269 TRACE_EVENT(xrep_symlink_salvage_target,
3270 	TP_PROTO(struct xfs_inode *ip, char *target, unsigned int targetlen),
3271 	TP_ARGS(ip, target, targetlen),
3272 	TP_STRUCT__entry(
3273 		__field(dev_t, dev)
3274 		__field(xfs_ino_t, ino)
3275 		__field(unsigned int, targetlen)
3276 		__dynamic_array(char, target, targetlen + 1)
3277 	),
3278 	TP_fast_assign(
3279 		__entry->dev = ip->i_mount->m_super->s_dev;
3280 		__entry->ino = ip->i_ino;
3281 		__entry->targetlen = targetlen;
3282 		memcpy(__get_str(target), target, targetlen);
3283 		__get_str(target)[targetlen] = 0;
3284 	),
3285 	TP_printk("dev %d:%d ip 0x%llx target '%.*s'",
3286 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3287 		  __entry->ino,
3288 		  __entry->targetlen,
3289 		  __get_str(target))
3290 );
3291 
3292 DECLARE_EVENT_CLASS(xrep_symlink_class,
3293 	TP_PROTO(struct xfs_inode *ip),
3294 	TP_ARGS(ip),
3295 	TP_STRUCT__entry(
3296 		__field(dev_t, dev)
3297 		__field(xfs_ino_t, ino)
3298 	),
3299 	TP_fast_assign(
3300 		__entry->dev = ip->i_mount->m_super->s_dev;
3301 		__entry->ino = ip->i_ino;
3302 	),
3303 	TP_printk("dev %d:%d ip 0x%llx",
3304 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3305 		  __entry->ino)
3306 );
3307 
3308 #define DEFINE_XREP_SYMLINK_EVENT(name) \
3309 DEFINE_EVENT(xrep_symlink_class, name, \
3310 	TP_PROTO(struct xfs_inode *ip), \
3311 	TP_ARGS(ip))
3312 DEFINE_XREP_SYMLINK_EVENT(xrep_symlink_rebuild);
3313 DEFINE_XREP_SYMLINK_EVENT(xrep_symlink_reset_fork);
3314 
3315 TRACE_EVENT(xrep_iunlink_visit,
3316 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3317 		 xfs_agino_t bucket_agino, struct xfs_inode *ip),
3318 	TP_ARGS(pag, bucket, bucket_agino, ip),
3319 	TP_STRUCT__entry(
3320 		__field(dev_t, dev)
3321 		__field(xfs_agnumber_t, agno)
3322 		__field(xfs_agino_t, agino)
3323 		__field(unsigned int, bucket)
3324 		__field(xfs_agino_t, bucket_agino)
3325 		__field(xfs_agino_t, prev_agino)
3326 		__field(xfs_agino_t, next_agino)
3327 	),
3328 	TP_fast_assign(
3329 		__entry->dev = pag->pag_mount->m_super->s_dev;
3330 		__entry->agno = pag->pag_agno;
3331 		__entry->agino = XFS_INO_TO_AGINO(pag->pag_mount, ip->i_ino);
3332 		__entry->bucket = bucket;
3333 		__entry->bucket_agino = bucket_agino;
3334 		__entry->prev_agino = ip->i_prev_unlinked;
3335 		__entry->next_agino = ip->i_next_unlinked;
3336 	),
3337 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x bucket_agino 0x%x prev_agino 0x%x next_agino 0x%x",
3338 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3339 		  __entry->agno,
3340 		  __entry->bucket,
3341 		  __entry->agino,
3342 		  __entry->bucket_agino,
3343 		  __entry->prev_agino,
3344 		  __entry->next_agino)
3345 );
3346 
3347 TRACE_EVENT(xrep_iunlink_reload_next,
3348 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t prev_agino),
3349 	TP_ARGS(ip, prev_agino),
3350 	TP_STRUCT__entry(
3351 		__field(dev_t, dev)
3352 		__field(xfs_agnumber_t, agno)
3353 		__field(xfs_agino_t, agino)
3354 		__field(xfs_agino_t, old_prev_agino)
3355 		__field(xfs_agino_t, prev_agino)
3356 		__field(xfs_agino_t, next_agino)
3357 		__field(unsigned int, nlink)
3358 	),
3359 	TP_fast_assign(
3360 		__entry->dev = ip->i_mount->m_super->s_dev;
3361 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3362 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3363 		__entry->old_prev_agino = ip->i_prev_unlinked;
3364 		__entry->prev_agino = prev_agino;
3365 		__entry->next_agino = ip->i_next_unlinked;
3366 		__entry->nlink = VFS_I(ip)->i_nlink;
3367 	),
3368 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x nlink %u old_prev_agino %u prev_agino 0x%x next_agino 0x%x",
3369 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3370 		  __entry->agno,
3371 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3372 		  __entry->agino,
3373 		  __entry->nlink,
3374 		  __entry->old_prev_agino,
3375 		  __entry->prev_agino,
3376 		  __entry->next_agino)
3377 );
3378 
3379 TRACE_EVENT(xrep_iunlink_reload_ondisk,
3380 	TP_PROTO(struct xfs_inode *ip),
3381 	TP_ARGS(ip),
3382 	TP_STRUCT__entry(
3383 		__field(dev_t, dev)
3384 		__field(xfs_agnumber_t, agno)
3385 		__field(xfs_agino_t, agino)
3386 		__field(unsigned int, nlink)
3387 		__field(xfs_agino_t, next_agino)
3388 	),
3389 	TP_fast_assign(
3390 		__entry->dev = ip->i_mount->m_super->s_dev;
3391 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3392 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3393 		__entry->nlink = VFS_I(ip)->i_nlink;
3394 		__entry->next_agino = ip->i_next_unlinked;
3395 	),
3396 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x nlink %u next_agino 0x%x",
3397 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3398 		  __entry->agno,
3399 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3400 		  __entry->agino,
3401 		  __entry->nlink,
3402 		  __entry->next_agino)
3403 );
3404 
3405 TRACE_EVENT(xrep_iunlink_walk_ondisk_bucket,
3406 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3407 		 xfs_agino_t prev_agino, xfs_agino_t next_agino),
3408 	TP_ARGS(pag, bucket, prev_agino, next_agino),
3409 	TP_STRUCT__entry(
3410 		__field(dev_t, dev)
3411 		__field(xfs_agnumber_t, agno)
3412 		__field(unsigned int, bucket)
3413 		__field(xfs_agino_t, prev_agino)
3414 		__field(xfs_agino_t, next_agino)
3415 	),
3416 	TP_fast_assign(
3417 		__entry->dev = pag->pag_mount->m_super->s_dev;
3418 		__entry->agno = pag->pag_agno;
3419 		__entry->bucket = bucket;
3420 		__entry->prev_agino = prev_agino;
3421 		__entry->next_agino = next_agino;
3422 	),
3423 	TP_printk("dev %d:%d agno 0x%x bucket %u prev_agino 0x%x next_agino 0x%x",
3424 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3425 		  __entry->agno,
3426 		  __entry->bucket,
3427 		  __entry->prev_agino,
3428 		  __entry->next_agino)
3429 );
3430 
3431 DECLARE_EVENT_CLASS(xrep_iunlink_resolve_class,
3432 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3433 		 xfs_agino_t prev_agino, xfs_agino_t next_agino),
3434 	TP_ARGS(pag, bucket, prev_agino, next_agino),
3435 	TP_STRUCT__entry(
3436 		__field(dev_t, dev)
3437 		__field(xfs_agnumber_t, agno)
3438 		__field(unsigned int, bucket)
3439 		__field(xfs_agino_t, prev_agino)
3440 		__field(xfs_agino_t, next_agino)
3441 	),
3442 	TP_fast_assign(
3443 		__entry->dev = pag->pag_mount->m_super->s_dev;
3444 		__entry->agno = pag->pag_agno;
3445 		__entry->bucket = bucket;
3446 		__entry->prev_agino = prev_agino;
3447 		__entry->next_agino = next_agino;
3448 	),
3449 	TP_printk("dev %d:%d agno 0x%x bucket %u prev_agino 0x%x next_agino 0x%x",
3450 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3451 		  __entry->agno,
3452 		  __entry->bucket,
3453 		  __entry->prev_agino,
3454 		  __entry->next_agino)
3455 );
3456 #define DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(name) \
3457 DEFINE_EVENT(xrep_iunlink_resolve_class, name, \
3458 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket, \
3459 		 xfs_agino_t prev_agino, xfs_agino_t next_agino), \
3460 	TP_ARGS(pag, bucket, prev_agino, next_agino))
3461 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_uncached);
3462 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_wronglist);
3463 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_nolist);
3464 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_ok);
3465 
3466 TRACE_EVENT(xrep_iunlink_relink_next,
3467 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t next_agino),
3468 	TP_ARGS(ip, next_agino),
3469 	TP_STRUCT__entry(
3470 		__field(dev_t, dev)
3471 		__field(xfs_agnumber_t, agno)
3472 		__field(xfs_agino_t, agino)
3473 		__field(xfs_agino_t, next_agino)
3474 		__field(xfs_agino_t, new_next_agino)
3475 	),
3476 	TP_fast_assign(
3477 		__entry->dev = ip->i_mount->m_super->s_dev;
3478 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3479 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3480 		__entry->next_agino = ip->i_next_unlinked;
3481 		__entry->new_next_agino = next_agino;
3482 	),
3483 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x next_agino 0x%x -> 0x%x",
3484 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3485 		  __entry->agno,
3486 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3487 		  __entry->agino,
3488 		  __entry->next_agino,
3489 		  __entry->new_next_agino)
3490 );
3491 
3492 TRACE_EVENT(xrep_iunlink_relink_prev,
3493 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t prev_agino),
3494 	TP_ARGS(ip, prev_agino),
3495 	TP_STRUCT__entry(
3496 		__field(dev_t, dev)
3497 		__field(xfs_agnumber_t, agno)
3498 		__field(xfs_agino_t, agino)
3499 		__field(xfs_agino_t, prev_agino)
3500 		__field(xfs_agino_t, new_prev_agino)
3501 	),
3502 	TP_fast_assign(
3503 		__entry->dev = ip->i_mount->m_super->s_dev;
3504 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3505 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3506 		__entry->prev_agino = ip->i_prev_unlinked;
3507 		__entry->new_prev_agino = prev_agino;
3508 	),
3509 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x prev_agino 0x%x -> 0x%x",
3510 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3511 		  __entry->agno,
3512 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3513 		  __entry->agino,
3514 		  __entry->prev_agino,
3515 		  __entry->new_prev_agino)
3516 );
3517 
3518 TRACE_EVENT(xrep_iunlink_add_to_bucket,
3519 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3520 		 xfs_agino_t agino, xfs_agino_t curr_head),
3521 	TP_ARGS(pag, bucket, agino, curr_head),
3522 	TP_STRUCT__entry(
3523 		__field(dev_t, dev)
3524 		__field(xfs_agnumber_t, agno)
3525 		__field(unsigned int, bucket)
3526 		__field(xfs_agino_t, agino)
3527 		__field(xfs_agino_t, next_agino)
3528 	),
3529 	TP_fast_assign(
3530 		__entry->dev = pag->pag_mount->m_super->s_dev;
3531 		__entry->agno = pag->pag_agno;
3532 		__entry->bucket = bucket;
3533 		__entry->agino = agino;
3534 		__entry->next_agino = curr_head;
3535 	),
3536 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x next_agino 0x%x",
3537 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3538 		  __entry->agno,
3539 		  __entry->bucket,
3540 		  __entry->agino,
3541 		  __entry->next_agino)
3542 );
3543 
3544 TRACE_EVENT(xrep_iunlink_commit_bucket,
3545 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3546 		 xfs_agino_t old_agino, xfs_agino_t agino),
3547 	TP_ARGS(pag, bucket, old_agino, agino),
3548 	TP_STRUCT__entry(
3549 		__field(dev_t, dev)
3550 		__field(xfs_agnumber_t, agno)
3551 		__field(unsigned int, bucket)
3552 		__field(xfs_agino_t, old_agino)
3553 		__field(xfs_agino_t, agino)
3554 	),
3555 	TP_fast_assign(
3556 		__entry->dev = pag->pag_mount->m_super->s_dev;
3557 		__entry->agno = pag->pag_agno;
3558 		__entry->bucket = bucket;
3559 		__entry->old_agino = old_agino;
3560 		__entry->agino = agino;
3561 	),
3562 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x -> 0x%x",
3563 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3564 		  __entry->agno,
3565 		  __entry->bucket,
3566 		  __entry->old_agino,
3567 		  __entry->agino)
3568 );
3569 
3570 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xrep_dirpath_set_outcome);
3571 DEFINE_XCHK_DIRTREE_EVENT(xrep_dirtree_delete_path);
3572 DEFINE_XCHK_DIRTREE_EVENT(xrep_dirtree_create_adoption);
3573 DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(xrep_dirtree_decided_fate);
3574 
3575 #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */
3576 
3577 #endif /* _TRACE_XFS_SCRUB_TRACE_H */
3578 
3579 #undef TRACE_INCLUDE_PATH
3580 #define TRACE_INCLUDE_PATH .
3581 #define TRACE_INCLUDE_FILE scrub/trace
3582 #include <trace/define_trace.h>
3583