xref: /linux/fs/xfs/scrub/trace.h (revision 90d32e92011eaae8e70a9169b4e7acf4ca8f9d3a)
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, 256)
963 	),
964 	TP_fast_assign(
965 		char		pathname[257];
966 		char		*path;
967 
968 		__entry->ino = file_inode(xf->file)->i_ino;
969 		memset(pathname, 0, sizeof(pathname));
970 		path = file_path(xf->file, pathname, sizeof(pathname) - 1);
971 		if (IS_ERR(path))
972 			path = "(unknown)";
973 		strncpy(__entry->pathname, path, sizeof(__entry->pathname));
974 	),
975 	TP_printk("xfino 0x%lx path '%s'",
976 		  __entry->ino,
977 		  __entry->pathname)
978 );
979 
980 TRACE_EVENT(xfile_destroy,
981 	TP_PROTO(struct xfile *xf),
982 	TP_ARGS(xf),
983 	TP_STRUCT__entry(
984 		__field(unsigned long, ino)
985 		__field(unsigned long long, bytes)
986 		__field(loff_t, size)
987 	),
988 	TP_fast_assign(
989 		struct inode		*inode = file_inode(xf->file);
990 
991 		__entry->ino = inode->i_ino;
992 		__entry->bytes = inode->i_blocks << SECTOR_SHIFT;
993 		__entry->size = i_size_read(inode);
994 	),
995 	TP_printk("xfino 0x%lx mem_bytes 0x%llx isize 0x%llx",
996 		  __entry->ino,
997 		  __entry->bytes,
998 		  __entry->size)
999 );
1000 
1001 DECLARE_EVENT_CLASS(xfile_class,
1002 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount),
1003 	TP_ARGS(xf, pos, bytecount),
1004 	TP_STRUCT__entry(
1005 		__field(unsigned long, ino)
1006 		__field(unsigned long long, bytes_used)
1007 		__field(loff_t, pos)
1008 		__field(loff_t, size)
1009 		__field(unsigned long long, bytecount)
1010 	),
1011 	TP_fast_assign(
1012 		struct inode		*inode = file_inode(xf->file);
1013 
1014 		__entry->ino = inode->i_ino;
1015 		__entry->bytes_used = inode->i_blocks << SECTOR_SHIFT;
1016 		__entry->pos = pos;
1017 		__entry->size = i_size_read(inode);
1018 		__entry->bytecount = bytecount;
1019 	),
1020 	TP_printk("xfino 0x%lx mem_bytes 0x%llx pos 0x%llx bytecount 0x%llx isize 0x%llx",
1021 		  __entry->ino,
1022 		  __entry->bytes_used,
1023 		  __entry->pos,
1024 		  __entry->bytecount,
1025 		  __entry->size)
1026 );
1027 #define DEFINE_XFILE_EVENT(name) \
1028 DEFINE_EVENT(xfile_class, name, \
1029 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount), \
1030 	TP_ARGS(xf, pos, bytecount))
1031 DEFINE_XFILE_EVENT(xfile_load);
1032 DEFINE_XFILE_EVENT(xfile_store);
1033 DEFINE_XFILE_EVENT(xfile_seek_data);
1034 DEFINE_XFILE_EVENT(xfile_get_folio);
1035 DEFINE_XFILE_EVENT(xfile_put_folio);
1036 DEFINE_XFILE_EVENT(xfile_discard);
1037 
1038 TRACE_EVENT(xfarray_create,
1039 	TP_PROTO(struct xfarray *xfa, unsigned long long required_capacity),
1040 	TP_ARGS(xfa, required_capacity),
1041 	TP_STRUCT__entry(
1042 		__field(unsigned long, ino)
1043 		__field(uint64_t, max_nr)
1044 		__field(size_t, obj_size)
1045 		__field(int, obj_size_log)
1046 		__field(unsigned long long, required_capacity)
1047 	),
1048 	TP_fast_assign(
1049 		__entry->max_nr = xfa->max_nr;
1050 		__entry->obj_size = xfa->obj_size;
1051 		__entry->obj_size_log = xfa->obj_size_log;
1052 		__entry->ino = file_inode(xfa->xfile->file)->i_ino;
1053 		__entry->required_capacity = required_capacity;
1054 	),
1055 	TP_printk("xfino 0x%lx max_nr %llu reqd_nr %llu objsz %zu objszlog %d",
1056 		  __entry->ino,
1057 		  __entry->max_nr,
1058 		  __entry->required_capacity,
1059 		  __entry->obj_size,
1060 		  __entry->obj_size_log)
1061 );
1062 
1063 TRACE_EVENT(xfarray_isort,
1064 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1065 	TP_ARGS(si, lo, hi),
1066 	TP_STRUCT__entry(
1067 		__field(unsigned long, ino)
1068 		__field(unsigned long long, lo)
1069 		__field(unsigned long long, hi)
1070 	),
1071 	TP_fast_assign(
1072 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1073 		__entry->lo = lo;
1074 		__entry->hi = hi;
1075 	),
1076 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
1077 		  __entry->ino,
1078 		  __entry->lo,
1079 		  __entry->hi,
1080 		  __entry->hi - __entry->lo)
1081 );
1082 
1083 TRACE_EVENT(xfarray_foliosort,
1084 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1085 	TP_ARGS(si, lo, hi),
1086 	TP_STRUCT__entry(
1087 		__field(unsigned long, ino)
1088 		__field(unsigned long long, lo)
1089 		__field(unsigned long long, hi)
1090 	),
1091 	TP_fast_assign(
1092 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1093 		__entry->lo = lo;
1094 		__entry->hi = hi;
1095 	),
1096 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
1097 		  __entry->ino,
1098 		  __entry->lo,
1099 		  __entry->hi,
1100 		  __entry->hi - __entry->lo)
1101 );
1102 
1103 TRACE_EVENT(xfarray_qsort,
1104 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
1105 	TP_ARGS(si, lo, hi),
1106 	TP_STRUCT__entry(
1107 		__field(unsigned long, ino)
1108 		__field(unsigned long long, lo)
1109 		__field(unsigned long long, hi)
1110 		__field(int, stack_depth)
1111 		__field(int, max_stack_depth)
1112 	),
1113 	TP_fast_assign(
1114 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1115 		__entry->lo = lo;
1116 		__entry->hi = hi;
1117 		__entry->stack_depth = si->stack_depth;
1118 		__entry->max_stack_depth = si->max_stack_depth;
1119 	),
1120 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu stack %d/%d",
1121 		  __entry->ino,
1122 		  __entry->lo,
1123 		  __entry->hi,
1124 		  __entry->hi - __entry->lo,
1125 		  __entry->stack_depth,
1126 		  __entry->max_stack_depth)
1127 );
1128 
1129 TRACE_EVENT(xfarray_sort,
1130 	TP_PROTO(struct xfarray_sortinfo *si, size_t bytes),
1131 	TP_ARGS(si, bytes),
1132 	TP_STRUCT__entry(
1133 		__field(unsigned long, ino)
1134 		__field(unsigned long long, nr)
1135 		__field(size_t, obj_size)
1136 		__field(size_t, bytes)
1137 		__field(unsigned int, max_stack_depth)
1138 	),
1139 	TP_fast_assign(
1140 		__entry->nr = si->array->nr;
1141 		__entry->obj_size = si->array->obj_size;
1142 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1143 		__entry->bytes = bytes;
1144 		__entry->max_stack_depth = si->max_stack_depth;
1145 	),
1146 	TP_printk("xfino 0x%lx nr %llu objsz %zu stack %u bytes %zu",
1147 		  __entry->ino,
1148 		  __entry->nr,
1149 		  __entry->obj_size,
1150 		  __entry->max_stack_depth,
1151 		  __entry->bytes)
1152 );
1153 
1154 TRACE_EVENT(xfarray_sort_scan,
1155 	TP_PROTO(struct xfarray_sortinfo *si, unsigned long long idx),
1156 	TP_ARGS(si, idx),
1157 	TP_STRUCT__entry(
1158 		__field(unsigned long, ino)
1159 		__field(unsigned long long, nr)
1160 		__field(size_t, obj_size)
1161 		__field(unsigned long long, idx)
1162 		__field(unsigned long long, folio_pos)
1163 		__field(unsigned long, folio_bytes)
1164 		__field(unsigned long long, first_idx)
1165 		__field(unsigned long long, last_idx)
1166 	),
1167 	TP_fast_assign(
1168 		__entry->nr = si->array->nr;
1169 		__entry->obj_size = si->array->obj_size;
1170 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1171 		__entry->idx = idx;
1172 		if (si->folio) {
1173 			__entry->folio_pos = folio_pos(si->folio);
1174 			__entry->folio_bytes = folio_size(si->folio);
1175 			__entry->first_idx = si->first_folio_idx;
1176 			__entry->last_idx = si->last_folio_idx;
1177 		} else {
1178 			__entry->folio_pos = 0;
1179 			__entry->folio_bytes = 0;
1180 			__entry->first_idx = 0;
1181 			__entry->last_idx = 0;
1182 		}
1183 	),
1184 	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",
1185 		  __entry->ino,
1186 		  __entry->nr,
1187 		  __entry->obj_size,
1188 		  __entry->idx,
1189 		  __entry->folio_pos,
1190 		  __entry->folio_bytes,
1191 		  __entry->first_idx,
1192 		  __entry->last_idx)
1193 );
1194 
1195 TRACE_EVENT(xfarray_sort_stats,
1196 	TP_PROTO(struct xfarray_sortinfo *si, int error),
1197 	TP_ARGS(si, error),
1198 	TP_STRUCT__entry(
1199 		__field(unsigned long, ino)
1200 #ifdef DEBUG
1201 		__field(unsigned long long, loads)
1202 		__field(unsigned long long, stores)
1203 		__field(unsigned long long, compares)
1204 		__field(unsigned long long, heapsorts)
1205 #endif
1206 		__field(unsigned int, max_stack_depth)
1207 		__field(unsigned int, max_stack_used)
1208 		__field(int, error)
1209 	),
1210 	TP_fast_assign(
1211 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1212 #ifdef DEBUG
1213 		__entry->loads = si->loads;
1214 		__entry->stores = si->stores;
1215 		__entry->compares = si->compares;
1216 		__entry->heapsorts = si->heapsorts;
1217 #endif
1218 		__entry->max_stack_depth = si->max_stack_depth;
1219 		__entry->max_stack_used = si->max_stack_used;
1220 		__entry->error = error;
1221 	),
1222 	TP_printk(
1223 #ifdef DEBUG
1224 		  "xfino 0x%lx loads %llu stores %llu compares %llu heapsorts %llu stack_depth %u/%u error %d",
1225 #else
1226 		  "xfino 0x%lx stack_depth %u/%u error %d",
1227 #endif
1228 		  __entry->ino,
1229 #ifdef DEBUG
1230 		  __entry->loads,
1231 		  __entry->stores,
1232 		  __entry->compares,
1233 		  __entry->heapsorts,
1234 #endif
1235 		  __entry->max_stack_used,
1236 		  __entry->max_stack_depth,
1237 		  __entry->error)
1238 );
1239 
1240 #ifdef CONFIG_XFS_RT
1241 TRACE_EVENT(xchk_rtsum_record_free,
1242 	TP_PROTO(struct xfs_mount *mp, xfs_rtxnum_t start,
1243 		 xfs_rtbxlen_t len, unsigned int log, loff_t pos,
1244 		 xfs_suminfo_t value),
1245 	TP_ARGS(mp, start, len, log, pos, value),
1246 	TP_STRUCT__entry(
1247 		__field(dev_t, dev)
1248 		__field(dev_t, rtdev)
1249 		__field(xfs_rtxnum_t, start)
1250 		__field(unsigned long long, len)
1251 		__field(unsigned int, log)
1252 		__field(loff_t, pos)
1253 		__field(xfs_suminfo_t, value)
1254 	),
1255 	TP_fast_assign(
1256 		__entry->dev = mp->m_super->s_dev;
1257 		__entry->rtdev = mp->m_rtdev_targp->bt_dev;
1258 		__entry->start = start;
1259 		__entry->len = len;
1260 		__entry->log = log;
1261 		__entry->pos = pos;
1262 		__entry->value = value;
1263 	),
1264 	TP_printk("dev %d:%d rtdev %d:%d rtx 0x%llx rtxcount 0x%llx log %u rsumpos 0x%llx sumcount %u",
1265 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1266 		  MAJOR(__entry->rtdev), MINOR(__entry->rtdev),
1267 		  __entry->start,
1268 		  __entry->len,
1269 		  __entry->log,
1270 		  __entry->pos,
1271 		  __entry->value)
1272 );
1273 #endif /* CONFIG_XFS_RT */
1274 
1275 DECLARE_EVENT_CLASS(xchk_iscan_class,
1276 	TP_PROTO(struct xchk_iscan *iscan),
1277 	TP_ARGS(iscan),
1278 	TP_STRUCT__entry(
1279 		__field(dev_t, dev)
1280 		__field(xfs_ino_t, cursor)
1281 		__field(xfs_ino_t, visited)
1282 	),
1283 	TP_fast_assign(
1284 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1285 		__entry->cursor = iscan->cursor_ino;
1286 		__entry->visited = iscan->__visited_ino;
1287 	),
1288 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx",
1289 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1290 		  __entry->cursor,
1291 		  __entry->visited)
1292 )
1293 #define DEFINE_ISCAN_EVENT(name) \
1294 DEFINE_EVENT(xchk_iscan_class, name, \
1295 	TP_PROTO(struct xchk_iscan *iscan), \
1296 	TP_ARGS(iscan))
1297 DEFINE_ISCAN_EVENT(xchk_iscan_move_cursor);
1298 DEFINE_ISCAN_EVENT(xchk_iscan_visit);
1299 DEFINE_ISCAN_EVENT(xchk_iscan_skip);
1300 DEFINE_ISCAN_EVENT(xchk_iscan_advance_ag);
1301 
1302 DECLARE_EVENT_CLASS(xchk_iscan_ino_class,
1303 	TP_PROTO(struct xchk_iscan *iscan, xfs_ino_t ino),
1304 	TP_ARGS(iscan, ino),
1305 	TP_STRUCT__entry(
1306 		__field(dev_t, dev)
1307 		__field(xfs_ino_t, startino)
1308 		__field(xfs_ino_t, cursor)
1309 		__field(xfs_ino_t, visited)
1310 		__field(xfs_ino_t, ino)
1311 	),
1312 	TP_fast_assign(
1313 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1314 		__entry->startino = iscan->scan_start_ino;
1315 		__entry->cursor = iscan->cursor_ino;
1316 		__entry->visited = iscan->__visited_ino;
1317 		__entry->ino = ino;
1318 	),
1319 	TP_printk("dev %d:%d iscan start 0x%llx cursor 0x%llx visited 0x%llx ino 0x%llx",
1320 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1321 		  __entry->startino,
1322 		  __entry->cursor,
1323 		  __entry->visited,
1324 		  __entry->ino)
1325 )
1326 #define DEFINE_ISCAN_INO_EVENT(name) \
1327 DEFINE_EVENT(xchk_iscan_ino_class, name, \
1328 	TP_PROTO(struct xchk_iscan *iscan, xfs_ino_t ino), \
1329 	TP_ARGS(iscan, ino))
1330 DEFINE_ISCAN_INO_EVENT(xchk_iscan_want_live_update);
1331 DEFINE_ISCAN_INO_EVENT(xchk_iscan_start);
1332 
1333 TRACE_EVENT(xchk_iscan_iget,
1334 	TP_PROTO(struct xchk_iscan *iscan, int error),
1335 	TP_ARGS(iscan, error),
1336 	TP_STRUCT__entry(
1337 		__field(dev_t, dev)
1338 		__field(xfs_ino_t, cursor)
1339 		__field(xfs_ino_t, visited)
1340 		__field(int, error)
1341 	),
1342 	TP_fast_assign(
1343 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1344 		__entry->cursor = iscan->cursor_ino;
1345 		__entry->visited = iscan->__visited_ino;
1346 		__entry->error = error;
1347 	),
1348 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx error %d",
1349 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1350 		  __entry->cursor,
1351 		  __entry->visited,
1352 		  __entry->error)
1353 );
1354 
1355 TRACE_EVENT(xchk_iscan_iget_batch,
1356 	TP_PROTO(struct xfs_mount *mp, struct xchk_iscan *iscan,
1357 		 unsigned int nr, unsigned int avail),
1358 	TP_ARGS(mp, iscan, nr, avail),
1359 	TP_STRUCT__entry(
1360 		__field(dev_t, dev)
1361 		__field(xfs_ino_t, cursor)
1362 		__field(xfs_ino_t, visited)
1363 		__field(unsigned int, nr)
1364 		__field(unsigned int, avail)
1365 		__field(unsigned int, unavail)
1366 		__field(xfs_ino_t, batch_ino)
1367 		__field(unsigned long long, skipmask)
1368 	),
1369 	TP_fast_assign(
1370 		__entry->dev = mp->m_super->s_dev;
1371 		__entry->cursor = iscan->cursor_ino;
1372 		__entry->visited = iscan->__visited_ino;
1373 		__entry->nr = nr;
1374 		__entry->avail = avail;
1375 		__entry->unavail = hweight64(iscan->__skipped_inomask);
1376 		__entry->batch_ino = iscan->__batch_ino;
1377 		__entry->skipmask = iscan->__skipped_inomask;
1378 	),
1379 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx batchino 0x%llx skipmask 0x%llx nr %u avail %u unavail %u",
1380 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1381 		  __entry->cursor,
1382 		  __entry->visited,
1383 		  __entry->batch_ino,
1384 		  __entry->skipmask,
1385 		  __entry->nr,
1386 		  __entry->avail,
1387 		  __entry->unavail)
1388 );
1389 
1390 DECLARE_EVENT_CLASS(xchk_iscan_retry_wait_class,
1391 	TP_PROTO(struct xchk_iscan *iscan),
1392 	TP_ARGS(iscan),
1393 	TP_STRUCT__entry(
1394 		__field(dev_t, dev)
1395 		__field(xfs_ino_t, cursor)
1396 		__field(xfs_ino_t, visited)
1397 		__field(unsigned int, retry_delay)
1398 		__field(unsigned long, remaining)
1399 		__field(unsigned int, iget_timeout)
1400 	),
1401 	TP_fast_assign(
1402 		__entry->dev = iscan->sc->mp->m_super->s_dev;
1403 		__entry->cursor = iscan->cursor_ino;
1404 		__entry->visited = iscan->__visited_ino;
1405 		__entry->retry_delay = iscan->iget_retry_delay;
1406 		__entry->remaining = jiffies_to_msecs(iscan->__iget_deadline - jiffies);
1407 		__entry->iget_timeout = iscan->iget_timeout;
1408 	),
1409 	TP_printk("dev %d:%d iscan cursor 0x%llx visited 0x%llx remaining %lu timeout %u delay %u",
1410 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1411 		  __entry->cursor,
1412 		  __entry->visited,
1413 		  __entry->remaining,
1414 		  __entry->iget_timeout,
1415 		  __entry->retry_delay)
1416 )
1417 #define DEFINE_ISCAN_RETRY_WAIT_EVENT(name) \
1418 DEFINE_EVENT(xchk_iscan_retry_wait_class, name, \
1419 	TP_PROTO(struct xchk_iscan *iscan), \
1420 	TP_ARGS(iscan))
1421 DEFINE_ISCAN_RETRY_WAIT_EVENT(xchk_iscan_iget_retry_wait);
1422 DEFINE_ISCAN_RETRY_WAIT_EVENT(xchk_iscan_agi_retry_wait);
1423 
1424 TRACE_EVENT(xchk_nlinks_collect_dirent,
1425 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *dp,
1426 		 xfs_ino_t ino, const struct xfs_name *name),
1427 	TP_ARGS(mp, dp, ino, name),
1428 	TP_STRUCT__entry(
1429 		__field(dev_t, dev)
1430 		__field(xfs_ino_t, dir)
1431 		__field(xfs_ino_t, ino)
1432 		__field(unsigned int, namelen)
1433 		__dynamic_array(char, name, name->len)
1434 	),
1435 	TP_fast_assign(
1436 		__entry->dev = mp->m_super->s_dev;
1437 		__entry->dir = dp->i_ino;
1438 		__entry->ino = ino;
1439 		__entry->namelen = name->len;
1440 		memcpy(__get_str(name), name->name, name->len);
1441 	),
1442 	TP_printk("dev %d:%d dir 0x%llx -> ino 0x%llx name '%.*s'",
1443 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1444 		  __entry->dir,
1445 		  __entry->ino,
1446 		  __entry->namelen,
1447 		  __get_str(name))
1448 );
1449 
1450 TRACE_EVENT(xchk_nlinks_collect_pptr,
1451 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *dp,
1452 		 const struct xfs_name *name,
1453 		 const struct xfs_parent_rec *pptr),
1454 	TP_ARGS(mp, dp, name, pptr),
1455 	TP_STRUCT__entry(
1456 		__field(dev_t, dev)
1457 		__field(xfs_ino_t, dir)
1458 		__field(xfs_ino_t, ino)
1459 		__field(unsigned int, namelen)
1460 		__dynamic_array(char, name, name->len)
1461 	),
1462 	TP_fast_assign(
1463 		__entry->dev = mp->m_super->s_dev;
1464 		__entry->dir = dp->i_ino;
1465 		__entry->ino = be64_to_cpu(pptr->p_ino);
1466 		__entry->namelen = name->len;
1467 		memcpy(__get_str(name), name->name, name->len);
1468 	),
1469 	TP_printk("dev %d:%d dir 0x%llx -> ino 0x%llx name '%.*s'",
1470 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1471 		  __entry->dir,
1472 		  __entry->ino,
1473 		  __entry->namelen,
1474 		  __get_str(name))
1475 );
1476 
1477 TRACE_EVENT(xchk_nlinks_collect_metafile,
1478 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino),
1479 	TP_ARGS(mp, ino),
1480 	TP_STRUCT__entry(
1481 		__field(dev_t, dev)
1482 		__field(xfs_ino_t, ino)
1483 	),
1484 	TP_fast_assign(
1485 		__entry->dev = mp->m_super->s_dev;
1486 		__entry->ino = ino;
1487 	),
1488 	TP_printk("dev %d:%d ino 0x%llx",
1489 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1490 		  __entry->ino)
1491 );
1492 
1493 TRACE_EVENT(xchk_nlinks_live_update,
1494 	TP_PROTO(struct xfs_mount *mp, const struct xfs_inode *dp,
1495 		 int action, xfs_ino_t ino, int delta,
1496 		 const char *name, unsigned int namelen),
1497 	TP_ARGS(mp, dp, action, ino, delta, name, namelen),
1498 	TP_STRUCT__entry(
1499 		__field(dev_t, dev)
1500 		__field(xfs_ino_t, dir)
1501 		__field(int, action)
1502 		__field(xfs_ino_t, ino)
1503 		__field(int, delta)
1504 		__field(unsigned int, namelen)
1505 		__dynamic_array(char, name, namelen)
1506 	),
1507 	TP_fast_assign(
1508 		__entry->dev = mp->m_super->s_dev;
1509 		__entry->dir = dp ? dp->i_ino : NULLFSINO;
1510 		__entry->action = action;
1511 		__entry->ino = ino;
1512 		__entry->delta = delta;
1513 		__entry->namelen = namelen;
1514 		memcpy(__get_str(name), name, namelen);
1515 	),
1516 	TP_printk("dev %d:%d dir 0x%llx ino 0x%llx nlink_delta %d name '%.*s'",
1517 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1518 		  __entry->dir,
1519 		  __entry->ino,
1520 		  __entry->delta,
1521 		  __entry->namelen,
1522 		  __get_str(name))
1523 );
1524 
1525 TRACE_EVENT(xchk_nlinks_check_zero,
1526 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
1527 		 const struct xchk_nlink *live),
1528 	TP_ARGS(mp, ino, live),
1529 	TP_STRUCT__entry(
1530 		__field(dev_t, dev)
1531 		__field(xfs_ino_t, ino)
1532 		__field(xfs_nlink_t, parents)
1533 		__field(xfs_nlink_t, backrefs)
1534 		__field(xfs_nlink_t, children)
1535 	),
1536 	TP_fast_assign(
1537 		__entry->dev = mp->m_super->s_dev;
1538 		__entry->ino = ino;
1539 		__entry->parents = live->parents;
1540 		__entry->backrefs = live->backrefs;
1541 		__entry->children = live->children;
1542 	),
1543 	TP_printk("dev %d:%d ino 0x%llx parents %u backrefs %u children %u",
1544 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1545 		  __entry->ino,
1546 		  __entry->parents,
1547 		  __entry->backrefs,
1548 		  __entry->children)
1549 );
1550 
1551 TRACE_EVENT(xchk_nlinks_update_incore,
1552 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
1553 		 const struct xchk_nlink *live, int parents_delta,
1554 		 int backrefs_delta, int children_delta),
1555 	TP_ARGS(mp, ino, live, parents_delta, backrefs_delta, children_delta),
1556 	TP_STRUCT__entry(
1557 		__field(dev_t, dev)
1558 		__field(xfs_ino_t, ino)
1559 		__field(xfs_nlink_t, parents)
1560 		__field(xfs_nlink_t, backrefs)
1561 		__field(xfs_nlink_t, children)
1562 		__field(int, parents_delta)
1563 		__field(int, backrefs_delta)
1564 		__field(int, children_delta)
1565 	),
1566 	TP_fast_assign(
1567 		__entry->dev = mp->m_super->s_dev;
1568 		__entry->ino = ino;
1569 		__entry->parents = live->parents;
1570 		__entry->backrefs = live->backrefs;
1571 		__entry->children = live->children;
1572 		__entry->parents_delta = parents_delta;
1573 		__entry->backrefs_delta = backrefs_delta;
1574 		__entry->children_delta = children_delta;
1575 	),
1576 	TP_printk("dev %d:%d ino 0x%llx parents %d:%u backrefs %d:%u children %d:%u",
1577 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1578 		  __entry->ino,
1579 		  __entry->parents_delta,
1580 		  __entry->parents,
1581 		  __entry->backrefs_delta,
1582 		  __entry->backrefs,
1583 		  __entry->children_delta,
1584 		  __entry->children)
1585 );
1586 
1587 DECLARE_EVENT_CLASS(xchk_nlinks_diff_class,
1588 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *ip,
1589 		 const struct xchk_nlink *live),
1590 	TP_ARGS(mp, ip, live),
1591 	TP_STRUCT__entry(
1592 		__field(dev_t, dev)
1593 		__field(xfs_ino_t, ino)
1594 		__field(uint8_t, ftype)
1595 		__field(xfs_nlink_t, nlink)
1596 		__field(xfs_nlink_t, parents)
1597 		__field(xfs_nlink_t, backrefs)
1598 		__field(xfs_nlink_t, children)
1599 	),
1600 	TP_fast_assign(
1601 		__entry->dev = mp->m_super->s_dev;
1602 		__entry->ino = ip->i_ino;
1603 		__entry->ftype = xfs_mode_to_ftype(VFS_I(ip)->i_mode);
1604 		__entry->nlink = VFS_I(ip)->i_nlink;
1605 		__entry->parents = live->parents;
1606 		__entry->backrefs = live->backrefs;
1607 		__entry->children = live->children;
1608 	),
1609 	TP_printk("dev %d:%d ino 0x%llx ftype %s nlink %u parents %u backrefs %u children %u",
1610 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1611 		  __entry->ino,
1612 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
1613 		  __entry->nlink,
1614 		  __entry->parents,
1615 		  __entry->backrefs,
1616 		  __entry->children)
1617 );
1618 #define DEFINE_SCRUB_NLINKS_DIFF_EVENT(name) \
1619 DEFINE_EVENT(xchk_nlinks_diff_class, name, \
1620 	TP_PROTO(struct xfs_mount *mp, struct xfs_inode *ip, \
1621 		 const struct xchk_nlink *live), \
1622 	TP_ARGS(mp, ip, live))
1623 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xchk_nlinks_compare_inode);
1624 
1625 DECLARE_EVENT_CLASS(xchk_pptr_class,
1626 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name,
1627 		 xfs_ino_t far_ino),
1628 	TP_ARGS(ip, name, far_ino),
1629 	TP_STRUCT__entry(
1630 		__field(dev_t, dev)
1631 		__field(xfs_ino_t, ino)
1632 		__field(unsigned int, namelen)
1633 		__dynamic_array(char, name, name->len)
1634 		__field(xfs_ino_t, far_ino)
1635 	),
1636 	TP_fast_assign(
1637 		__entry->dev = ip->i_mount->m_super->s_dev;
1638 		__entry->ino = ip->i_ino;
1639 		__entry->namelen = name->len;
1640 		memcpy(__get_str(name), name, name->len);
1641 		__entry->far_ino = far_ino;
1642 	),
1643 	TP_printk("dev %d:%d ino 0x%llx name '%.*s' far_ino 0x%llx",
1644 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1645 		  __entry->ino,
1646 		  __entry->namelen,
1647 		  __get_str(name),
1648 		  __entry->far_ino)
1649 )
1650 #define DEFINE_XCHK_PPTR_EVENT(name) \
1651 DEFINE_EVENT(xchk_pptr_class, name, \
1652 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name, \
1653 		 xfs_ino_t far_ino), \
1654 	TP_ARGS(ip, name, far_ino))
1655 DEFINE_XCHK_PPTR_EVENT(xchk_dir_defer);
1656 DEFINE_XCHK_PPTR_EVENT(xchk_dir_slowpath);
1657 DEFINE_XCHK_PPTR_EVENT(xchk_dir_ultraslowpath);
1658 DEFINE_XCHK_PPTR_EVENT(xchk_parent_defer);
1659 DEFINE_XCHK_PPTR_EVENT(xchk_parent_slowpath);
1660 DEFINE_XCHK_PPTR_EVENT(xchk_parent_ultraslowpath);
1661 
1662 DECLARE_EVENT_CLASS(xchk_dirtree_class,
1663 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip,
1664 		 unsigned int path_nr, const struct xfs_name *name,
1665 		 const struct xfs_parent_rec *pptr),
1666 	TP_ARGS(sc, ip, path_nr, name, pptr),
1667 	TP_STRUCT__entry(
1668 		__field(dev_t, dev)
1669 		__field(unsigned int, path_nr)
1670 		__field(xfs_ino_t, child_ino)
1671 		__field(unsigned int, child_gen)
1672 		__field(xfs_ino_t, parent_ino)
1673 		__field(unsigned int, parent_gen)
1674 		__field(unsigned int, namelen)
1675 		__dynamic_array(char, name, name->len)
1676 	),
1677 	TP_fast_assign(
1678 		__entry->dev = sc->mp->m_super->s_dev;
1679 		__entry->path_nr = path_nr;
1680 		__entry->child_ino = ip->i_ino;
1681 		__entry->child_gen = VFS_I(ip)->i_generation;
1682 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
1683 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
1684 		__entry->namelen = name->len;
1685 		memcpy(__get_str(name), name->name, name->len);
1686 	),
1687 	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'",
1688 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1689 		  __entry->path_nr,
1690 		  __entry->child_ino,
1691 		  __entry->child_gen,
1692 		  __entry->parent_ino,
1693 		  __entry->parent_gen,
1694 		  __entry->namelen,
1695 		  __get_str(name))
1696 );
1697 #define DEFINE_XCHK_DIRTREE_EVENT(name) \
1698 DEFINE_EVENT(xchk_dirtree_class, name, \
1699 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, \
1700 		 unsigned int path_nr, const struct xfs_name *name, \
1701 		 const struct xfs_parent_rec *pptr), \
1702 	TP_ARGS(sc, ip, path_nr, name, pptr))
1703 DEFINE_XCHK_DIRTREE_EVENT(xchk_dirtree_create_path);
1704 DEFINE_XCHK_DIRTREE_EVENT(xchk_dirpath_walk_upwards);
1705 
1706 DECLARE_EVENT_CLASS(xchk_dirpath_class,
1707 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip,
1708 		 unsigned int path_nr, unsigned int step_nr,
1709 		 const struct xfs_name *name,
1710 		 const struct xfs_parent_rec *pptr),
1711 	TP_ARGS(sc, ip, path_nr, step_nr, name, pptr),
1712 	TP_STRUCT__entry(
1713 		__field(dev_t, dev)
1714 		__field(unsigned int, path_nr)
1715 		__field(unsigned int, step_nr)
1716 		__field(xfs_ino_t, child_ino)
1717 		__field(unsigned int, child_gen)
1718 		__field(xfs_ino_t, parent_ino)
1719 		__field(unsigned int, parent_gen)
1720 		__field(unsigned int, namelen)
1721 		__dynamic_array(char, name, name->len)
1722 	),
1723 	TP_fast_assign(
1724 		__entry->dev = sc->mp->m_super->s_dev;
1725 		__entry->path_nr = path_nr;
1726 		__entry->step_nr = step_nr;
1727 		__entry->child_ino = ip->i_ino;
1728 		__entry->child_gen = VFS_I(ip)->i_generation;
1729 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
1730 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
1731 		__entry->namelen = name->len;
1732 		memcpy(__get_str(name), name->name, name->len);
1733 	),
1734 	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'",
1735 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1736 		  __entry->path_nr,
1737 		  __entry->step_nr,
1738 		  __entry->child_ino,
1739 		  __entry->child_gen,
1740 		  __entry->parent_ino,
1741 		  __entry->parent_gen,
1742 		  __entry->namelen,
1743 		  __get_str(name))
1744 );
1745 #define DEFINE_XCHK_DIRPATH_EVENT(name) \
1746 DEFINE_EVENT(xchk_dirpath_class, name, \
1747 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, \
1748 		 unsigned int path_nr, unsigned int step_nr, \
1749 		 const struct xfs_name *name, \
1750 		 const struct xfs_parent_rec *pptr), \
1751 	TP_ARGS(sc, ip, path_nr, step_nr, name, pptr))
1752 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_disappeared);
1753 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_badgen);
1754 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_nondir_parent);
1755 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_unlinked_parent);
1756 DEFINE_XCHK_DIRPATH_EVENT(xchk_dirpath_found_next_step);
1757 
1758 TRACE_DEFINE_ENUM(XCHK_DIRPATH_SCANNING);
1759 TRACE_DEFINE_ENUM(XCHK_DIRPATH_DELETE);
1760 TRACE_DEFINE_ENUM(XCHK_DIRPATH_CORRUPT);
1761 TRACE_DEFINE_ENUM(XCHK_DIRPATH_LOOP);
1762 TRACE_DEFINE_ENUM(XCHK_DIRPATH_STALE);
1763 TRACE_DEFINE_ENUM(XCHK_DIRPATH_OK);
1764 TRACE_DEFINE_ENUM(XREP_DIRPATH_DELETING);
1765 TRACE_DEFINE_ENUM(XREP_DIRPATH_DELETED);
1766 TRACE_DEFINE_ENUM(XREP_DIRPATH_ADOPTING);
1767 TRACE_DEFINE_ENUM(XREP_DIRPATH_ADOPTED);
1768 
1769 #define XCHK_DIRPATH_OUTCOME_STRINGS \
1770 	{ XCHK_DIRPATH_SCANNING,	"scanning" }, \
1771 	{ XCHK_DIRPATH_DELETE,		"delete" }, \
1772 	{ XCHK_DIRPATH_CORRUPT,		"corrupt" }, \
1773 	{ XCHK_DIRPATH_LOOP,		"loop" }, \
1774 	{ XCHK_DIRPATH_STALE,		"stale" }, \
1775 	{ XCHK_DIRPATH_OK,		"ok" }, \
1776 	{ XREP_DIRPATH_DELETING,	"deleting" }, \
1777 	{ XREP_DIRPATH_DELETED,		"deleted" }, \
1778 	{ XREP_DIRPATH_ADOPTING,	"adopting" }, \
1779 	{ XREP_DIRPATH_ADOPTED,		"adopted" }
1780 
1781 DECLARE_EVENT_CLASS(xchk_dirpath_outcome_class,
1782 	TP_PROTO(struct xfs_scrub *sc, unsigned long long path_nr,
1783 		 unsigned int nr_steps, \
1784 		 unsigned int outcome),
1785 	TP_ARGS(sc, path_nr, nr_steps, outcome),
1786 	TP_STRUCT__entry(
1787 		__field(dev_t, dev)
1788 		__field(unsigned long long, path_nr)
1789 		__field(unsigned int, nr_steps)
1790 		__field(unsigned int, outcome)
1791 	),
1792 	TP_fast_assign(
1793 		__entry->dev = sc->mp->m_super->s_dev;
1794 		__entry->path_nr = path_nr;
1795 		__entry->nr_steps = nr_steps;
1796 		__entry->outcome = outcome;
1797 	),
1798 	TP_printk("dev %d:%d path %llu steps %u outcome %s",
1799 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1800 		  __entry->path_nr,
1801 		  __entry->nr_steps,
1802 		  __print_symbolic(__entry->outcome, XCHK_DIRPATH_OUTCOME_STRINGS))
1803 );
1804 #define DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(name) \
1805 DEFINE_EVENT(xchk_dirpath_outcome_class, name, \
1806 	TP_PROTO(struct xfs_scrub *sc, unsigned long long path_nr, \
1807 		 unsigned int nr_steps, \
1808 		 unsigned int outcome), \
1809 	TP_ARGS(sc, path_nr, nr_steps, outcome))
1810 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xchk_dirpath_set_outcome);
1811 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xchk_dirpath_evaluate_path);
1812 
1813 DECLARE_EVENT_CLASS(xchk_dirtree_evaluate_class,
1814 	TP_PROTO(const struct xchk_dirtree *dl,
1815 		 const struct xchk_dirtree_outcomes *oc),
1816 	TP_ARGS(dl, oc),
1817 	TP_STRUCT__entry(
1818 		__field(dev_t, dev)
1819 		__field(xfs_ino_t, ino)
1820 		__field(xfs_ino_t, rootino)
1821 		__field(unsigned int, nr_paths)
1822 		__field(unsigned int, bad)
1823 		__field(unsigned int, suspect)
1824 		__field(unsigned int, good)
1825 		__field(bool, needs_adoption)
1826 	),
1827 	TP_fast_assign(
1828 		__entry->dev = dl->sc->mp->m_super->s_dev;
1829 		__entry->ino = dl->sc->ip->i_ino;
1830 		__entry->rootino = dl->root_ino;
1831 		__entry->nr_paths = dl->nr_paths;
1832 		__entry->bad = oc->bad;
1833 		__entry->suspect = oc->suspect;
1834 		__entry->good = oc->good;
1835 		__entry->needs_adoption = oc->needs_adoption ? 1 : 0;
1836 	),
1837 	TP_printk("dev %d:%d ino 0x%llx rootino 0x%llx nr_paths %u bad %u suspect %u good %u adopt? %d",
1838 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1839 		  __entry->ino,
1840 		  __entry->rootino,
1841 		  __entry->nr_paths,
1842 		  __entry->bad,
1843 		  __entry->suspect,
1844 		  __entry->good,
1845 		  __entry->needs_adoption)
1846 );
1847 #define DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(name) \
1848 DEFINE_EVENT(xchk_dirtree_evaluate_class, name, \
1849 	TP_PROTO(const struct xchk_dirtree *dl, \
1850 		 const struct xchk_dirtree_outcomes *oc), \
1851 	TP_ARGS(dl, oc))
1852 DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(xchk_dirtree_evaluate);
1853 
1854 TRACE_EVENT(xchk_dirpath_changed,
1855 	TP_PROTO(struct xfs_scrub *sc, unsigned int path_nr,
1856 		 unsigned int step_nr, const struct xfs_inode *dp,
1857 		 const struct xfs_inode *ip, const struct xfs_name *xname),
1858 	TP_ARGS(sc, path_nr, step_nr, dp, ip, xname),
1859 	TP_STRUCT__entry(
1860 		__field(dev_t, dev)
1861 		__field(unsigned int, path_nr)
1862 		__field(unsigned int, step_nr)
1863 		__field(xfs_ino_t, child_ino)
1864 		__field(xfs_ino_t, parent_ino)
1865 		__field(unsigned int, namelen)
1866 		__dynamic_array(char, name, xname->len)
1867 	),
1868 	TP_fast_assign(
1869 		__entry->dev = sc->mp->m_super->s_dev;
1870 		__entry->path_nr = path_nr;
1871 		__entry->step_nr = step_nr;
1872 		__entry->child_ino = ip->i_ino;
1873 		__entry->parent_ino = dp->i_ino;
1874 		__entry->namelen = xname->len;
1875 		memcpy(__get_str(name), xname->name, xname->len);
1876 	),
1877 	TP_printk("dev %d:%d path %u step %u child_ino 0x%llx parent_ino 0x%llx name '%.*s'",
1878 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1879 		  __entry->path_nr,
1880 		  __entry->step_nr,
1881 		  __entry->child_ino,
1882 		  __entry->parent_ino,
1883 		  __entry->namelen,
1884 		  __get_str(name))
1885 );
1886 
1887 TRACE_EVENT(xchk_dirtree_live_update,
1888 	TP_PROTO(struct xfs_scrub *sc, const struct xfs_inode *dp,
1889 		 int action, const struct xfs_inode *ip, int delta,
1890 		 const struct xfs_name *xname),
1891 	TP_ARGS(sc, dp, action, ip, delta, xname),
1892 	TP_STRUCT__entry(
1893 		__field(dev_t, dev)
1894 		__field(xfs_ino_t, parent_ino)
1895 		__field(int, action)
1896 		__field(xfs_ino_t, child_ino)
1897 		__field(int, delta)
1898 		__field(unsigned int, namelen)
1899 		__dynamic_array(char, name, xname->len)
1900 	),
1901 	TP_fast_assign(
1902 		__entry->dev = sc->mp->m_super->s_dev;
1903 		__entry->parent_ino = dp->i_ino;
1904 		__entry->action = action;
1905 		__entry->child_ino = ip->i_ino;
1906 		__entry->delta = delta;
1907 		__entry->namelen = xname->len;
1908 		memcpy(__get_str(name), xname->name, xname->len);
1909 	),
1910 	TP_printk("dev %d:%d parent_ino 0x%llx child_ino 0x%llx nlink_delta %d name '%.*s'",
1911 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1912 		  __entry->parent_ino,
1913 		  __entry->child_ino,
1914 		  __entry->delta,
1915 		  __entry->namelen,
1916 		  __get_str(name))
1917 );
1918 
1919 /* repair tracepoints */
1920 #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR)
1921 
1922 DECLARE_EVENT_CLASS(xrep_extent_class,
1923 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len),
1924 	TP_ARGS(pag, agbno, len),
1925 	TP_STRUCT__entry(
1926 		__field(dev_t, dev)
1927 		__field(xfs_agnumber_t, agno)
1928 		__field(xfs_agblock_t, agbno)
1929 		__field(xfs_extlen_t, len)
1930 	),
1931 	TP_fast_assign(
1932 		__entry->dev = pag->pag_mount->m_super->s_dev;
1933 		__entry->agno = pag->pag_agno;
1934 		__entry->agbno = agbno;
1935 		__entry->len = len;
1936 	),
1937 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
1938 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1939 		  __entry->agno,
1940 		  __entry->agbno,
1941 		  __entry->len)
1942 );
1943 #define DEFINE_REPAIR_EXTENT_EVENT(name) \
1944 DEFINE_EVENT(xrep_extent_class, name, \
1945 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len), \
1946 	TP_ARGS(pag, agbno, len))
1947 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_unmap_extent);
1948 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_free_extent);
1949 DEFINE_REPAIR_EXTENT_EVENT(xreap_agextent_binval);
1950 DEFINE_REPAIR_EXTENT_EVENT(xreap_bmapi_binval);
1951 DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert);
1952 
1953 DECLARE_EVENT_CLASS(xrep_reap_find_class,
1954 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len,
1955 		bool crosslinked),
1956 	TP_ARGS(pag, agbno, len, crosslinked),
1957 	TP_STRUCT__entry(
1958 		__field(dev_t, dev)
1959 		__field(xfs_agnumber_t, agno)
1960 		__field(xfs_agblock_t, agbno)
1961 		__field(xfs_extlen_t, len)
1962 		__field(bool, crosslinked)
1963 	),
1964 	TP_fast_assign(
1965 		__entry->dev = pag->pag_mount->m_super->s_dev;
1966 		__entry->agno = pag->pag_agno;
1967 		__entry->agbno = agbno;
1968 		__entry->len = len;
1969 		__entry->crosslinked = crosslinked;
1970 	),
1971 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x crosslinked %d",
1972 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1973 		  __entry->agno,
1974 		  __entry->agbno,
1975 		  __entry->len,
1976 		  __entry->crosslinked ? 1 : 0)
1977 );
1978 #define DEFINE_REPAIR_REAP_FIND_EVENT(name) \
1979 DEFINE_EVENT(xrep_reap_find_class, name, \
1980 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \
1981 		 bool crosslinked), \
1982 	TP_ARGS(pag, agbno, len, crosslinked))
1983 DEFINE_REPAIR_REAP_FIND_EVENT(xreap_agextent_select);
1984 DEFINE_REPAIR_REAP_FIND_EVENT(xreap_bmapi_select);
1985 
1986 DECLARE_EVENT_CLASS(xrep_rmap_class,
1987 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1988 		 xfs_agblock_t agbno, xfs_extlen_t len,
1989 		 uint64_t owner, uint64_t offset, unsigned int flags),
1990 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
1991 	TP_STRUCT__entry(
1992 		__field(dev_t, dev)
1993 		__field(xfs_agnumber_t, agno)
1994 		__field(xfs_agblock_t, agbno)
1995 		__field(xfs_extlen_t, len)
1996 		__field(uint64_t, owner)
1997 		__field(uint64_t, offset)
1998 		__field(unsigned int, flags)
1999 	),
2000 	TP_fast_assign(
2001 		__entry->dev = mp->m_super->s_dev;
2002 		__entry->agno = agno;
2003 		__entry->agbno = agbno;
2004 		__entry->len = len;
2005 		__entry->owner = owner;
2006 		__entry->offset = offset;
2007 		__entry->flags = flags;
2008 	),
2009 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2010 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2011 		  __entry->agno,
2012 		  __entry->agbno,
2013 		  __entry->len,
2014 		  __entry->owner,
2015 		  __entry->offset,
2016 		  __entry->flags)
2017 );
2018 #define DEFINE_REPAIR_RMAP_EVENT(name) \
2019 DEFINE_EVENT(xrep_rmap_class, name, \
2020 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2021 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2022 		 uint64_t owner, uint64_t offset, unsigned int flags), \
2023 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
2024 DEFINE_REPAIR_RMAP_EVENT(xrep_ibt_walk_rmap);
2025 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_walk_rmap);
2026 
2027 TRACE_EVENT(xrep_abt_found,
2028 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2029 		 const struct xfs_alloc_rec_incore *rec),
2030 	TP_ARGS(mp, agno, rec),
2031 	TP_STRUCT__entry(
2032 		__field(dev_t, dev)
2033 		__field(xfs_agnumber_t, agno)
2034 		__field(xfs_agblock_t, startblock)
2035 		__field(xfs_extlen_t, blockcount)
2036 	),
2037 	TP_fast_assign(
2038 		__entry->dev = mp->m_super->s_dev;
2039 		__entry->agno = agno;
2040 		__entry->startblock = rec->ar_startblock;
2041 		__entry->blockcount = rec->ar_blockcount;
2042 	),
2043 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2044 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2045 		  __entry->agno,
2046 		  __entry->startblock,
2047 		  __entry->blockcount)
2048 )
2049 
2050 TRACE_EVENT(xrep_ibt_found,
2051 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2052 		 const struct xfs_inobt_rec_incore *rec),
2053 	TP_ARGS(mp, agno, rec),
2054 	TP_STRUCT__entry(
2055 		__field(dev_t, dev)
2056 		__field(xfs_agnumber_t, agno)
2057 		__field(xfs_agino_t, startino)
2058 		__field(uint16_t, holemask)
2059 		__field(uint8_t, count)
2060 		__field(uint8_t, freecount)
2061 		__field(uint64_t, freemask)
2062 	),
2063 	TP_fast_assign(
2064 		__entry->dev = mp->m_super->s_dev;
2065 		__entry->agno = agno;
2066 		__entry->startino = rec->ir_startino;
2067 		__entry->holemask = rec->ir_holemask;
2068 		__entry->count = rec->ir_count;
2069 		__entry->freecount = rec->ir_freecount;
2070 		__entry->freemask = rec->ir_free;
2071 	),
2072 	TP_printk("dev %d:%d agno 0x%x agino 0x%x holemask 0x%x count 0x%x freecount 0x%x freemask 0x%llx",
2073 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2074 		  __entry->agno,
2075 		  __entry->startino,
2076 		  __entry->holemask,
2077 		  __entry->count,
2078 		  __entry->freecount,
2079 		  __entry->freemask)
2080 )
2081 
2082 TRACE_EVENT(xrep_refc_found,
2083 	TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *rec),
2084 	TP_ARGS(pag, rec),
2085 	TP_STRUCT__entry(
2086 		__field(dev_t, dev)
2087 		__field(xfs_agnumber_t, agno)
2088 		__field(enum xfs_refc_domain, domain)
2089 		__field(xfs_agblock_t, startblock)
2090 		__field(xfs_extlen_t, blockcount)
2091 		__field(xfs_nlink_t, refcount)
2092 	),
2093 	TP_fast_assign(
2094 		__entry->dev = pag->pag_mount->m_super->s_dev;
2095 		__entry->agno = pag->pag_agno;
2096 		__entry->domain = rec->rc_domain;
2097 		__entry->startblock = rec->rc_startblock;
2098 		__entry->blockcount = rec->rc_blockcount;
2099 		__entry->refcount = rec->rc_refcount;
2100 	),
2101 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u",
2102 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2103 		  __entry->agno,
2104 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
2105 		  __entry->startblock,
2106 		  __entry->blockcount,
2107 		  __entry->refcount)
2108 )
2109 
2110 TRACE_EVENT(xrep_bmap_found,
2111 	TP_PROTO(struct xfs_inode *ip, int whichfork,
2112 		 struct xfs_bmbt_irec *irec),
2113 	TP_ARGS(ip, whichfork, irec),
2114 	TP_STRUCT__entry(
2115 		__field(dev_t, dev)
2116 		__field(xfs_ino_t, ino)
2117 		__field(int, whichfork)
2118 		__field(xfs_fileoff_t, lblk)
2119 		__field(xfs_filblks_t, len)
2120 		__field(xfs_fsblock_t, pblk)
2121 		__field(int, state)
2122 	),
2123 	TP_fast_assign(
2124 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
2125 		__entry->ino = ip->i_ino;
2126 		__entry->whichfork = whichfork;
2127 		__entry->lblk = irec->br_startoff;
2128 		__entry->len = irec->br_blockcount;
2129 		__entry->pblk = irec->br_startblock;
2130 		__entry->state = irec->br_state;
2131 	),
2132 	TP_printk("dev %d:%d ino 0x%llx whichfork %s fileoff 0x%llx fsbcount 0x%llx startblock 0x%llx state %d",
2133 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2134 		  __entry->ino,
2135 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2136 		  __entry->lblk,
2137 		  __entry->len,
2138 		  __entry->pblk,
2139 		  __entry->state)
2140 );
2141 
2142 TRACE_EVENT(xrep_rmap_found,
2143 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2144 		 const struct xfs_rmap_irec *rec),
2145 	TP_ARGS(mp, agno, rec),
2146 	TP_STRUCT__entry(
2147 		__field(dev_t, dev)
2148 		__field(xfs_agnumber_t, agno)
2149 		__field(xfs_agblock_t, agbno)
2150 		__field(xfs_extlen_t, len)
2151 		__field(uint64_t, owner)
2152 		__field(uint64_t, offset)
2153 		__field(unsigned int, flags)
2154 	),
2155 	TP_fast_assign(
2156 		__entry->dev = mp->m_super->s_dev;
2157 		__entry->agno = agno;
2158 		__entry->agbno = rec->rm_startblock;
2159 		__entry->len = rec->rm_blockcount;
2160 		__entry->owner = rec->rm_owner;
2161 		__entry->offset = rec->rm_offset;
2162 		__entry->flags = rec->rm_flags;
2163 	),
2164 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
2165 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2166 		  __entry->agno,
2167 		  __entry->agbno,
2168 		  __entry->len,
2169 		  __entry->owner,
2170 		  __entry->offset,
2171 		  __entry->flags)
2172 );
2173 
2174 TRACE_EVENT(xrep_findroot_block,
2175 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
2176 		 uint32_t magic, uint16_t level),
2177 	TP_ARGS(mp, agno, agbno, magic, level),
2178 	TP_STRUCT__entry(
2179 		__field(dev_t, dev)
2180 		__field(xfs_agnumber_t, agno)
2181 		__field(xfs_agblock_t, agbno)
2182 		__field(uint32_t, magic)
2183 		__field(uint16_t, level)
2184 	),
2185 	TP_fast_assign(
2186 		__entry->dev = mp->m_super->s_dev;
2187 		__entry->agno = agno;
2188 		__entry->agbno = agbno;
2189 		__entry->magic = magic;
2190 		__entry->level = level;
2191 	),
2192 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x magic 0x%x level %u",
2193 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2194 		  __entry->agno,
2195 		  __entry->agbno,
2196 		  __entry->magic,
2197 		  __entry->level)
2198 )
2199 TRACE_EVENT(xrep_calc_ag_resblks,
2200 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2201 		 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen,
2202 		 xfs_agblock_t usedlen),
2203 	TP_ARGS(mp, agno, icount, aglen, freelen, usedlen),
2204 	TP_STRUCT__entry(
2205 		__field(dev_t, dev)
2206 		__field(xfs_agnumber_t, agno)
2207 		__field(xfs_agino_t, icount)
2208 		__field(xfs_agblock_t, aglen)
2209 		__field(xfs_agblock_t, freelen)
2210 		__field(xfs_agblock_t, usedlen)
2211 	),
2212 	TP_fast_assign(
2213 		__entry->dev = mp->m_super->s_dev;
2214 		__entry->agno = agno;
2215 		__entry->icount = icount;
2216 		__entry->aglen = aglen;
2217 		__entry->freelen = freelen;
2218 		__entry->usedlen = usedlen;
2219 	),
2220 	TP_printk("dev %d:%d agno 0x%x icount %u aglen %u freelen %u usedlen %u",
2221 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2222 		  __entry->agno,
2223 		  __entry->icount,
2224 		  __entry->aglen,
2225 		  __entry->freelen,
2226 		  __entry->usedlen)
2227 )
2228 TRACE_EVENT(xrep_calc_ag_resblks_btsize,
2229 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2230 		 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz,
2231 		 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz),
2232 	TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz),
2233 	TP_STRUCT__entry(
2234 		__field(dev_t, dev)
2235 		__field(xfs_agnumber_t, agno)
2236 		__field(xfs_agblock_t, bnobt_sz)
2237 		__field(xfs_agblock_t, inobt_sz)
2238 		__field(xfs_agblock_t, rmapbt_sz)
2239 		__field(xfs_agblock_t, refcbt_sz)
2240 	),
2241 	TP_fast_assign(
2242 		__entry->dev = mp->m_super->s_dev;
2243 		__entry->agno = agno;
2244 		__entry->bnobt_sz = bnobt_sz;
2245 		__entry->inobt_sz = inobt_sz;
2246 		__entry->rmapbt_sz = rmapbt_sz;
2247 		__entry->refcbt_sz = refcbt_sz;
2248 	),
2249 	TP_printk("dev %d:%d agno 0x%x bnobt %u inobt %u rmapbt %u refcountbt %u",
2250 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2251 		  __entry->agno,
2252 		  __entry->bnobt_sz,
2253 		  __entry->inobt_sz,
2254 		  __entry->rmapbt_sz,
2255 		  __entry->refcbt_sz)
2256 )
2257 TRACE_EVENT(xrep_reset_counters,
2258 	TP_PROTO(struct xfs_mount *mp, struct xchk_fscounters *fsc),
2259 	TP_ARGS(mp, fsc),
2260 	TP_STRUCT__entry(
2261 		__field(dev_t, dev)
2262 		__field(uint64_t, icount)
2263 		__field(uint64_t, ifree)
2264 		__field(uint64_t, fdblocks)
2265 		__field(uint64_t, frextents)
2266 	),
2267 	TP_fast_assign(
2268 		__entry->dev = mp->m_super->s_dev;
2269 		__entry->icount = fsc->icount;
2270 		__entry->ifree = fsc->ifree;
2271 		__entry->fdblocks = fsc->fdblocks;
2272 		__entry->frextents = fsc->frextents;
2273 	),
2274 	TP_printk("dev %d:%d icount %llu ifree %llu fdblocks %llu frextents %llu",
2275 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2276 		  __entry->icount,
2277 		  __entry->ifree,
2278 		  __entry->fdblocks,
2279 		  __entry->frextents)
2280 )
2281 
2282 DECLARE_EVENT_CLASS(xrep_newbt_extent_class,
2283 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
2284 		 xfs_agblock_t agbno, xfs_extlen_t len,
2285 		 int64_t owner),
2286 	TP_ARGS(mp, agno, agbno, len, owner),
2287 	TP_STRUCT__entry(
2288 		__field(dev_t, dev)
2289 		__field(xfs_agnumber_t, agno)
2290 		__field(xfs_agblock_t, agbno)
2291 		__field(xfs_extlen_t, len)
2292 		__field(int64_t, owner)
2293 	),
2294 	TP_fast_assign(
2295 		__entry->dev = mp->m_super->s_dev;
2296 		__entry->agno = agno;
2297 		__entry->agbno = agbno;
2298 		__entry->len = len;
2299 		__entry->owner = owner;
2300 	),
2301 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx",
2302 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2303 		  __entry->agno,
2304 		  __entry->agbno,
2305 		  __entry->len,
2306 		  __entry->owner)
2307 );
2308 #define DEFINE_NEWBT_EXTENT_EVENT(name) \
2309 DEFINE_EVENT(xrep_newbt_extent_class, name, \
2310 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
2311 		 xfs_agblock_t agbno, xfs_extlen_t len, \
2312 		 int64_t owner), \
2313 	TP_ARGS(mp, agno, agbno, len, owner))
2314 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_ag_blocks);
2315 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_alloc_file_blocks);
2316 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_free_blocks);
2317 DEFINE_NEWBT_EXTENT_EVENT(xrep_newbt_claim_block);
2318 
2319 DECLARE_EVENT_CLASS(xrep_dinode_class,
2320 	TP_PROTO(struct xfs_scrub *sc, struct xfs_dinode *dip),
2321 	TP_ARGS(sc, dip),
2322 	TP_STRUCT__entry(
2323 		__field(dev_t, dev)
2324 		__field(xfs_ino_t, ino)
2325 		__field(uint16_t, mode)
2326 		__field(uint8_t, version)
2327 		__field(uint8_t, format)
2328 		__field(uint32_t, uid)
2329 		__field(uint32_t, gid)
2330 		__field(uint64_t, size)
2331 		__field(uint64_t, nblocks)
2332 		__field(uint32_t, extsize)
2333 		__field(uint32_t, nextents)
2334 		__field(uint16_t, anextents)
2335 		__field(uint8_t, forkoff)
2336 		__field(uint8_t, aformat)
2337 		__field(uint16_t, flags)
2338 		__field(uint32_t, gen)
2339 		__field(uint64_t, flags2)
2340 		__field(uint32_t, cowextsize)
2341 	),
2342 	TP_fast_assign(
2343 		__entry->dev = sc->mp->m_super->s_dev;
2344 		__entry->ino = sc->sm->sm_ino;
2345 		__entry->mode = be16_to_cpu(dip->di_mode);
2346 		__entry->version = dip->di_version;
2347 		__entry->format = dip->di_format;
2348 		__entry->uid = be32_to_cpu(dip->di_uid);
2349 		__entry->gid = be32_to_cpu(dip->di_gid);
2350 		__entry->size = be64_to_cpu(dip->di_size);
2351 		__entry->nblocks = be64_to_cpu(dip->di_nblocks);
2352 		__entry->extsize = be32_to_cpu(dip->di_extsize);
2353 		__entry->nextents = be32_to_cpu(dip->di_nextents);
2354 		__entry->anextents = be16_to_cpu(dip->di_anextents);
2355 		__entry->forkoff = dip->di_forkoff;
2356 		__entry->aformat = dip->di_aformat;
2357 		__entry->flags = be16_to_cpu(dip->di_flags);
2358 		__entry->gen = be32_to_cpu(dip->di_gen);
2359 		__entry->flags2 = be64_to_cpu(dip->di_flags2);
2360 		__entry->cowextsize = be32_to_cpu(dip->di_cowextsize);
2361 	),
2362 	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",
2363 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2364 		  __entry->ino,
2365 		  __entry->mode,
2366 		  __entry->version,
2367 		  __entry->format,
2368 		  __entry->uid,
2369 		  __entry->gid,
2370 		  __entry->size,
2371 		  __entry->nblocks,
2372 		  __entry->extsize,
2373 		  __entry->nextents,
2374 		  __entry->anextents,
2375 		  __entry->forkoff,
2376 		  __entry->aformat,
2377 		  __entry->flags,
2378 		  __entry->gen,
2379 		  __entry->flags2,
2380 		  __entry->cowextsize)
2381 )
2382 
2383 #define DEFINE_REPAIR_DINODE_EVENT(name) \
2384 DEFINE_EVENT(xrep_dinode_class, name, \
2385 	TP_PROTO(struct xfs_scrub *sc, struct xfs_dinode *dip), \
2386 	TP_ARGS(sc, dip))
2387 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_header);
2388 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_mode);
2389 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_flags);
2390 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_size);
2391 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_extsize_hints);
2392 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_symlink);
2393 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_dir);
2394 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_fixed);
2395 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_forks);
2396 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_dfork);
2397 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_zap_afork);
2398 DEFINE_REPAIR_DINODE_EVENT(xrep_dinode_ensure_forkoff);
2399 
2400 DECLARE_EVENT_CLASS(xrep_inode_class,
2401 	TP_PROTO(struct xfs_scrub *sc),
2402 	TP_ARGS(sc),
2403 	TP_STRUCT__entry(
2404 		__field(dev_t, dev)
2405 		__field(xfs_ino_t, ino)
2406 		__field(xfs_fsize_t, size)
2407 		__field(xfs_rfsblock_t, nblocks)
2408 		__field(uint16_t, flags)
2409 		__field(uint64_t, flags2)
2410 		__field(uint32_t, nextents)
2411 		__field(uint8_t, format)
2412 		__field(uint32_t, anextents)
2413 		__field(uint8_t, aformat)
2414 	),
2415 	TP_fast_assign(
2416 		__entry->dev = sc->mp->m_super->s_dev;
2417 		__entry->ino = sc->sm->sm_ino;
2418 		__entry->size = sc->ip->i_disk_size;
2419 		__entry->nblocks = sc->ip->i_nblocks;
2420 		__entry->flags = sc->ip->i_diflags;
2421 		__entry->flags2 = sc->ip->i_diflags2;
2422 		__entry->nextents = sc->ip->i_df.if_nextents;
2423 		__entry->format = sc->ip->i_df.if_format;
2424 		__entry->anextents = sc->ip->i_af.if_nextents;
2425 		__entry->aformat = sc->ip->i_af.if_format;
2426 	),
2427 	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",
2428 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2429 		  __entry->ino,
2430 		  __entry->size,
2431 		  __entry->nblocks,
2432 		  __entry->flags,
2433 		  __entry->flags2,
2434 		  __entry->nextents,
2435 		  __entry->format,
2436 		  __entry->anextents,
2437 		  __entry->aformat)
2438 )
2439 
2440 #define DEFINE_REPAIR_INODE_EVENT(name) \
2441 DEFINE_EVENT(xrep_inode_class, name, \
2442 	TP_PROTO(struct xfs_scrub *sc), \
2443 	TP_ARGS(sc))
2444 DEFINE_REPAIR_INODE_EVENT(xrep_inode_blockcounts);
2445 DEFINE_REPAIR_INODE_EVENT(xrep_inode_ids);
2446 DEFINE_REPAIR_INODE_EVENT(xrep_inode_flags);
2447 DEFINE_REPAIR_INODE_EVENT(xrep_inode_blockdir_size);
2448 DEFINE_REPAIR_INODE_EVENT(xrep_inode_sfdir_size);
2449 DEFINE_REPAIR_INODE_EVENT(xrep_inode_dir_size);
2450 DEFINE_REPAIR_INODE_EVENT(xrep_inode_fixed);
2451 
2452 TRACE_EVENT(xrep_dinode_count_rmaps,
2453 	TP_PROTO(struct xfs_scrub *sc, xfs_rfsblock_t data_blocks,
2454 		xfs_rfsblock_t rt_blocks, xfs_rfsblock_t attr_blocks,
2455 		xfs_extnum_t data_extents, xfs_extnum_t rt_extents,
2456 		xfs_aextnum_t attr_extents),
2457 	TP_ARGS(sc, data_blocks, rt_blocks, attr_blocks, data_extents,
2458 		rt_extents, attr_extents),
2459 	TP_STRUCT__entry(
2460 		__field(dev_t, dev)
2461 		__field(xfs_ino_t, ino)
2462 		__field(xfs_rfsblock_t, data_blocks)
2463 		__field(xfs_rfsblock_t, rt_blocks)
2464 		__field(xfs_rfsblock_t, attr_blocks)
2465 		__field(xfs_extnum_t, data_extents)
2466 		__field(xfs_extnum_t, rt_extents)
2467 		__field(xfs_aextnum_t, attr_extents)
2468 	),
2469 	TP_fast_assign(
2470 		__entry->dev = sc->mp->m_super->s_dev;
2471 		__entry->ino = sc->sm->sm_ino;
2472 		__entry->data_blocks = data_blocks;
2473 		__entry->rt_blocks = rt_blocks;
2474 		__entry->attr_blocks = attr_blocks;
2475 		__entry->data_extents = data_extents;
2476 		__entry->rt_extents = rt_extents;
2477 		__entry->attr_extents = attr_extents;
2478 	),
2479 	TP_printk("dev %d:%d ino 0x%llx dblocks 0x%llx rtblocks 0x%llx ablocks 0x%llx dextents %llu rtextents %llu aextents %u",
2480 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2481 		  __entry->ino,
2482 		  __entry->data_blocks,
2483 		  __entry->rt_blocks,
2484 		  __entry->attr_blocks,
2485 		  __entry->data_extents,
2486 		  __entry->rt_extents,
2487 		  __entry->attr_extents)
2488 );
2489 
2490 TRACE_EVENT(xrep_dinode_findmode_dirent,
2491 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *dp,
2492 		 unsigned int ftype),
2493 	TP_ARGS(sc, dp, ftype),
2494 	TP_STRUCT__entry(
2495 		__field(dev_t, dev)
2496 		__field(xfs_ino_t, ino)
2497 		__field(xfs_ino_t, parent_ino)
2498 		__field(unsigned int, ftype)
2499 	),
2500 	TP_fast_assign(
2501 		__entry->dev = sc->mp->m_super->s_dev;
2502 		__entry->ino = sc->sm->sm_ino;
2503 		__entry->parent_ino = dp->i_ino;
2504 		__entry->ftype = ftype;
2505 	),
2506 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx ftype '%s'",
2507 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2508 		  __entry->ino,
2509 		  __entry->parent_ino,
2510 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR))
2511 );
2512 
2513 TRACE_EVENT(xrep_dinode_findmode_dirent_inval,
2514 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *dp,
2515 		 unsigned int ftype, unsigned int found_ftype),
2516 	TP_ARGS(sc, dp, ftype, found_ftype),
2517 	TP_STRUCT__entry(
2518 		__field(dev_t, dev)
2519 		__field(xfs_ino_t, ino)
2520 		__field(xfs_ino_t, parent_ino)
2521 		__field(unsigned int, ftype)
2522 		__field(unsigned int, found_ftype)
2523 	),
2524 	TP_fast_assign(
2525 		__entry->dev = sc->mp->m_super->s_dev;
2526 		__entry->ino = sc->sm->sm_ino;
2527 		__entry->parent_ino = dp->i_ino;
2528 		__entry->ftype = ftype;
2529 		__entry->found_ftype = found_ftype;
2530 	),
2531 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx ftype '%s' found_ftype '%s'",
2532 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2533 		  __entry->ino,
2534 		  __entry->parent_ino,
2535 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
2536 		  __print_symbolic(__entry->found_ftype, XFS_DIR3_FTYPE_STR))
2537 );
2538 
2539 TRACE_EVENT(xrep_cow_mark_file_range,
2540 	TP_PROTO(struct xfs_inode *ip, xfs_fsblock_t startblock,
2541 		 xfs_fileoff_t startoff, xfs_filblks_t blockcount),
2542 	TP_ARGS(ip, startblock, startoff, blockcount),
2543 	TP_STRUCT__entry(
2544 		__field(dev_t, dev)
2545 		__field(xfs_ino_t, ino)
2546 		__field(xfs_fsblock_t, startblock)
2547 		__field(xfs_fileoff_t, startoff)
2548 		__field(xfs_filblks_t, blockcount)
2549 	),
2550 	TP_fast_assign(
2551 		__entry->dev = ip->i_mount->m_super->s_dev;
2552 		__entry->ino = ip->i_ino;
2553 		__entry->startoff = startoff;
2554 		__entry->startblock = startblock;
2555 		__entry->blockcount = blockcount;
2556 	),
2557 	TP_printk("dev %d:%d ino 0x%llx fileoff 0x%llx startblock 0x%llx fsbcount 0x%llx",
2558 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2559 		  __entry->ino,
2560 		  __entry->startoff,
2561 		  __entry->startblock,
2562 		  __entry->blockcount)
2563 );
2564 
2565 TRACE_EVENT(xrep_cow_replace_mapping,
2566 	TP_PROTO(struct xfs_inode *ip, const struct xfs_bmbt_irec *irec,
2567 		 xfs_fsblock_t new_startblock, xfs_extlen_t new_blockcount),
2568 	TP_ARGS(ip, irec, new_startblock, new_blockcount),
2569 	TP_STRUCT__entry(
2570 		__field(dev_t, dev)
2571 		__field(xfs_ino_t, ino)
2572 		__field(xfs_fsblock_t, startblock)
2573 		__field(xfs_fileoff_t, startoff)
2574 		__field(xfs_filblks_t, blockcount)
2575 		__field(xfs_exntst_t, state)
2576 		__field(xfs_fsblock_t, new_startblock)
2577 		__field(xfs_extlen_t, new_blockcount)
2578 	),
2579 	TP_fast_assign(
2580 		__entry->dev = ip->i_mount->m_super->s_dev;
2581 		__entry->ino = ip->i_ino;
2582 		__entry->startoff = irec->br_startoff;
2583 		__entry->startblock = irec->br_startblock;
2584 		__entry->blockcount = irec->br_blockcount;
2585 		__entry->state = irec->br_state;
2586 		__entry->new_startblock = new_startblock;
2587 		__entry->new_blockcount = new_blockcount;
2588 	),
2589 	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",
2590 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2591 		  __entry->ino,
2592 		  __entry->startoff,
2593 		  __entry->startblock,
2594 		  __entry->blockcount,
2595 		  __entry->state,
2596 		  __entry->new_startblock,
2597 		  __entry->new_blockcount)
2598 );
2599 
2600 TRACE_EVENT(xrep_cow_free_staging,
2601 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno,
2602 		 xfs_extlen_t blockcount),
2603 	TP_ARGS(pag, agbno, blockcount),
2604 	TP_STRUCT__entry(
2605 		__field(dev_t, dev)
2606 		__field(xfs_agnumber_t, agno)
2607 		__field(xfs_agblock_t, agbno)
2608 		__field(xfs_extlen_t, blockcount)
2609 	),
2610 	TP_fast_assign(
2611 		__entry->dev = pag->pag_mount->m_super->s_dev;
2612 		__entry->agno = pag->pag_agno;
2613 		__entry->agbno = agbno;
2614 		__entry->blockcount = blockcount;
2615 	),
2616 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
2617 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2618 		  __entry->agno,
2619 		  __entry->agbno,
2620 		  __entry->blockcount)
2621 );
2622 
2623 #ifdef CONFIG_XFS_QUOTA
2624 DECLARE_EVENT_CLASS(xrep_dquot_class,
2625 	TP_PROTO(struct xfs_mount *mp, uint8_t type, uint32_t id),
2626 	TP_ARGS(mp, type, id),
2627 	TP_STRUCT__entry(
2628 		__field(dev_t, dev)
2629 		__field(uint8_t, type)
2630 		__field(uint32_t, id)
2631 	),
2632 	TP_fast_assign(
2633 		__entry->dev = mp->m_super->s_dev;
2634 		__entry->id = id;
2635 		__entry->type = type;
2636 	),
2637 	TP_printk("dev %d:%d type %s id 0x%x",
2638 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2639 		  __print_flags(__entry->type, "|", XFS_DQTYPE_STRINGS),
2640 		  __entry->id)
2641 );
2642 
2643 #define DEFINE_XREP_DQUOT_EVENT(name) \
2644 DEFINE_EVENT(xrep_dquot_class, name, \
2645 	TP_PROTO(struct xfs_mount *mp, uint8_t type, uint32_t id), \
2646 	TP_ARGS(mp, type, id))
2647 DEFINE_XREP_DQUOT_EVENT(xrep_dquot_item);
2648 DEFINE_XREP_DQUOT_EVENT(xrep_disk_dquot);
2649 DEFINE_XREP_DQUOT_EVENT(xrep_dquot_item_fill_bmap_hole);
2650 DEFINE_XREP_DQUOT_EVENT(xrep_quotacheck_dquot);
2651 #endif /* CONFIG_XFS_QUOTA */
2652 
2653 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_update_inode);
2654 DEFINE_SCRUB_NLINKS_DIFF_EVENT(xrep_nlinks_unfixable_inode);
2655 
2656 TRACE_EVENT(xrep_rmap_live_update,
2657 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, unsigned int op,
2658 		 const struct xfs_rmap_update_params *p),
2659 	TP_ARGS(mp, agno, op, p),
2660 	TP_STRUCT__entry(
2661 		__field(dev_t, dev)
2662 		__field(xfs_agnumber_t, agno)
2663 		__field(unsigned int, op)
2664 		__field(xfs_agblock_t, agbno)
2665 		__field(xfs_extlen_t, len)
2666 		__field(uint64_t, owner)
2667 		__field(uint64_t, offset)
2668 		__field(unsigned int, flags)
2669 	),
2670 	TP_fast_assign(
2671 		__entry->dev = mp->m_super->s_dev;
2672 		__entry->agno = agno;
2673 		__entry->op = op;
2674 		__entry->agbno = p->startblock;
2675 		__entry->len = p->blockcount;
2676 		xfs_owner_info_unpack(&p->oinfo, &__entry->owner,
2677 				&__entry->offset, &__entry->flags);
2678 		if (p->unwritten)
2679 			__entry->flags |= XFS_RMAP_UNWRITTEN;
2680 	),
2681 	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",
2682 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2683 		  __entry->agno,
2684 		  __entry->op,
2685 		  __entry->agbno,
2686 		  __entry->len,
2687 		  __entry->owner,
2688 		  __entry->offset,
2689 		  __entry->flags)
2690 );
2691 
2692 TRACE_EVENT(xrep_tempfile_create,
2693 	TP_PROTO(struct xfs_scrub *sc),
2694 	TP_ARGS(sc),
2695 	TP_STRUCT__entry(
2696 		__field(dev_t, dev)
2697 		__field(xfs_ino_t, ino)
2698 		__field(unsigned int, type)
2699 		__field(xfs_agnumber_t, agno)
2700 		__field(xfs_ino_t, inum)
2701 		__field(unsigned int, gen)
2702 		__field(unsigned int, flags)
2703 		__field(xfs_ino_t, temp_inum)
2704 	),
2705 	TP_fast_assign(
2706 		__entry->dev = sc->mp->m_super->s_dev;
2707 		__entry->ino = sc->file ? XFS_I(file_inode(sc->file))->i_ino : 0;
2708 		__entry->type = sc->sm->sm_type;
2709 		__entry->agno = sc->sm->sm_agno;
2710 		__entry->inum = sc->sm->sm_ino;
2711 		__entry->gen = sc->sm->sm_gen;
2712 		__entry->flags = sc->sm->sm_flags;
2713 		__entry->temp_inum = sc->tempip->i_ino;
2714 	),
2715 	TP_printk("dev %d:%d ino 0x%llx type %s inum 0x%llx gen 0x%x flags 0x%x temp_inum 0x%llx",
2716 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2717 		  __entry->ino,
2718 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2719 		  __entry->inum,
2720 		  __entry->gen,
2721 		  __entry->flags,
2722 		  __entry->temp_inum)
2723 );
2724 
2725 DECLARE_EVENT_CLASS(xrep_tempfile_class,
2726 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
2727 		 struct xfs_bmbt_irec *irec),
2728 	TP_ARGS(sc, whichfork, irec),
2729 	TP_STRUCT__entry(
2730 		__field(dev_t, dev)
2731 		__field(xfs_ino_t, ino)
2732 		__field(int, whichfork)
2733 		__field(xfs_fileoff_t, lblk)
2734 		__field(xfs_filblks_t, len)
2735 		__field(xfs_fsblock_t, pblk)
2736 		__field(int, state)
2737 	),
2738 	TP_fast_assign(
2739 		__entry->dev = sc->mp->m_super->s_dev;
2740 		__entry->ino = sc->tempip->i_ino;
2741 		__entry->whichfork = whichfork;
2742 		__entry->lblk = irec->br_startoff;
2743 		__entry->len = irec->br_blockcount;
2744 		__entry->pblk = irec->br_startblock;
2745 		__entry->state = irec->br_state;
2746 	),
2747 	TP_printk("dev %d:%d ino 0x%llx whichfork %s fileoff 0x%llx fsbcount 0x%llx startblock 0x%llx state %d",
2748 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2749 		  __entry->ino,
2750 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2751 		  __entry->lblk,
2752 		  __entry->len,
2753 		  __entry->pblk,
2754 		  __entry->state)
2755 );
2756 #define DEFINE_XREP_TEMPFILE_EVENT(name) \
2757 DEFINE_EVENT(xrep_tempfile_class, name, \
2758 	TP_PROTO(struct xfs_scrub *sc, int whichfork, \
2759 		 struct xfs_bmbt_irec *irec), \
2760 	TP_ARGS(sc, whichfork, irec))
2761 DEFINE_XREP_TEMPFILE_EVENT(xrep_tempfile_prealloc);
2762 DEFINE_XREP_TEMPFILE_EVENT(xrep_tempfile_copyin);
2763 
2764 TRACE_EVENT(xreap_ifork_extent,
2765 	TP_PROTO(struct xfs_scrub *sc, struct xfs_inode *ip, int whichfork,
2766 		 const struct xfs_bmbt_irec *irec),
2767 	TP_ARGS(sc, ip, whichfork, irec),
2768 	TP_STRUCT__entry(
2769 		__field(dev_t, dev)
2770 		__field(xfs_ino_t, ino)
2771 		__field(int, whichfork)
2772 		__field(xfs_fileoff_t, fileoff)
2773 		__field(xfs_filblks_t, len)
2774 		__field(xfs_agnumber_t, agno)
2775 		__field(xfs_agblock_t, agbno)
2776 		__field(int, state)
2777 	),
2778 	TP_fast_assign(
2779 		__entry->dev = sc->mp->m_super->s_dev;
2780 		__entry->ino = ip->i_ino;
2781 		__entry->whichfork = whichfork;
2782 		__entry->fileoff = irec->br_startoff;
2783 		__entry->len = irec->br_blockcount;
2784 		__entry->agno = XFS_FSB_TO_AGNO(sc->mp, irec->br_startblock);
2785 		__entry->agbno = XFS_FSB_TO_AGBNO(sc->mp, irec->br_startblock);
2786 		__entry->state = irec->br_state;
2787 	),
2788 	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",
2789 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2790 		  __entry->ino,
2791 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
2792 		  __entry->agno,
2793 		  __entry->agbno,
2794 		  __entry->fileoff,
2795 		  __entry->len,
2796 		  __entry->state)
2797 );
2798 
2799 TRACE_EVENT(xreap_bmapi_binval_scan,
2800 	TP_PROTO(struct xfs_scrub *sc, const struct xfs_bmbt_irec *irec,
2801 		 xfs_extlen_t scan_blocks),
2802 	TP_ARGS(sc, irec, scan_blocks),
2803 	TP_STRUCT__entry(
2804 		__field(dev_t, dev)
2805 		__field(xfs_filblks_t, len)
2806 		__field(xfs_agnumber_t, agno)
2807 		__field(xfs_agblock_t, agbno)
2808 		__field(xfs_extlen_t, scan_blocks)
2809 	),
2810 	TP_fast_assign(
2811 		__entry->dev = sc->mp->m_super->s_dev;
2812 		__entry->len = irec->br_blockcount;
2813 		__entry->agno = XFS_FSB_TO_AGNO(sc->mp, irec->br_startblock);
2814 		__entry->agbno = XFS_FSB_TO_AGBNO(sc->mp, irec->br_startblock);
2815 		__entry->scan_blocks = scan_blocks;
2816 	),
2817 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%llx scan_blocks 0x%x",
2818 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2819 		  __entry->agno,
2820 		  __entry->agbno,
2821 		  __entry->len,
2822 		  __entry->scan_blocks)
2823 );
2824 
2825 TRACE_EVENT(xrep_xattr_recover_leafblock,
2826 	TP_PROTO(struct xfs_inode *ip, xfs_dablk_t dabno, uint16_t magic),
2827 	TP_ARGS(ip, dabno, magic),
2828 	TP_STRUCT__entry(
2829 		__field(dev_t, dev)
2830 		__field(xfs_ino_t, ino)
2831 		__field(xfs_dablk_t, dabno)
2832 		__field(uint16_t, magic)
2833 	),
2834 	TP_fast_assign(
2835 		__entry->dev = ip->i_mount->m_super->s_dev;
2836 		__entry->ino = ip->i_ino;
2837 		__entry->dabno = dabno;
2838 		__entry->magic = magic;
2839 	),
2840 	TP_printk("dev %d:%d ino 0x%llx dablk 0x%x magic 0x%x",
2841 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2842 		  __entry->ino,
2843 		  __entry->dabno,
2844 		  __entry->magic)
2845 );
2846 
2847 DECLARE_EVENT_CLASS(xrep_xattr_salvage_class,
2848 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, char *name,
2849 		 unsigned int namelen, unsigned int valuelen),
2850 	TP_ARGS(ip, flags, name, namelen, valuelen),
2851 	TP_STRUCT__entry(
2852 		__field(dev_t, dev)
2853 		__field(xfs_ino_t, ino)
2854 		__field(unsigned int, flags)
2855 		__field(unsigned int, namelen)
2856 		__dynamic_array(char, name, namelen)
2857 		__field(unsigned int, valuelen)
2858 	),
2859 	TP_fast_assign(
2860 		__entry->dev = ip->i_mount->m_super->s_dev;
2861 		__entry->ino = ip->i_ino;
2862 		__entry->flags = flags;
2863 		__entry->namelen = namelen;
2864 		memcpy(__get_str(name), name, namelen);
2865 		__entry->valuelen = valuelen;
2866 	),
2867 	TP_printk("dev %d:%d ino 0x%llx flags %s name '%.*s' valuelen 0x%x",
2868 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2869 		  __entry->ino,
2870 		   __print_flags(__entry->flags, "|", XFS_ATTR_NAMESPACE_STR),
2871 		  __entry->namelen,
2872 		  __get_str(name),
2873 		  __entry->valuelen)
2874 );
2875 #define DEFINE_XREP_XATTR_SALVAGE_EVENT(name) \
2876 DEFINE_EVENT(xrep_xattr_salvage_class, name, \
2877 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, char *name, \
2878 		 unsigned int namelen, unsigned int valuelen), \
2879 	TP_ARGS(ip, flags, name, namelen, valuelen))
2880 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_xattr_salvage_rec);
2881 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_xattr_insert_rec);
2882 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_parent_stash_xattr);
2883 DEFINE_XREP_XATTR_SALVAGE_EVENT(xrep_parent_insert_xattr);
2884 
2885 DECLARE_EVENT_CLASS(xrep_pptr_salvage_class,
2886 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, const void *name,
2887 		 unsigned int namelen, const void *value, unsigned int valuelen),
2888 	TP_ARGS(ip, flags, name, namelen, value, valuelen),
2889 	TP_STRUCT__entry(
2890 		__field(dev_t, dev)
2891 		__field(xfs_ino_t, ino)
2892 		__field(xfs_ino_t, parent_ino)
2893 		__field(unsigned int, parent_gen)
2894 		__field(unsigned int, namelen)
2895 		__dynamic_array(char, name, namelen)
2896 	),
2897 	TP_fast_assign(
2898 		const struct xfs_parent_rec	*rec = value;
2899 
2900 		__entry->dev = ip->i_mount->m_super->s_dev;
2901 		__entry->ino = ip->i_ino;
2902 		__entry->parent_ino = be64_to_cpu(rec->p_ino);
2903 		__entry->parent_gen = be32_to_cpu(rec->p_gen);
2904 		__entry->namelen = namelen;
2905 		memcpy(__get_str(name), name, namelen);
2906 	),
2907 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
2908 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2909 		  __entry->ino,
2910 		  __entry->parent_ino,
2911 		  __entry->parent_gen,
2912 		  __entry->namelen,
2913 		  __get_str(name))
2914 )
2915 #define DEFINE_XREP_PPTR_SALVAGE_EVENT(name) \
2916 DEFINE_EVENT(xrep_pptr_salvage_class, name, \
2917 	TP_PROTO(struct xfs_inode *ip, unsigned int flags, const void *name, \
2918 		 unsigned int namelen, const void *value, unsigned int valuelen), \
2919 	TP_ARGS(ip, flags, name, namelen, value, valuelen))
2920 DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_salvage_pptr);
2921 DEFINE_XREP_PPTR_SALVAGE_EVENT(xrep_xattr_insert_pptr);
2922 
2923 TRACE_EVENT(xrep_xattr_class,
2924 	TP_PROTO(struct xfs_inode *ip, struct xfs_inode *arg_ip),
2925 	TP_ARGS(ip, arg_ip),
2926 	TP_STRUCT__entry(
2927 		__field(dev_t, dev)
2928 		__field(xfs_ino_t, ino)
2929 		__field(xfs_ino_t, src_ino)
2930 	),
2931 	TP_fast_assign(
2932 		__entry->dev = ip->i_mount->m_super->s_dev;
2933 		__entry->ino = ip->i_ino;
2934 		__entry->src_ino = arg_ip->i_ino;
2935 	),
2936 	TP_printk("dev %d:%d ino 0x%llx src 0x%llx",
2937 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2938 		  __entry->ino,
2939 		  __entry->src_ino)
2940 )
2941 #define DEFINE_XREP_XATTR_EVENT(name) \
2942 DEFINE_EVENT(xrep_xattr_class, name, \
2943 	TP_PROTO(struct xfs_inode *ip, struct xfs_inode *arg_ip), \
2944 	TP_ARGS(ip, arg_ip))
2945 DEFINE_XREP_XATTR_EVENT(xrep_xattr_rebuild_tree);
2946 DEFINE_XREP_XATTR_EVENT(xrep_xattr_reset_fork);
2947 DEFINE_XREP_XATTR_EVENT(xrep_xattr_full_reset);
2948 
2949 DECLARE_EVENT_CLASS(xrep_xattr_pptr_scan_class,
2950 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp,
2951 		 const struct xfs_name *name),
2952 	TP_ARGS(ip, dp, name),
2953 	TP_STRUCT__entry(
2954 		__field(dev_t, dev)
2955 		__field(xfs_ino_t, ino)
2956 		__field(xfs_ino_t, parent_ino)
2957 		__field(unsigned int, parent_gen)
2958 		__field(unsigned int, namelen)
2959 		__dynamic_array(char, name, name->len)
2960 	),
2961 	TP_fast_assign(
2962 		__entry->dev = ip->i_mount->m_super->s_dev;
2963 		__entry->ino = ip->i_ino;
2964 		__entry->parent_ino = dp->i_ino;
2965 		__entry->parent_gen = VFS_IC(dp)->i_generation;
2966 		__entry->namelen = name->len;
2967 		memcpy(__get_str(name), name->name, name->len);
2968 	),
2969 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
2970 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2971 		  __entry->ino,
2972 		  __entry->parent_ino,
2973 		  __entry->parent_gen,
2974 		  __entry->namelen,
2975 		  __get_str(name))
2976 )
2977 #define DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(name) \
2978 DEFINE_EVENT(xrep_xattr_pptr_scan_class, name, \
2979 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp, \
2980 		 const struct xfs_name *name), \
2981 	TP_ARGS(ip, dp, name))
2982 DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(xrep_xattr_stash_parentadd);
2983 DEFINE_XREP_XATTR_PPTR_SCAN_EVENT(xrep_xattr_stash_parentremove);
2984 
2985 TRACE_EVENT(xrep_dir_recover_dirblock,
2986 	TP_PROTO(struct xfs_inode *dp, xfs_dablk_t dabno, uint32_t magic,
2987 		 uint32_t magic_guess),
2988 	TP_ARGS(dp, dabno, magic, magic_guess),
2989 	TP_STRUCT__entry(
2990 		__field(dev_t, dev)
2991 		__field(xfs_ino_t, dir_ino)
2992 		__field(xfs_dablk_t, dabno)
2993 		__field(uint32_t, magic)
2994 		__field(uint32_t, magic_guess)
2995 	),
2996 	TP_fast_assign(
2997 		__entry->dev = dp->i_mount->m_super->s_dev;
2998 		__entry->dir_ino = dp->i_ino;
2999 		__entry->dabno = dabno;
3000 		__entry->magic = magic;
3001 		__entry->magic_guess = magic_guess;
3002 	),
3003 	TP_printk("dev %d:%d dir 0x%llx dablk 0x%x magic 0x%x magic_guess 0x%x",
3004 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3005 		  __entry->dir_ino,
3006 		  __entry->dabno,
3007 		  __entry->magic,
3008 		  __entry->magic_guess)
3009 );
3010 
3011 DECLARE_EVENT_CLASS(xrep_dir_class,
3012 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t parent_ino),
3013 	TP_ARGS(dp, parent_ino),
3014 	TP_STRUCT__entry(
3015 		__field(dev_t, dev)
3016 		__field(xfs_ino_t, dir_ino)
3017 		__field(xfs_ino_t, parent_ino)
3018 	),
3019 	TP_fast_assign(
3020 		__entry->dev = dp->i_mount->m_super->s_dev;
3021 		__entry->dir_ino = dp->i_ino;
3022 		__entry->parent_ino = parent_ino;
3023 	),
3024 	TP_printk("dev %d:%d dir 0x%llx parent 0x%llx",
3025 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3026 		  __entry->dir_ino,
3027 		  __entry->parent_ino)
3028 )
3029 #define DEFINE_XREP_DIR_EVENT(name) \
3030 DEFINE_EVENT(xrep_dir_class, name, \
3031 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t parent_ino), \
3032 	TP_ARGS(dp, parent_ino))
3033 DEFINE_XREP_DIR_EVENT(xrep_dir_rebuild_tree);
3034 DEFINE_XREP_DIR_EVENT(xrep_dir_reset_fork);
3035 DEFINE_XREP_DIR_EVENT(xrep_parent_reset_dotdot);
3036 
3037 DECLARE_EVENT_CLASS(xrep_dirent_class,
3038 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name,
3039 		 xfs_ino_t ino),
3040 	TP_ARGS(dp, name, ino),
3041 	TP_STRUCT__entry(
3042 		__field(dev_t, dev)
3043 		__field(xfs_ino_t, dir_ino)
3044 		__field(unsigned int, namelen)
3045 		__dynamic_array(char, name, name->len)
3046 		__field(xfs_ino_t, ino)
3047 		__field(uint8_t, ftype)
3048 	),
3049 	TP_fast_assign(
3050 		__entry->dev = dp->i_mount->m_super->s_dev;
3051 		__entry->dir_ino = dp->i_ino;
3052 		__entry->namelen = name->len;
3053 		memcpy(__get_str(name), name->name, name->len);
3054 		__entry->ino = ino;
3055 		__entry->ftype = name->type;
3056 	),
3057 	TP_printk("dev %d:%d dir 0x%llx ftype %s name '%.*s' ino 0x%llx",
3058 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3059 		  __entry->dir_ino,
3060 		  __print_symbolic(__entry->ftype, XFS_DIR3_FTYPE_STR),
3061 		  __entry->namelen,
3062 		  __get_str(name),
3063 		  __entry->ino)
3064 )
3065 #define DEFINE_XREP_DIRENT_EVENT(name) \
3066 DEFINE_EVENT(xrep_dirent_class, name, \
3067 	TP_PROTO(struct xfs_inode *dp, const struct xfs_name *name, \
3068 		 xfs_ino_t ino), \
3069 	TP_ARGS(dp, name, ino))
3070 DEFINE_XREP_DIRENT_EVENT(xrep_dir_salvage_entry);
3071 DEFINE_XREP_DIRENT_EVENT(xrep_dir_stash_createname);
3072 DEFINE_XREP_DIRENT_EVENT(xrep_dir_replay_createname);
3073 DEFINE_XREP_DIRENT_EVENT(xrep_adoption_reparent);
3074 DEFINE_XREP_DIRENT_EVENT(xrep_dir_stash_removename);
3075 DEFINE_XREP_DIRENT_EVENT(xrep_dir_replay_removename);
3076 
3077 DECLARE_EVENT_CLASS(xrep_adoption_class,
3078 	TP_PROTO(struct xfs_inode *dp, struct xfs_inode *ip, bool moved),
3079 	TP_ARGS(dp, ip, moved),
3080 	TP_STRUCT__entry(
3081 		__field(dev_t, dev)
3082 		__field(xfs_ino_t, dir_ino)
3083 		__field(xfs_ino_t, child_ino)
3084 		__field(bool, moved)
3085 	),
3086 	TP_fast_assign(
3087 		__entry->dev = dp->i_mount->m_super->s_dev;
3088 		__entry->dir_ino = dp->i_ino;
3089 		__entry->child_ino = ip->i_ino;
3090 		__entry->moved = moved;
3091 	),
3092 	TP_printk("dev %d:%d dir 0x%llx child 0x%llx moved? %d",
3093 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3094 		  __entry->dir_ino,
3095 		  __entry->child_ino,
3096 		  __entry->moved)
3097 );
3098 #define DEFINE_XREP_ADOPTION_EVENT(name) \
3099 DEFINE_EVENT(xrep_adoption_class, name, \
3100 	TP_PROTO(struct xfs_inode *dp, struct xfs_inode *ip, bool moved), \
3101 	TP_ARGS(dp, ip, moved))
3102 DEFINE_XREP_ADOPTION_EVENT(xrep_adoption_trans_roll);
3103 
3104 DECLARE_EVENT_CLASS(xrep_parent_salvage_class,
3105 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t ino),
3106 	TP_ARGS(dp, ino),
3107 	TP_STRUCT__entry(
3108 		__field(dev_t, dev)
3109 		__field(xfs_ino_t, dir_ino)
3110 		__field(xfs_ino_t, ino)
3111 	),
3112 	TP_fast_assign(
3113 		__entry->dev = dp->i_mount->m_super->s_dev;
3114 		__entry->dir_ino = dp->i_ino;
3115 		__entry->ino = ino;
3116 	),
3117 	TP_printk("dev %d:%d dir 0x%llx parent 0x%llx",
3118 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3119 		  __entry->dir_ino,
3120 		  __entry->ino)
3121 )
3122 #define DEFINE_XREP_PARENT_SALVAGE_EVENT(name) \
3123 DEFINE_EVENT(xrep_parent_salvage_class, name, \
3124 	TP_PROTO(struct xfs_inode *dp, xfs_ino_t ino), \
3125 	TP_ARGS(dp, ino))
3126 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_dir_salvaged_parent);
3127 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_findparent_dirent);
3128 DEFINE_XREP_PARENT_SALVAGE_EVENT(xrep_findparent_from_dcache);
3129 
3130 DECLARE_EVENT_CLASS(xrep_pptr_class,
3131 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name,
3132 		 const struct xfs_parent_rec *pptr),
3133 	TP_ARGS(ip, name, pptr),
3134 	TP_STRUCT__entry(
3135 		__field(dev_t, dev)
3136 		__field(xfs_ino_t, ino)
3137 		__field(xfs_ino_t, parent_ino)
3138 		__field(unsigned int, parent_gen)
3139 		__field(unsigned int, namelen)
3140 		__dynamic_array(char, name, name->len)
3141 	),
3142 	TP_fast_assign(
3143 		__entry->dev = ip->i_mount->m_super->s_dev;
3144 		__entry->ino = ip->i_ino;
3145 		__entry->parent_ino = be64_to_cpu(pptr->p_ino);
3146 		__entry->parent_gen = be32_to_cpu(pptr->p_gen);
3147 		__entry->namelen = name->len;
3148 		memcpy(__get_str(name), name->name, name->len);
3149 	),
3150 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
3151 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3152 		  __entry->ino,
3153 		  __entry->parent_ino,
3154 		  __entry->parent_gen,
3155 		  __entry->namelen,
3156 		  __get_str(name))
3157 )
3158 #define DEFINE_XREP_PPTR_EVENT(name) \
3159 DEFINE_EVENT(xrep_pptr_class, name, \
3160 	TP_PROTO(struct xfs_inode *ip, const struct xfs_name *name, \
3161 		 const struct xfs_parent_rec *pptr), \
3162 	TP_ARGS(ip, name, pptr))
3163 DEFINE_XREP_PPTR_EVENT(xrep_xattr_replay_parentadd);
3164 DEFINE_XREP_PPTR_EVENT(xrep_xattr_replay_parentremove);
3165 DEFINE_XREP_PPTR_EVENT(xrep_parent_replay_parentadd);
3166 DEFINE_XREP_PPTR_EVENT(xrep_parent_replay_parentremove);
3167 
3168 DECLARE_EVENT_CLASS(xrep_pptr_scan_class,
3169 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp,
3170 		 const struct xfs_name *name),
3171 	TP_ARGS(ip, dp, name),
3172 	TP_STRUCT__entry(
3173 		__field(dev_t, dev)
3174 		__field(xfs_ino_t, ino)
3175 		__field(xfs_ino_t, parent_ino)
3176 		__field(unsigned int, parent_gen)
3177 		__field(unsigned int, namelen)
3178 		__dynamic_array(char, name, name->len)
3179 	),
3180 	TP_fast_assign(
3181 		__entry->dev = ip->i_mount->m_super->s_dev;
3182 		__entry->ino = ip->i_ino;
3183 		__entry->parent_ino = dp->i_ino;
3184 		__entry->parent_gen = VFS_IC(dp)->i_generation;
3185 		__entry->namelen = name->len;
3186 		memcpy(__get_str(name), name->name, name->len);
3187 	),
3188 	TP_printk("dev %d:%d ino 0x%llx parent_ino 0x%llx parent_gen 0x%x name '%.*s'",
3189 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3190 		  __entry->ino,
3191 		  __entry->parent_ino,
3192 		  __entry->parent_gen,
3193 		  __entry->namelen,
3194 		  __get_str(name))
3195 )
3196 #define DEFINE_XREP_PPTR_SCAN_EVENT(name) \
3197 DEFINE_EVENT(xrep_pptr_scan_class, name, \
3198 	TP_PROTO(struct xfs_inode *ip, const struct xfs_inode *dp, \
3199 		 const struct xfs_name *name), \
3200 	TP_ARGS(ip, dp, name))
3201 DEFINE_XREP_PPTR_SCAN_EVENT(xrep_parent_stash_parentadd);
3202 DEFINE_XREP_PPTR_SCAN_EVENT(xrep_parent_stash_parentremove);
3203 
3204 TRACE_EVENT(xrep_nlinks_set_record,
3205 	TP_PROTO(struct xfs_mount *mp, xfs_ino_t ino,
3206 		 const struct xchk_nlink *obs),
3207 	TP_ARGS(mp, ino, obs),
3208 	TP_STRUCT__entry(
3209 		__field(dev_t, dev)
3210 		__field(xfs_ino_t, ino)
3211 		__field(xfs_nlink_t, parents)
3212 		__field(xfs_nlink_t, backrefs)
3213 		__field(xfs_nlink_t, children)
3214 	),
3215 	TP_fast_assign(
3216 		__entry->dev = mp->m_super->s_dev;
3217 		__entry->ino = ino;
3218 		__entry->parents = obs->parents;
3219 		__entry->backrefs = obs->backrefs;
3220 		__entry->children = obs->children;
3221 	),
3222 	TP_printk("dev %d:%d ino 0x%llx parents %u backrefs %u children %u",
3223 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3224 		  __entry->ino,
3225 		  __entry->parents,
3226 		  __entry->backrefs,
3227 		  __entry->children)
3228 );
3229 
3230 DECLARE_EVENT_CLASS(xrep_dentry_class,
3231 	TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry),
3232 	TP_ARGS(mp, dentry),
3233 	TP_STRUCT__entry(
3234 		__field(dev_t, dev)
3235 		__field(unsigned int, flags)
3236 		__field(unsigned long, ino)
3237 		__field(bool, positive)
3238 		__field(unsigned long, parent_ino)
3239 		__field(unsigned int, namelen)
3240 		__dynamic_array(char, name, dentry->d_name.len)
3241 	),
3242 	TP_fast_assign(
3243 		__entry->dev = mp->m_super->s_dev;
3244 		__entry->flags = dentry->d_flags;
3245 		__entry->positive = d_is_positive(dentry);
3246 		if (dentry->d_parent && d_inode(dentry->d_parent))
3247 			__entry->parent_ino = d_inode(dentry->d_parent)->i_ino;
3248 		else
3249 			__entry->parent_ino = -1UL;
3250 		__entry->ino = d_inode(dentry) ? d_inode(dentry)->i_ino : 0;
3251 		__entry->namelen = dentry->d_name.len;
3252 		memcpy(__get_str(name), dentry->d_name.name, dentry->d_name.len);
3253 	),
3254 	TP_printk("dev %d:%d flags 0x%x positive? %d parent_ino 0x%lx ino 0x%lx name '%.*s'",
3255 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3256 		  __entry->flags,
3257 		  __entry->positive,
3258 		  __entry->parent_ino,
3259 		  __entry->ino,
3260 		  __entry->namelen,
3261 		  __get_str(name))
3262 );
3263 #define DEFINE_REPAIR_DENTRY_EVENT(name) \
3264 DEFINE_EVENT(xrep_dentry_class, name, \
3265 	TP_PROTO(struct xfs_mount *mp, const struct dentry *dentry), \
3266 	TP_ARGS(mp, dentry))
3267 DEFINE_REPAIR_DENTRY_EVENT(xrep_adoption_check_child);
3268 DEFINE_REPAIR_DENTRY_EVENT(xrep_adoption_invalidate_child);
3269 DEFINE_REPAIR_DENTRY_EVENT(xrep_dirtree_delete_child);
3270 
3271 TRACE_EVENT(xrep_symlink_salvage_target,
3272 	TP_PROTO(struct xfs_inode *ip, char *target, unsigned int targetlen),
3273 	TP_ARGS(ip, target, targetlen),
3274 	TP_STRUCT__entry(
3275 		__field(dev_t, dev)
3276 		__field(xfs_ino_t, ino)
3277 		__field(unsigned int, targetlen)
3278 		__dynamic_array(char, target, targetlen + 1)
3279 	),
3280 	TP_fast_assign(
3281 		__entry->dev = ip->i_mount->m_super->s_dev;
3282 		__entry->ino = ip->i_ino;
3283 		__entry->targetlen = targetlen;
3284 		memcpy(__get_str(target), target, targetlen);
3285 		__get_str(target)[targetlen] = 0;
3286 	),
3287 	TP_printk("dev %d:%d ip 0x%llx target '%.*s'",
3288 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3289 		  __entry->ino,
3290 		  __entry->targetlen,
3291 		  __get_str(target))
3292 );
3293 
3294 DECLARE_EVENT_CLASS(xrep_symlink_class,
3295 	TP_PROTO(struct xfs_inode *ip),
3296 	TP_ARGS(ip),
3297 	TP_STRUCT__entry(
3298 		__field(dev_t, dev)
3299 		__field(xfs_ino_t, ino)
3300 	),
3301 	TP_fast_assign(
3302 		__entry->dev = ip->i_mount->m_super->s_dev;
3303 		__entry->ino = ip->i_ino;
3304 	),
3305 	TP_printk("dev %d:%d ip 0x%llx",
3306 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3307 		  __entry->ino)
3308 );
3309 
3310 #define DEFINE_XREP_SYMLINK_EVENT(name) \
3311 DEFINE_EVENT(xrep_symlink_class, name, \
3312 	TP_PROTO(struct xfs_inode *ip), \
3313 	TP_ARGS(ip))
3314 DEFINE_XREP_SYMLINK_EVENT(xrep_symlink_rebuild);
3315 DEFINE_XREP_SYMLINK_EVENT(xrep_symlink_reset_fork);
3316 
3317 TRACE_EVENT(xrep_iunlink_visit,
3318 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3319 		 xfs_agino_t bucket_agino, struct xfs_inode *ip),
3320 	TP_ARGS(pag, bucket, bucket_agino, ip),
3321 	TP_STRUCT__entry(
3322 		__field(dev_t, dev)
3323 		__field(xfs_agnumber_t, agno)
3324 		__field(xfs_agino_t, agino)
3325 		__field(unsigned int, bucket)
3326 		__field(xfs_agino_t, bucket_agino)
3327 		__field(xfs_agino_t, prev_agino)
3328 		__field(xfs_agino_t, next_agino)
3329 	),
3330 	TP_fast_assign(
3331 		__entry->dev = pag->pag_mount->m_super->s_dev;
3332 		__entry->agno = pag->pag_agno;
3333 		__entry->agino = XFS_INO_TO_AGINO(pag->pag_mount, ip->i_ino);
3334 		__entry->bucket = bucket;
3335 		__entry->bucket_agino = bucket_agino;
3336 		__entry->prev_agino = ip->i_prev_unlinked;
3337 		__entry->next_agino = ip->i_next_unlinked;
3338 	),
3339 	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",
3340 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3341 		  __entry->agno,
3342 		  __entry->bucket,
3343 		  __entry->agino,
3344 		  __entry->bucket_agino,
3345 		  __entry->prev_agino,
3346 		  __entry->next_agino)
3347 );
3348 
3349 TRACE_EVENT(xrep_iunlink_reload_next,
3350 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t prev_agino),
3351 	TP_ARGS(ip, prev_agino),
3352 	TP_STRUCT__entry(
3353 		__field(dev_t, dev)
3354 		__field(xfs_agnumber_t, agno)
3355 		__field(xfs_agino_t, agino)
3356 		__field(xfs_agino_t, old_prev_agino)
3357 		__field(xfs_agino_t, prev_agino)
3358 		__field(xfs_agino_t, next_agino)
3359 		__field(unsigned int, nlink)
3360 	),
3361 	TP_fast_assign(
3362 		__entry->dev = ip->i_mount->m_super->s_dev;
3363 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3364 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3365 		__entry->old_prev_agino = ip->i_prev_unlinked;
3366 		__entry->prev_agino = prev_agino;
3367 		__entry->next_agino = ip->i_next_unlinked;
3368 		__entry->nlink = VFS_I(ip)->i_nlink;
3369 	),
3370 	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",
3371 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3372 		  __entry->agno,
3373 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3374 		  __entry->agino,
3375 		  __entry->nlink,
3376 		  __entry->old_prev_agino,
3377 		  __entry->prev_agino,
3378 		  __entry->next_agino)
3379 );
3380 
3381 TRACE_EVENT(xrep_iunlink_reload_ondisk,
3382 	TP_PROTO(struct xfs_inode *ip),
3383 	TP_ARGS(ip),
3384 	TP_STRUCT__entry(
3385 		__field(dev_t, dev)
3386 		__field(xfs_agnumber_t, agno)
3387 		__field(xfs_agino_t, agino)
3388 		__field(unsigned int, nlink)
3389 		__field(xfs_agino_t, next_agino)
3390 	),
3391 	TP_fast_assign(
3392 		__entry->dev = ip->i_mount->m_super->s_dev;
3393 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3394 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3395 		__entry->nlink = VFS_I(ip)->i_nlink;
3396 		__entry->next_agino = ip->i_next_unlinked;
3397 	),
3398 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x nlink %u next_agino 0x%x",
3399 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3400 		  __entry->agno,
3401 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3402 		  __entry->agino,
3403 		  __entry->nlink,
3404 		  __entry->next_agino)
3405 );
3406 
3407 TRACE_EVENT(xrep_iunlink_walk_ondisk_bucket,
3408 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3409 		 xfs_agino_t prev_agino, xfs_agino_t next_agino),
3410 	TP_ARGS(pag, bucket, prev_agino, next_agino),
3411 	TP_STRUCT__entry(
3412 		__field(dev_t, dev)
3413 		__field(xfs_agnumber_t, agno)
3414 		__field(unsigned int, bucket)
3415 		__field(xfs_agino_t, prev_agino)
3416 		__field(xfs_agino_t, next_agino)
3417 	),
3418 	TP_fast_assign(
3419 		__entry->dev = pag->pag_mount->m_super->s_dev;
3420 		__entry->agno = pag->pag_agno;
3421 		__entry->bucket = bucket;
3422 		__entry->prev_agino = prev_agino;
3423 		__entry->next_agino = next_agino;
3424 	),
3425 	TP_printk("dev %d:%d agno 0x%x bucket %u prev_agino 0x%x next_agino 0x%x",
3426 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3427 		  __entry->agno,
3428 		  __entry->bucket,
3429 		  __entry->prev_agino,
3430 		  __entry->next_agino)
3431 );
3432 
3433 DECLARE_EVENT_CLASS(xrep_iunlink_resolve_class,
3434 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3435 		 xfs_agino_t prev_agino, xfs_agino_t next_agino),
3436 	TP_ARGS(pag, bucket, prev_agino, next_agino),
3437 	TP_STRUCT__entry(
3438 		__field(dev_t, dev)
3439 		__field(xfs_agnumber_t, agno)
3440 		__field(unsigned int, bucket)
3441 		__field(xfs_agino_t, prev_agino)
3442 		__field(xfs_agino_t, next_agino)
3443 	),
3444 	TP_fast_assign(
3445 		__entry->dev = pag->pag_mount->m_super->s_dev;
3446 		__entry->agno = pag->pag_agno;
3447 		__entry->bucket = bucket;
3448 		__entry->prev_agino = prev_agino;
3449 		__entry->next_agino = next_agino;
3450 	),
3451 	TP_printk("dev %d:%d agno 0x%x bucket %u prev_agino 0x%x next_agino 0x%x",
3452 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3453 		  __entry->agno,
3454 		  __entry->bucket,
3455 		  __entry->prev_agino,
3456 		  __entry->next_agino)
3457 );
3458 #define DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(name) \
3459 DEFINE_EVENT(xrep_iunlink_resolve_class, name, \
3460 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket, \
3461 		 xfs_agino_t prev_agino, xfs_agino_t next_agino), \
3462 	TP_ARGS(pag, bucket, prev_agino, next_agino))
3463 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_uncached);
3464 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_wronglist);
3465 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_nolist);
3466 DEFINE_REPAIR_IUNLINK_RESOLVE_EVENT(xrep_iunlink_resolve_ok);
3467 
3468 TRACE_EVENT(xrep_iunlink_relink_next,
3469 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t next_agino),
3470 	TP_ARGS(ip, next_agino),
3471 	TP_STRUCT__entry(
3472 		__field(dev_t, dev)
3473 		__field(xfs_agnumber_t, agno)
3474 		__field(xfs_agino_t, agino)
3475 		__field(xfs_agino_t, next_agino)
3476 		__field(xfs_agino_t, new_next_agino)
3477 	),
3478 	TP_fast_assign(
3479 		__entry->dev = ip->i_mount->m_super->s_dev;
3480 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3481 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3482 		__entry->next_agino = ip->i_next_unlinked;
3483 		__entry->new_next_agino = next_agino;
3484 	),
3485 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x next_agino 0x%x -> 0x%x",
3486 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3487 		  __entry->agno,
3488 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3489 		  __entry->agino,
3490 		  __entry->next_agino,
3491 		  __entry->new_next_agino)
3492 );
3493 
3494 TRACE_EVENT(xrep_iunlink_relink_prev,
3495 	TP_PROTO(struct xfs_inode *ip, xfs_agino_t prev_agino),
3496 	TP_ARGS(ip, prev_agino),
3497 	TP_STRUCT__entry(
3498 		__field(dev_t, dev)
3499 		__field(xfs_agnumber_t, agno)
3500 		__field(xfs_agino_t, agino)
3501 		__field(xfs_agino_t, prev_agino)
3502 		__field(xfs_agino_t, new_prev_agino)
3503 	),
3504 	TP_fast_assign(
3505 		__entry->dev = ip->i_mount->m_super->s_dev;
3506 		__entry->agno = XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino);
3507 		__entry->agino = XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino);
3508 		__entry->prev_agino = ip->i_prev_unlinked;
3509 		__entry->new_prev_agino = prev_agino;
3510 	),
3511 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x prev_agino 0x%x -> 0x%x",
3512 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3513 		  __entry->agno,
3514 		  __entry->agino % XFS_AGI_UNLINKED_BUCKETS,
3515 		  __entry->agino,
3516 		  __entry->prev_agino,
3517 		  __entry->new_prev_agino)
3518 );
3519 
3520 TRACE_EVENT(xrep_iunlink_add_to_bucket,
3521 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3522 		 xfs_agino_t agino, xfs_agino_t curr_head),
3523 	TP_ARGS(pag, bucket, agino, curr_head),
3524 	TP_STRUCT__entry(
3525 		__field(dev_t, dev)
3526 		__field(xfs_agnumber_t, agno)
3527 		__field(unsigned int, bucket)
3528 		__field(xfs_agino_t, agino)
3529 		__field(xfs_agino_t, next_agino)
3530 	),
3531 	TP_fast_assign(
3532 		__entry->dev = pag->pag_mount->m_super->s_dev;
3533 		__entry->agno = pag->pag_agno;
3534 		__entry->bucket = bucket;
3535 		__entry->agino = agino;
3536 		__entry->next_agino = curr_head;
3537 	),
3538 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x next_agino 0x%x",
3539 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3540 		  __entry->agno,
3541 		  __entry->bucket,
3542 		  __entry->agino,
3543 		  __entry->next_agino)
3544 );
3545 
3546 TRACE_EVENT(xrep_iunlink_commit_bucket,
3547 	TP_PROTO(struct xfs_perag *pag, unsigned int bucket,
3548 		 xfs_agino_t old_agino, xfs_agino_t agino),
3549 	TP_ARGS(pag, bucket, old_agino, agino),
3550 	TP_STRUCT__entry(
3551 		__field(dev_t, dev)
3552 		__field(xfs_agnumber_t, agno)
3553 		__field(unsigned int, bucket)
3554 		__field(xfs_agino_t, old_agino)
3555 		__field(xfs_agino_t, agino)
3556 	),
3557 	TP_fast_assign(
3558 		__entry->dev = pag->pag_mount->m_super->s_dev;
3559 		__entry->agno = pag->pag_agno;
3560 		__entry->bucket = bucket;
3561 		__entry->old_agino = old_agino;
3562 		__entry->agino = agino;
3563 	),
3564 	TP_printk("dev %d:%d agno 0x%x bucket %u agino 0x%x -> 0x%x",
3565 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3566 		  __entry->agno,
3567 		  __entry->bucket,
3568 		  __entry->old_agino,
3569 		  __entry->agino)
3570 );
3571 
3572 DEFINE_XCHK_DIRPATH_OUTCOME_EVENT(xrep_dirpath_set_outcome);
3573 DEFINE_XCHK_DIRTREE_EVENT(xrep_dirtree_delete_path);
3574 DEFINE_XCHK_DIRTREE_EVENT(xrep_dirtree_create_adoption);
3575 DEFINE_XCHK_DIRTREE_EVALUATE_EVENT(xrep_dirtree_decided_fate);
3576 
3577 #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */
3578 
3579 #endif /* _TRACE_XFS_SCRUB_TRACE_H */
3580 
3581 #undef TRACE_INCLUDE_PATH
3582 #define TRACE_INCLUDE_PATH .
3583 #define TRACE_INCLUDE_FILE scrub/trace
3584 #include <trace/define_trace.h>
3585