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