xref: /openbmc/linux/fs/xfs/scrub/trace.h (revision 55e43d6abd078ed6d219902ce8cb4d68e3c993ba)
1739a2fe0SDarrick J. Wong // SPDX-License-Identifier: GPL-2.0-or-later
236fd6e86SDarrick J. Wong /*
3ecc73f8aSDarrick J. Wong  * Copyright (C) 2017-2023 Oracle.  All Rights Reserved.
4739a2fe0SDarrick J. Wong  * Author: Darrick J. Wong <djwong@kernel.org>
5e5f2e54aSDarrick J. Wong  *
6e5f2e54aSDarrick J. Wong  * NOTE: none of these tracepoints shall be considered a stable kernel ABI
7e5f2e54aSDarrick J. Wong  * as they can change at any time.  See xfs_trace.h for documentation of
8e5f2e54aSDarrick J. Wong  * specific units found in tracepoint output.
936fd6e86SDarrick J. Wong  */
1036fd6e86SDarrick J. Wong #undef TRACE_SYSTEM
1136fd6e86SDarrick J. Wong #define TRACE_SYSTEM xfs_scrub
1236fd6e86SDarrick J. Wong 
1336fd6e86SDarrick J. Wong #if !defined(_TRACE_XFS_SCRUB_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
1436fd6e86SDarrick J. Wong #define _TRACE_XFS_SCRUB_TRACE_H
1536fd6e86SDarrick J. Wong 
1636fd6e86SDarrick J. Wong #include <linux/tracepoint.h>
174700d229SDarrick J. Wong #include "xfs_bit.h"
1836fd6e86SDarrick J. Wong 
193934e8ebSDarrick J. Wong struct xfile;
203934e8ebSDarrick J. Wong struct xfarray;
21232ea052SDarrick J. Wong struct xfarray_sortinfo;
223934e8ebSDarrick J. Wong 
23c494213fSDarrick J. Wong /*
24c494213fSDarrick J. Wong  * ftrace's __print_symbolic requires that all enum values be wrapped in the
25c494213fSDarrick J. Wong  * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace
26c494213fSDarrick J. Wong  * ring buffer.  Somehow this was only worth mentioning in the ftrace sample
27c494213fSDarrick J. Wong  * code.
28c494213fSDarrick J. Wong  */
29c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi);
30c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi);
31c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi);
32c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_INOi);
33c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi);
34c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi);
35c494213fSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi);
36c494213fSDarrick J. Wong 
3790148903SDarrick J. Wong TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED);
3890148903SDarrick J. Wong TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW);
3990148903SDarrick J. Wong 
4086d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PROBE);
4186d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SB);
4286d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGF);
4386d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGFL);
4486d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGI);
4586d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BNOBT);
4686d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_CNTBT);
4786d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INOBT);
4886d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FINOBT);
4986d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RMAPBT);
5086d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_REFCNTBT);
5186d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INODE);
5286d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTD);
5386d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTA);
5486d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTC);
5586d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_DIR);
5686d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_XATTR);
5786d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SYMLINK);
5886d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PARENT);
5986d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTBITMAP);
6086d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTSUM);
6186d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_UQUOTA);
6286d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_GQUOTA);
6386d163dbSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PQUOTA);
6475efa57dSDarrick J. Wong TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS);
6586d163dbSDarrick J. Wong 
6686d163dbSDarrick J. Wong #define XFS_SCRUB_TYPE_STRINGS \
6786d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_PROBE,		"probe" }, \
6886d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_SB,		"sb" }, \
6986d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_AGF,		"agf" }, \
7086d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_AGFL,		"agfl" }, \
7186d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_AGI,		"agi" }, \
7286d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_BNOBT,		"bnobt" }, \
7386d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_CNTBT,		"cntbt" }, \
7486d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_INOBT,		"inobt" }, \
7586d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_FINOBT,	"finobt" }, \
7686d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_RMAPBT,	"rmapbt" }, \
7786d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_REFCNTBT,	"refcountbt" }, \
7886d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_INODE,		"inode" }, \
7986d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_BMBTD,		"bmapbtd" }, \
8086d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_BMBTA,		"bmapbta" }, \
8186d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_BMBTC,		"bmapbtc" }, \
8286d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_DIR,		"directory" }, \
8386d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_XATTR,		"xattr" }, \
8486d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_SYMLINK,	"symlink" }, \
8586d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_PARENT,	"parent" }, \
8686d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_RTBITMAP,	"rtbitmap" }, \
8786d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_RTSUM,		"rtsummary" }, \
8886d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_UQUOTA,	"usrquota" }, \
8986d163dbSDarrick J. Wong 	{ XFS_SCRUB_TYPE_GQUOTA,	"grpquota" }, \
9075efa57dSDarrick J. Wong 	{ XFS_SCRUB_TYPE_PQUOTA,	"prjquota" }, \
9175efa57dSDarrick J. Wong 	{ XFS_SCRUB_TYPE_FSCOUNTERS,	"fscounters" }
9286d163dbSDarrick J. Wong 
93c03e4b9eSDarrick J. Wong #define XFS_SCRUB_FLAG_STRINGS \
94c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_IFLAG_REPAIR,		"repair" }, \
95c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_CORRUPT,		"corrupt" }, \
96c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_PREEN,		"preen" }, \
97c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_XFAIL,		"xfail" }, \
98c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_XCORRUPT,		"xcorrupt" }, \
99c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_INCOMPLETE,		"incomplete" }, \
100c03e4b9eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_WARNING,		"warning" }, \
1015c83df2eSDarrick J. Wong 	{ XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED,	"norepair" }, \
1025c83df2eSDarrick J. Wong 	{ XFS_SCRUB_IFLAG_FORCE_REBUILD,	"rebuild" }
103c03e4b9eSDarrick J. Wong 
104466c525dSDarrick J. Wong #define XFS_SCRUB_STATE_STRINGS \
105466c525dSDarrick J. Wong 	{ XCHK_TRY_HARDER,			"try_harder" }, \
106ce85a1e0SDarrick J. Wong 	{ XCHK_HAVE_FREEZE_PROT,		"nofreeze" }, \
107466c525dSDarrick J. Wong 	{ XCHK_FSGATES_DRAIN,			"fsgates_drain" }, \
10888accf17SDarrick J. Wong 	{ XCHK_NEED_DRAIN,			"need_drain" }, \
109466c525dSDarrick J. Wong 	{ XREP_ALREADY_FIXED,			"already_fixed" }
110466c525dSDarrick J. Wong 
111c517b3aaSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_class,
112a5637186SDarrick J. Wong 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm,
113a5637186SDarrick J. Wong 		 int error),
114a5637186SDarrick J. Wong 	TP_ARGS(ip, sm, error),
115a5637186SDarrick J. Wong 	TP_STRUCT__entry(
116a5637186SDarrick J. Wong 		__field(dev_t, dev)
117a5637186SDarrick J. Wong 		__field(xfs_ino_t, ino)
118a5637186SDarrick J. Wong 		__field(unsigned int, type)
119a5637186SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
120a5637186SDarrick J. Wong 		__field(xfs_ino_t, inum)
121a5637186SDarrick J. Wong 		__field(unsigned int, gen)
122a5637186SDarrick J. Wong 		__field(unsigned int, flags)
123a5637186SDarrick J. Wong 		__field(int, error)
124a5637186SDarrick J. Wong 	),
125a5637186SDarrick J. Wong 	TP_fast_assign(
126a5637186SDarrick J. Wong 		__entry->dev = ip->i_mount->m_super->s_dev;
127a5637186SDarrick J. Wong 		__entry->ino = ip->i_ino;
128a5637186SDarrick J. Wong 		__entry->type = sm->sm_type;
129a5637186SDarrick J. Wong 		__entry->agno = sm->sm_agno;
130a5637186SDarrick J. Wong 		__entry->inum = sm->sm_ino;
131a5637186SDarrick J. Wong 		__entry->gen = sm->sm_gen;
132a5637186SDarrick J. Wong 		__entry->flags = sm->sm_flags;
133a5637186SDarrick J. Wong 		__entry->error = error;
134a5637186SDarrick J. Wong 	),
135c03e4b9eSDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d",
136a5637186SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
137a5637186SDarrick J. Wong 		  __entry->ino,
13886d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
139a5637186SDarrick J. Wong 		  __entry->agno,
140a5637186SDarrick J. Wong 		  __entry->inum,
141a5637186SDarrick J. Wong 		  __entry->gen,
142c03e4b9eSDarrick J. Wong 		  __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS),
143a5637186SDarrick J. Wong 		  __entry->error)
144a5637186SDarrick J. Wong )
145a5637186SDarrick J. Wong #define DEFINE_SCRUB_EVENT(name) \
146c517b3aaSDarrick J. Wong DEFINE_EVENT(xchk_class, name, \
147a5637186SDarrick J. Wong 	TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \
148a5637186SDarrick J. Wong 		 int error), \
149a5637186SDarrick J. Wong 	TP_ARGS(ip, sm, error))
150a5637186SDarrick J. Wong 
151c517b3aaSDarrick J. Wong DEFINE_SCRUB_EVENT(xchk_start);
152c517b3aaSDarrick J. Wong DEFINE_SCRUB_EVENT(xchk_done);
153c517b3aaSDarrick J. Wong DEFINE_SCRUB_EVENT(xchk_deadlock_retry);
154b5e2196eSDarrick J. Wong DEFINE_SCRUB_EVENT(xrep_attempt);
155b5e2196eSDarrick J. Wong DEFINE_SCRUB_EVENT(xrep_done);
1564700d229SDarrick J. Wong 
157466c525dSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_fsgate_class,
158466c525dSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, unsigned int fsgate_flags),
159466c525dSDarrick J. Wong 	TP_ARGS(sc, fsgate_flags),
160466c525dSDarrick J. Wong 	TP_STRUCT__entry(
161466c525dSDarrick J. Wong 		__field(dev_t, dev)
162466c525dSDarrick J. Wong 		__field(unsigned int, type)
163466c525dSDarrick J. Wong 		__field(unsigned int, fsgate_flags)
164466c525dSDarrick J. Wong 	),
165466c525dSDarrick J. Wong 	TP_fast_assign(
166466c525dSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
167466c525dSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
168466c525dSDarrick J. Wong 		__entry->fsgate_flags = fsgate_flags;
169466c525dSDarrick J. Wong 	),
170466c525dSDarrick J. Wong 	TP_printk("dev %d:%d type %s fsgates '%s'",
171466c525dSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
172466c525dSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
173466c525dSDarrick J. Wong 		  __print_flags(__entry->fsgate_flags, "|", XFS_SCRUB_STATE_STRINGS))
174466c525dSDarrick J. Wong )
175466c525dSDarrick J. Wong 
176466c525dSDarrick J. Wong #define DEFINE_SCRUB_FSHOOK_EVENT(name) \
177466c525dSDarrick J. Wong DEFINE_EVENT(xchk_fsgate_class, name, \
178466c525dSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, unsigned int fsgates_flags), \
179466c525dSDarrick J. Wong 	TP_ARGS(sc, fsgates_flags))
180466c525dSDarrick J. Wong 
181466c525dSDarrick J. Wong DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_enable);
182466c525dSDarrick J. Wong DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_disable);
183466c525dSDarrick J. Wong 
184c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_op_error,
1851d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, xfs_agnumber_t agno,
1864700d229SDarrick J. Wong 		 xfs_agblock_t bno, int error, void *ret_ip),
1874700d229SDarrick J. Wong 	TP_ARGS(sc, agno, bno, error, ret_ip),
1884700d229SDarrick J. Wong 	TP_STRUCT__entry(
1894700d229SDarrick J. Wong 		__field(dev_t, dev)
1904700d229SDarrick J. Wong 		__field(unsigned int, type)
1914700d229SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1924700d229SDarrick J. Wong 		__field(xfs_agblock_t, bno)
1934700d229SDarrick J. Wong 		__field(int, error)
1944700d229SDarrick J. Wong 		__field(void *, ret_ip)
1954700d229SDarrick J. Wong 	),
1964700d229SDarrick J. Wong 	TP_fast_assign(
1974700d229SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
1984700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
1994700d229SDarrick J. Wong 		__entry->agno = agno;
2004700d229SDarrick J. Wong 		__entry->bno = bno;
2014700d229SDarrick J. Wong 		__entry->error = error;
2024700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
2034700d229SDarrick J. Wong 	),
204f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x error %d ret_ip %pS",
2054700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
20686d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2074700d229SDarrick J. Wong 		  __entry->agno,
2084700d229SDarrick J. Wong 		  __entry->bno,
2094700d229SDarrick J. Wong 		  __entry->error,
2104700d229SDarrick J. Wong 		  __entry->ret_ip)
2114700d229SDarrick J. Wong );
2124700d229SDarrick J. Wong 
213c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_file_op_error,
2141d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
2154700d229SDarrick J. Wong 		 xfs_fileoff_t offset, int error, void *ret_ip),
2164700d229SDarrick J. Wong 	TP_ARGS(sc, whichfork, offset, error, ret_ip),
2174700d229SDarrick J. Wong 	TP_STRUCT__entry(
2184700d229SDarrick J. Wong 		__field(dev_t, dev)
2194700d229SDarrick J. Wong 		__field(xfs_ino_t, ino)
2204700d229SDarrick J. Wong 		__field(int, whichfork)
2214700d229SDarrick J. Wong 		__field(unsigned int, type)
2224700d229SDarrick J. Wong 		__field(xfs_fileoff_t, offset)
2234700d229SDarrick J. Wong 		__field(int, error)
2244700d229SDarrick J. Wong 		__field(void *, ret_ip)
2254700d229SDarrick J. Wong 	),
2264700d229SDarrick J. Wong 	TP_fast_assign(
2274700d229SDarrick J. Wong 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
2284700d229SDarrick J. Wong 		__entry->ino = sc->ip->i_ino;
2294700d229SDarrick J. Wong 		__entry->whichfork = whichfork;
2304700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
2314700d229SDarrick J. Wong 		__entry->offset = offset;
2324700d229SDarrick J. Wong 		__entry->error = error;
2334700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
2344700d229SDarrick J. Wong 	),
235f93f85f7SDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx error %d ret_ip %pS",
2364700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2374700d229SDarrick J. Wong 		  __entry->ino,
238f93f85f7SDarrick J. Wong 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
23986d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2404700d229SDarrick J. Wong 		  __entry->offset,
2414700d229SDarrick J. Wong 		  __entry->error,
2424700d229SDarrick J. Wong 		  __entry->ret_ip)
2434700d229SDarrick J. Wong );
2444700d229SDarrick J. Wong 
245c517b3aaSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_block_error_class,
2461d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, void *ret_ip),
2474700d229SDarrick J. Wong 	TP_ARGS(sc, daddr, ret_ip),
2484700d229SDarrick J. Wong 	TP_STRUCT__entry(
2494700d229SDarrick J. Wong 		__field(dev_t, dev)
2504700d229SDarrick J. Wong 		__field(unsigned int, type)
2514700d229SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
2523fd7cb84SDarrick J. Wong 		__field(xfs_agblock_t, agbno)
2534700d229SDarrick J. Wong 		__field(void *, ret_ip)
2544700d229SDarrick J. Wong 	),
2554700d229SDarrick J. Wong 	TP_fast_assign(
2564700d229SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
2574700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
2583fd7cb84SDarrick J. Wong 		__entry->agno = xfs_daddr_to_agno(sc->mp, daddr);
2593fd7cb84SDarrick J. Wong 		__entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr);
2604700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
2614700d229SDarrick J. Wong 	),
262f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x ret_ip %pS",
2634700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
26486d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2654700d229SDarrick J. Wong 		  __entry->agno,
2663fd7cb84SDarrick J. Wong 		  __entry->agbno,
2674700d229SDarrick J. Wong 		  __entry->ret_ip)
2684700d229SDarrick J. Wong )
2694700d229SDarrick J. Wong 
2704700d229SDarrick J. Wong #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \
271c517b3aaSDarrick J. Wong DEFINE_EVENT(xchk_block_error_class, name, \
2721d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, \
2734700d229SDarrick J. Wong 		 void *ret_ip), \
2744700d229SDarrick J. Wong 	TP_ARGS(sc, daddr, ret_ip))
2754700d229SDarrick J. Wong 
27675efa57dSDarrick J. Wong DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_fs_error);
277c517b3aaSDarrick J. Wong DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_error);
278c517b3aaSDarrick J. Wong DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_preen);
2794700d229SDarrick J. Wong 
280c517b3aaSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_ino_error_class,
2811d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, void *ret_ip),
2827e56d9eaSDarrick J. Wong 	TP_ARGS(sc, ino, ret_ip),
2834700d229SDarrick J. Wong 	TP_STRUCT__entry(
2844700d229SDarrick J. Wong 		__field(dev_t, dev)
2854700d229SDarrick J. Wong 		__field(xfs_ino_t, ino)
2864700d229SDarrick J. Wong 		__field(unsigned int, type)
2874700d229SDarrick J. Wong 		__field(void *, ret_ip)
2884700d229SDarrick J. Wong 	),
2894700d229SDarrick J. Wong 	TP_fast_assign(
2904700d229SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
2914700d229SDarrick J. Wong 		__entry->ino = ino;
2924700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
2934700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
2944700d229SDarrick J. Wong 	),
29586d163dbSDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx type %s ret_ip %pS",
2964700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
2974700d229SDarrick J. Wong 		  __entry->ino,
29886d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
2994700d229SDarrick J. Wong 		  __entry->ret_ip)
3004700d229SDarrick J. Wong )
3014700d229SDarrick J. Wong 
3024700d229SDarrick J. Wong #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \
303c517b3aaSDarrick J. Wong DEFINE_EVENT(xchk_ino_error_class, name, \
3041d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, \
3057e56d9eaSDarrick J. Wong 		 void *ret_ip), \
3067e56d9eaSDarrick J. Wong 	TP_ARGS(sc, ino, ret_ip))
3074700d229SDarrick J. Wong 
308c517b3aaSDarrick J. Wong DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_error);
309c517b3aaSDarrick J. Wong DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_preen);
310c517b3aaSDarrick J. Wong DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_warning);
3114700d229SDarrick J. Wong 
312c517b3aaSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_fblock_error_class,
3131d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int whichfork,
3144700d229SDarrick J. Wong 		 xfs_fileoff_t offset, void *ret_ip),
3154700d229SDarrick J. Wong 	TP_ARGS(sc, whichfork, offset, ret_ip),
3164700d229SDarrick J. Wong 	TP_STRUCT__entry(
3174700d229SDarrick J. Wong 		__field(dev_t, dev)
3184700d229SDarrick J. Wong 		__field(xfs_ino_t, ino)
3194700d229SDarrick J. Wong 		__field(int, whichfork)
3204700d229SDarrick J. Wong 		__field(unsigned int, type)
3214700d229SDarrick J. Wong 		__field(xfs_fileoff_t, offset)
3224700d229SDarrick J. Wong 		__field(void *, ret_ip)
3234700d229SDarrick J. Wong 	),
3244700d229SDarrick J. Wong 	TP_fast_assign(
3254700d229SDarrick J. Wong 		__entry->dev = sc->ip->i_mount->m_super->s_dev;
3264700d229SDarrick J. Wong 		__entry->ino = sc->ip->i_ino;
3274700d229SDarrick J. Wong 		__entry->whichfork = whichfork;
3284700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
3294700d229SDarrick J. Wong 		__entry->offset = offset;
3304700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
3314700d229SDarrick J. Wong 	),
332f93f85f7SDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx ret_ip %pS",
3334700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
3344700d229SDarrick J. Wong 		  __entry->ino,
335f93f85f7SDarrick J. Wong 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
33686d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
3374700d229SDarrick J. Wong 		  __entry->offset,
3384700d229SDarrick J. Wong 		  __entry->ret_ip)
3394700d229SDarrick J. Wong );
3404700d229SDarrick J. Wong 
3414700d229SDarrick J. Wong #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \
342c517b3aaSDarrick J. Wong DEFINE_EVENT(xchk_fblock_error_class, name, \
3431d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int whichfork, \
3444700d229SDarrick J. Wong 		 xfs_fileoff_t offset, void *ret_ip), \
3454700d229SDarrick J. Wong 	TP_ARGS(sc, whichfork, offset, ret_ip))
3464700d229SDarrick J. Wong 
347c517b3aaSDarrick J. Wong DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_error);
348c517b3aaSDarrick J. Wong DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_warning);
3494700d229SDarrick J. Wong 
350c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_incomplete,
3511d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, void *ret_ip),
3524700d229SDarrick J. Wong 	TP_ARGS(sc, ret_ip),
3534700d229SDarrick J. Wong 	TP_STRUCT__entry(
3544700d229SDarrick J. Wong 		__field(dev_t, dev)
3554700d229SDarrick J. Wong 		__field(unsigned int, type)
3564700d229SDarrick J. Wong 		__field(void *, ret_ip)
3574700d229SDarrick J. Wong 	),
3584700d229SDarrick J. Wong 	TP_fast_assign(
3594700d229SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
3604700d229SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
3614700d229SDarrick J. Wong 		__entry->ret_ip = ret_ip;
3624700d229SDarrick J. Wong 	),
36386d163dbSDarrick J. Wong 	TP_printk("dev %d:%d type %s ret_ip %pS",
3644700d229SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
36586d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
3664700d229SDarrick J. Wong 		  __entry->ret_ip)
3674700d229SDarrick J. Wong );
368a5637186SDarrick J. Wong 
369c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_btree_op_error,
3701d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
371537964bcSDarrick J. Wong 		 int level, int error, void *ret_ip),
372537964bcSDarrick J. Wong 	TP_ARGS(sc, cur, level, error, ret_ip),
373537964bcSDarrick J. Wong 	TP_STRUCT__entry(
374537964bcSDarrick J. Wong 		__field(dev_t, dev)
375537964bcSDarrick J. Wong 		__field(unsigned int, type)
376537964bcSDarrick J. Wong 		__field(xfs_btnum_t, btnum)
377537964bcSDarrick J. Wong 		__field(int, level)
378537964bcSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
379537964bcSDarrick J. Wong 		__field(xfs_agblock_t, bno)
38004ae87a5SPeter Zijlstra 		__field(int, ptr)
381537964bcSDarrick J. Wong 		__field(int, error)
382537964bcSDarrick J. Wong 		__field(void *, ret_ip)
383537964bcSDarrick J. Wong 	),
384537964bcSDarrick J. Wong 	TP_fast_assign(
385c517b3aaSDarrick J. Wong 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
386537964bcSDarrick J. Wong 
387537964bcSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
388537964bcSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
389537964bcSDarrick J. Wong 		__entry->btnum = cur->bc_btnum;
390537964bcSDarrick J. Wong 		__entry->level = level;
391537964bcSDarrick J. Wong 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
392537964bcSDarrick J. Wong 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
3936ca444cfSDarrick J. Wong 		__entry->ptr = cur->bc_levels[level].ptr;
394537964bcSDarrick J. Wong 		__entry->error = error;
395537964bcSDarrick J. Wong 		__entry->ret_ip = ret_ip;
396537964bcSDarrick J. Wong 	),
397f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
398537964bcSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
39986d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
400c494213fSDarrick J. Wong 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
401537964bcSDarrick J. Wong 		  __entry->level,
402537964bcSDarrick J. Wong 		  __entry->ptr,
403537964bcSDarrick J. Wong 		  __entry->agno,
404537964bcSDarrick J. Wong 		  __entry->bno,
405537964bcSDarrick J. Wong 		  __entry->error,
406537964bcSDarrick J. Wong 		  __entry->ret_ip)
407537964bcSDarrick J. Wong );
408537964bcSDarrick J. Wong 
409c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_ifork_btree_op_error,
4101d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
411537964bcSDarrick J. Wong 		 int level, int error, void *ret_ip),
412537964bcSDarrick J. Wong 	TP_ARGS(sc, cur, level, error, ret_ip),
413537964bcSDarrick J. Wong 	TP_STRUCT__entry(
414537964bcSDarrick J. Wong 		__field(dev_t, dev)
415537964bcSDarrick J. Wong 		__field(xfs_ino_t, ino)
416537964bcSDarrick J. Wong 		__field(int, whichfork)
417537964bcSDarrick J. Wong 		__field(unsigned int, type)
418537964bcSDarrick J. Wong 		__field(xfs_btnum_t, btnum)
419537964bcSDarrick J. Wong 		__field(int, level)
420537964bcSDarrick J. Wong 		__field(int, ptr)
421537964bcSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
422537964bcSDarrick J. Wong 		__field(xfs_agblock_t, bno)
423537964bcSDarrick J. Wong 		__field(int, error)
424537964bcSDarrick J. Wong 		__field(void *, ret_ip)
425537964bcSDarrick J. Wong 	),
426537964bcSDarrick J. Wong 	TP_fast_assign(
427c517b3aaSDarrick J. Wong 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
428537964bcSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
429537964bcSDarrick J. Wong 		__entry->ino = sc->ip->i_ino;
43092219c29SDave Chinner 		__entry->whichfork = cur->bc_ino.whichfork;
431537964bcSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
432537964bcSDarrick J. Wong 		__entry->btnum = cur->bc_btnum;
433537964bcSDarrick J. Wong 		__entry->level = level;
4346ca444cfSDarrick J. Wong 		__entry->ptr = cur->bc_levels[level].ptr;
435537964bcSDarrick J. Wong 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
436537964bcSDarrick J. Wong 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
437537964bcSDarrick J. Wong 		__entry->error = error;
438537964bcSDarrick J. Wong 		__entry->ret_ip = ret_ip;
439537964bcSDarrick J. Wong 	),
440f93f85f7SDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS",
441537964bcSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
442537964bcSDarrick J. Wong 		  __entry->ino,
443f93f85f7SDarrick J. Wong 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
44486d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
445c494213fSDarrick J. Wong 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
446537964bcSDarrick J. Wong 		  __entry->level,
447537964bcSDarrick J. Wong 		  __entry->ptr,
448537964bcSDarrick J. Wong 		  __entry->agno,
449537964bcSDarrick J. Wong 		  __entry->bno,
450537964bcSDarrick J. Wong 		  __entry->error,
451537964bcSDarrick J. Wong 		  __entry->ret_ip)
452537964bcSDarrick J. Wong );
453537964bcSDarrick J. Wong 
454c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_btree_error,
4551d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
456537964bcSDarrick J. Wong 		 int level, void *ret_ip),
457537964bcSDarrick J. Wong 	TP_ARGS(sc, cur, level, ret_ip),
458537964bcSDarrick J. Wong 	TP_STRUCT__entry(
459537964bcSDarrick J. Wong 		__field(dev_t, dev)
460537964bcSDarrick J. Wong 		__field(unsigned int, type)
461537964bcSDarrick J. Wong 		__field(xfs_btnum_t, btnum)
462537964bcSDarrick J. Wong 		__field(int, level)
463537964bcSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
464537964bcSDarrick J. Wong 		__field(xfs_agblock_t, bno)
46504ae87a5SPeter Zijlstra 		__field(int, ptr)
466537964bcSDarrick J. Wong 		__field(void *, ret_ip)
467537964bcSDarrick J. Wong 	),
468537964bcSDarrick J. Wong 	TP_fast_assign(
469c517b3aaSDarrick J. Wong 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
470537964bcSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
471537964bcSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
472537964bcSDarrick J. Wong 		__entry->btnum = cur->bc_btnum;
473537964bcSDarrick J. Wong 		__entry->level = level;
474537964bcSDarrick J. Wong 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
475537964bcSDarrick J. Wong 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
4766ca444cfSDarrick J. Wong 		__entry->ptr = cur->bc_levels[level].ptr;
477537964bcSDarrick J. Wong 		__entry->ret_ip = ret_ip;
478537964bcSDarrick J. Wong 	),
479f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
480537964bcSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
48186d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
482c494213fSDarrick J. Wong 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
483537964bcSDarrick J. Wong 		  __entry->level,
484537964bcSDarrick J. Wong 		  __entry->ptr,
485537964bcSDarrick J. Wong 		  __entry->agno,
486537964bcSDarrick J. Wong 		  __entry->bno,
487537964bcSDarrick J. Wong 		  __entry->ret_ip)
488537964bcSDarrick J. Wong );
489537964bcSDarrick J. Wong 
490c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_ifork_btree_error,
4911d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
492537964bcSDarrick J. Wong 		 int level, void *ret_ip),
493537964bcSDarrick J. Wong 	TP_ARGS(sc, cur, level, ret_ip),
494537964bcSDarrick J. Wong 	TP_STRUCT__entry(
495537964bcSDarrick J. Wong 		__field(dev_t, dev)
496537964bcSDarrick J. Wong 		__field(xfs_ino_t, ino)
497537964bcSDarrick J. Wong 		__field(int, whichfork)
498537964bcSDarrick J. Wong 		__field(unsigned int, type)
499537964bcSDarrick J. Wong 		__field(xfs_btnum_t, btnum)
500537964bcSDarrick J. Wong 		__field(int, level)
501537964bcSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
502537964bcSDarrick J. Wong 		__field(xfs_agblock_t, bno)
50304ae87a5SPeter Zijlstra 		__field(int, ptr)
504537964bcSDarrick J. Wong 		__field(void *, ret_ip)
505537964bcSDarrick J. Wong 	),
506537964bcSDarrick J. Wong 	TP_fast_assign(
507c517b3aaSDarrick J. Wong 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
508537964bcSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
50908b1325dSDarrick J. Wong 		__entry->ino = cur->bc_ino.ip->i_ino;
51092219c29SDave Chinner 		__entry->whichfork = cur->bc_ino.whichfork;
511537964bcSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
512537964bcSDarrick J. Wong 		__entry->btnum = cur->bc_btnum;
513537964bcSDarrick J. Wong 		__entry->level = level;
514537964bcSDarrick J. Wong 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
515537964bcSDarrick J. Wong 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
5166ca444cfSDarrick J. Wong 		__entry->ptr = cur->bc_levels[level].ptr;
517537964bcSDarrick J. Wong 		__entry->ret_ip = ret_ip;
518537964bcSDarrick J. Wong 	),
519f93f85f7SDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx fork %s type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS",
520537964bcSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
521537964bcSDarrick J. Wong 		  __entry->ino,
522f93f85f7SDarrick J. Wong 		  __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS),
52386d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
524c494213fSDarrick J. Wong 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
525537964bcSDarrick J. Wong 		  __entry->level,
526537964bcSDarrick J. Wong 		  __entry->ptr,
527537964bcSDarrick J. Wong 		  __entry->agno,
528537964bcSDarrick J. Wong 		  __entry->bno,
529537964bcSDarrick J. Wong 		  __entry->ret_ip)
530537964bcSDarrick J. Wong );
531537964bcSDarrick J. Wong 
532c517b3aaSDarrick J. Wong DECLARE_EVENT_CLASS(xchk_sbtree_class,
5331d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur,
53437f3fa7fSDarrick J. Wong 		 int level),
53537f3fa7fSDarrick J. Wong 	TP_ARGS(sc, cur, level),
53637f3fa7fSDarrick J. Wong 	TP_STRUCT__entry(
53737f3fa7fSDarrick J. Wong 		__field(dev_t, dev)
53837f3fa7fSDarrick J. Wong 		__field(int, type)
53937f3fa7fSDarrick J. Wong 		__field(xfs_btnum_t, btnum)
54037f3fa7fSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
54137f3fa7fSDarrick J. Wong 		__field(xfs_agblock_t, bno)
54237f3fa7fSDarrick J. Wong 		__field(int, level)
54337f3fa7fSDarrick J. Wong 		__field(int, nlevels)
54437f3fa7fSDarrick J. Wong 		__field(int, ptr)
54537f3fa7fSDarrick J. Wong 	),
54637f3fa7fSDarrick J. Wong 	TP_fast_assign(
547c517b3aaSDarrick J. Wong 		xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level);
54837f3fa7fSDarrick J. Wong 
54937f3fa7fSDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
55037f3fa7fSDarrick J. Wong 		__entry->type = sc->sm->sm_type;
55137f3fa7fSDarrick J. Wong 		__entry->btnum = cur->bc_btnum;
55237f3fa7fSDarrick J. Wong 		__entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno);
55337f3fa7fSDarrick J. Wong 		__entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno);
55437f3fa7fSDarrick J. Wong 		__entry->level = level;
55537f3fa7fSDarrick J. Wong 		__entry->nlevels = cur->bc_nlevels;
5566ca444cfSDarrick J. Wong 		__entry->ptr = cur->bc_levels[level].ptr;
55737f3fa7fSDarrick J. Wong 	),
558f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d type %s btree %s agno 0x%x agbno 0x%x level %d nlevels %d ptr %d",
55937f3fa7fSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
56086d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
561c494213fSDarrick J. Wong 		  __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS),
56237f3fa7fSDarrick J. Wong 		  __entry->agno,
56337f3fa7fSDarrick J. Wong 		  __entry->bno,
56437f3fa7fSDarrick J. Wong 		  __entry->level,
56537f3fa7fSDarrick J. Wong 		  __entry->nlevels,
56637f3fa7fSDarrick J. Wong 		  __entry->ptr)
56737f3fa7fSDarrick J. Wong )
56837f3fa7fSDarrick J. Wong #define DEFINE_SCRUB_SBTREE_EVENT(name) \
569c517b3aaSDarrick J. Wong DEFINE_EVENT(xchk_sbtree_class, name, \
5701d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, \
57137f3fa7fSDarrick J. Wong 		 int level), \
57237f3fa7fSDarrick J. Wong 	TP_ARGS(sc, cur, level))
57337f3fa7fSDarrick J. Wong 
574c517b3aaSDarrick J. Wong DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_rec);
575c517b3aaSDarrick J. Wong DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_key);
57637f3fa7fSDarrick J. Wong 
577c517b3aaSDarrick J. Wong TRACE_EVENT(xchk_xref_error,
5781d8a748aSDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int error, void *ret_ip),
57964b12563SDarrick J. Wong 	TP_ARGS(sc, error, ret_ip),
58064b12563SDarrick J. Wong 	TP_STRUCT__entry(
58164b12563SDarrick J. Wong 		__field(dev_t, dev)
58264b12563SDarrick J. Wong 		__field(int, type)
58364b12563SDarrick J. Wong 		__field(int, error)
58464b12563SDarrick J. Wong 		__field(void *, ret_ip)
58564b12563SDarrick J. Wong 	),
58664b12563SDarrick J. Wong 	TP_fast_assign(
58764b12563SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
58864b12563SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
58964b12563SDarrick J. Wong 		__entry->error = error;
59064b12563SDarrick J. Wong 		__entry->ret_ip = ret_ip;
59164b12563SDarrick J. Wong 	),
59286d163dbSDarrick J. Wong 	TP_printk("dev %d:%d type %s xref error %d ret_ip %pS",
59364b12563SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
59486d163dbSDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
59564b12563SDarrick J. Wong 		  __entry->error,
59664b12563SDarrick J. Wong 		  __entry->ret_ip)
59764b12563SDarrick J. Wong );
59864b12563SDarrick J. Wong 
599b9454fe0SDarrick J. Wong TRACE_EVENT(xchk_iallocbt_check_cluster,
600b9454fe0SDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
601b9454fe0SDarrick J. Wong 		 xfs_agino_t startino, xfs_daddr_t map_daddr,
602b9454fe0SDarrick J. Wong 		 unsigned short map_len, unsigned int chunk_ino,
603b9454fe0SDarrick J. Wong 		 unsigned int nr_inodes, uint16_t cluster_mask,
604b9454fe0SDarrick J. Wong 		 uint16_t holemask, unsigned int cluster_ino),
605b9454fe0SDarrick J. Wong 	TP_ARGS(mp, agno, startino, map_daddr, map_len, chunk_ino, nr_inodes,
606b9454fe0SDarrick J. Wong 		cluster_mask, holemask, cluster_ino),
607b9454fe0SDarrick J. Wong 	TP_STRUCT__entry(
608b9454fe0SDarrick J. Wong 		__field(dev_t, dev)
609b9454fe0SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
610b9454fe0SDarrick J. Wong 		__field(xfs_agino_t, startino)
611b9454fe0SDarrick J. Wong 		__field(xfs_daddr_t, map_daddr)
612b9454fe0SDarrick J. Wong 		__field(unsigned short, map_len)
613b9454fe0SDarrick J. Wong 		__field(unsigned int, chunk_ino)
614b9454fe0SDarrick J. Wong 		__field(unsigned int, nr_inodes)
615b9454fe0SDarrick J. Wong 		__field(unsigned int, cluster_ino)
616b9454fe0SDarrick J. Wong 		__field(uint16_t, cluster_mask)
617b9454fe0SDarrick J. Wong 		__field(uint16_t, holemask)
618b9454fe0SDarrick J. Wong 	),
619b9454fe0SDarrick J. Wong 	TP_fast_assign(
620b9454fe0SDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
621b9454fe0SDarrick J. Wong 		__entry->agno = agno;
622b9454fe0SDarrick J. Wong 		__entry->startino = startino;
623b9454fe0SDarrick J. Wong 		__entry->map_daddr = map_daddr;
624b9454fe0SDarrick J. Wong 		__entry->map_len = map_len;
625b9454fe0SDarrick J. Wong 		__entry->chunk_ino = chunk_ino;
626b9454fe0SDarrick J. Wong 		__entry->nr_inodes = nr_inodes;
627b9454fe0SDarrick J. Wong 		__entry->cluster_mask = cluster_mask;
628b9454fe0SDarrick J. Wong 		__entry->holemask = holemask;
629b9454fe0SDarrick J. Wong 		__entry->cluster_ino = cluster_ino;
630b9454fe0SDarrick J. Wong 	),
6317989acccSDarrick J. Wong 	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",
632b9454fe0SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
633b9454fe0SDarrick J. Wong 		  __entry->agno,
634b9454fe0SDarrick J. Wong 		  __entry->startino,
635b9454fe0SDarrick J. Wong 		  __entry->map_daddr,
636b9454fe0SDarrick J. Wong 		  __entry->map_len,
637b9454fe0SDarrick J. Wong 		  __entry->chunk_ino,
638b9454fe0SDarrick J. Wong 		  __entry->nr_inodes,
639b9454fe0SDarrick J. Wong 		  __entry->cluster_mask,
640b9454fe0SDarrick J. Wong 		  __entry->holemask,
641b9454fe0SDarrick J. Wong 		  __entry->cluster_ino)
642b9454fe0SDarrick J. Wong )
643b9454fe0SDarrick J. Wong 
644369c001bSDarrick J. Wong TRACE_EVENT(xchk_inode_is_allocated,
645369c001bSDarrick J. Wong 	TP_PROTO(struct xfs_inode *ip),
646369c001bSDarrick J. Wong 	TP_ARGS(ip),
647369c001bSDarrick J. Wong 	TP_STRUCT__entry(
648369c001bSDarrick J. Wong 		__field(dev_t, dev)
649369c001bSDarrick J. Wong 		__field(xfs_ino_t, ino)
650369c001bSDarrick J. Wong 		__field(unsigned long, iflags)
651369c001bSDarrick J. Wong 		__field(umode_t, mode)
652369c001bSDarrick J. Wong 	),
653369c001bSDarrick J. Wong 	TP_fast_assign(
654369c001bSDarrick J. Wong 		__entry->dev = VFS_I(ip)->i_sb->s_dev;
655369c001bSDarrick J. Wong 		__entry->ino = ip->i_ino;
656369c001bSDarrick J. Wong 		__entry->iflags = ip->i_flags;
657369c001bSDarrick J. Wong 		__entry->mode = VFS_I(ip)->i_mode;
658369c001bSDarrick J. Wong 	),
659369c001bSDarrick J. Wong 	TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx mode 0x%x",
660369c001bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
661369c001bSDarrick J. Wong 		  __entry->ino,
662369c001bSDarrick J. Wong 		  __entry->iflags,
663369c001bSDarrick J. Wong 		  __entry->mode)
664369c001bSDarrick J. Wong );
665369c001bSDarrick J. Wong 
66675efa57dSDarrick J. Wong TRACE_EVENT(xchk_fscounters_calc,
66775efa57dSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, uint64_t icount, uint64_t ifree,
66875efa57dSDarrick J. Wong 		 uint64_t fdblocks, uint64_t delalloc),
66975efa57dSDarrick J. Wong 	TP_ARGS(mp, icount, ifree, fdblocks, delalloc),
67075efa57dSDarrick J. Wong 	TP_STRUCT__entry(
67175efa57dSDarrick J. Wong 		__field(dev_t, dev)
67275efa57dSDarrick J. Wong 		__field(int64_t, icount_sb)
67375efa57dSDarrick J. Wong 		__field(uint64_t, icount_calculated)
67475efa57dSDarrick J. Wong 		__field(int64_t, ifree_sb)
67575efa57dSDarrick J. Wong 		__field(uint64_t, ifree_calculated)
67675efa57dSDarrick J. Wong 		__field(int64_t, fdblocks_sb)
67775efa57dSDarrick J. Wong 		__field(uint64_t, fdblocks_calculated)
67875efa57dSDarrick J. Wong 		__field(uint64_t, delalloc)
67975efa57dSDarrick J. Wong 	),
68075efa57dSDarrick J. Wong 	TP_fast_assign(
68175efa57dSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
68275efa57dSDarrick J. Wong 		__entry->icount_sb = mp->m_sb.sb_icount;
68375efa57dSDarrick J. Wong 		__entry->icount_calculated = icount;
68475efa57dSDarrick J. Wong 		__entry->ifree_sb = mp->m_sb.sb_ifree;
68575efa57dSDarrick J. Wong 		__entry->ifree_calculated = ifree;
68675efa57dSDarrick J. Wong 		__entry->fdblocks_sb = mp->m_sb.sb_fdblocks;
68775efa57dSDarrick J. Wong 		__entry->fdblocks_calculated = fdblocks;
68875efa57dSDarrick J. Wong 		__entry->delalloc = delalloc;
68975efa57dSDarrick J. Wong 	),
69075efa57dSDarrick J. Wong 	TP_printk("dev %d:%d icount %lld:%llu ifree %lld::%llu fdblocks %lld::%llu delalloc %llu",
69175efa57dSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
69275efa57dSDarrick J. Wong 		  __entry->icount_sb,
69375efa57dSDarrick J. Wong 		  __entry->icount_calculated,
69475efa57dSDarrick J. Wong 		  __entry->ifree_sb,
69575efa57dSDarrick J. Wong 		  __entry->ifree_calculated,
69675efa57dSDarrick J. Wong 		  __entry->fdblocks_sb,
69775efa57dSDarrick J. Wong 		  __entry->fdblocks_calculated,
69875efa57dSDarrick J. Wong 		  __entry->delalloc)
69975efa57dSDarrick J. Wong )
70075efa57dSDarrick J. Wong 
70175efa57dSDarrick J. Wong TRACE_EVENT(xchk_fscounters_within_range,
70275efa57dSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, uint64_t expected, int64_t curr_value,
70375efa57dSDarrick J. Wong 		 int64_t old_value),
70475efa57dSDarrick J. Wong 	TP_ARGS(mp, expected, curr_value, old_value),
70575efa57dSDarrick J. Wong 	TP_STRUCT__entry(
70675efa57dSDarrick J. Wong 		__field(dev_t, dev)
70775efa57dSDarrick J. Wong 		__field(uint64_t, expected)
70875efa57dSDarrick J. Wong 		__field(int64_t, curr_value)
70975efa57dSDarrick J. Wong 		__field(int64_t, old_value)
71075efa57dSDarrick J. Wong 	),
71175efa57dSDarrick J. Wong 	TP_fast_assign(
71275efa57dSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
71375efa57dSDarrick J. Wong 		__entry->expected = expected;
71475efa57dSDarrick J. Wong 		__entry->curr_value = curr_value;
71575efa57dSDarrick J. Wong 		__entry->old_value = old_value;
71675efa57dSDarrick J. Wong 	),
71775efa57dSDarrick J. Wong 	TP_printk("dev %d:%d expected %llu curr_value %lld old_value %lld",
71875efa57dSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
71975efa57dSDarrick J. Wong 		  __entry->expected,
72075efa57dSDarrick J. Wong 		  __entry->curr_value,
72175efa57dSDarrick J. Wong 		  __entry->old_value)
72275efa57dSDarrick J. Wong )
72375efa57dSDarrick J. Wong 
724ce85a1e0SDarrick J. Wong DECLARE_EVENT_CLASS(xchk_fsfreeze_class,
725ce85a1e0SDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int error),
726ce85a1e0SDarrick J. Wong 	TP_ARGS(sc, error),
727ce85a1e0SDarrick J. Wong 	TP_STRUCT__entry(
728ce85a1e0SDarrick J. Wong 		__field(dev_t, dev)
729ce85a1e0SDarrick J. Wong 		__field(unsigned int, type)
730ce85a1e0SDarrick J. Wong 		__field(int, error)
731ce85a1e0SDarrick J. Wong 	),
732ce85a1e0SDarrick J. Wong 	TP_fast_assign(
733ce85a1e0SDarrick J. Wong 		__entry->dev = sc->mp->m_super->s_dev;
734ce85a1e0SDarrick J. Wong 		__entry->type = sc->sm->sm_type;
735ce85a1e0SDarrick J. Wong 		__entry->error = error;
736ce85a1e0SDarrick J. Wong 	),
737ce85a1e0SDarrick J. Wong 	TP_printk("dev %d:%d type %s error %d",
738ce85a1e0SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
739ce85a1e0SDarrick J. Wong 		  __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS),
740ce85a1e0SDarrick J. Wong 		  __entry->error)
741ce85a1e0SDarrick J. Wong );
742ce85a1e0SDarrick J. Wong #define DEFINE_XCHK_FSFREEZE_EVENT(name) \
743ce85a1e0SDarrick J. Wong DEFINE_EVENT(xchk_fsfreeze_class, name, \
744ce85a1e0SDarrick J. Wong 	TP_PROTO(struct xfs_scrub *sc, int error), \
745ce85a1e0SDarrick J. Wong 	TP_ARGS(sc, error))
746ce85a1e0SDarrick J. Wong DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsfreeze);
747ce85a1e0SDarrick J. Wong DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsthaw);
748ce85a1e0SDarrick J. Wong 
74990148903SDarrick J. Wong TRACE_EVENT(xchk_refcount_incorrect,
75090148903SDarrick J. Wong 	TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *irec,
75190148903SDarrick J. Wong 		 xfs_nlink_t seen),
75290148903SDarrick J. Wong 	TP_ARGS(pag, irec, seen),
75390148903SDarrick J. Wong 	TP_STRUCT__entry(
75490148903SDarrick J. Wong 		__field(dev_t, dev)
75590148903SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
75690148903SDarrick J. Wong 		__field(enum xfs_refc_domain, domain)
75790148903SDarrick J. Wong 		__field(xfs_agblock_t, startblock)
75890148903SDarrick J. Wong 		__field(xfs_extlen_t, blockcount)
75990148903SDarrick J. Wong 		__field(xfs_nlink_t, refcount)
76090148903SDarrick J. Wong 		__field(xfs_nlink_t, seen)
76190148903SDarrick J. Wong 	),
76290148903SDarrick J. Wong 	TP_fast_assign(
76390148903SDarrick J. Wong 		__entry->dev = pag->pag_mount->m_super->s_dev;
76490148903SDarrick J. Wong 		__entry->agno = pag->pag_agno;
76590148903SDarrick J. Wong 		__entry->domain = irec->rc_domain;
76690148903SDarrick J. Wong 		__entry->startblock = irec->rc_startblock;
76790148903SDarrick J. Wong 		__entry->blockcount = irec->rc_blockcount;
76890148903SDarrick J. Wong 		__entry->refcount = irec->rc_refcount;
76990148903SDarrick J. Wong 		__entry->seen = seen;
77090148903SDarrick J. Wong 	),
77190148903SDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u seen %u",
77290148903SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
77390148903SDarrick J. Wong 		  __entry->agno,
77490148903SDarrick J. Wong 		  __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS),
77590148903SDarrick J. Wong 		  __entry->startblock,
77690148903SDarrick J. Wong 		  __entry->blockcount,
77790148903SDarrick J. Wong 		  __entry->refcount,
77890148903SDarrick J. Wong 		  __entry->seen)
77990148903SDarrick J. Wong )
78090148903SDarrick J. Wong 
7813934e8ebSDarrick J. Wong TRACE_EVENT(xfile_create,
7823934e8ebSDarrick J. Wong 	TP_PROTO(struct xfile *xf),
7833934e8ebSDarrick J. Wong 	TP_ARGS(xf),
7843934e8ebSDarrick J. Wong 	TP_STRUCT__entry(
7853934e8ebSDarrick J. Wong 		__field(dev_t, dev)
7863934e8ebSDarrick J. Wong 		__field(unsigned long, ino)
787*1bee32f3SDarrick J. Wong 		__array(char, pathname, MAXNAMELEN)
7883934e8ebSDarrick J. Wong 	),
7893934e8ebSDarrick J. Wong 	TP_fast_assign(
7903934e8ebSDarrick J. Wong 		char		*path;
7913934e8ebSDarrick J. Wong 
7923934e8ebSDarrick J. Wong 		__entry->ino = file_inode(xf->file)->i_ino;
793*1bee32f3SDarrick J. Wong 		path = file_path(xf->file, __entry->pathname, MAXNAMELEN);
7943934e8ebSDarrick J. Wong 		if (IS_ERR(path))
795*1bee32f3SDarrick J. Wong 			strncpy(__entry->pathname, "(unknown)",
796*1bee32f3SDarrick J. Wong 					sizeof(__entry->pathname));
7973934e8ebSDarrick J. Wong 	),
7983934e8ebSDarrick J. Wong 	TP_printk("xfino 0x%lx path '%s'",
7993934e8ebSDarrick J. Wong 		  __entry->ino,
8003934e8ebSDarrick J. Wong 		  __entry->pathname)
8013934e8ebSDarrick J. Wong );
8023934e8ebSDarrick J. Wong 
8033934e8ebSDarrick J. Wong TRACE_EVENT(xfile_destroy,
8043934e8ebSDarrick J. Wong 	TP_PROTO(struct xfile *xf),
8053934e8ebSDarrick J. Wong 	TP_ARGS(xf),
8063934e8ebSDarrick J. Wong 	TP_STRUCT__entry(
8073934e8ebSDarrick J. Wong 		__field(unsigned long, ino)
8083934e8ebSDarrick J. Wong 		__field(unsigned long long, bytes)
8093934e8ebSDarrick J. Wong 		__field(loff_t, size)
8103934e8ebSDarrick J. Wong 	),
8113934e8ebSDarrick J. Wong 	TP_fast_assign(
8123934e8ebSDarrick J. Wong 		struct xfile_stat	statbuf;
8133934e8ebSDarrick J. Wong 		int			ret;
8143934e8ebSDarrick J. Wong 
8153934e8ebSDarrick J. Wong 		ret = xfile_stat(xf, &statbuf);
8163934e8ebSDarrick J. Wong 		if (!ret) {
8173934e8ebSDarrick J. Wong 			__entry->bytes = statbuf.bytes;
8183934e8ebSDarrick J. Wong 			__entry->size = statbuf.size;
8193934e8ebSDarrick J. Wong 		} else {
8203934e8ebSDarrick J. Wong 			__entry->bytes = -1;
8213934e8ebSDarrick J. Wong 			__entry->size = -1;
8223934e8ebSDarrick J. Wong 		}
8233934e8ebSDarrick J. Wong 		__entry->ino = file_inode(xf->file)->i_ino;
8243934e8ebSDarrick J. Wong 	),
8253934e8ebSDarrick J. Wong 	TP_printk("xfino 0x%lx mem_bytes 0x%llx isize 0x%llx",
8263934e8ebSDarrick J. Wong 		  __entry->ino,
8273934e8ebSDarrick J. Wong 		  __entry->bytes,
8283934e8ebSDarrick J. Wong 		  __entry->size)
8293934e8ebSDarrick J. Wong );
8303934e8ebSDarrick J. Wong 
8313934e8ebSDarrick J. Wong DECLARE_EVENT_CLASS(xfile_class,
8323934e8ebSDarrick J. Wong 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount),
8333934e8ebSDarrick J. Wong 	TP_ARGS(xf, pos, bytecount),
8343934e8ebSDarrick J. Wong 	TP_STRUCT__entry(
8353934e8ebSDarrick J. Wong 		__field(unsigned long, ino)
8363934e8ebSDarrick J. Wong 		__field(unsigned long long, bytes_used)
8373934e8ebSDarrick J. Wong 		__field(loff_t, pos)
8383934e8ebSDarrick J. Wong 		__field(loff_t, size)
8393934e8ebSDarrick J. Wong 		__field(unsigned long long, bytecount)
8403934e8ebSDarrick J. Wong 	),
8413934e8ebSDarrick J. Wong 	TP_fast_assign(
8423934e8ebSDarrick J. Wong 		struct xfile_stat	statbuf;
8433934e8ebSDarrick J. Wong 		int			ret;
8443934e8ebSDarrick J. Wong 
8453934e8ebSDarrick J. Wong 		ret = xfile_stat(xf, &statbuf);
8463934e8ebSDarrick J. Wong 		if (!ret) {
8473934e8ebSDarrick J. Wong 			__entry->bytes_used = statbuf.bytes;
8483934e8ebSDarrick J. Wong 			__entry->size = statbuf.size;
8493934e8ebSDarrick J. Wong 		} else {
8503934e8ebSDarrick J. Wong 			__entry->bytes_used = -1;
8513934e8ebSDarrick J. Wong 			__entry->size = -1;
8523934e8ebSDarrick J. Wong 		}
8533934e8ebSDarrick J. Wong 		__entry->ino = file_inode(xf->file)->i_ino;
8543934e8ebSDarrick J. Wong 		__entry->pos = pos;
8553934e8ebSDarrick J. Wong 		__entry->bytecount = bytecount;
8563934e8ebSDarrick J. Wong 	),
8573934e8ebSDarrick J. Wong 	TP_printk("xfino 0x%lx mem_bytes 0x%llx pos 0x%llx bytecount 0x%llx isize 0x%llx",
8583934e8ebSDarrick J. Wong 		  __entry->ino,
8593934e8ebSDarrick J. Wong 		  __entry->bytes_used,
8603934e8ebSDarrick J. Wong 		  __entry->pos,
8613934e8ebSDarrick J. Wong 		  __entry->bytecount,
8623934e8ebSDarrick J. Wong 		  __entry->size)
8633934e8ebSDarrick J. Wong );
8643934e8ebSDarrick J. Wong #define DEFINE_XFILE_EVENT(name) \
8653934e8ebSDarrick J. Wong DEFINE_EVENT(xfile_class, name, \
8663934e8ebSDarrick J. Wong 	TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount), \
8673934e8ebSDarrick J. Wong 	TP_ARGS(xf, pos, bytecount))
8683934e8ebSDarrick J. Wong DEFINE_XFILE_EVENT(xfile_pread);
8693934e8ebSDarrick J. Wong DEFINE_XFILE_EVENT(xfile_pwrite);
8703934e8ebSDarrick J. Wong DEFINE_XFILE_EVENT(xfile_seek_data);
871137db333SDarrick J. Wong DEFINE_XFILE_EVENT(xfile_get_page);
872137db333SDarrick J. Wong DEFINE_XFILE_EVENT(xfile_put_page);
8733934e8ebSDarrick J. Wong 
8743934e8ebSDarrick J. Wong TRACE_EVENT(xfarray_create,
8753934e8ebSDarrick J. Wong 	TP_PROTO(struct xfarray *xfa, unsigned long long required_capacity),
8763934e8ebSDarrick J. Wong 	TP_ARGS(xfa, required_capacity),
8773934e8ebSDarrick J. Wong 	TP_STRUCT__entry(
8783934e8ebSDarrick J. Wong 		__field(unsigned long, ino)
8793934e8ebSDarrick J. Wong 		__field(uint64_t, max_nr)
8803934e8ebSDarrick J. Wong 		__field(size_t, obj_size)
8813934e8ebSDarrick J. Wong 		__field(int, obj_size_log)
8823934e8ebSDarrick J. Wong 		__field(unsigned long long, required_capacity)
8833934e8ebSDarrick J. Wong 	),
8843934e8ebSDarrick J. Wong 	TP_fast_assign(
8853934e8ebSDarrick J. Wong 		__entry->max_nr = xfa->max_nr;
8863934e8ebSDarrick J. Wong 		__entry->obj_size = xfa->obj_size;
8873934e8ebSDarrick J. Wong 		__entry->obj_size_log = xfa->obj_size_log;
8883934e8ebSDarrick J. Wong 		__entry->ino = file_inode(xfa->xfile->file)->i_ino;
8893934e8ebSDarrick J. Wong 		__entry->required_capacity = required_capacity;
8903934e8ebSDarrick J. Wong 	),
8913934e8ebSDarrick J. Wong 	TP_printk("xfino 0x%lx max_nr %llu reqd_nr %llu objsz %zu objszlog %d",
8923934e8ebSDarrick J. Wong 		  __entry->ino,
8933934e8ebSDarrick J. Wong 		  __entry->max_nr,
8943934e8ebSDarrick J. Wong 		  __entry->required_capacity,
8953934e8ebSDarrick J. Wong 		  __entry->obj_size,
8963934e8ebSDarrick J. Wong 		  __entry->obj_size_log)
8973934e8ebSDarrick J. Wong );
8983934e8ebSDarrick J. Wong 
899232ea052SDarrick J. Wong TRACE_EVENT(xfarray_isort,
900232ea052SDarrick J. Wong 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
901232ea052SDarrick J. Wong 	TP_ARGS(si, lo, hi),
902232ea052SDarrick J. Wong 	TP_STRUCT__entry(
903232ea052SDarrick J. Wong 		__field(unsigned long, ino)
904232ea052SDarrick J. Wong 		__field(unsigned long long, lo)
905232ea052SDarrick J. Wong 		__field(unsigned long long, hi)
906232ea052SDarrick J. Wong 	),
907232ea052SDarrick J. Wong 	TP_fast_assign(
908232ea052SDarrick J. Wong 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
909232ea052SDarrick J. Wong 		__entry->lo = lo;
910232ea052SDarrick J. Wong 		__entry->hi = hi;
911232ea052SDarrick J. Wong 	),
912232ea052SDarrick J. Wong 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
913232ea052SDarrick J. Wong 		  __entry->ino,
914232ea052SDarrick J. Wong 		  __entry->lo,
915232ea052SDarrick J. Wong 		  __entry->hi,
916232ea052SDarrick J. Wong 		  __entry->hi - __entry->lo)
917232ea052SDarrick J. Wong );
918232ea052SDarrick J. Wong 
919e5b46c75SDarrick J. Wong TRACE_EVENT(xfarray_pagesort,
920e5b46c75SDarrick J. Wong 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
921e5b46c75SDarrick J. Wong 	TP_ARGS(si, lo, hi),
922e5b46c75SDarrick J. Wong 	TP_STRUCT__entry(
923e5b46c75SDarrick J. Wong 		__field(unsigned long, ino)
924e5b46c75SDarrick J. Wong 		__field(unsigned long long, lo)
925e5b46c75SDarrick J. Wong 		__field(unsigned long long, hi)
926e5b46c75SDarrick J. Wong 	),
927e5b46c75SDarrick J. Wong 	TP_fast_assign(
928e5b46c75SDarrick J. Wong 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
929e5b46c75SDarrick J. Wong 		__entry->lo = lo;
930e5b46c75SDarrick J. Wong 		__entry->hi = hi;
931e5b46c75SDarrick J. Wong 	),
932e5b46c75SDarrick J. Wong 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu",
933e5b46c75SDarrick J. Wong 		  __entry->ino,
934e5b46c75SDarrick J. Wong 		  __entry->lo,
935e5b46c75SDarrick J. Wong 		  __entry->hi,
936e5b46c75SDarrick J. Wong 		  __entry->hi - __entry->lo)
937e5b46c75SDarrick J. Wong );
938e5b46c75SDarrick J. Wong 
939232ea052SDarrick J. Wong TRACE_EVENT(xfarray_qsort,
940232ea052SDarrick J. Wong 	TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi),
941232ea052SDarrick J. Wong 	TP_ARGS(si, lo, hi),
942232ea052SDarrick J. Wong 	TP_STRUCT__entry(
943232ea052SDarrick J. Wong 		__field(unsigned long, ino)
944232ea052SDarrick J. Wong 		__field(unsigned long long, lo)
945232ea052SDarrick J. Wong 		__field(unsigned long long, hi)
946232ea052SDarrick J. Wong 		__field(int, stack_depth)
947232ea052SDarrick J. Wong 		__field(int, max_stack_depth)
948232ea052SDarrick J. Wong 	),
949232ea052SDarrick J. Wong 	TP_fast_assign(
950232ea052SDarrick J. Wong 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
951232ea052SDarrick J. Wong 		__entry->lo = lo;
952232ea052SDarrick J. Wong 		__entry->hi = hi;
953232ea052SDarrick J. Wong 		__entry->stack_depth = si->stack_depth;
954232ea052SDarrick J. Wong 		__entry->max_stack_depth = si->max_stack_depth;
955232ea052SDarrick J. Wong 	),
956232ea052SDarrick J. Wong 	TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu stack %d/%d",
957232ea052SDarrick J. Wong 		  __entry->ino,
958232ea052SDarrick J. Wong 		  __entry->lo,
959232ea052SDarrick J. Wong 		  __entry->hi,
960232ea052SDarrick J. Wong 		  __entry->hi - __entry->lo,
961232ea052SDarrick J. Wong 		  __entry->stack_depth,
962232ea052SDarrick J. Wong 		  __entry->max_stack_depth)
963232ea052SDarrick J. Wong );
964232ea052SDarrick J. Wong 
965232ea052SDarrick J. Wong TRACE_EVENT(xfarray_sort,
966232ea052SDarrick J. Wong 	TP_PROTO(struct xfarray_sortinfo *si, size_t bytes),
967232ea052SDarrick J. Wong 	TP_ARGS(si, bytes),
968232ea052SDarrick J. Wong 	TP_STRUCT__entry(
969232ea052SDarrick J. Wong 		__field(unsigned long, ino)
970232ea052SDarrick J. Wong 		__field(unsigned long long, nr)
971232ea052SDarrick J. Wong 		__field(size_t, obj_size)
972232ea052SDarrick J. Wong 		__field(size_t, bytes)
973232ea052SDarrick J. Wong 		__field(unsigned int, max_stack_depth)
974232ea052SDarrick J. Wong 	),
975232ea052SDarrick J. Wong 	TP_fast_assign(
976232ea052SDarrick J. Wong 		__entry->nr = si->array->nr;
977232ea052SDarrick J. Wong 		__entry->obj_size = si->array->obj_size;
978232ea052SDarrick J. Wong 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
979232ea052SDarrick J. Wong 		__entry->bytes = bytes;
980232ea052SDarrick J. Wong 		__entry->max_stack_depth = si->max_stack_depth;
981232ea052SDarrick J. Wong 	),
982232ea052SDarrick J. Wong 	TP_printk("xfino 0x%lx nr %llu objsz %zu stack %u bytes %zu",
983232ea052SDarrick J. Wong 		  __entry->ino,
984232ea052SDarrick J. Wong 		  __entry->nr,
985232ea052SDarrick J. Wong 		  __entry->obj_size,
986232ea052SDarrick J. Wong 		  __entry->max_stack_depth,
987232ea052SDarrick J. Wong 		  __entry->bytes)
988232ea052SDarrick J. Wong );
989232ea052SDarrick J. Wong 
990232ea052SDarrick J. Wong TRACE_EVENT(xfarray_sort_stats,
991232ea052SDarrick J. Wong 	TP_PROTO(struct xfarray_sortinfo *si, int error),
992232ea052SDarrick J. Wong 	TP_ARGS(si, error),
993232ea052SDarrick J. Wong 	TP_STRUCT__entry(
994232ea052SDarrick J. Wong 		__field(unsigned long, ino)
995232ea052SDarrick J. Wong #ifdef DEBUG
996232ea052SDarrick J. Wong 		__field(unsigned long long, loads)
997232ea052SDarrick J. Wong 		__field(unsigned long long, stores)
998232ea052SDarrick J. Wong 		__field(unsigned long long, compares)
999c390c645SDarrick J. Wong 		__field(unsigned long long, heapsorts)
1000232ea052SDarrick J. Wong #endif
1001232ea052SDarrick J. Wong 		__field(unsigned int, max_stack_depth)
1002232ea052SDarrick J. Wong 		__field(unsigned int, max_stack_used)
1003232ea052SDarrick J. Wong 		__field(int, error)
1004232ea052SDarrick J. Wong 	),
1005232ea052SDarrick J. Wong 	TP_fast_assign(
1006232ea052SDarrick J. Wong 		__entry->ino = file_inode(si->array->xfile->file)->i_ino;
1007232ea052SDarrick J. Wong #ifdef DEBUG
1008232ea052SDarrick J. Wong 		__entry->loads = si->loads;
1009232ea052SDarrick J. Wong 		__entry->stores = si->stores;
1010232ea052SDarrick J. Wong 		__entry->compares = si->compares;
1011c390c645SDarrick J. Wong 		__entry->heapsorts = si->heapsorts;
1012232ea052SDarrick J. Wong #endif
1013232ea052SDarrick J. Wong 		__entry->max_stack_depth = si->max_stack_depth;
1014232ea052SDarrick J. Wong 		__entry->max_stack_used = si->max_stack_used;
1015232ea052SDarrick J. Wong 		__entry->error = error;
1016232ea052SDarrick J. Wong 	),
1017232ea052SDarrick J. Wong 	TP_printk(
1018232ea052SDarrick J. Wong #ifdef DEBUG
1019c390c645SDarrick J. Wong 		  "xfino 0x%lx loads %llu stores %llu compares %llu heapsorts %llu stack_depth %u/%u error %d",
1020232ea052SDarrick J. Wong #else
1021232ea052SDarrick J. Wong 		  "xfino 0x%lx stack_depth %u/%u error %d",
1022232ea052SDarrick J. Wong #endif
1023232ea052SDarrick J. Wong 		  __entry->ino,
1024232ea052SDarrick J. Wong #ifdef DEBUG
1025232ea052SDarrick J. Wong 		  __entry->loads,
1026232ea052SDarrick J. Wong 		  __entry->stores,
1027232ea052SDarrick J. Wong 		  __entry->compares,
1028c390c645SDarrick J. Wong 		  __entry->heapsorts,
1029232ea052SDarrick J. Wong #endif
1030232ea052SDarrick J. Wong 		  __entry->max_stack_used,
1031232ea052SDarrick J. Wong 		  __entry->max_stack_depth,
1032232ea052SDarrick J. Wong 		  __entry->error)
1033232ea052SDarrick J. Wong );
1034232ea052SDarrick J. Wong 
1035526aab5fSDarrick J. Wong #ifdef CONFIG_XFS_RT
1036526aab5fSDarrick J. Wong TRACE_EVENT(xchk_rtsum_record_free,
1037526aab5fSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_rtblock_t start,
103857a20b61SDarrick J. Wong 		 xfs_rtbxlen_t len, unsigned int log, loff_t pos,
103957a20b61SDarrick J. Wong 		 xfs_suminfo_t v),
1040526aab5fSDarrick J. Wong 	TP_ARGS(mp, start, len, log, pos, v),
1041526aab5fSDarrick J. Wong 	TP_STRUCT__entry(
1042526aab5fSDarrick J. Wong 		__field(dev_t, dev)
1043526aab5fSDarrick J. Wong 		__field(dev_t, rtdev)
1044526aab5fSDarrick J. Wong 		__field(xfs_rtblock_t, start)
1045526aab5fSDarrick J. Wong 		__field(unsigned long long, len)
1046526aab5fSDarrick J. Wong 		__field(unsigned int, log)
1047526aab5fSDarrick J. Wong 		__field(loff_t, pos)
1048526aab5fSDarrick J. Wong 		__field(xfs_suminfo_t, v)
1049526aab5fSDarrick J. Wong 	),
1050526aab5fSDarrick J. Wong 	TP_fast_assign(
1051526aab5fSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1052526aab5fSDarrick J. Wong 		__entry->rtdev = mp->m_rtdev_targp->bt_dev;
1053526aab5fSDarrick J. Wong 		__entry->start = start;
1054526aab5fSDarrick J. Wong 		__entry->len = len;
1055526aab5fSDarrick J. Wong 		__entry->log = log;
1056526aab5fSDarrick J. Wong 		__entry->pos = pos;
1057526aab5fSDarrick J. Wong 		__entry->v = v;
1058526aab5fSDarrick J. Wong 	),
1059526aab5fSDarrick J. Wong 	TP_printk("dev %d:%d rtdev %d:%d rtx 0x%llx rtxcount 0x%llx log %u rsumpos 0x%llx sumcount %u",
1060526aab5fSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1061526aab5fSDarrick J. Wong 		  MAJOR(__entry->rtdev), MINOR(__entry->rtdev),
1062526aab5fSDarrick J. Wong 		  __entry->start,
1063526aab5fSDarrick J. Wong 		  __entry->len,
1064526aab5fSDarrick J. Wong 		  __entry->log,
1065526aab5fSDarrick J. Wong 		  __entry->pos,
1066526aab5fSDarrick J. Wong 		  __entry->v)
1067526aab5fSDarrick J. Wong );
1068526aab5fSDarrick J. Wong #endif /* CONFIG_XFS_RT */
1069526aab5fSDarrick J. Wong 
1070718fa74bSDarrick J. Wong /* repair tracepoints */
1071718fa74bSDarrick J. Wong #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR)
1072718fa74bSDarrick J. Wong 
1073b5e2196eSDarrick J. Wong DECLARE_EVENT_CLASS(xrep_extent_class,
107477a1396fSDarrick J. Wong 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len),
107577a1396fSDarrick J. Wong 	TP_ARGS(pag, agbno, len),
1076718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1077718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1078718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1079718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, agbno)
1080718fa74bSDarrick J. Wong 		__field(xfs_extlen_t, len)
1081718fa74bSDarrick J. Wong 	),
1082718fa74bSDarrick J. Wong 	TP_fast_assign(
108377a1396fSDarrick J. Wong 		__entry->dev = pag->pag_mount->m_super->s_dev;
108477a1396fSDarrick J. Wong 		__entry->agno = pag->pag_agno;
1085718fa74bSDarrick J. Wong 		__entry->agbno = agbno;
1086718fa74bSDarrick J. Wong 		__entry->len = len;
1087718fa74bSDarrick J. Wong 	),
10887989acccSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x",
1089718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1090718fa74bSDarrick J. Wong 		  __entry->agno,
1091718fa74bSDarrick J. Wong 		  __entry->agbno,
1092718fa74bSDarrick J. Wong 		  __entry->len)
1093718fa74bSDarrick J. Wong );
1094718fa74bSDarrick J. Wong #define DEFINE_REPAIR_EXTENT_EVENT(name) \
1095b5e2196eSDarrick J. Wong DEFINE_EVENT(xrep_extent_class, name, \
109677a1396fSDarrick J. Wong 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len), \
109777a1396fSDarrick J. Wong 	TP_ARGS(pag, agbno, len))
10981c7ce115SDarrick J. Wong DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_unmap_extent);
10991c7ce115SDarrick J. Wong DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_free_extent);
11001c7ce115SDarrick J. Wong DEFINE_REPAIR_EXTENT_EVENT(xreap_agextent_binval);
1101b5e2196eSDarrick J. Wong DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert);
1102718fa74bSDarrick J. Wong 
11031c7ce115SDarrick J. Wong DECLARE_EVENT_CLASS(xrep_reap_find_class,
11041c7ce115SDarrick J. Wong 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len,
11051c7ce115SDarrick J. Wong 		bool crosslinked),
11061c7ce115SDarrick J. Wong 	TP_ARGS(pag, agbno, len, crosslinked),
11071c7ce115SDarrick J. Wong 	TP_STRUCT__entry(
11081c7ce115SDarrick J. Wong 		__field(dev_t, dev)
11091c7ce115SDarrick J. Wong 		__field(xfs_agnumber_t, agno)
11101c7ce115SDarrick J. Wong 		__field(xfs_agblock_t, agbno)
11111c7ce115SDarrick J. Wong 		__field(xfs_extlen_t, len)
11121c7ce115SDarrick J. Wong 		__field(bool, crosslinked)
11131c7ce115SDarrick J. Wong 	),
11141c7ce115SDarrick J. Wong 	TP_fast_assign(
11151c7ce115SDarrick J. Wong 		__entry->dev = pag->pag_mount->m_super->s_dev;
11161c7ce115SDarrick J. Wong 		__entry->agno = pag->pag_agno;
11171c7ce115SDarrick J. Wong 		__entry->agbno = agbno;
11181c7ce115SDarrick J. Wong 		__entry->len = len;
11191c7ce115SDarrick J. Wong 		__entry->crosslinked = crosslinked;
11201c7ce115SDarrick J. Wong 	),
11211c7ce115SDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x crosslinked %d",
11221c7ce115SDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
11231c7ce115SDarrick J. Wong 		  __entry->agno,
11241c7ce115SDarrick J. Wong 		  __entry->agbno,
11251c7ce115SDarrick J. Wong 		  __entry->len,
11261c7ce115SDarrick J. Wong 		  __entry->crosslinked ? 1 : 0)
11271c7ce115SDarrick J. Wong );
11281c7ce115SDarrick J. Wong #define DEFINE_REPAIR_REAP_FIND_EVENT(name) \
11291c7ce115SDarrick J. Wong DEFINE_EVENT(xrep_reap_find_class, name, \
11301c7ce115SDarrick J. Wong 	TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \
11311c7ce115SDarrick J. Wong 		 bool crosslinked), \
11321c7ce115SDarrick J. Wong 	TP_ARGS(pag, agbno, len, crosslinked))
11331c7ce115SDarrick J. Wong DEFINE_REPAIR_REAP_FIND_EVENT(xreap_agextent_select);
11341c7ce115SDarrick J. Wong 
1135b5e2196eSDarrick J. Wong DECLARE_EVENT_CLASS(xrep_rmap_class,
1136718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1137718fa74bSDarrick J. Wong 		 xfs_agblock_t agbno, xfs_extlen_t len,
1138718fa74bSDarrick J. Wong 		 uint64_t owner, uint64_t offset, unsigned int flags),
1139718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags),
1140718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1141718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1142718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1143718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, agbno)
1144718fa74bSDarrick J. Wong 		__field(xfs_extlen_t, len)
1145718fa74bSDarrick J. Wong 		__field(uint64_t, owner)
1146718fa74bSDarrick J. Wong 		__field(uint64_t, offset)
1147718fa74bSDarrick J. Wong 		__field(unsigned int, flags)
1148718fa74bSDarrick J. Wong 	),
1149718fa74bSDarrick J. Wong 	TP_fast_assign(
1150718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1151718fa74bSDarrick J. Wong 		__entry->agno = agno;
1152718fa74bSDarrick J. Wong 		__entry->agbno = agbno;
1153718fa74bSDarrick J. Wong 		__entry->len = len;
1154718fa74bSDarrick J. Wong 		__entry->owner = owner;
1155718fa74bSDarrick J. Wong 		__entry->offset = offset;
1156718fa74bSDarrick J. Wong 		__entry->flags = flags;
1157718fa74bSDarrick J. Wong 	),
11587989acccSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x",
1159718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1160718fa74bSDarrick J. Wong 		  __entry->agno,
1161718fa74bSDarrick J. Wong 		  __entry->agbno,
1162718fa74bSDarrick J. Wong 		  __entry->len,
1163718fa74bSDarrick J. Wong 		  __entry->owner,
1164718fa74bSDarrick J. Wong 		  __entry->offset,
1165718fa74bSDarrick J. Wong 		  __entry->flags)
1166718fa74bSDarrick J. Wong );
1167718fa74bSDarrick J. Wong #define DEFINE_REPAIR_RMAP_EVENT(name) \
1168b5e2196eSDarrick J. Wong DEFINE_EVENT(xrep_rmap_class, name, \
1169718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \
1170718fa74bSDarrick J. Wong 		 xfs_agblock_t agbno, xfs_extlen_t len, \
1171718fa74bSDarrick J. Wong 		 uint64_t owner, uint64_t offset, unsigned int flags), \
1172718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, agbno, len, owner, offset, flags))
1173b5e2196eSDarrick J. Wong DEFINE_REPAIR_RMAP_EVENT(xrep_alloc_extent_fn);
1174b5e2196eSDarrick J. Wong DEFINE_REPAIR_RMAP_EVENT(xrep_ialloc_extent_fn);
1175b5e2196eSDarrick J. Wong DEFINE_REPAIR_RMAP_EVENT(xrep_rmap_extent_fn);
1176b5e2196eSDarrick J. Wong DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_extent_fn);
1177718fa74bSDarrick J. Wong 
1178b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_refcount_extent_fn,
1179718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1180718fa74bSDarrick J. Wong 		 struct xfs_refcount_irec *irec),
1181718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, irec),
1182718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1183718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1184718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1185718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, startblock)
1186718fa74bSDarrick J. Wong 		__field(xfs_extlen_t, blockcount)
1187718fa74bSDarrick J. Wong 		__field(xfs_nlink_t, refcount)
1188718fa74bSDarrick J. Wong 	),
1189718fa74bSDarrick J. Wong 	TP_fast_assign(
1190718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1191718fa74bSDarrick J. Wong 		__entry->agno = agno;
1192718fa74bSDarrick J. Wong 		__entry->startblock = irec->rc_startblock;
1193718fa74bSDarrick J. Wong 		__entry->blockcount = irec->rc_blockcount;
1194718fa74bSDarrick J. Wong 		__entry->refcount = irec->rc_refcount;
1195718fa74bSDarrick J. Wong 	),
11967989acccSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u",
1197718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1198718fa74bSDarrick J. Wong 		  __entry->agno,
1199718fa74bSDarrick J. Wong 		  __entry->startblock,
1200718fa74bSDarrick J. Wong 		  __entry->blockcount,
1201718fa74bSDarrick J. Wong 		  __entry->refcount)
1202718fa74bSDarrick J. Wong )
1203718fa74bSDarrick J. Wong 
1204b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_findroot_block,
1205718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno,
1206718fa74bSDarrick J. Wong 		 uint32_t magic, uint16_t level),
1207718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, agbno, magic, level),
1208718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1209718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1210718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1211718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, agbno)
1212718fa74bSDarrick J. Wong 		__field(uint32_t, magic)
1213718fa74bSDarrick J. Wong 		__field(uint16_t, level)
1214718fa74bSDarrick J. Wong 	),
1215718fa74bSDarrick J. Wong 	TP_fast_assign(
1216718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1217718fa74bSDarrick J. Wong 		__entry->agno = agno;
1218718fa74bSDarrick J. Wong 		__entry->agbno = agbno;
1219718fa74bSDarrick J. Wong 		__entry->magic = magic;
1220718fa74bSDarrick J. Wong 		__entry->level = level;
1221718fa74bSDarrick J. Wong 	),
1222f7b08163SDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x agbno 0x%x magic 0x%x level %u",
1223718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1224718fa74bSDarrick J. Wong 		  __entry->agno,
1225718fa74bSDarrick J. Wong 		  __entry->agbno,
1226718fa74bSDarrick J. Wong 		  __entry->magic,
1227718fa74bSDarrick J. Wong 		  __entry->level)
1228718fa74bSDarrick J. Wong )
1229b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_calc_ag_resblks,
1230718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1231718fa74bSDarrick J. Wong 		 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen,
1232718fa74bSDarrick J. Wong 		 xfs_agblock_t usedlen),
1233718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, icount, aglen, freelen, usedlen),
1234718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1235718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1236718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1237718fa74bSDarrick J. Wong 		__field(xfs_agino_t, icount)
1238718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, aglen)
1239718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, freelen)
1240718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, usedlen)
1241718fa74bSDarrick J. Wong 	),
1242718fa74bSDarrick J. Wong 	TP_fast_assign(
1243718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1244718fa74bSDarrick J. Wong 		__entry->agno = agno;
1245718fa74bSDarrick J. Wong 		__entry->icount = icount;
1246718fa74bSDarrick J. Wong 		__entry->aglen = aglen;
1247718fa74bSDarrick J. Wong 		__entry->freelen = freelen;
1248718fa74bSDarrick J. Wong 		__entry->usedlen = usedlen;
1249718fa74bSDarrick J. Wong 	),
12509febf39dSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x icount %u aglen %u freelen %u usedlen %u",
1251718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1252718fa74bSDarrick J. Wong 		  __entry->agno,
1253718fa74bSDarrick J. Wong 		  __entry->icount,
1254718fa74bSDarrick J. Wong 		  __entry->aglen,
1255718fa74bSDarrick J. Wong 		  __entry->freelen,
1256718fa74bSDarrick J. Wong 		  __entry->usedlen)
1257718fa74bSDarrick J. Wong )
1258b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_calc_ag_resblks_btsize,
1259718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1260718fa74bSDarrick J. Wong 		 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz,
1261718fa74bSDarrick J. Wong 		 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz),
1262718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz),
1263718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1264718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1265718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1266718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, bnobt_sz)
1267718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, inobt_sz)
1268718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, rmapbt_sz)
1269718fa74bSDarrick J. Wong 		__field(xfs_agblock_t, refcbt_sz)
1270718fa74bSDarrick J. Wong 	),
1271718fa74bSDarrick J. Wong 	TP_fast_assign(
1272718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1273718fa74bSDarrick J. Wong 		__entry->agno = agno;
1274718fa74bSDarrick J. Wong 		__entry->bnobt_sz = bnobt_sz;
1275718fa74bSDarrick J. Wong 		__entry->inobt_sz = inobt_sz;
1276718fa74bSDarrick J. Wong 		__entry->rmapbt_sz = rmapbt_sz;
1277718fa74bSDarrick J. Wong 		__entry->refcbt_sz = refcbt_sz;
1278718fa74bSDarrick J. Wong 	),
12799febf39dSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x bnobt %u inobt %u rmapbt %u refcountbt %u",
1280718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1281718fa74bSDarrick J. Wong 		  __entry->agno,
1282718fa74bSDarrick J. Wong 		  __entry->bnobt_sz,
1283718fa74bSDarrick J. Wong 		  __entry->inobt_sz,
1284718fa74bSDarrick J. Wong 		  __entry->rmapbt_sz,
1285718fa74bSDarrick J. Wong 		  __entry->refcbt_sz)
1286718fa74bSDarrick J. Wong )
1287b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_reset_counters,
1288718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp),
1289718fa74bSDarrick J. Wong 	TP_ARGS(mp),
1290718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1291718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1292718fa74bSDarrick J. Wong 	),
1293718fa74bSDarrick J. Wong 	TP_fast_assign(
1294718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1295718fa74bSDarrick J. Wong 	),
1296718fa74bSDarrick J. Wong 	TP_printk("dev %d:%d",
1297718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev))
1298718fa74bSDarrick J. Wong )
1299718fa74bSDarrick J. Wong 
1300b5e2196eSDarrick J. Wong TRACE_EVENT(xrep_ialloc_insert,
1301718fa74bSDarrick J. Wong 	TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno,
1302718fa74bSDarrick J. Wong 		 xfs_agino_t startino, uint16_t holemask, uint8_t count,
1303718fa74bSDarrick J. Wong 		 uint8_t freecount, uint64_t freemask),
1304718fa74bSDarrick J. Wong 	TP_ARGS(mp, agno, startino, holemask, count, freecount, freemask),
1305718fa74bSDarrick J. Wong 	TP_STRUCT__entry(
1306718fa74bSDarrick J. Wong 		__field(dev_t, dev)
1307718fa74bSDarrick J. Wong 		__field(xfs_agnumber_t, agno)
1308718fa74bSDarrick J. Wong 		__field(xfs_agino_t, startino)
1309718fa74bSDarrick J. Wong 		__field(uint16_t, holemask)
1310718fa74bSDarrick J. Wong 		__field(uint8_t, count)
1311718fa74bSDarrick J. Wong 		__field(uint8_t, freecount)
1312718fa74bSDarrick J. Wong 		__field(uint64_t, freemask)
1313718fa74bSDarrick J. Wong 	),
1314718fa74bSDarrick J. Wong 	TP_fast_assign(
1315718fa74bSDarrick J. Wong 		__entry->dev = mp->m_super->s_dev;
1316718fa74bSDarrick J. Wong 		__entry->agno = agno;
1317718fa74bSDarrick J. Wong 		__entry->startino = startino;
1318718fa74bSDarrick J. Wong 		__entry->holemask = holemask;
1319718fa74bSDarrick J. Wong 		__entry->count = count;
1320718fa74bSDarrick J. Wong 		__entry->freecount = freecount;
1321718fa74bSDarrick J. Wong 		__entry->freemask = freemask;
1322718fa74bSDarrick J. Wong 	),
13239febf39dSDarrick J. Wong 	TP_printk("dev %d:%d agno 0x%x startino 0x%x holemask 0x%x count %u freecount %u freemask 0x%llx",
1324718fa74bSDarrick J. Wong 		  MAJOR(__entry->dev), MINOR(__entry->dev),
1325718fa74bSDarrick J. Wong 		  __entry->agno,
1326718fa74bSDarrick J. Wong 		  __entry->startino,
1327718fa74bSDarrick J. Wong 		  __entry->holemask,
1328718fa74bSDarrick J. Wong 		  __entry->count,
1329718fa74bSDarrick J. Wong 		  __entry->freecount,
1330718fa74bSDarrick J. Wong 		  __entry->freemask)
1331718fa74bSDarrick J. Wong )
1332718fa74bSDarrick J. Wong 
1333718fa74bSDarrick J. Wong #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */
1334718fa74bSDarrick J. Wong 
133536fd6e86SDarrick J. Wong #endif /* _TRACE_XFS_SCRUB_TRACE_H */
133636fd6e86SDarrick J. Wong 
133736fd6e86SDarrick J. Wong #undef TRACE_INCLUDE_PATH
133836fd6e86SDarrick J. Wong #define TRACE_INCLUDE_PATH .
133936fd6e86SDarrick J. Wong #define TRACE_INCLUDE_FILE scrub/trace
134036fd6e86SDarrick J. Wong #include <trace/define_trace.h>
1341