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 19 /* 20 * ftrace's __print_symbolic requires that all enum values be wrapped in the 21 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace 22 * ring buffer. Somehow this was only worth mentioning in the ftrace sample 23 * code. 24 */ 25 TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi); 26 TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi); 27 TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi); 28 TRACE_DEFINE_ENUM(XFS_BTNUM_INOi); 29 TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi); 30 TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi); 31 TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi); 32 33 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED); 34 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW); 35 36 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PROBE); 37 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SB); 38 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGF); 39 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGFL); 40 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGI); 41 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BNOBT); 42 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_CNTBT); 43 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INOBT); 44 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FINOBT); 45 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RMAPBT); 46 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_REFCNTBT); 47 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INODE); 48 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTD); 49 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTA); 50 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTC); 51 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_DIR); 52 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_XATTR); 53 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SYMLINK); 54 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PARENT); 55 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTBITMAP); 56 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTSUM); 57 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_UQUOTA); 58 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_GQUOTA); 59 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PQUOTA); 60 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS); 61 62 #define XFS_SCRUB_TYPE_STRINGS \ 63 { XFS_SCRUB_TYPE_PROBE, "probe" }, \ 64 { XFS_SCRUB_TYPE_SB, "sb" }, \ 65 { XFS_SCRUB_TYPE_AGF, "agf" }, \ 66 { XFS_SCRUB_TYPE_AGFL, "agfl" }, \ 67 { XFS_SCRUB_TYPE_AGI, "agi" }, \ 68 { XFS_SCRUB_TYPE_BNOBT, "bnobt" }, \ 69 { XFS_SCRUB_TYPE_CNTBT, "cntbt" }, \ 70 { XFS_SCRUB_TYPE_INOBT, "inobt" }, \ 71 { XFS_SCRUB_TYPE_FINOBT, "finobt" }, \ 72 { XFS_SCRUB_TYPE_RMAPBT, "rmapbt" }, \ 73 { XFS_SCRUB_TYPE_REFCNTBT, "refcountbt" }, \ 74 { XFS_SCRUB_TYPE_INODE, "inode" }, \ 75 { XFS_SCRUB_TYPE_BMBTD, "bmapbtd" }, \ 76 { XFS_SCRUB_TYPE_BMBTA, "bmapbta" }, \ 77 { XFS_SCRUB_TYPE_BMBTC, "bmapbtc" }, \ 78 { XFS_SCRUB_TYPE_DIR, "directory" }, \ 79 { XFS_SCRUB_TYPE_XATTR, "xattr" }, \ 80 { XFS_SCRUB_TYPE_SYMLINK, "symlink" }, \ 81 { XFS_SCRUB_TYPE_PARENT, "parent" }, \ 82 { XFS_SCRUB_TYPE_RTBITMAP, "rtbitmap" }, \ 83 { XFS_SCRUB_TYPE_RTSUM, "rtsummary" }, \ 84 { XFS_SCRUB_TYPE_UQUOTA, "usrquota" }, \ 85 { XFS_SCRUB_TYPE_GQUOTA, "grpquota" }, \ 86 { XFS_SCRUB_TYPE_PQUOTA, "prjquota" }, \ 87 { XFS_SCRUB_TYPE_FSCOUNTERS, "fscounters" } 88 89 #define XFS_SCRUB_FLAG_STRINGS \ 90 { XFS_SCRUB_IFLAG_REPAIR, "repair" }, \ 91 { XFS_SCRUB_OFLAG_CORRUPT, "corrupt" }, \ 92 { XFS_SCRUB_OFLAG_PREEN, "preen" }, \ 93 { XFS_SCRUB_OFLAG_XFAIL, "xfail" }, \ 94 { XFS_SCRUB_OFLAG_XCORRUPT, "xcorrupt" }, \ 95 { XFS_SCRUB_OFLAG_INCOMPLETE, "incomplete" }, \ 96 { XFS_SCRUB_OFLAG_WARNING, "warning" }, \ 97 { XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED, "norepair" } 98 99 #define XFS_SCRUB_STATE_STRINGS \ 100 { XCHK_TRY_HARDER, "try_harder" }, \ 101 { XCHK_FSGATES_DRAIN, "fsgates_drain" }, \ 102 { XCHK_NEED_DRAIN, "need_drain" }, \ 103 { XREP_ALREADY_FIXED, "already_fixed" } 104 105 DECLARE_EVENT_CLASS(xchk_class, 106 TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, 107 int error), 108 TP_ARGS(ip, sm, error), 109 TP_STRUCT__entry( 110 __field(dev_t, dev) 111 __field(xfs_ino_t, ino) 112 __field(unsigned int, type) 113 __field(xfs_agnumber_t, agno) 114 __field(xfs_ino_t, inum) 115 __field(unsigned int, gen) 116 __field(unsigned int, flags) 117 __field(int, error) 118 ), 119 TP_fast_assign( 120 __entry->dev = ip->i_mount->m_super->s_dev; 121 __entry->ino = ip->i_ino; 122 __entry->type = sm->sm_type; 123 __entry->agno = sm->sm_agno; 124 __entry->inum = sm->sm_ino; 125 __entry->gen = sm->sm_gen; 126 __entry->flags = sm->sm_flags; 127 __entry->error = error; 128 ), 129 TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d", 130 MAJOR(__entry->dev), MINOR(__entry->dev), 131 __entry->ino, 132 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 133 __entry->agno, 134 __entry->inum, 135 __entry->gen, 136 __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS), 137 __entry->error) 138 ) 139 #define DEFINE_SCRUB_EVENT(name) \ 140 DEFINE_EVENT(xchk_class, name, \ 141 TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \ 142 int error), \ 143 TP_ARGS(ip, sm, error)) 144 145 DEFINE_SCRUB_EVENT(xchk_start); 146 DEFINE_SCRUB_EVENT(xchk_done); 147 DEFINE_SCRUB_EVENT(xchk_deadlock_retry); 148 DEFINE_SCRUB_EVENT(xrep_attempt); 149 DEFINE_SCRUB_EVENT(xrep_done); 150 151 DECLARE_EVENT_CLASS(xchk_fsgate_class, 152 TP_PROTO(struct xfs_scrub *sc, unsigned int fsgate_flags), 153 TP_ARGS(sc, fsgate_flags), 154 TP_STRUCT__entry( 155 __field(dev_t, dev) 156 __field(unsigned int, type) 157 __field(unsigned int, fsgate_flags) 158 ), 159 TP_fast_assign( 160 __entry->dev = sc->mp->m_super->s_dev; 161 __entry->type = sc->sm->sm_type; 162 __entry->fsgate_flags = fsgate_flags; 163 ), 164 TP_printk("dev %d:%d type %s fsgates '%s'", 165 MAJOR(__entry->dev), MINOR(__entry->dev), 166 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 167 __print_flags(__entry->fsgate_flags, "|", XFS_SCRUB_STATE_STRINGS)) 168 ) 169 170 #define DEFINE_SCRUB_FSHOOK_EVENT(name) \ 171 DEFINE_EVENT(xchk_fsgate_class, name, \ 172 TP_PROTO(struct xfs_scrub *sc, unsigned int fsgates_flags), \ 173 TP_ARGS(sc, fsgates_flags)) 174 175 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_enable); 176 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_disable); 177 178 TRACE_EVENT(xchk_op_error, 179 TP_PROTO(struct xfs_scrub *sc, xfs_agnumber_t agno, 180 xfs_agblock_t bno, int error, void *ret_ip), 181 TP_ARGS(sc, agno, bno, error, ret_ip), 182 TP_STRUCT__entry( 183 __field(dev_t, dev) 184 __field(unsigned int, type) 185 __field(xfs_agnumber_t, agno) 186 __field(xfs_agblock_t, bno) 187 __field(int, error) 188 __field(void *, ret_ip) 189 ), 190 TP_fast_assign( 191 __entry->dev = sc->mp->m_super->s_dev; 192 __entry->type = sc->sm->sm_type; 193 __entry->agno = agno; 194 __entry->bno = bno; 195 __entry->error = error; 196 __entry->ret_ip = ret_ip; 197 ), 198 TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x error %d ret_ip %pS", 199 MAJOR(__entry->dev), MINOR(__entry->dev), 200 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 201 __entry->agno, 202 __entry->bno, 203 __entry->error, 204 __entry->ret_ip) 205 ); 206 207 TRACE_EVENT(xchk_file_op_error, 208 TP_PROTO(struct xfs_scrub *sc, int whichfork, 209 xfs_fileoff_t offset, int error, void *ret_ip), 210 TP_ARGS(sc, whichfork, offset, error, ret_ip), 211 TP_STRUCT__entry( 212 __field(dev_t, dev) 213 __field(xfs_ino_t, ino) 214 __field(int, whichfork) 215 __field(unsigned int, type) 216 __field(xfs_fileoff_t, offset) 217 __field(int, error) 218 __field(void *, ret_ip) 219 ), 220 TP_fast_assign( 221 __entry->dev = sc->ip->i_mount->m_super->s_dev; 222 __entry->ino = sc->ip->i_ino; 223 __entry->whichfork = whichfork; 224 __entry->type = sc->sm->sm_type; 225 __entry->offset = offset; 226 __entry->error = error; 227 __entry->ret_ip = ret_ip; 228 ), 229 TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx error %d ret_ip %pS", 230 MAJOR(__entry->dev), MINOR(__entry->dev), 231 __entry->ino, 232 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 233 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 234 __entry->offset, 235 __entry->error, 236 __entry->ret_ip) 237 ); 238 239 DECLARE_EVENT_CLASS(xchk_block_error_class, 240 TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, void *ret_ip), 241 TP_ARGS(sc, daddr, ret_ip), 242 TP_STRUCT__entry( 243 __field(dev_t, dev) 244 __field(unsigned int, type) 245 __field(xfs_agnumber_t, agno) 246 __field(xfs_agblock_t, agbno) 247 __field(void *, ret_ip) 248 ), 249 TP_fast_assign( 250 __entry->dev = sc->mp->m_super->s_dev; 251 __entry->type = sc->sm->sm_type; 252 __entry->agno = xfs_daddr_to_agno(sc->mp, daddr); 253 __entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr); 254 __entry->ret_ip = ret_ip; 255 ), 256 TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x ret_ip %pS", 257 MAJOR(__entry->dev), MINOR(__entry->dev), 258 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 259 __entry->agno, 260 __entry->agbno, 261 __entry->ret_ip) 262 ) 263 264 #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \ 265 DEFINE_EVENT(xchk_block_error_class, name, \ 266 TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, \ 267 void *ret_ip), \ 268 TP_ARGS(sc, daddr, ret_ip)) 269 270 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_fs_error); 271 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_error); 272 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_preen); 273 274 DECLARE_EVENT_CLASS(xchk_ino_error_class, 275 TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, void *ret_ip), 276 TP_ARGS(sc, ino, ret_ip), 277 TP_STRUCT__entry( 278 __field(dev_t, dev) 279 __field(xfs_ino_t, ino) 280 __field(unsigned int, type) 281 __field(void *, ret_ip) 282 ), 283 TP_fast_assign( 284 __entry->dev = sc->mp->m_super->s_dev; 285 __entry->ino = ino; 286 __entry->type = sc->sm->sm_type; 287 __entry->ret_ip = ret_ip; 288 ), 289 TP_printk("dev %d:%d ino 0x%llx type %s ret_ip %pS", 290 MAJOR(__entry->dev), MINOR(__entry->dev), 291 __entry->ino, 292 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 293 __entry->ret_ip) 294 ) 295 296 #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \ 297 DEFINE_EVENT(xchk_ino_error_class, name, \ 298 TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, \ 299 void *ret_ip), \ 300 TP_ARGS(sc, ino, ret_ip)) 301 302 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_error); 303 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_preen); 304 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_warning); 305 306 DECLARE_EVENT_CLASS(xchk_fblock_error_class, 307 TP_PROTO(struct xfs_scrub *sc, int whichfork, 308 xfs_fileoff_t offset, void *ret_ip), 309 TP_ARGS(sc, whichfork, offset, ret_ip), 310 TP_STRUCT__entry( 311 __field(dev_t, dev) 312 __field(xfs_ino_t, ino) 313 __field(int, whichfork) 314 __field(unsigned int, type) 315 __field(xfs_fileoff_t, offset) 316 __field(void *, ret_ip) 317 ), 318 TP_fast_assign( 319 __entry->dev = sc->ip->i_mount->m_super->s_dev; 320 __entry->ino = sc->ip->i_ino; 321 __entry->whichfork = whichfork; 322 __entry->type = sc->sm->sm_type; 323 __entry->offset = offset; 324 __entry->ret_ip = ret_ip; 325 ), 326 TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx ret_ip %pS", 327 MAJOR(__entry->dev), MINOR(__entry->dev), 328 __entry->ino, 329 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 330 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 331 __entry->offset, 332 __entry->ret_ip) 333 ); 334 335 #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \ 336 DEFINE_EVENT(xchk_fblock_error_class, name, \ 337 TP_PROTO(struct xfs_scrub *sc, int whichfork, \ 338 xfs_fileoff_t offset, void *ret_ip), \ 339 TP_ARGS(sc, whichfork, offset, ret_ip)) 340 341 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_error); 342 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_warning); 343 344 TRACE_EVENT(xchk_incomplete, 345 TP_PROTO(struct xfs_scrub *sc, void *ret_ip), 346 TP_ARGS(sc, ret_ip), 347 TP_STRUCT__entry( 348 __field(dev_t, dev) 349 __field(unsigned int, type) 350 __field(void *, ret_ip) 351 ), 352 TP_fast_assign( 353 __entry->dev = sc->mp->m_super->s_dev; 354 __entry->type = sc->sm->sm_type; 355 __entry->ret_ip = ret_ip; 356 ), 357 TP_printk("dev %d:%d type %s ret_ip %pS", 358 MAJOR(__entry->dev), MINOR(__entry->dev), 359 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 360 __entry->ret_ip) 361 ); 362 363 TRACE_EVENT(xchk_btree_op_error, 364 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 365 int level, int error, void *ret_ip), 366 TP_ARGS(sc, cur, level, error, ret_ip), 367 TP_STRUCT__entry( 368 __field(dev_t, dev) 369 __field(unsigned int, type) 370 __field(xfs_btnum_t, btnum) 371 __field(int, level) 372 __field(xfs_agnumber_t, agno) 373 __field(xfs_agblock_t, bno) 374 __field(int, ptr) 375 __field(int, error) 376 __field(void *, ret_ip) 377 ), 378 TP_fast_assign( 379 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 380 381 __entry->dev = sc->mp->m_super->s_dev; 382 __entry->type = sc->sm->sm_type; 383 __entry->btnum = cur->bc_btnum; 384 __entry->level = level; 385 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 386 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 387 __entry->ptr = cur->bc_levels[level].ptr; 388 __entry->error = error; 389 __entry->ret_ip = ret_ip; 390 ), 391 TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS", 392 MAJOR(__entry->dev), MINOR(__entry->dev), 393 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 394 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 395 __entry->level, 396 __entry->ptr, 397 __entry->agno, 398 __entry->bno, 399 __entry->error, 400 __entry->ret_ip) 401 ); 402 403 TRACE_EVENT(xchk_ifork_btree_op_error, 404 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 405 int level, int error, void *ret_ip), 406 TP_ARGS(sc, cur, level, error, ret_ip), 407 TP_STRUCT__entry( 408 __field(dev_t, dev) 409 __field(xfs_ino_t, ino) 410 __field(int, whichfork) 411 __field(unsigned int, type) 412 __field(xfs_btnum_t, btnum) 413 __field(int, level) 414 __field(int, ptr) 415 __field(xfs_agnumber_t, agno) 416 __field(xfs_agblock_t, bno) 417 __field(int, error) 418 __field(void *, ret_ip) 419 ), 420 TP_fast_assign( 421 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 422 __entry->dev = sc->mp->m_super->s_dev; 423 __entry->ino = sc->ip->i_ino; 424 __entry->whichfork = cur->bc_ino.whichfork; 425 __entry->type = sc->sm->sm_type; 426 __entry->btnum = cur->bc_btnum; 427 __entry->level = level; 428 __entry->ptr = cur->bc_levels[level].ptr; 429 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 430 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 431 __entry->error = error; 432 __entry->ret_ip = ret_ip; 433 ), 434 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", 435 MAJOR(__entry->dev), MINOR(__entry->dev), 436 __entry->ino, 437 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 438 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 439 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 440 __entry->level, 441 __entry->ptr, 442 __entry->agno, 443 __entry->bno, 444 __entry->error, 445 __entry->ret_ip) 446 ); 447 448 TRACE_EVENT(xchk_btree_error, 449 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 450 int level, void *ret_ip), 451 TP_ARGS(sc, cur, level, ret_ip), 452 TP_STRUCT__entry( 453 __field(dev_t, dev) 454 __field(unsigned int, type) 455 __field(xfs_btnum_t, btnum) 456 __field(int, level) 457 __field(xfs_agnumber_t, agno) 458 __field(xfs_agblock_t, bno) 459 __field(int, ptr) 460 __field(void *, ret_ip) 461 ), 462 TP_fast_assign( 463 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 464 __entry->dev = sc->mp->m_super->s_dev; 465 __entry->type = sc->sm->sm_type; 466 __entry->btnum = cur->bc_btnum; 467 __entry->level = level; 468 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 469 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 470 __entry->ptr = cur->bc_levels[level].ptr; 471 __entry->ret_ip = ret_ip; 472 ), 473 TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS", 474 MAJOR(__entry->dev), MINOR(__entry->dev), 475 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 476 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 477 __entry->level, 478 __entry->ptr, 479 __entry->agno, 480 __entry->bno, 481 __entry->ret_ip) 482 ); 483 484 TRACE_EVENT(xchk_ifork_btree_error, 485 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 486 int level, void *ret_ip), 487 TP_ARGS(sc, cur, level, ret_ip), 488 TP_STRUCT__entry( 489 __field(dev_t, dev) 490 __field(xfs_ino_t, ino) 491 __field(int, whichfork) 492 __field(unsigned int, type) 493 __field(xfs_btnum_t, btnum) 494 __field(int, level) 495 __field(xfs_agnumber_t, agno) 496 __field(xfs_agblock_t, bno) 497 __field(int, ptr) 498 __field(void *, ret_ip) 499 ), 500 TP_fast_assign( 501 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 502 __entry->dev = sc->mp->m_super->s_dev; 503 __entry->ino = sc->ip->i_ino; 504 __entry->whichfork = cur->bc_ino.whichfork; 505 __entry->type = sc->sm->sm_type; 506 __entry->btnum = cur->bc_btnum; 507 __entry->level = level; 508 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 509 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 510 __entry->ptr = cur->bc_levels[level].ptr; 511 __entry->ret_ip = ret_ip; 512 ), 513 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", 514 MAJOR(__entry->dev), MINOR(__entry->dev), 515 __entry->ino, 516 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 517 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 518 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 519 __entry->level, 520 __entry->ptr, 521 __entry->agno, 522 __entry->bno, 523 __entry->ret_ip) 524 ); 525 526 DECLARE_EVENT_CLASS(xchk_sbtree_class, 527 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 528 int level), 529 TP_ARGS(sc, cur, level), 530 TP_STRUCT__entry( 531 __field(dev_t, dev) 532 __field(int, type) 533 __field(xfs_btnum_t, btnum) 534 __field(xfs_agnumber_t, agno) 535 __field(xfs_agblock_t, bno) 536 __field(int, level) 537 __field(int, nlevels) 538 __field(int, ptr) 539 ), 540 TP_fast_assign( 541 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 542 543 __entry->dev = sc->mp->m_super->s_dev; 544 __entry->type = sc->sm->sm_type; 545 __entry->btnum = cur->bc_btnum; 546 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 547 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 548 __entry->level = level; 549 __entry->nlevels = cur->bc_nlevels; 550 __entry->ptr = cur->bc_levels[level].ptr; 551 ), 552 TP_printk("dev %d:%d type %s btree %s agno 0x%x agbno 0x%x level %d nlevels %d ptr %d", 553 MAJOR(__entry->dev), MINOR(__entry->dev), 554 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 555 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 556 __entry->agno, 557 __entry->bno, 558 __entry->level, 559 __entry->nlevels, 560 __entry->ptr) 561 ) 562 #define DEFINE_SCRUB_SBTREE_EVENT(name) \ 563 DEFINE_EVENT(xchk_sbtree_class, name, \ 564 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, \ 565 int level), \ 566 TP_ARGS(sc, cur, level)) 567 568 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_rec); 569 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_key); 570 571 TRACE_EVENT(xchk_xref_error, 572 TP_PROTO(struct xfs_scrub *sc, int error, void *ret_ip), 573 TP_ARGS(sc, error, ret_ip), 574 TP_STRUCT__entry( 575 __field(dev_t, dev) 576 __field(int, type) 577 __field(int, error) 578 __field(void *, ret_ip) 579 ), 580 TP_fast_assign( 581 __entry->dev = sc->mp->m_super->s_dev; 582 __entry->type = sc->sm->sm_type; 583 __entry->error = error; 584 __entry->ret_ip = ret_ip; 585 ), 586 TP_printk("dev %d:%d type %s xref error %d ret_ip %pS", 587 MAJOR(__entry->dev), MINOR(__entry->dev), 588 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 589 __entry->error, 590 __entry->ret_ip) 591 ); 592 593 TRACE_EVENT(xchk_iallocbt_check_cluster, 594 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 595 xfs_agino_t startino, xfs_daddr_t map_daddr, 596 unsigned short map_len, unsigned int chunk_ino, 597 unsigned int nr_inodes, uint16_t cluster_mask, 598 uint16_t holemask, unsigned int cluster_ino), 599 TP_ARGS(mp, agno, startino, map_daddr, map_len, chunk_ino, nr_inodes, 600 cluster_mask, holemask, cluster_ino), 601 TP_STRUCT__entry( 602 __field(dev_t, dev) 603 __field(xfs_agnumber_t, agno) 604 __field(xfs_agino_t, startino) 605 __field(xfs_daddr_t, map_daddr) 606 __field(unsigned short, map_len) 607 __field(unsigned int, chunk_ino) 608 __field(unsigned int, nr_inodes) 609 __field(unsigned int, cluster_ino) 610 __field(uint16_t, cluster_mask) 611 __field(uint16_t, holemask) 612 ), 613 TP_fast_assign( 614 __entry->dev = mp->m_super->s_dev; 615 __entry->agno = agno; 616 __entry->startino = startino; 617 __entry->map_daddr = map_daddr; 618 __entry->map_len = map_len; 619 __entry->chunk_ino = chunk_ino; 620 __entry->nr_inodes = nr_inodes; 621 __entry->cluster_mask = cluster_mask; 622 __entry->holemask = holemask; 623 __entry->cluster_ino = cluster_ino; 624 ), 625 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", 626 MAJOR(__entry->dev), MINOR(__entry->dev), 627 __entry->agno, 628 __entry->startino, 629 __entry->map_daddr, 630 __entry->map_len, 631 __entry->chunk_ino, 632 __entry->nr_inodes, 633 __entry->cluster_mask, 634 __entry->holemask, 635 __entry->cluster_ino) 636 ) 637 638 TRACE_EVENT(xchk_fscounters_calc, 639 TP_PROTO(struct xfs_mount *mp, uint64_t icount, uint64_t ifree, 640 uint64_t fdblocks, uint64_t delalloc), 641 TP_ARGS(mp, icount, ifree, fdblocks, delalloc), 642 TP_STRUCT__entry( 643 __field(dev_t, dev) 644 __field(int64_t, icount_sb) 645 __field(uint64_t, icount_calculated) 646 __field(int64_t, ifree_sb) 647 __field(uint64_t, ifree_calculated) 648 __field(int64_t, fdblocks_sb) 649 __field(uint64_t, fdblocks_calculated) 650 __field(uint64_t, delalloc) 651 ), 652 TP_fast_assign( 653 __entry->dev = mp->m_super->s_dev; 654 __entry->icount_sb = mp->m_sb.sb_icount; 655 __entry->icount_calculated = icount; 656 __entry->ifree_sb = mp->m_sb.sb_ifree; 657 __entry->ifree_calculated = ifree; 658 __entry->fdblocks_sb = mp->m_sb.sb_fdblocks; 659 __entry->fdblocks_calculated = fdblocks; 660 __entry->delalloc = delalloc; 661 ), 662 TP_printk("dev %d:%d icount %lld:%llu ifree %lld::%llu fdblocks %lld::%llu delalloc %llu", 663 MAJOR(__entry->dev), MINOR(__entry->dev), 664 __entry->icount_sb, 665 __entry->icount_calculated, 666 __entry->ifree_sb, 667 __entry->ifree_calculated, 668 __entry->fdblocks_sb, 669 __entry->fdblocks_calculated, 670 __entry->delalloc) 671 ) 672 673 TRACE_EVENT(xchk_fscounters_within_range, 674 TP_PROTO(struct xfs_mount *mp, uint64_t expected, int64_t curr_value, 675 int64_t old_value), 676 TP_ARGS(mp, expected, curr_value, old_value), 677 TP_STRUCT__entry( 678 __field(dev_t, dev) 679 __field(uint64_t, expected) 680 __field(int64_t, curr_value) 681 __field(int64_t, old_value) 682 ), 683 TP_fast_assign( 684 __entry->dev = mp->m_super->s_dev; 685 __entry->expected = expected; 686 __entry->curr_value = curr_value; 687 __entry->old_value = old_value; 688 ), 689 TP_printk("dev %d:%d expected %llu curr_value %lld old_value %lld", 690 MAJOR(__entry->dev), MINOR(__entry->dev), 691 __entry->expected, 692 __entry->curr_value, 693 __entry->old_value) 694 ) 695 696 TRACE_EVENT(xchk_refcount_incorrect, 697 TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *irec, 698 xfs_nlink_t seen), 699 TP_ARGS(pag, irec, seen), 700 TP_STRUCT__entry( 701 __field(dev_t, dev) 702 __field(xfs_agnumber_t, agno) 703 __field(enum xfs_refc_domain, domain) 704 __field(xfs_agblock_t, startblock) 705 __field(xfs_extlen_t, blockcount) 706 __field(xfs_nlink_t, refcount) 707 __field(xfs_nlink_t, seen) 708 ), 709 TP_fast_assign( 710 __entry->dev = pag->pag_mount->m_super->s_dev; 711 __entry->agno = pag->pag_agno; 712 __entry->domain = irec->rc_domain; 713 __entry->startblock = irec->rc_startblock; 714 __entry->blockcount = irec->rc_blockcount; 715 __entry->refcount = irec->rc_refcount; 716 __entry->seen = seen; 717 ), 718 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u seen %u", 719 MAJOR(__entry->dev), MINOR(__entry->dev), 720 __entry->agno, 721 __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS), 722 __entry->startblock, 723 __entry->blockcount, 724 __entry->refcount, 725 __entry->seen) 726 ) 727 728 /* repair tracepoints */ 729 #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) 730 731 DECLARE_EVENT_CLASS(xrep_extent_class, 732 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 733 xfs_agblock_t agbno, xfs_extlen_t len), 734 TP_ARGS(mp, agno, agbno, len), 735 TP_STRUCT__entry( 736 __field(dev_t, dev) 737 __field(xfs_agnumber_t, agno) 738 __field(xfs_agblock_t, agbno) 739 __field(xfs_extlen_t, len) 740 ), 741 TP_fast_assign( 742 __entry->dev = mp->m_super->s_dev; 743 __entry->agno = agno; 744 __entry->agbno = agbno; 745 __entry->len = len; 746 ), 747 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x", 748 MAJOR(__entry->dev), MINOR(__entry->dev), 749 __entry->agno, 750 __entry->agbno, 751 __entry->len) 752 ); 753 #define DEFINE_REPAIR_EXTENT_EVENT(name) \ 754 DEFINE_EVENT(xrep_extent_class, name, \ 755 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 756 xfs_agblock_t agbno, xfs_extlen_t len), \ 757 TP_ARGS(mp, agno, agbno, len)) 758 DEFINE_REPAIR_EXTENT_EVENT(xrep_dispose_btree_extent); 759 DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert); 760 761 DECLARE_EVENT_CLASS(xrep_rmap_class, 762 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 763 xfs_agblock_t agbno, xfs_extlen_t len, 764 uint64_t owner, uint64_t offset, unsigned int flags), 765 TP_ARGS(mp, agno, agbno, len, owner, offset, flags), 766 TP_STRUCT__entry( 767 __field(dev_t, dev) 768 __field(xfs_agnumber_t, agno) 769 __field(xfs_agblock_t, agbno) 770 __field(xfs_extlen_t, len) 771 __field(uint64_t, owner) 772 __field(uint64_t, offset) 773 __field(unsigned int, flags) 774 ), 775 TP_fast_assign( 776 __entry->dev = mp->m_super->s_dev; 777 __entry->agno = agno; 778 __entry->agbno = agbno; 779 __entry->len = len; 780 __entry->owner = owner; 781 __entry->offset = offset; 782 __entry->flags = flags; 783 ), 784 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x", 785 MAJOR(__entry->dev), MINOR(__entry->dev), 786 __entry->agno, 787 __entry->agbno, 788 __entry->len, 789 __entry->owner, 790 __entry->offset, 791 __entry->flags) 792 ); 793 #define DEFINE_REPAIR_RMAP_EVENT(name) \ 794 DEFINE_EVENT(xrep_rmap_class, name, \ 795 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 796 xfs_agblock_t agbno, xfs_extlen_t len, \ 797 uint64_t owner, uint64_t offset, unsigned int flags), \ 798 TP_ARGS(mp, agno, agbno, len, owner, offset, flags)) 799 DEFINE_REPAIR_RMAP_EVENT(xrep_alloc_extent_fn); 800 DEFINE_REPAIR_RMAP_EVENT(xrep_ialloc_extent_fn); 801 DEFINE_REPAIR_RMAP_EVENT(xrep_rmap_extent_fn); 802 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_extent_fn); 803 804 TRACE_EVENT(xrep_refcount_extent_fn, 805 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 806 struct xfs_refcount_irec *irec), 807 TP_ARGS(mp, agno, irec), 808 TP_STRUCT__entry( 809 __field(dev_t, dev) 810 __field(xfs_agnumber_t, agno) 811 __field(xfs_agblock_t, startblock) 812 __field(xfs_extlen_t, blockcount) 813 __field(xfs_nlink_t, refcount) 814 ), 815 TP_fast_assign( 816 __entry->dev = mp->m_super->s_dev; 817 __entry->agno = agno; 818 __entry->startblock = irec->rc_startblock; 819 __entry->blockcount = irec->rc_blockcount; 820 __entry->refcount = irec->rc_refcount; 821 ), 822 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u", 823 MAJOR(__entry->dev), MINOR(__entry->dev), 824 __entry->agno, 825 __entry->startblock, 826 __entry->blockcount, 827 __entry->refcount) 828 ) 829 830 TRACE_EVENT(xrep_init_btblock, 831 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, 832 xfs_btnum_t btnum), 833 TP_ARGS(mp, agno, agbno, btnum), 834 TP_STRUCT__entry( 835 __field(dev_t, dev) 836 __field(xfs_agnumber_t, agno) 837 __field(xfs_agblock_t, agbno) 838 __field(uint32_t, btnum) 839 ), 840 TP_fast_assign( 841 __entry->dev = mp->m_super->s_dev; 842 __entry->agno = agno; 843 __entry->agbno = agbno; 844 __entry->btnum = btnum; 845 ), 846 TP_printk("dev %d:%d agno 0x%x agbno 0x%x btree %s", 847 MAJOR(__entry->dev), MINOR(__entry->dev), 848 __entry->agno, 849 __entry->agbno, 850 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS)) 851 ) 852 TRACE_EVENT(xrep_findroot_block, 853 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, 854 uint32_t magic, uint16_t level), 855 TP_ARGS(mp, agno, agbno, magic, level), 856 TP_STRUCT__entry( 857 __field(dev_t, dev) 858 __field(xfs_agnumber_t, agno) 859 __field(xfs_agblock_t, agbno) 860 __field(uint32_t, magic) 861 __field(uint16_t, level) 862 ), 863 TP_fast_assign( 864 __entry->dev = mp->m_super->s_dev; 865 __entry->agno = agno; 866 __entry->agbno = agbno; 867 __entry->magic = magic; 868 __entry->level = level; 869 ), 870 TP_printk("dev %d:%d agno 0x%x agbno 0x%x magic 0x%x level %u", 871 MAJOR(__entry->dev), MINOR(__entry->dev), 872 __entry->agno, 873 __entry->agbno, 874 __entry->magic, 875 __entry->level) 876 ) 877 TRACE_EVENT(xrep_calc_ag_resblks, 878 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 879 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen, 880 xfs_agblock_t usedlen), 881 TP_ARGS(mp, agno, icount, aglen, freelen, usedlen), 882 TP_STRUCT__entry( 883 __field(dev_t, dev) 884 __field(xfs_agnumber_t, agno) 885 __field(xfs_agino_t, icount) 886 __field(xfs_agblock_t, aglen) 887 __field(xfs_agblock_t, freelen) 888 __field(xfs_agblock_t, usedlen) 889 ), 890 TP_fast_assign( 891 __entry->dev = mp->m_super->s_dev; 892 __entry->agno = agno; 893 __entry->icount = icount; 894 __entry->aglen = aglen; 895 __entry->freelen = freelen; 896 __entry->usedlen = usedlen; 897 ), 898 TP_printk("dev %d:%d agno 0x%x icount %u aglen %u freelen %u usedlen %u", 899 MAJOR(__entry->dev), MINOR(__entry->dev), 900 __entry->agno, 901 __entry->icount, 902 __entry->aglen, 903 __entry->freelen, 904 __entry->usedlen) 905 ) 906 TRACE_EVENT(xrep_calc_ag_resblks_btsize, 907 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 908 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz, 909 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz), 910 TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz), 911 TP_STRUCT__entry( 912 __field(dev_t, dev) 913 __field(xfs_agnumber_t, agno) 914 __field(xfs_agblock_t, bnobt_sz) 915 __field(xfs_agblock_t, inobt_sz) 916 __field(xfs_agblock_t, rmapbt_sz) 917 __field(xfs_agblock_t, refcbt_sz) 918 ), 919 TP_fast_assign( 920 __entry->dev = mp->m_super->s_dev; 921 __entry->agno = agno; 922 __entry->bnobt_sz = bnobt_sz; 923 __entry->inobt_sz = inobt_sz; 924 __entry->rmapbt_sz = rmapbt_sz; 925 __entry->refcbt_sz = refcbt_sz; 926 ), 927 TP_printk("dev %d:%d agno 0x%x bnobt %u inobt %u rmapbt %u refcountbt %u", 928 MAJOR(__entry->dev), MINOR(__entry->dev), 929 __entry->agno, 930 __entry->bnobt_sz, 931 __entry->inobt_sz, 932 __entry->rmapbt_sz, 933 __entry->refcbt_sz) 934 ) 935 TRACE_EVENT(xrep_reset_counters, 936 TP_PROTO(struct xfs_mount *mp), 937 TP_ARGS(mp), 938 TP_STRUCT__entry( 939 __field(dev_t, dev) 940 ), 941 TP_fast_assign( 942 __entry->dev = mp->m_super->s_dev; 943 ), 944 TP_printk("dev %d:%d", 945 MAJOR(__entry->dev), MINOR(__entry->dev)) 946 ) 947 948 TRACE_EVENT(xrep_ialloc_insert, 949 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 950 xfs_agino_t startino, uint16_t holemask, uint8_t count, 951 uint8_t freecount, uint64_t freemask), 952 TP_ARGS(mp, agno, startino, holemask, count, freecount, freemask), 953 TP_STRUCT__entry( 954 __field(dev_t, dev) 955 __field(xfs_agnumber_t, agno) 956 __field(xfs_agino_t, startino) 957 __field(uint16_t, holemask) 958 __field(uint8_t, count) 959 __field(uint8_t, freecount) 960 __field(uint64_t, freemask) 961 ), 962 TP_fast_assign( 963 __entry->dev = mp->m_super->s_dev; 964 __entry->agno = agno; 965 __entry->startino = startino; 966 __entry->holemask = holemask; 967 __entry->count = count; 968 __entry->freecount = freecount; 969 __entry->freemask = freemask; 970 ), 971 TP_printk("dev %d:%d agno 0x%x startino 0x%x holemask 0x%x count %u freecount %u freemask 0x%llx", 972 MAJOR(__entry->dev), MINOR(__entry->dev), 973 __entry->agno, 974 __entry->startino, 975 __entry->holemask, 976 __entry->count, 977 __entry->freecount, 978 __entry->freemask) 979 ) 980 981 #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */ 982 983 #endif /* _TRACE_XFS_SCRUB_TRACE_H */ 984 985 #undef TRACE_INCLUDE_PATH 986 #define TRACE_INCLUDE_PATH . 987 #define TRACE_INCLUDE_FILE scrub/trace 988 #include <trace/define_trace.h> 989