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 struct xfile; 20 struct xfarray; 21 struct xfarray_sortinfo; 22 23 /* 24 * ftrace's __print_symbolic requires that all enum values be wrapped in the 25 * TRACE_DEFINE_ENUM macro so that the enum value can be encoded in the ftrace 26 * ring buffer. Somehow this was only worth mentioning in the ftrace sample 27 * code. 28 */ 29 TRACE_DEFINE_ENUM(XFS_BTNUM_BNOi); 30 TRACE_DEFINE_ENUM(XFS_BTNUM_CNTi); 31 TRACE_DEFINE_ENUM(XFS_BTNUM_BMAPi); 32 TRACE_DEFINE_ENUM(XFS_BTNUM_INOi); 33 TRACE_DEFINE_ENUM(XFS_BTNUM_FINOi); 34 TRACE_DEFINE_ENUM(XFS_BTNUM_RMAPi); 35 TRACE_DEFINE_ENUM(XFS_BTNUM_REFCi); 36 37 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_SHARED); 38 TRACE_DEFINE_ENUM(XFS_REFC_DOMAIN_COW); 39 40 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PROBE); 41 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SB); 42 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGF); 43 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGFL); 44 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_AGI); 45 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BNOBT); 46 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_CNTBT); 47 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INOBT); 48 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FINOBT); 49 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RMAPBT); 50 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_REFCNTBT); 51 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_INODE); 52 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTD); 53 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTA); 54 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_BMBTC); 55 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_DIR); 56 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_XATTR); 57 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_SYMLINK); 58 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PARENT); 59 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTBITMAP); 60 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_RTSUM); 61 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_UQUOTA); 62 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_GQUOTA); 63 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_PQUOTA); 64 TRACE_DEFINE_ENUM(XFS_SCRUB_TYPE_FSCOUNTERS); 65 66 #define XFS_SCRUB_TYPE_STRINGS \ 67 { XFS_SCRUB_TYPE_PROBE, "probe" }, \ 68 { XFS_SCRUB_TYPE_SB, "sb" }, \ 69 { XFS_SCRUB_TYPE_AGF, "agf" }, \ 70 { XFS_SCRUB_TYPE_AGFL, "agfl" }, \ 71 { XFS_SCRUB_TYPE_AGI, "agi" }, \ 72 { XFS_SCRUB_TYPE_BNOBT, "bnobt" }, \ 73 { XFS_SCRUB_TYPE_CNTBT, "cntbt" }, \ 74 { XFS_SCRUB_TYPE_INOBT, "inobt" }, \ 75 { XFS_SCRUB_TYPE_FINOBT, "finobt" }, \ 76 { XFS_SCRUB_TYPE_RMAPBT, "rmapbt" }, \ 77 { XFS_SCRUB_TYPE_REFCNTBT, "refcountbt" }, \ 78 { XFS_SCRUB_TYPE_INODE, "inode" }, \ 79 { XFS_SCRUB_TYPE_BMBTD, "bmapbtd" }, \ 80 { XFS_SCRUB_TYPE_BMBTA, "bmapbta" }, \ 81 { XFS_SCRUB_TYPE_BMBTC, "bmapbtc" }, \ 82 { XFS_SCRUB_TYPE_DIR, "directory" }, \ 83 { XFS_SCRUB_TYPE_XATTR, "xattr" }, \ 84 { XFS_SCRUB_TYPE_SYMLINK, "symlink" }, \ 85 { XFS_SCRUB_TYPE_PARENT, "parent" }, \ 86 { XFS_SCRUB_TYPE_RTBITMAP, "rtbitmap" }, \ 87 { XFS_SCRUB_TYPE_RTSUM, "rtsummary" }, \ 88 { XFS_SCRUB_TYPE_UQUOTA, "usrquota" }, \ 89 { XFS_SCRUB_TYPE_GQUOTA, "grpquota" }, \ 90 { XFS_SCRUB_TYPE_PQUOTA, "prjquota" }, \ 91 { XFS_SCRUB_TYPE_FSCOUNTERS, "fscounters" } 92 93 #define XFS_SCRUB_FLAG_STRINGS \ 94 { XFS_SCRUB_IFLAG_REPAIR, "repair" }, \ 95 { XFS_SCRUB_OFLAG_CORRUPT, "corrupt" }, \ 96 { XFS_SCRUB_OFLAG_PREEN, "preen" }, \ 97 { XFS_SCRUB_OFLAG_XFAIL, "xfail" }, \ 98 { XFS_SCRUB_OFLAG_XCORRUPT, "xcorrupt" }, \ 99 { XFS_SCRUB_OFLAG_INCOMPLETE, "incomplete" }, \ 100 { XFS_SCRUB_OFLAG_WARNING, "warning" }, \ 101 { XFS_SCRUB_OFLAG_NO_REPAIR_NEEDED, "norepair" }, \ 102 { XFS_SCRUB_IFLAG_FORCE_REBUILD, "rebuild" } 103 104 #define XFS_SCRUB_STATE_STRINGS \ 105 { XCHK_TRY_HARDER, "try_harder" }, \ 106 { XCHK_HAVE_FREEZE_PROT, "nofreeze" }, \ 107 { XCHK_FSGATES_DRAIN, "fsgates_drain" }, \ 108 { XCHK_NEED_DRAIN, "need_drain" }, \ 109 { XREP_ALREADY_FIXED, "already_fixed" } 110 111 DECLARE_EVENT_CLASS(xchk_class, 112 TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, 113 int error), 114 TP_ARGS(ip, sm, error), 115 TP_STRUCT__entry( 116 __field(dev_t, dev) 117 __field(xfs_ino_t, ino) 118 __field(unsigned int, type) 119 __field(xfs_agnumber_t, agno) 120 __field(xfs_ino_t, inum) 121 __field(unsigned int, gen) 122 __field(unsigned int, flags) 123 __field(int, error) 124 ), 125 TP_fast_assign( 126 __entry->dev = ip->i_mount->m_super->s_dev; 127 __entry->ino = ip->i_ino; 128 __entry->type = sm->sm_type; 129 __entry->agno = sm->sm_agno; 130 __entry->inum = sm->sm_ino; 131 __entry->gen = sm->sm_gen; 132 __entry->flags = sm->sm_flags; 133 __entry->error = error; 134 ), 135 TP_printk("dev %d:%d ino 0x%llx type %s agno 0x%x inum 0x%llx gen 0x%x flags (%s) error %d", 136 MAJOR(__entry->dev), MINOR(__entry->dev), 137 __entry->ino, 138 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 139 __entry->agno, 140 __entry->inum, 141 __entry->gen, 142 __print_flags(__entry->flags, "|", XFS_SCRUB_FLAG_STRINGS), 143 __entry->error) 144 ) 145 #define DEFINE_SCRUB_EVENT(name) \ 146 DEFINE_EVENT(xchk_class, name, \ 147 TP_PROTO(struct xfs_inode *ip, struct xfs_scrub_metadata *sm, \ 148 int error), \ 149 TP_ARGS(ip, sm, error)) 150 151 DEFINE_SCRUB_EVENT(xchk_start); 152 DEFINE_SCRUB_EVENT(xchk_done); 153 DEFINE_SCRUB_EVENT(xchk_deadlock_retry); 154 DEFINE_SCRUB_EVENT(xrep_attempt); 155 DEFINE_SCRUB_EVENT(xrep_done); 156 157 DECLARE_EVENT_CLASS(xchk_fsgate_class, 158 TP_PROTO(struct xfs_scrub *sc, unsigned int fsgate_flags), 159 TP_ARGS(sc, fsgate_flags), 160 TP_STRUCT__entry( 161 __field(dev_t, dev) 162 __field(unsigned int, type) 163 __field(unsigned int, fsgate_flags) 164 ), 165 TP_fast_assign( 166 __entry->dev = sc->mp->m_super->s_dev; 167 __entry->type = sc->sm->sm_type; 168 __entry->fsgate_flags = fsgate_flags; 169 ), 170 TP_printk("dev %d:%d type %s fsgates '%s'", 171 MAJOR(__entry->dev), MINOR(__entry->dev), 172 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 173 __print_flags(__entry->fsgate_flags, "|", XFS_SCRUB_STATE_STRINGS)) 174 ) 175 176 #define DEFINE_SCRUB_FSHOOK_EVENT(name) \ 177 DEFINE_EVENT(xchk_fsgate_class, name, \ 178 TP_PROTO(struct xfs_scrub *sc, unsigned int fsgates_flags), \ 179 TP_ARGS(sc, fsgates_flags)) 180 181 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_enable); 182 DEFINE_SCRUB_FSHOOK_EVENT(xchk_fsgates_disable); 183 184 TRACE_EVENT(xchk_op_error, 185 TP_PROTO(struct xfs_scrub *sc, xfs_agnumber_t agno, 186 xfs_agblock_t bno, int error, void *ret_ip), 187 TP_ARGS(sc, agno, bno, error, ret_ip), 188 TP_STRUCT__entry( 189 __field(dev_t, dev) 190 __field(unsigned int, type) 191 __field(xfs_agnumber_t, agno) 192 __field(xfs_agblock_t, bno) 193 __field(int, error) 194 __field(void *, ret_ip) 195 ), 196 TP_fast_assign( 197 __entry->dev = sc->mp->m_super->s_dev; 198 __entry->type = sc->sm->sm_type; 199 __entry->agno = agno; 200 __entry->bno = bno; 201 __entry->error = error; 202 __entry->ret_ip = ret_ip; 203 ), 204 TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x error %d ret_ip %pS", 205 MAJOR(__entry->dev), MINOR(__entry->dev), 206 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 207 __entry->agno, 208 __entry->bno, 209 __entry->error, 210 __entry->ret_ip) 211 ); 212 213 TRACE_EVENT(xchk_file_op_error, 214 TP_PROTO(struct xfs_scrub *sc, int whichfork, 215 xfs_fileoff_t offset, int error, void *ret_ip), 216 TP_ARGS(sc, whichfork, offset, error, ret_ip), 217 TP_STRUCT__entry( 218 __field(dev_t, dev) 219 __field(xfs_ino_t, ino) 220 __field(int, whichfork) 221 __field(unsigned int, type) 222 __field(xfs_fileoff_t, offset) 223 __field(int, error) 224 __field(void *, ret_ip) 225 ), 226 TP_fast_assign( 227 __entry->dev = sc->ip->i_mount->m_super->s_dev; 228 __entry->ino = sc->ip->i_ino; 229 __entry->whichfork = whichfork; 230 __entry->type = sc->sm->sm_type; 231 __entry->offset = offset; 232 __entry->error = error; 233 __entry->ret_ip = ret_ip; 234 ), 235 TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx error %d ret_ip %pS", 236 MAJOR(__entry->dev), MINOR(__entry->dev), 237 __entry->ino, 238 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 239 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 240 __entry->offset, 241 __entry->error, 242 __entry->ret_ip) 243 ); 244 245 DECLARE_EVENT_CLASS(xchk_block_error_class, 246 TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, void *ret_ip), 247 TP_ARGS(sc, daddr, ret_ip), 248 TP_STRUCT__entry( 249 __field(dev_t, dev) 250 __field(unsigned int, type) 251 __field(xfs_agnumber_t, agno) 252 __field(xfs_agblock_t, agbno) 253 __field(void *, ret_ip) 254 ), 255 TP_fast_assign( 256 __entry->dev = sc->mp->m_super->s_dev; 257 __entry->type = sc->sm->sm_type; 258 __entry->agno = xfs_daddr_to_agno(sc->mp, daddr); 259 __entry->agbno = xfs_daddr_to_agbno(sc->mp, daddr); 260 __entry->ret_ip = ret_ip; 261 ), 262 TP_printk("dev %d:%d type %s agno 0x%x agbno 0x%x ret_ip %pS", 263 MAJOR(__entry->dev), MINOR(__entry->dev), 264 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 265 __entry->agno, 266 __entry->agbno, 267 __entry->ret_ip) 268 ) 269 270 #define DEFINE_SCRUB_BLOCK_ERROR_EVENT(name) \ 271 DEFINE_EVENT(xchk_block_error_class, name, \ 272 TP_PROTO(struct xfs_scrub *sc, xfs_daddr_t daddr, \ 273 void *ret_ip), \ 274 TP_ARGS(sc, daddr, ret_ip)) 275 276 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_fs_error); 277 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_error); 278 DEFINE_SCRUB_BLOCK_ERROR_EVENT(xchk_block_preen); 279 280 DECLARE_EVENT_CLASS(xchk_ino_error_class, 281 TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, void *ret_ip), 282 TP_ARGS(sc, ino, ret_ip), 283 TP_STRUCT__entry( 284 __field(dev_t, dev) 285 __field(xfs_ino_t, ino) 286 __field(unsigned int, type) 287 __field(void *, ret_ip) 288 ), 289 TP_fast_assign( 290 __entry->dev = sc->mp->m_super->s_dev; 291 __entry->ino = ino; 292 __entry->type = sc->sm->sm_type; 293 __entry->ret_ip = ret_ip; 294 ), 295 TP_printk("dev %d:%d ino 0x%llx type %s ret_ip %pS", 296 MAJOR(__entry->dev), MINOR(__entry->dev), 297 __entry->ino, 298 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 299 __entry->ret_ip) 300 ) 301 302 #define DEFINE_SCRUB_INO_ERROR_EVENT(name) \ 303 DEFINE_EVENT(xchk_ino_error_class, name, \ 304 TP_PROTO(struct xfs_scrub *sc, xfs_ino_t ino, \ 305 void *ret_ip), \ 306 TP_ARGS(sc, ino, ret_ip)) 307 308 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_error); 309 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_preen); 310 DEFINE_SCRUB_INO_ERROR_EVENT(xchk_ino_warning); 311 312 DECLARE_EVENT_CLASS(xchk_fblock_error_class, 313 TP_PROTO(struct xfs_scrub *sc, int whichfork, 314 xfs_fileoff_t offset, void *ret_ip), 315 TP_ARGS(sc, whichfork, offset, ret_ip), 316 TP_STRUCT__entry( 317 __field(dev_t, dev) 318 __field(xfs_ino_t, ino) 319 __field(int, whichfork) 320 __field(unsigned int, type) 321 __field(xfs_fileoff_t, offset) 322 __field(void *, ret_ip) 323 ), 324 TP_fast_assign( 325 __entry->dev = sc->ip->i_mount->m_super->s_dev; 326 __entry->ino = sc->ip->i_ino; 327 __entry->whichfork = whichfork; 328 __entry->type = sc->sm->sm_type; 329 __entry->offset = offset; 330 __entry->ret_ip = ret_ip; 331 ), 332 TP_printk("dev %d:%d ino 0x%llx fork %s type %s fileoff 0x%llx ret_ip %pS", 333 MAJOR(__entry->dev), MINOR(__entry->dev), 334 __entry->ino, 335 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 336 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 337 __entry->offset, 338 __entry->ret_ip) 339 ); 340 341 #define DEFINE_SCRUB_FBLOCK_ERROR_EVENT(name) \ 342 DEFINE_EVENT(xchk_fblock_error_class, name, \ 343 TP_PROTO(struct xfs_scrub *sc, int whichfork, \ 344 xfs_fileoff_t offset, void *ret_ip), \ 345 TP_ARGS(sc, whichfork, offset, ret_ip)) 346 347 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_error); 348 DEFINE_SCRUB_FBLOCK_ERROR_EVENT(xchk_fblock_warning); 349 350 TRACE_EVENT(xchk_incomplete, 351 TP_PROTO(struct xfs_scrub *sc, void *ret_ip), 352 TP_ARGS(sc, ret_ip), 353 TP_STRUCT__entry( 354 __field(dev_t, dev) 355 __field(unsigned int, type) 356 __field(void *, ret_ip) 357 ), 358 TP_fast_assign( 359 __entry->dev = sc->mp->m_super->s_dev; 360 __entry->type = sc->sm->sm_type; 361 __entry->ret_ip = ret_ip; 362 ), 363 TP_printk("dev %d:%d type %s ret_ip %pS", 364 MAJOR(__entry->dev), MINOR(__entry->dev), 365 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 366 __entry->ret_ip) 367 ); 368 369 TRACE_EVENT(xchk_btree_op_error, 370 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 371 int level, int error, void *ret_ip), 372 TP_ARGS(sc, cur, level, error, ret_ip), 373 TP_STRUCT__entry( 374 __field(dev_t, dev) 375 __field(unsigned int, type) 376 __field(xfs_btnum_t, btnum) 377 __field(int, level) 378 __field(xfs_agnumber_t, agno) 379 __field(xfs_agblock_t, bno) 380 __field(int, ptr) 381 __field(int, error) 382 __field(void *, ret_ip) 383 ), 384 TP_fast_assign( 385 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 386 387 __entry->dev = sc->mp->m_super->s_dev; 388 __entry->type = sc->sm->sm_type; 389 __entry->btnum = cur->bc_btnum; 390 __entry->level = level; 391 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 392 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 393 __entry->ptr = cur->bc_levels[level].ptr; 394 __entry->error = error; 395 __entry->ret_ip = ret_ip; 396 ), 397 TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x error %d ret_ip %pS", 398 MAJOR(__entry->dev), MINOR(__entry->dev), 399 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 400 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 401 __entry->level, 402 __entry->ptr, 403 __entry->agno, 404 __entry->bno, 405 __entry->error, 406 __entry->ret_ip) 407 ); 408 409 TRACE_EVENT(xchk_ifork_btree_op_error, 410 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 411 int level, int error, void *ret_ip), 412 TP_ARGS(sc, cur, level, error, ret_ip), 413 TP_STRUCT__entry( 414 __field(dev_t, dev) 415 __field(xfs_ino_t, ino) 416 __field(int, whichfork) 417 __field(unsigned int, type) 418 __field(xfs_btnum_t, btnum) 419 __field(int, level) 420 __field(int, ptr) 421 __field(xfs_agnumber_t, agno) 422 __field(xfs_agblock_t, bno) 423 __field(int, error) 424 __field(void *, ret_ip) 425 ), 426 TP_fast_assign( 427 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 428 __entry->dev = sc->mp->m_super->s_dev; 429 __entry->ino = sc->ip->i_ino; 430 __entry->whichfork = cur->bc_ino.whichfork; 431 __entry->type = sc->sm->sm_type; 432 __entry->btnum = cur->bc_btnum; 433 __entry->level = level; 434 __entry->ptr = cur->bc_levels[level].ptr; 435 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 436 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 437 __entry->error = error; 438 __entry->ret_ip = ret_ip; 439 ), 440 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", 441 MAJOR(__entry->dev), MINOR(__entry->dev), 442 __entry->ino, 443 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 444 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 445 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 446 __entry->level, 447 __entry->ptr, 448 __entry->agno, 449 __entry->bno, 450 __entry->error, 451 __entry->ret_ip) 452 ); 453 454 TRACE_EVENT(xchk_btree_error, 455 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 456 int level, void *ret_ip), 457 TP_ARGS(sc, cur, level, ret_ip), 458 TP_STRUCT__entry( 459 __field(dev_t, dev) 460 __field(unsigned int, type) 461 __field(xfs_btnum_t, btnum) 462 __field(int, level) 463 __field(xfs_agnumber_t, agno) 464 __field(xfs_agblock_t, bno) 465 __field(int, ptr) 466 __field(void *, ret_ip) 467 ), 468 TP_fast_assign( 469 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 470 __entry->dev = sc->mp->m_super->s_dev; 471 __entry->type = sc->sm->sm_type; 472 __entry->btnum = cur->bc_btnum; 473 __entry->level = level; 474 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 475 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 476 __entry->ptr = cur->bc_levels[level].ptr; 477 __entry->ret_ip = ret_ip; 478 ), 479 TP_printk("dev %d:%d type %s btree %s level %d ptr %d agno 0x%x agbno 0x%x ret_ip %pS", 480 MAJOR(__entry->dev), MINOR(__entry->dev), 481 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 482 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 483 __entry->level, 484 __entry->ptr, 485 __entry->agno, 486 __entry->bno, 487 __entry->ret_ip) 488 ); 489 490 TRACE_EVENT(xchk_ifork_btree_error, 491 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 492 int level, void *ret_ip), 493 TP_ARGS(sc, cur, level, ret_ip), 494 TP_STRUCT__entry( 495 __field(dev_t, dev) 496 __field(xfs_ino_t, ino) 497 __field(int, whichfork) 498 __field(unsigned int, type) 499 __field(xfs_btnum_t, btnum) 500 __field(int, level) 501 __field(xfs_agnumber_t, agno) 502 __field(xfs_agblock_t, bno) 503 __field(int, ptr) 504 __field(void *, ret_ip) 505 ), 506 TP_fast_assign( 507 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 508 __entry->dev = sc->mp->m_super->s_dev; 509 __entry->ino = cur->bc_ino.ip->i_ino; 510 __entry->whichfork = cur->bc_ino.whichfork; 511 __entry->type = sc->sm->sm_type; 512 __entry->btnum = cur->bc_btnum; 513 __entry->level = level; 514 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 515 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 516 __entry->ptr = cur->bc_levels[level].ptr; 517 __entry->ret_ip = ret_ip; 518 ), 519 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", 520 MAJOR(__entry->dev), MINOR(__entry->dev), 521 __entry->ino, 522 __print_symbolic(__entry->whichfork, XFS_WHICHFORK_STRINGS), 523 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 524 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 525 __entry->level, 526 __entry->ptr, 527 __entry->agno, 528 __entry->bno, 529 __entry->ret_ip) 530 ); 531 532 DECLARE_EVENT_CLASS(xchk_sbtree_class, 533 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, 534 int level), 535 TP_ARGS(sc, cur, level), 536 TP_STRUCT__entry( 537 __field(dev_t, dev) 538 __field(int, type) 539 __field(xfs_btnum_t, btnum) 540 __field(xfs_agnumber_t, agno) 541 __field(xfs_agblock_t, bno) 542 __field(int, level) 543 __field(int, nlevels) 544 __field(int, ptr) 545 ), 546 TP_fast_assign( 547 xfs_fsblock_t fsbno = xchk_btree_cur_fsbno(cur, level); 548 549 __entry->dev = sc->mp->m_super->s_dev; 550 __entry->type = sc->sm->sm_type; 551 __entry->btnum = cur->bc_btnum; 552 __entry->agno = XFS_FSB_TO_AGNO(cur->bc_mp, fsbno); 553 __entry->bno = XFS_FSB_TO_AGBNO(cur->bc_mp, fsbno); 554 __entry->level = level; 555 __entry->nlevels = cur->bc_nlevels; 556 __entry->ptr = cur->bc_levels[level].ptr; 557 ), 558 TP_printk("dev %d:%d type %s btree %s agno 0x%x agbno 0x%x level %d nlevels %d ptr %d", 559 MAJOR(__entry->dev), MINOR(__entry->dev), 560 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 561 __print_symbolic(__entry->btnum, XFS_BTNUM_STRINGS), 562 __entry->agno, 563 __entry->bno, 564 __entry->level, 565 __entry->nlevels, 566 __entry->ptr) 567 ) 568 #define DEFINE_SCRUB_SBTREE_EVENT(name) \ 569 DEFINE_EVENT(xchk_sbtree_class, name, \ 570 TP_PROTO(struct xfs_scrub *sc, struct xfs_btree_cur *cur, \ 571 int level), \ 572 TP_ARGS(sc, cur, level)) 573 574 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_rec); 575 DEFINE_SCRUB_SBTREE_EVENT(xchk_btree_key); 576 577 TRACE_EVENT(xchk_xref_error, 578 TP_PROTO(struct xfs_scrub *sc, int error, void *ret_ip), 579 TP_ARGS(sc, error, ret_ip), 580 TP_STRUCT__entry( 581 __field(dev_t, dev) 582 __field(int, type) 583 __field(int, error) 584 __field(void *, ret_ip) 585 ), 586 TP_fast_assign( 587 __entry->dev = sc->mp->m_super->s_dev; 588 __entry->type = sc->sm->sm_type; 589 __entry->error = error; 590 __entry->ret_ip = ret_ip; 591 ), 592 TP_printk("dev %d:%d type %s xref error %d ret_ip %pS", 593 MAJOR(__entry->dev), MINOR(__entry->dev), 594 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 595 __entry->error, 596 __entry->ret_ip) 597 ); 598 599 TRACE_EVENT(xchk_iallocbt_check_cluster, 600 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 601 xfs_agino_t startino, xfs_daddr_t map_daddr, 602 unsigned short map_len, unsigned int chunk_ino, 603 unsigned int nr_inodes, uint16_t cluster_mask, 604 uint16_t holemask, unsigned int cluster_ino), 605 TP_ARGS(mp, agno, startino, map_daddr, map_len, chunk_ino, nr_inodes, 606 cluster_mask, holemask, cluster_ino), 607 TP_STRUCT__entry( 608 __field(dev_t, dev) 609 __field(xfs_agnumber_t, agno) 610 __field(xfs_agino_t, startino) 611 __field(xfs_daddr_t, map_daddr) 612 __field(unsigned short, map_len) 613 __field(unsigned int, chunk_ino) 614 __field(unsigned int, nr_inodes) 615 __field(unsigned int, cluster_ino) 616 __field(uint16_t, cluster_mask) 617 __field(uint16_t, holemask) 618 ), 619 TP_fast_assign( 620 __entry->dev = mp->m_super->s_dev; 621 __entry->agno = agno; 622 __entry->startino = startino; 623 __entry->map_daddr = map_daddr; 624 __entry->map_len = map_len; 625 __entry->chunk_ino = chunk_ino; 626 __entry->nr_inodes = nr_inodes; 627 __entry->cluster_mask = cluster_mask; 628 __entry->holemask = holemask; 629 __entry->cluster_ino = cluster_ino; 630 ), 631 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", 632 MAJOR(__entry->dev), MINOR(__entry->dev), 633 __entry->agno, 634 __entry->startino, 635 __entry->map_daddr, 636 __entry->map_len, 637 __entry->chunk_ino, 638 __entry->nr_inodes, 639 __entry->cluster_mask, 640 __entry->holemask, 641 __entry->cluster_ino) 642 ) 643 644 TRACE_EVENT(xchk_inode_is_allocated, 645 TP_PROTO(struct xfs_inode *ip), 646 TP_ARGS(ip), 647 TP_STRUCT__entry( 648 __field(dev_t, dev) 649 __field(xfs_ino_t, ino) 650 __field(unsigned long, iflags) 651 __field(umode_t, mode) 652 ), 653 TP_fast_assign( 654 __entry->dev = VFS_I(ip)->i_sb->s_dev; 655 __entry->ino = ip->i_ino; 656 __entry->iflags = ip->i_flags; 657 __entry->mode = VFS_I(ip)->i_mode; 658 ), 659 TP_printk("dev %d:%d ino 0x%llx iflags 0x%lx mode 0x%x", 660 MAJOR(__entry->dev), MINOR(__entry->dev), 661 __entry->ino, 662 __entry->iflags, 663 __entry->mode) 664 ); 665 666 TRACE_EVENT(xchk_fscounters_calc, 667 TP_PROTO(struct xfs_mount *mp, uint64_t icount, uint64_t ifree, 668 uint64_t fdblocks, uint64_t delalloc), 669 TP_ARGS(mp, icount, ifree, fdblocks, delalloc), 670 TP_STRUCT__entry( 671 __field(dev_t, dev) 672 __field(int64_t, icount_sb) 673 __field(uint64_t, icount_calculated) 674 __field(int64_t, ifree_sb) 675 __field(uint64_t, ifree_calculated) 676 __field(int64_t, fdblocks_sb) 677 __field(uint64_t, fdblocks_calculated) 678 __field(uint64_t, delalloc) 679 ), 680 TP_fast_assign( 681 __entry->dev = mp->m_super->s_dev; 682 __entry->icount_sb = mp->m_sb.sb_icount; 683 __entry->icount_calculated = icount; 684 __entry->ifree_sb = mp->m_sb.sb_ifree; 685 __entry->ifree_calculated = ifree; 686 __entry->fdblocks_sb = mp->m_sb.sb_fdblocks; 687 __entry->fdblocks_calculated = fdblocks; 688 __entry->delalloc = delalloc; 689 ), 690 TP_printk("dev %d:%d icount %lld:%llu ifree %lld::%llu fdblocks %lld::%llu delalloc %llu", 691 MAJOR(__entry->dev), MINOR(__entry->dev), 692 __entry->icount_sb, 693 __entry->icount_calculated, 694 __entry->ifree_sb, 695 __entry->ifree_calculated, 696 __entry->fdblocks_sb, 697 __entry->fdblocks_calculated, 698 __entry->delalloc) 699 ) 700 701 TRACE_EVENT(xchk_fscounters_within_range, 702 TP_PROTO(struct xfs_mount *mp, uint64_t expected, int64_t curr_value, 703 int64_t old_value), 704 TP_ARGS(mp, expected, curr_value, old_value), 705 TP_STRUCT__entry( 706 __field(dev_t, dev) 707 __field(uint64_t, expected) 708 __field(int64_t, curr_value) 709 __field(int64_t, old_value) 710 ), 711 TP_fast_assign( 712 __entry->dev = mp->m_super->s_dev; 713 __entry->expected = expected; 714 __entry->curr_value = curr_value; 715 __entry->old_value = old_value; 716 ), 717 TP_printk("dev %d:%d expected %llu curr_value %lld old_value %lld", 718 MAJOR(__entry->dev), MINOR(__entry->dev), 719 __entry->expected, 720 __entry->curr_value, 721 __entry->old_value) 722 ) 723 724 DECLARE_EVENT_CLASS(xchk_fsfreeze_class, 725 TP_PROTO(struct xfs_scrub *sc, int error), 726 TP_ARGS(sc, error), 727 TP_STRUCT__entry( 728 __field(dev_t, dev) 729 __field(unsigned int, type) 730 __field(int, error) 731 ), 732 TP_fast_assign( 733 __entry->dev = sc->mp->m_super->s_dev; 734 __entry->type = sc->sm->sm_type; 735 __entry->error = error; 736 ), 737 TP_printk("dev %d:%d type %s error %d", 738 MAJOR(__entry->dev), MINOR(__entry->dev), 739 __print_symbolic(__entry->type, XFS_SCRUB_TYPE_STRINGS), 740 __entry->error) 741 ); 742 #define DEFINE_XCHK_FSFREEZE_EVENT(name) \ 743 DEFINE_EVENT(xchk_fsfreeze_class, name, \ 744 TP_PROTO(struct xfs_scrub *sc, int error), \ 745 TP_ARGS(sc, error)) 746 DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsfreeze); 747 DEFINE_XCHK_FSFREEZE_EVENT(xchk_fsthaw); 748 749 TRACE_EVENT(xchk_refcount_incorrect, 750 TP_PROTO(struct xfs_perag *pag, const struct xfs_refcount_irec *irec, 751 xfs_nlink_t seen), 752 TP_ARGS(pag, irec, seen), 753 TP_STRUCT__entry( 754 __field(dev_t, dev) 755 __field(xfs_agnumber_t, agno) 756 __field(enum xfs_refc_domain, domain) 757 __field(xfs_agblock_t, startblock) 758 __field(xfs_extlen_t, blockcount) 759 __field(xfs_nlink_t, refcount) 760 __field(xfs_nlink_t, seen) 761 ), 762 TP_fast_assign( 763 __entry->dev = pag->pag_mount->m_super->s_dev; 764 __entry->agno = pag->pag_agno; 765 __entry->domain = irec->rc_domain; 766 __entry->startblock = irec->rc_startblock; 767 __entry->blockcount = irec->rc_blockcount; 768 __entry->refcount = irec->rc_refcount; 769 __entry->seen = seen; 770 ), 771 TP_printk("dev %d:%d agno 0x%x dom %s agbno 0x%x fsbcount 0x%x refcount %u seen %u", 772 MAJOR(__entry->dev), MINOR(__entry->dev), 773 __entry->agno, 774 __print_symbolic(__entry->domain, XFS_REFC_DOMAIN_STRINGS), 775 __entry->startblock, 776 __entry->blockcount, 777 __entry->refcount, 778 __entry->seen) 779 ) 780 781 TRACE_EVENT(xfile_create, 782 TP_PROTO(struct xfile *xf), 783 TP_ARGS(xf), 784 TP_STRUCT__entry( 785 __field(dev_t, dev) 786 __field(unsigned long, ino) 787 __array(char, pathname, MAXNAMELEN) 788 ), 789 TP_fast_assign( 790 char *path; 791 792 __entry->ino = file_inode(xf->file)->i_ino; 793 path = file_path(xf->file, __entry->pathname, MAXNAMELEN); 794 if (IS_ERR(path)) 795 strncpy(__entry->pathname, "(unknown)", 796 sizeof(__entry->pathname)); 797 ), 798 TP_printk("xfino 0x%lx path '%s'", 799 __entry->ino, 800 __entry->pathname) 801 ); 802 803 TRACE_EVENT(xfile_destroy, 804 TP_PROTO(struct xfile *xf), 805 TP_ARGS(xf), 806 TP_STRUCT__entry( 807 __field(unsigned long, ino) 808 __field(unsigned long long, bytes) 809 __field(loff_t, size) 810 ), 811 TP_fast_assign( 812 struct xfile_stat statbuf; 813 int ret; 814 815 ret = xfile_stat(xf, &statbuf); 816 if (!ret) { 817 __entry->bytes = statbuf.bytes; 818 __entry->size = statbuf.size; 819 } else { 820 __entry->bytes = -1; 821 __entry->size = -1; 822 } 823 __entry->ino = file_inode(xf->file)->i_ino; 824 ), 825 TP_printk("xfino 0x%lx mem_bytes 0x%llx isize 0x%llx", 826 __entry->ino, 827 __entry->bytes, 828 __entry->size) 829 ); 830 831 DECLARE_EVENT_CLASS(xfile_class, 832 TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount), 833 TP_ARGS(xf, pos, bytecount), 834 TP_STRUCT__entry( 835 __field(unsigned long, ino) 836 __field(unsigned long long, bytes_used) 837 __field(loff_t, pos) 838 __field(loff_t, size) 839 __field(unsigned long long, bytecount) 840 ), 841 TP_fast_assign( 842 struct xfile_stat statbuf; 843 int ret; 844 845 ret = xfile_stat(xf, &statbuf); 846 if (!ret) { 847 __entry->bytes_used = statbuf.bytes; 848 __entry->size = statbuf.size; 849 } else { 850 __entry->bytes_used = -1; 851 __entry->size = -1; 852 } 853 __entry->ino = file_inode(xf->file)->i_ino; 854 __entry->pos = pos; 855 __entry->bytecount = bytecount; 856 ), 857 TP_printk("xfino 0x%lx mem_bytes 0x%llx pos 0x%llx bytecount 0x%llx isize 0x%llx", 858 __entry->ino, 859 __entry->bytes_used, 860 __entry->pos, 861 __entry->bytecount, 862 __entry->size) 863 ); 864 #define DEFINE_XFILE_EVENT(name) \ 865 DEFINE_EVENT(xfile_class, name, \ 866 TP_PROTO(struct xfile *xf, loff_t pos, unsigned long long bytecount), \ 867 TP_ARGS(xf, pos, bytecount)) 868 DEFINE_XFILE_EVENT(xfile_pread); 869 DEFINE_XFILE_EVENT(xfile_pwrite); 870 DEFINE_XFILE_EVENT(xfile_seek_data); 871 DEFINE_XFILE_EVENT(xfile_get_page); 872 DEFINE_XFILE_EVENT(xfile_put_page); 873 874 TRACE_EVENT(xfarray_create, 875 TP_PROTO(struct xfarray *xfa, unsigned long long required_capacity), 876 TP_ARGS(xfa, required_capacity), 877 TP_STRUCT__entry( 878 __field(unsigned long, ino) 879 __field(uint64_t, max_nr) 880 __field(size_t, obj_size) 881 __field(int, obj_size_log) 882 __field(unsigned long long, required_capacity) 883 ), 884 TP_fast_assign( 885 __entry->max_nr = xfa->max_nr; 886 __entry->obj_size = xfa->obj_size; 887 __entry->obj_size_log = xfa->obj_size_log; 888 __entry->ino = file_inode(xfa->xfile->file)->i_ino; 889 __entry->required_capacity = required_capacity; 890 ), 891 TP_printk("xfino 0x%lx max_nr %llu reqd_nr %llu objsz %zu objszlog %d", 892 __entry->ino, 893 __entry->max_nr, 894 __entry->required_capacity, 895 __entry->obj_size, 896 __entry->obj_size_log) 897 ); 898 899 TRACE_EVENT(xfarray_isort, 900 TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi), 901 TP_ARGS(si, lo, hi), 902 TP_STRUCT__entry( 903 __field(unsigned long, ino) 904 __field(unsigned long long, lo) 905 __field(unsigned long long, hi) 906 ), 907 TP_fast_assign( 908 __entry->ino = file_inode(si->array->xfile->file)->i_ino; 909 __entry->lo = lo; 910 __entry->hi = hi; 911 ), 912 TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu", 913 __entry->ino, 914 __entry->lo, 915 __entry->hi, 916 __entry->hi - __entry->lo) 917 ); 918 919 TRACE_EVENT(xfarray_pagesort, 920 TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi), 921 TP_ARGS(si, lo, hi), 922 TP_STRUCT__entry( 923 __field(unsigned long, ino) 924 __field(unsigned long long, lo) 925 __field(unsigned long long, hi) 926 ), 927 TP_fast_assign( 928 __entry->ino = file_inode(si->array->xfile->file)->i_ino; 929 __entry->lo = lo; 930 __entry->hi = hi; 931 ), 932 TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu", 933 __entry->ino, 934 __entry->lo, 935 __entry->hi, 936 __entry->hi - __entry->lo) 937 ); 938 939 TRACE_EVENT(xfarray_qsort, 940 TP_PROTO(struct xfarray_sortinfo *si, uint64_t lo, uint64_t hi), 941 TP_ARGS(si, lo, hi), 942 TP_STRUCT__entry( 943 __field(unsigned long, ino) 944 __field(unsigned long long, lo) 945 __field(unsigned long long, hi) 946 __field(int, stack_depth) 947 __field(int, max_stack_depth) 948 ), 949 TP_fast_assign( 950 __entry->ino = file_inode(si->array->xfile->file)->i_ino; 951 __entry->lo = lo; 952 __entry->hi = hi; 953 __entry->stack_depth = si->stack_depth; 954 __entry->max_stack_depth = si->max_stack_depth; 955 ), 956 TP_printk("xfino 0x%lx lo %llu hi %llu elts %llu stack %d/%d", 957 __entry->ino, 958 __entry->lo, 959 __entry->hi, 960 __entry->hi - __entry->lo, 961 __entry->stack_depth, 962 __entry->max_stack_depth) 963 ); 964 965 TRACE_EVENT(xfarray_sort, 966 TP_PROTO(struct xfarray_sortinfo *si, size_t bytes), 967 TP_ARGS(si, bytes), 968 TP_STRUCT__entry( 969 __field(unsigned long, ino) 970 __field(unsigned long long, nr) 971 __field(size_t, obj_size) 972 __field(size_t, bytes) 973 __field(unsigned int, max_stack_depth) 974 ), 975 TP_fast_assign( 976 __entry->nr = si->array->nr; 977 __entry->obj_size = si->array->obj_size; 978 __entry->ino = file_inode(si->array->xfile->file)->i_ino; 979 __entry->bytes = bytes; 980 __entry->max_stack_depth = si->max_stack_depth; 981 ), 982 TP_printk("xfino 0x%lx nr %llu objsz %zu stack %u bytes %zu", 983 __entry->ino, 984 __entry->nr, 985 __entry->obj_size, 986 __entry->max_stack_depth, 987 __entry->bytes) 988 ); 989 990 TRACE_EVENT(xfarray_sort_stats, 991 TP_PROTO(struct xfarray_sortinfo *si, int error), 992 TP_ARGS(si, error), 993 TP_STRUCT__entry( 994 __field(unsigned long, ino) 995 #ifdef DEBUG 996 __field(unsigned long long, loads) 997 __field(unsigned long long, stores) 998 __field(unsigned long long, compares) 999 __field(unsigned long long, heapsorts) 1000 #endif 1001 __field(unsigned int, max_stack_depth) 1002 __field(unsigned int, max_stack_used) 1003 __field(int, error) 1004 ), 1005 TP_fast_assign( 1006 __entry->ino = file_inode(si->array->xfile->file)->i_ino; 1007 #ifdef DEBUG 1008 __entry->loads = si->loads; 1009 __entry->stores = si->stores; 1010 __entry->compares = si->compares; 1011 __entry->heapsorts = si->heapsorts; 1012 #endif 1013 __entry->max_stack_depth = si->max_stack_depth; 1014 __entry->max_stack_used = si->max_stack_used; 1015 __entry->error = error; 1016 ), 1017 TP_printk( 1018 #ifdef DEBUG 1019 "xfino 0x%lx loads %llu stores %llu compares %llu heapsorts %llu stack_depth %u/%u error %d", 1020 #else 1021 "xfino 0x%lx stack_depth %u/%u error %d", 1022 #endif 1023 __entry->ino, 1024 #ifdef DEBUG 1025 __entry->loads, 1026 __entry->stores, 1027 __entry->compares, 1028 __entry->heapsorts, 1029 #endif 1030 __entry->max_stack_used, 1031 __entry->max_stack_depth, 1032 __entry->error) 1033 ); 1034 1035 #ifdef CONFIG_XFS_RT 1036 TRACE_EVENT(xchk_rtsum_record_free, 1037 TP_PROTO(struct xfs_mount *mp, xfs_rtblock_t start, 1038 xfs_rtbxlen_t len, unsigned int log, loff_t pos, 1039 xfs_suminfo_t v), 1040 TP_ARGS(mp, start, len, log, pos, v), 1041 TP_STRUCT__entry( 1042 __field(dev_t, dev) 1043 __field(dev_t, rtdev) 1044 __field(xfs_rtblock_t, start) 1045 __field(unsigned long long, len) 1046 __field(unsigned int, log) 1047 __field(loff_t, pos) 1048 __field(xfs_suminfo_t, v) 1049 ), 1050 TP_fast_assign( 1051 __entry->dev = mp->m_super->s_dev; 1052 __entry->rtdev = mp->m_rtdev_targp->bt_dev; 1053 __entry->start = start; 1054 __entry->len = len; 1055 __entry->log = log; 1056 __entry->pos = pos; 1057 __entry->v = v; 1058 ), 1059 TP_printk("dev %d:%d rtdev %d:%d rtx 0x%llx rtxcount 0x%llx log %u rsumpos 0x%llx sumcount %u", 1060 MAJOR(__entry->dev), MINOR(__entry->dev), 1061 MAJOR(__entry->rtdev), MINOR(__entry->rtdev), 1062 __entry->start, 1063 __entry->len, 1064 __entry->log, 1065 __entry->pos, 1066 __entry->v) 1067 ); 1068 #endif /* CONFIG_XFS_RT */ 1069 1070 /* repair tracepoints */ 1071 #if IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) 1072 1073 DECLARE_EVENT_CLASS(xrep_extent_class, 1074 TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len), 1075 TP_ARGS(pag, agbno, len), 1076 TP_STRUCT__entry( 1077 __field(dev_t, dev) 1078 __field(xfs_agnumber_t, agno) 1079 __field(xfs_agblock_t, agbno) 1080 __field(xfs_extlen_t, len) 1081 ), 1082 TP_fast_assign( 1083 __entry->dev = pag->pag_mount->m_super->s_dev; 1084 __entry->agno = pag->pag_agno; 1085 __entry->agbno = agbno; 1086 __entry->len = len; 1087 ), 1088 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x", 1089 MAJOR(__entry->dev), MINOR(__entry->dev), 1090 __entry->agno, 1091 __entry->agbno, 1092 __entry->len) 1093 ); 1094 #define DEFINE_REPAIR_EXTENT_EVENT(name) \ 1095 DEFINE_EVENT(xrep_extent_class, name, \ 1096 TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len), \ 1097 TP_ARGS(pag, agbno, len)) 1098 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_unmap_extent); 1099 DEFINE_REPAIR_EXTENT_EVENT(xreap_dispose_free_extent); 1100 DEFINE_REPAIR_EXTENT_EVENT(xreap_agextent_binval); 1101 DEFINE_REPAIR_EXTENT_EVENT(xrep_agfl_insert); 1102 1103 DECLARE_EVENT_CLASS(xrep_reap_find_class, 1104 TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, 1105 bool crosslinked), 1106 TP_ARGS(pag, agbno, len, crosslinked), 1107 TP_STRUCT__entry( 1108 __field(dev_t, dev) 1109 __field(xfs_agnumber_t, agno) 1110 __field(xfs_agblock_t, agbno) 1111 __field(xfs_extlen_t, len) 1112 __field(bool, crosslinked) 1113 ), 1114 TP_fast_assign( 1115 __entry->dev = pag->pag_mount->m_super->s_dev; 1116 __entry->agno = pag->pag_agno; 1117 __entry->agbno = agbno; 1118 __entry->len = len; 1119 __entry->crosslinked = crosslinked; 1120 ), 1121 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x crosslinked %d", 1122 MAJOR(__entry->dev), MINOR(__entry->dev), 1123 __entry->agno, 1124 __entry->agbno, 1125 __entry->len, 1126 __entry->crosslinked ? 1 : 0) 1127 ); 1128 #define DEFINE_REPAIR_REAP_FIND_EVENT(name) \ 1129 DEFINE_EVENT(xrep_reap_find_class, name, \ 1130 TP_PROTO(struct xfs_perag *pag, xfs_agblock_t agbno, xfs_extlen_t len, \ 1131 bool crosslinked), \ 1132 TP_ARGS(pag, agbno, len, crosslinked)) 1133 DEFINE_REPAIR_REAP_FIND_EVENT(xreap_agextent_select); 1134 1135 DECLARE_EVENT_CLASS(xrep_rmap_class, 1136 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1137 xfs_agblock_t agbno, xfs_extlen_t len, 1138 uint64_t owner, uint64_t offset, unsigned int flags), 1139 TP_ARGS(mp, agno, agbno, len, owner, offset, flags), 1140 TP_STRUCT__entry( 1141 __field(dev_t, dev) 1142 __field(xfs_agnumber_t, agno) 1143 __field(xfs_agblock_t, agbno) 1144 __field(xfs_extlen_t, len) 1145 __field(uint64_t, owner) 1146 __field(uint64_t, offset) 1147 __field(unsigned int, flags) 1148 ), 1149 TP_fast_assign( 1150 __entry->dev = mp->m_super->s_dev; 1151 __entry->agno = agno; 1152 __entry->agbno = agbno; 1153 __entry->len = len; 1154 __entry->owner = owner; 1155 __entry->offset = offset; 1156 __entry->flags = flags; 1157 ), 1158 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x owner 0x%llx fileoff 0x%llx flags 0x%x", 1159 MAJOR(__entry->dev), MINOR(__entry->dev), 1160 __entry->agno, 1161 __entry->agbno, 1162 __entry->len, 1163 __entry->owner, 1164 __entry->offset, 1165 __entry->flags) 1166 ); 1167 #define DEFINE_REPAIR_RMAP_EVENT(name) \ 1168 DEFINE_EVENT(xrep_rmap_class, name, \ 1169 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, \ 1170 xfs_agblock_t agbno, xfs_extlen_t len, \ 1171 uint64_t owner, uint64_t offset, unsigned int flags), \ 1172 TP_ARGS(mp, agno, agbno, len, owner, offset, flags)) 1173 DEFINE_REPAIR_RMAP_EVENT(xrep_alloc_extent_fn); 1174 DEFINE_REPAIR_RMAP_EVENT(xrep_ialloc_extent_fn); 1175 DEFINE_REPAIR_RMAP_EVENT(xrep_rmap_extent_fn); 1176 DEFINE_REPAIR_RMAP_EVENT(xrep_bmap_extent_fn); 1177 1178 TRACE_EVENT(xrep_refcount_extent_fn, 1179 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1180 struct xfs_refcount_irec *irec), 1181 TP_ARGS(mp, agno, irec), 1182 TP_STRUCT__entry( 1183 __field(dev_t, dev) 1184 __field(xfs_agnumber_t, agno) 1185 __field(xfs_agblock_t, startblock) 1186 __field(xfs_extlen_t, blockcount) 1187 __field(xfs_nlink_t, refcount) 1188 ), 1189 TP_fast_assign( 1190 __entry->dev = mp->m_super->s_dev; 1191 __entry->agno = agno; 1192 __entry->startblock = irec->rc_startblock; 1193 __entry->blockcount = irec->rc_blockcount; 1194 __entry->refcount = irec->rc_refcount; 1195 ), 1196 TP_printk("dev %d:%d agno 0x%x agbno 0x%x fsbcount 0x%x refcount %u", 1197 MAJOR(__entry->dev), MINOR(__entry->dev), 1198 __entry->agno, 1199 __entry->startblock, 1200 __entry->blockcount, 1201 __entry->refcount) 1202 ) 1203 1204 TRACE_EVENT(xrep_findroot_block, 1205 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, xfs_agblock_t agbno, 1206 uint32_t magic, uint16_t level), 1207 TP_ARGS(mp, agno, agbno, magic, level), 1208 TP_STRUCT__entry( 1209 __field(dev_t, dev) 1210 __field(xfs_agnumber_t, agno) 1211 __field(xfs_agblock_t, agbno) 1212 __field(uint32_t, magic) 1213 __field(uint16_t, level) 1214 ), 1215 TP_fast_assign( 1216 __entry->dev = mp->m_super->s_dev; 1217 __entry->agno = agno; 1218 __entry->agbno = agbno; 1219 __entry->magic = magic; 1220 __entry->level = level; 1221 ), 1222 TP_printk("dev %d:%d agno 0x%x agbno 0x%x magic 0x%x level %u", 1223 MAJOR(__entry->dev), MINOR(__entry->dev), 1224 __entry->agno, 1225 __entry->agbno, 1226 __entry->magic, 1227 __entry->level) 1228 ) 1229 TRACE_EVENT(xrep_calc_ag_resblks, 1230 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1231 xfs_agino_t icount, xfs_agblock_t aglen, xfs_agblock_t freelen, 1232 xfs_agblock_t usedlen), 1233 TP_ARGS(mp, agno, icount, aglen, freelen, usedlen), 1234 TP_STRUCT__entry( 1235 __field(dev_t, dev) 1236 __field(xfs_agnumber_t, agno) 1237 __field(xfs_agino_t, icount) 1238 __field(xfs_agblock_t, aglen) 1239 __field(xfs_agblock_t, freelen) 1240 __field(xfs_agblock_t, usedlen) 1241 ), 1242 TP_fast_assign( 1243 __entry->dev = mp->m_super->s_dev; 1244 __entry->agno = agno; 1245 __entry->icount = icount; 1246 __entry->aglen = aglen; 1247 __entry->freelen = freelen; 1248 __entry->usedlen = usedlen; 1249 ), 1250 TP_printk("dev %d:%d agno 0x%x icount %u aglen %u freelen %u usedlen %u", 1251 MAJOR(__entry->dev), MINOR(__entry->dev), 1252 __entry->agno, 1253 __entry->icount, 1254 __entry->aglen, 1255 __entry->freelen, 1256 __entry->usedlen) 1257 ) 1258 TRACE_EVENT(xrep_calc_ag_resblks_btsize, 1259 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1260 xfs_agblock_t bnobt_sz, xfs_agblock_t inobt_sz, 1261 xfs_agblock_t rmapbt_sz, xfs_agblock_t refcbt_sz), 1262 TP_ARGS(mp, agno, bnobt_sz, inobt_sz, rmapbt_sz, refcbt_sz), 1263 TP_STRUCT__entry( 1264 __field(dev_t, dev) 1265 __field(xfs_agnumber_t, agno) 1266 __field(xfs_agblock_t, bnobt_sz) 1267 __field(xfs_agblock_t, inobt_sz) 1268 __field(xfs_agblock_t, rmapbt_sz) 1269 __field(xfs_agblock_t, refcbt_sz) 1270 ), 1271 TP_fast_assign( 1272 __entry->dev = mp->m_super->s_dev; 1273 __entry->agno = agno; 1274 __entry->bnobt_sz = bnobt_sz; 1275 __entry->inobt_sz = inobt_sz; 1276 __entry->rmapbt_sz = rmapbt_sz; 1277 __entry->refcbt_sz = refcbt_sz; 1278 ), 1279 TP_printk("dev %d:%d agno 0x%x bnobt %u inobt %u rmapbt %u refcountbt %u", 1280 MAJOR(__entry->dev), MINOR(__entry->dev), 1281 __entry->agno, 1282 __entry->bnobt_sz, 1283 __entry->inobt_sz, 1284 __entry->rmapbt_sz, 1285 __entry->refcbt_sz) 1286 ) 1287 TRACE_EVENT(xrep_reset_counters, 1288 TP_PROTO(struct xfs_mount *mp), 1289 TP_ARGS(mp), 1290 TP_STRUCT__entry( 1291 __field(dev_t, dev) 1292 ), 1293 TP_fast_assign( 1294 __entry->dev = mp->m_super->s_dev; 1295 ), 1296 TP_printk("dev %d:%d", 1297 MAJOR(__entry->dev), MINOR(__entry->dev)) 1298 ) 1299 1300 TRACE_EVENT(xrep_ialloc_insert, 1301 TP_PROTO(struct xfs_mount *mp, xfs_agnumber_t agno, 1302 xfs_agino_t startino, uint16_t holemask, uint8_t count, 1303 uint8_t freecount, uint64_t freemask), 1304 TP_ARGS(mp, agno, startino, holemask, count, freecount, freemask), 1305 TP_STRUCT__entry( 1306 __field(dev_t, dev) 1307 __field(xfs_agnumber_t, agno) 1308 __field(xfs_agino_t, startino) 1309 __field(uint16_t, holemask) 1310 __field(uint8_t, count) 1311 __field(uint8_t, freecount) 1312 __field(uint64_t, freemask) 1313 ), 1314 TP_fast_assign( 1315 __entry->dev = mp->m_super->s_dev; 1316 __entry->agno = agno; 1317 __entry->startino = startino; 1318 __entry->holemask = holemask; 1319 __entry->count = count; 1320 __entry->freecount = freecount; 1321 __entry->freemask = freemask; 1322 ), 1323 TP_printk("dev %d:%d agno 0x%x startino 0x%x holemask 0x%x count %u freecount %u freemask 0x%llx", 1324 MAJOR(__entry->dev), MINOR(__entry->dev), 1325 __entry->agno, 1326 __entry->startino, 1327 __entry->holemask, 1328 __entry->count, 1329 __entry->freecount, 1330 __entry->freemask) 1331 ) 1332 1333 #endif /* IS_ENABLED(CONFIG_XFS_ONLINE_REPAIR) */ 1334 1335 #endif /* _TRACE_XFS_SCRUB_TRACE_H */ 1336 1337 #undef TRACE_INCLUDE_PATH 1338 #define TRACE_INCLUDE_PATH . 1339 #define TRACE_INCLUDE_FILE scrub/trace 1340 #include <trace/define_trace.h> 1341