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