1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM f2fs 4 5 #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_F2FS_H 7 8 #include <linux/tracepoint.h> 9 #include <uapi/linux/f2fs.h> 10 11 #define show_dev(dev) MAJOR(dev), MINOR(dev) 12 #define show_dev_ino(entry) show_dev(entry->dev), (unsigned long)entry->ino 13 14 TRACE_DEFINE_ENUM(NODE); 15 TRACE_DEFINE_ENUM(DATA); 16 TRACE_DEFINE_ENUM(META); 17 TRACE_DEFINE_ENUM(META_FLUSH); 18 TRACE_DEFINE_ENUM(IPU); 19 TRACE_DEFINE_ENUM(OPU); 20 TRACE_DEFINE_ENUM(HOT); 21 TRACE_DEFINE_ENUM(WARM); 22 TRACE_DEFINE_ENUM(COLD); 23 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA); 24 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA); 25 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA); 26 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE); 27 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE); 28 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE); 29 TRACE_DEFINE_ENUM(NO_CHECK_TYPE); 30 TRACE_DEFINE_ENUM(GC_GREEDY); 31 TRACE_DEFINE_ENUM(GC_CB); 32 TRACE_DEFINE_ENUM(FG_GC); 33 TRACE_DEFINE_ENUM(BG_GC); 34 TRACE_DEFINE_ENUM(LFS); 35 TRACE_DEFINE_ENUM(SSR); 36 TRACE_DEFINE_ENUM(__REQ_RAHEAD); 37 TRACE_DEFINE_ENUM(__REQ_SYNC); 38 TRACE_DEFINE_ENUM(__REQ_IDLE); 39 TRACE_DEFINE_ENUM(__REQ_PREFLUSH); 40 TRACE_DEFINE_ENUM(__REQ_FUA); 41 TRACE_DEFINE_ENUM(__REQ_PRIO); 42 TRACE_DEFINE_ENUM(__REQ_META); 43 TRACE_DEFINE_ENUM(CP_UMOUNT); 44 TRACE_DEFINE_ENUM(CP_FASTBOOT); 45 TRACE_DEFINE_ENUM(CP_SYNC); 46 TRACE_DEFINE_ENUM(CP_RECOVERY); 47 TRACE_DEFINE_ENUM(CP_DISCARD); 48 TRACE_DEFINE_ENUM(CP_TRIMMED); 49 TRACE_DEFINE_ENUM(CP_PAUSE); 50 TRACE_DEFINE_ENUM(CP_RESIZE); 51 TRACE_DEFINE_ENUM(EX_READ); 52 TRACE_DEFINE_ENUM(EX_BLOCK_AGE); 53 54 #define show_block_type(type) \ 55 __print_symbolic(type, \ 56 { NODE, "NODE" }, \ 57 { DATA, "DATA" }, \ 58 { META, "META" }, \ 59 { META_FLUSH, "META_FLUSH" }, \ 60 { IPU, "IN-PLACE" }, \ 61 { OPU, "OUT-OF-PLACE" }) 62 63 #define show_block_temp(temp) \ 64 __print_symbolic(temp, \ 65 { HOT, "HOT" }, \ 66 { WARM, "WARM" }, \ 67 { COLD, "COLD" }) 68 69 #define F2FS_OP_FLAGS (REQ_RAHEAD | REQ_SYNC | REQ_META | REQ_PRIO | \ 70 REQ_PREFLUSH | REQ_FUA) 71 #define F2FS_BIO_FLAG_MASK(t) (__force u32)((t) & F2FS_OP_FLAGS) 72 73 #define show_bio_type(op,op_flags) show_bio_op(op), \ 74 show_bio_op_flags(op_flags) 75 76 #define show_bio_op(op) blk_op_str(op) 77 78 #define show_bio_op_flags(flags) \ 79 __print_flags(F2FS_BIO_FLAG_MASK(flags), "|", \ 80 { (__force u32)REQ_RAHEAD, "R" }, \ 81 { (__force u32)REQ_SYNC, "S" }, \ 82 { (__force u32)REQ_META, "M" }, \ 83 { (__force u32)REQ_PRIO, "P" }, \ 84 { (__force u32)REQ_PREFLUSH, "PF" }, \ 85 { (__force u32)REQ_FUA, "FUA" }) 86 87 #define show_data_type(type) \ 88 __print_symbolic(type, \ 89 { CURSEG_HOT_DATA, "Hot DATA" }, \ 90 { CURSEG_WARM_DATA, "Warm DATA" }, \ 91 { CURSEG_COLD_DATA, "Cold DATA" }, \ 92 { CURSEG_HOT_NODE, "Hot NODE" }, \ 93 { CURSEG_WARM_NODE, "Warm NODE" }, \ 94 { CURSEG_COLD_NODE, "Cold NODE" }, \ 95 { NO_CHECK_TYPE, "No TYPE" }) 96 97 #define show_file_type(type) \ 98 __print_symbolic(type, \ 99 { 0, "FILE" }, \ 100 { 1, "DIR" }) 101 102 #define show_gc_type(type) \ 103 __print_symbolic(type, \ 104 { FG_GC, "Foreground GC" }, \ 105 { BG_GC, "Background GC" }) 106 107 #define show_alloc_mode(type) \ 108 __print_symbolic(type, \ 109 { LFS, "LFS-mode" }, \ 110 { SSR, "SSR-mode" }, \ 111 { AT_SSR, "AT_SSR-mode" }) 112 113 #define show_victim_policy(type) \ 114 __print_symbolic(type, \ 115 { GC_GREEDY, "Greedy" }, \ 116 { GC_CB, "Cost-Benefit" }, \ 117 { GC_AT, "Age-threshold" }) 118 119 #define show_cpreason(type) \ 120 __print_flags(type, "|", \ 121 { CP_UMOUNT, "Umount" }, \ 122 { CP_FASTBOOT, "Fastboot" }, \ 123 { CP_SYNC, "Sync" }, \ 124 { CP_RECOVERY, "Recovery" }, \ 125 { CP_DISCARD, "Discard" }, \ 126 { CP_PAUSE, "Pause" }, \ 127 { CP_TRIMMED, "Trimmed" }, \ 128 { CP_RESIZE, "Resize" }) 129 130 #define show_fsync_cpreason(type) \ 131 __print_symbolic(type, \ 132 { CP_NO_NEEDED, "no needed" }, \ 133 { CP_NON_REGULAR, "non regular" }, \ 134 { CP_COMPRESSED, "compressed" }, \ 135 { CP_HARDLINK, "hardlink" }, \ 136 { CP_SB_NEED_CP, "sb needs cp" }, \ 137 { CP_WRONG_PINO, "wrong pino" }, \ 138 { CP_NO_SPC_ROLL, "no space roll forward" }, \ 139 { CP_NODE_NEED_CP, "node needs cp" }, \ 140 { CP_FASTBOOT_MODE, "fastboot mode" }, \ 141 { CP_SPEC_LOG_NUM, "log type is 2" }, \ 142 { CP_RECOVER_DIR, "dir needs recovery" }, \ 143 { CP_XATTR_DIR, "dir's xattr updated" }) 144 145 #define show_shutdown_mode(type) \ 146 __print_symbolic(type, \ 147 { F2FS_GOING_DOWN_FULLSYNC, "full sync" }, \ 148 { F2FS_GOING_DOWN_METASYNC, "meta sync" }, \ 149 { F2FS_GOING_DOWN_NOSYNC, "no sync" }, \ 150 { F2FS_GOING_DOWN_METAFLUSH, "meta flush" }, \ 151 { F2FS_GOING_DOWN_NEED_FSCK, "need fsck" }) 152 153 #define show_compress_algorithm(type) \ 154 __print_symbolic(type, \ 155 { COMPRESS_LZO, "LZO" }, \ 156 { COMPRESS_LZ4, "LZ4" }, \ 157 { COMPRESS_ZSTD, "ZSTD" }, \ 158 { COMPRESS_LZORLE, "LZO-RLE" }) 159 160 #define show_extent_type(type) \ 161 __print_symbolic(type, \ 162 { EX_READ, "Read" }, \ 163 { EX_BLOCK_AGE, "Block Age" }) 164 165 #define show_inode_type(x) \ 166 __print_symbolic(x, \ 167 { S_IFLNK, "symbolic" }, \ 168 { S_IFREG, "regular" }, \ 169 { S_IFDIR, "directory" }, \ 170 { S_IFCHR, "character" }, \ 171 { S_IFBLK, "block" }, \ 172 { S_IFIFO, "fifo" }, \ 173 { S_IFSOCK, "sock" }) 174 175 #define S_ALL_PERM (S_ISUID | S_ISGID | S_ISVTX | \ 176 S_IRWXU | S_IRWXG | S_IRWXO) 177 178 struct f2fs_sb_info; 179 struct f2fs_io_info; 180 struct extent_info; 181 struct victim_sel_policy; 182 struct f2fs_map_blocks; 183 184 DECLARE_EVENT_CLASS(f2fs__inode, 185 186 TP_PROTO(struct inode *inode), 187 188 TP_ARGS(inode), 189 190 TP_STRUCT__entry( 191 __field(dev_t, dev) 192 __field(ino_t, ino) 193 __field(ino_t, pino) 194 __field(umode_t, mode) 195 __field(loff_t, size) 196 __field(unsigned int, nlink) 197 __field(blkcnt_t, blocks) 198 __field(__u8, advise) 199 ), 200 201 TP_fast_assign( 202 __entry->dev = inode->i_sb->s_dev; 203 __entry->ino = inode->i_ino; 204 __entry->pino = F2FS_I(inode)->i_pino; 205 __entry->mode = inode->i_mode; 206 __entry->nlink = inode->i_nlink; 207 __entry->size = inode->i_size; 208 __entry->blocks = inode->i_blocks; 209 __entry->advise = F2FS_I(inode)->i_advise; 210 ), 211 212 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, " 213 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x", 214 show_dev_ino(__entry), 215 (unsigned long)__entry->pino, 216 __entry->mode, 217 __entry->size, 218 (unsigned int)__entry->nlink, 219 (unsigned long long)__entry->blocks, 220 (unsigned char)__entry->advise) 221 ); 222 223 DECLARE_EVENT_CLASS(f2fs__inode_exit, 224 225 TP_PROTO(struct inode *inode, int ret), 226 227 TP_ARGS(inode, ret), 228 229 TP_STRUCT__entry( 230 __field(dev_t, dev) 231 __field(ino_t, ino) 232 __field(umode_t, mode) 233 __field(int, ret) 234 ), 235 236 TP_fast_assign( 237 __entry->dev = inode->i_sb->s_dev; 238 __entry->ino = inode->i_ino; 239 __entry->mode = inode->i_mode; 240 __entry->ret = ret; 241 ), 242 243 TP_printk("dev = (%d,%d), ino = %lu, type: %s, mode = 0%o, ret = %d", 244 show_dev_ino(__entry), 245 show_inode_type(__entry->mode & S_IFMT), 246 __entry->mode & S_ALL_PERM, 247 __entry->ret) 248 ); 249 250 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter, 251 252 TP_PROTO(struct inode *inode), 253 254 TP_ARGS(inode) 255 ); 256 257 TRACE_EVENT(f2fs_sync_file_exit, 258 259 TP_PROTO(struct inode *inode, int cp_reason, int datasync, int ret), 260 261 TP_ARGS(inode, cp_reason, datasync, ret), 262 263 TP_STRUCT__entry( 264 __field(dev_t, dev) 265 __field(ino_t, ino) 266 __field(int, cp_reason) 267 __field(int, datasync) 268 __field(int, ret) 269 ), 270 271 TP_fast_assign( 272 __entry->dev = inode->i_sb->s_dev; 273 __entry->ino = inode->i_ino; 274 __entry->cp_reason = cp_reason; 275 __entry->datasync = datasync; 276 __entry->ret = ret; 277 ), 278 279 TP_printk("dev = (%d,%d), ino = %lu, cp_reason: %s, " 280 "datasync = %d, ret = %d", 281 show_dev_ino(__entry), 282 show_fsync_cpreason(__entry->cp_reason), 283 __entry->datasync, 284 __entry->ret) 285 ); 286 287 TRACE_EVENT(f2fs_sync_fs, 288 289 TP_PROTO(struct super_block *sb, int wait), 290 291 TP_ARGS(sb, wait), 292 293 TP_STRUCT__entry( 294 __field(dev_t, dev) 295 __field(int, dirty) 296 __field(int, wait) 297 ), 298 299 TP_fast_assign( 300 __entry->dev = sb->s_dev; 301 __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY); 302 __entry->wait = wait; 303 ), 304 305 TP_printk("dev = (%d,%d), superblock is %s, wait = %d", 306 show_dev(__entry->dev), 307 __entry->dirty ? "dirty" : "not dirty", 308 __entry->wait) 309 ); 310 311 DEFINE_EVENT(f2fs__inode, f2fs_iget, 312 313 TP_PROTO(struct inode *inode), 314 315 TP_ARGS(inode) 316 ); 317 318 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit, 319 320 TP_PROTO(struct inode *inode, int ret), 321 322 TP_ARGS(inode, ret) 323 ); 324 325 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode, 326 327 TP_PROTO(struct inode *inode), 328 329 TP_ARGS(inode) 330 ); 331 332 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode, 333 334 TP_PROTO(struct inode *inode, int ret), 335 336 TP_ARGS(inode, ret) 337 ); 338 339 TRACE_EVENT(f2fs_unlink_enter, 340 341 TP_PROTO(struct inode *dir, struct dentry *dentry), 342 343 TP_ARGS(dir, dentry), 344 345 TP_STRUCT__entry( 346 __field(dev_t, dev) 347 __field(ino_t, ino) 348 __field(loff_t, size) 349 __field(blkcnt_t, blocks) 350 __string(name, dentry->d_name.name) 351 ), 352 353 TP_fast_assign( 354 __entry->dev = dir->i_sb->s_dev; 355 __entry->ino = dir->i_ino; 356 __entry->size = dir->i_size; 357 __entry->blocks = dir->i_blocks; 358 __assign_str(name); 359 ), 360 361 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, " 362 "i_blocks = %llu, name = %s", 363 show_dev_ino(__entry), 364 __entry->size, 365 (unsigned long long)__entry->blocks, 366 __get_str(name)) 367 ); 368 369 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit, 370 371 TP_PROTO(struct inode *inode, int ret), 372 373 TP_ARGS(inode, ret) 374 ); 375 376 DEFINE_EVENT(f2fs__inode_exit, f2fs_drop_inode, 377 378 TP_PROTO(struct inode *inode, int ret), 379 380 TP_ARGS(inode, ret) 381 ); 382 383 DEFINE_EVENT(f2fs__inode, f2fs_truncate, 384 385 TP_PROTO(struct inode *inode), 386 387 TP_ARGS(inode) 388 ); 389 390 TRACE_EVENT(f2fs_truncate_data_blocks_range, 391 392 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free), 393 394 TP_ARGS(inode, nid, ofs, free), 395 396 TP_STRUCT__entry( 397 __field(dev_t, dev) 398 __field(ino_t, ino) 399 __field(nid_t, nid) 400 __field(unsigned int, ofs) 401 __field(int, free) 402 ), 403 404 TP_fast_assign( 405 __entry->dev = inode->i_sb->s_dev; 406 __entry->ino = inode->i_ino; 407 __entry->nid = nid; 408 __entry->ofs = ofs; 409 __entry->free = free; 410 ), 411 412 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d", 413 show_dev_ino(__entry), 414 (unsigned int)__entry->nid, 415 __entry->ofs, 416 __entry->free) 417 ); 418 419 DECLARE_EVENT_CLASS(f2fs__truncate_op, 420 421 TP_PROTO(struct inode *inode, u64 from), 422 423 TP_ARGS(inode, from), 424 425 TP_STRUCT__entry( 426 __field(dev_t, dev) 427 __field(ino_t, ino) 428 __field(loff_t, size) 429 __field(blkcnt_t, blocks) 430 __field(u64, from) 431 ), 432 433 TP_fast_assign( 434 __entry->dev = inode->i_sb->s_dev; 435 __entry->ino = inode->i_ino; 436 __entry->size = inode->i_size; 437 __entry->blocks = inode->i_blocks; 438 __entry->from = from; 439 ), 440 441 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, " 442 "start file offset = %llu", 443 show_dev_ino(__entry), 444 __entry->size, 445 (unsigned long long)__entry->blocks, 446 (unsigned long long)__entry->from) 447 ); 448 449 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter, 450 451 TP_PROTO(struct inode *inode, u64 from), 452 453 TP_ARGS(inode, from) 454 ); 455 456 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit, 457 458 TP_PROTO(struct inode *inode, int ret), 459 460 TP_ARGS(inode, ret) 461 ); 462 463 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter, 464 465 TP_PROTO(struct inode *inode, u64 from), 466 467 TP_ARGS(inode, from) 468 ); 469 470 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit, 471 472 TP_PROTO(struct inode *inode, int ret), 473 474 TP_ARGS(inode, ret) 475 ); 476 477 DECLARE_EVENT_CLASS(f2fs__truncate_node, 478 479 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 480 481 TP_ARGS(inode, nid, blk_addr), 482 483 TP_STRUCT__entry( 484 __field(dev_t, dev) 485 __field(ino_t, ino) 486 __field(nid_t, nid) 487 __field(block_t, blk_addr) 488 ), 489 490 TP_fast_assign( 491 __entry->dev = inode->i_sb->s_dev; 492 __entry->ino = inode->i_ino; 493 __entry->nid = nid; 494 __entry->blk_addr = blk_addr; 495 ), 496 497 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx", 498 show_dev_ino(__entry), 499 (unsigned int)__entry->nid, 500 (unsigned long long)__entry->blk_addr) 501 ); 502 503 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter, 504 505 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 506 507 TP_ARGS(inode, nid, blk_addr) 508 ); 509 510 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit, 511 512 TP_PROTO(struct inode *inode, int ret), 513 514 TP_ARGS(inode, ret) 515 ); 516 517 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node, 518 519 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 520 521 TP_ARGS(inode, nid, blk_addr) 522 ); 523 524 TRACE_EVENT(f2fs_truncate_partial_nodes, 525 526 TP_PROTO(struct inode *inode, nid_t *nid, int depth, int err), 527 528 TP_ARGS(inode, nid, depth, err), 529 530 TP_STRUCT__entry( 531 __field(dev_t, dev) 532 __field(ino_t, ino) 533 __array(nid_t, nid, 3) 534 __field(int, depth) 535 __field(int, err) 536 ), 537 538 TP_fast_assign( 539 __entry->dev = inode->i_sb->s_dev; 540 __entry->ino = inode->i_ino; 541 __entry->nid[0] = nid[0]; 542 __entry->nid[1] = nid[1]; 543 __entry->nid[2] = nid[2]; 544 __entry->depth = depth; 545 __entry->err = err; 546 ), 547 548 TP_printk("dev = (%d,%d), ino = %lu, " 549 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d", 550 show_dev_ino(__entry), 551 (unsigned int)__entry->nid[0], 552 (unsigned int)__entry->nid[1], 553 (unsigned int)__entry->nid[2], 554 __entry->depth, 555 __entry->err) 556 ); 557 558 TRACE_EVENT(f2fs_file_write_iter, 559 560 TP_PROTO(struct inode *inode, loff_t offset, size_t length, 561 ssize_t ret), 562 563 TP_ARGS(inode, offset, length, ret), 564 565 TP_STRUCT__entry( 566 __field(dev_t, dev) 567 __field(ino_t, ino) 568 __field(loff_t, offset) 569 __field(size_t, length) 570 __field(ssize_t, ret) 571 ), 572 573 TP_fast_assign( 574 __entry->dev = inode->i_sb->s_dev; 575 __entry->ino = inode->i_ino; 576 __entry->offset = offset; 577 __entry->length = length; 578 __entry->ret = ret; 579 ), 580 581 TP_printk("dev = (%d,%d), ino = %lu, " 582 "offset = %lld, length = %zu, written(err) = %zd", 583 show_dev_ino(__entry), 584 __entry->offset, 585 __entry->length, 586 __entry->ret) 587 ); 588 589 TRACE_EVENT(f2fs_map_blocks, 590 TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int flag, 591 int ret), 592 593 TP_ARGS(inode, map, flag, ret), 594 595 TP_STRUCT__entry( 596 __field(dev_t, dev) 597 __field(ino_t, ino) 598 __field(block_t, m_lblk) 599 __field(block_t, m_pblk) 600 __field(unsigned int, m_len) 601 __field(unsigned int, m_flags) 602 __field(int, m_seg_type) 603 __field(bool, m_may_create) 604 __field(bool, m_multidev_dio) 605 __field(int, flag) 606 __field(int, ret) 607 ), 608 609 TP_fast_assign( 610 __entry->dev = map->m_bdev->bd_dev; 611 __entry->ino = inode->i_ino; 612 __entry->m_lblk = map->m_lblk; 613 __entry->m_pblk = map->m_pblk; 614 __entry->m_len = map->m_len; 615 __entry->m_flags = map->m_flags; 616 __entry->m_seg_type = map->m_seg_type; 617 __entry->m_may_create = map->m_may_create; 618 __entry->m_multidev_dio = map->m_multidev_dio; 619 __entry->flag = flag; 620 __entry->ret = ret; 621 ), 622 623 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, " 624 "start blkaddr = 0x%llx, len = 0x%llx, flags = %u, " 625 "seg_type = %d, may_create = %d, multidevice = %d, " 626 "flag = %d, err = %d", 627 show_dev_ino(__entry), 628 (unsigned long long)__entry->m_lblk, 629 (unsigned long long)__entry->m_pblk, 630 (unsigned long long)__entry->m_len, 631 __entry->m_flags, 632 __entry->m_seg_type, 633 __entry->m_may_create, 634 __entry->m_multidev_dio, 635 __entry->flag, 636 __entry->ret) 637 ); 638 639 TRACE_EVENT(f2fs_background_gc, 640 641 TP_PROTO(struct super_block *sb, unsigned int wait_ms, 642 unsigned int prefree, unsigned int free), 643 644 TP_ARGS(sb, wait_ms, prefree, free), 645 646 TP_STRUCT__entry( 647 __field(dev_t, dev) 648 __field(unsigned int, wait_ms) 649 __field(unsigned int, prefree) 650 __field(unsigned int, free) 651 ), 652 653 TP_fast_assign( 654 __entry->dev = sb->s_dev; 655 __entry->wait_ms = wait_ms; 656 __entry->prefree = prefree; 657 __entry->free = free; 658 ), 659 660 TP_printk("dev = (%d,%d), wait_ms = %u, prefree = %u, free = %u", 661 show_dev(__entry->dev), 662 __entry->wait_ms, 663 __entry->prefree, 664 __entry->free) 665 ); 666 667 TRACE_EVENT(f2fs_gc_begin, 668 669 TP_PROTO(struct super_block *sb, int gc_type, bool no_bg_gc, 670 unsigned int nr_free_secs, 671 long long dirty_nodes, long long dirty_dents, 672 long long dirty_imeta, unsigned int free_sec, 673 unsigned int free_seg, int reserved_seg, 674 unsigned int prefree_seg), 675 676 TP_ARGS(sb, gc_type, no_bg_gc, nr_free_secs, dirty_nodes, 677 dirty_dents, dirty_imeta, 678 free_sec, free_seg, reserved_seg, prefree_seg), 679 680 TP_STRUCT__entry( 681 __field(dev_t, dev) 682 __field(int, gc_type) 683 __field(bool, no_bg_gc) 684 __field(unsigned int, nr_free_secs) 685 __field(long long, dirty_nodes) 686 __field(long long, dirty_dents) 687 __field(long long, dirty_imeta) 688 __field(unsigned int, free_sec) 689 __field(unsigned int, free_seg) 690 __field(int, reserved_seg) 691 __field(unsigned int, prefree_seg) 692 ), 693 694 TP_fast_assign( 695 __entry->dev = sb->s_dev; 696 __entry->gc_type = gc_type; 697 __entry->no_bg_gc = no_bg_gc; 698 __entry->nr_free_secs = nr_free_secs; 699 __entry->dirty_nodes = dirty_nodes; 700 __entry->dirty_dents = dirty_dents; 701 __entry->dirty_imeta = dirty_imeta; 702 __entry->free_sec = free_sec; 703 __entry->free_seg = free_seg; 704 __entry->reserved_seg = reserved_seg; 705 __entry->prefree_seg = prefree_seg; 706 ), 707 708 TP_printk("dev = (%d,%d), gc_type = %s, no_background_GC = %d, nr_free_secs = %u, " 709 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, free_seg:%u, " 710 "rsv_seg:%d, prefree_seg:%u", 711 show_dev(__entry->dev), 712 show_gc_type(__entry->gc_type), 713 (__entry->gc_type == BG_GC) ? __entry->no_bg_gc : -1, 714 __entry->nr_free_secs, 715 __entry->dirty_nodes, 716 __entry->dirty_dents, 717 __entry->dirty_imeta, 718 __entry->free_sec, 719 __entry->free_seg, 720 __entry->reserved_seg, 721 __entry->prefree_seg) 722 ); 723 724 TRACE_EVENT(f2fs_gc_end, 725 726 TP_PROTO(struct super_block *sb, int ret, int seg_freed, 727 int sec_freed, long long dirty_nodes, 728 long long dirty_dents, long long dirty_imeta, 729 unsigned int free_sec, unsigned int free_seg, 730 int reserved_seg, unsigned int prefree_seg), 731 732 TP_ARGS(sb, ret, seg_freed, sec_freed, dirty_nodes, dirty_dents, 733 dirty_imeta, free_sec, free_seg, reserved_seg, prefree_seg), 734 735 TP_STRUCT__entry( 736 __field(dev_t, dev) 737 __field(int, ret) 738 __field(int, seg_freed) 739 __field(int, sec_freed) 740 __field(long long, dirty_nodes) 741 __field(long long, dirty_dents) 742 __field(long long, dirty_imeta) 743 __field(unsigned int, free_sec) 744 __field(unsigned int, free_seg) 745 __field(int, reserved_seg) 746 __field(unsigned int, prefree_seg) 747 ), 748 749 TP_fast_assign( 750 __entry->dev = sb->s_dev; 751 __entry->ret = ret; 752 __entry->seg_freed = seg_freed; 753 __entry->sec_freed = sec_freed; 754 __entry->dirty_nodes = dirty_nodes; 755 __entry->dirty_dents = dirty_dents; 756 __entry->dirty_imeta = dirty_imeta; 757 __entry->free_sec = free_sec; 758 __entry->free_seg = free_seg; 759 __entry->reserved_seg = reserved_seg; 760 __entry->prefree_seg = prefree_seg; 761 ), 762 763 TP_printk("dev = (%d,%d), ret = %d, seg_freed = %d, sec_freed = %d, " 764 "nodes = %lld, dents = %lld, imeta = %lld, free_sec:%u, " 765 "free_seg:%u, rsv_seg:%d, prefree_seg:%u", 766 show_dev(__entry->dev), 767 __entry->ret, 768 __entry->seg_freed, 769 __entry->sec_freed, 770 __entry->dirty_nodes, 771 __entry->dirty_dents, 772 __entry->dirty_imeta, 773 __entry->free_sec, 774 __entry->free_seg, 775 __entry->reserved_seg, 776 __entry->prefree_seg) 777 ); 778 779 TRACE_EVENT(f2fs_get_victim, 780 781 TP_PROTO(struct super_block *sb, int type, int gc_type, 782 struct victim_sel_policy *p, unsigned int pre_victim, 783 unsigned int prefree, unsigned int free), 784 785 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free), 786 787 TP_STRUCT__entry( 788 __field(dev_t, dev) 789 __field(int, type) 790 __field(int, gc_type) 791 __field(int, alloc_mode) 792 __field(int, gc_mode) 793 __field(unsigned int, victim) 794 __field(unsigned int, cost) 795 __field(unsigned int, ofs_unit) 796 __field(unsigned int, pre_victim) 797 __field(unsigned int, prefree) 798 __field(unsigned int, free) 799 ), 800 801 TP_fast_assign( 802 __entry->dev = sb->s_dev; 803 __entry->type = type; 804 __entry->gc_type = gc_type; 805 __entry->alloc_mode = p->alloc_mode; 806 __entry->gc_mode = p->gc_mode; 807 __entry->victim = p->min_segno; 808 __entry->cost = p->min_cost; 809 __entry->ofs_unit = p->ofs_unit; 810 __entry->pre_victim = pre_victim; 811 __entry->prefree = prefree; 812 __entry->free = free; 813 ), 814 815 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), " 816 "victim = %u, cost = %u, ofs_unit = %u, " 817 "pre_victim_secno = %d, prefree = %u, free = %u", 818 show_dev(__entry->dev), 819 show_data_type(__entry->type), 820 show_gc_type(__entry->gc_type), 821 show_alloc_mode(__entry->alloc_mode), 822 show_victim_policy(__entry->gc_mode), 823 __entry->victim, 824 __entry->cost, 825 __entry->ofs_unit, 826 (int)__entry->pre_victim, 827 __entry->prefree, 828 __entry->free) 829 ); 830 831 TRACE_EVENT(f2fs_lookup_start, 832 833 TP_PROTO(struct inode *dir, struct dentry *dentry, unsigned int flags), 834 835 TP_ARGS(dir, dentry, flags), 836 837 TP_STRUCT__entry( 838 __field(dev_t, dev) 839 __field(ino_t, ino) 840 __string(name, dentry->d_name.name) 841 __field(unsigned int, flags) 842 ), 843 844 TP_fast_assign( 845 __entry->dev = dir->i_sb->s_dev; 846 __entry->ino = dir->i_ino; 847 __assign_str(name); 848 __entry->flags = flags; 849 ), 850 851 TP_printk("dev = (%d,%d), pino = %lu, name:%s, flags:%u", 852 show_dev_ino(__entry), 853 __get_str(name), 854 __entry->flags) 855 ); 856 857 TRACE_EVENT(f2fs_lookup_end, 858 859 TP_PROTO(struct inode *dir, struct dentry *dentry, nid_t ino, 860 int err), 861 862 TP_ARGS(dir, dentry, ino, err), 863 864 TP_STRUCT__entry( 865 __field(dev_t, dev) 866 __field(ino_t, ino) 867 __string(name, dentry->d_name.name) 868 __field(nid_t, cino) 869 __field(int, err) 870 ), 871 872 TP_fast_assign( 873 __entry->dev = dir->i_sb->s_dev; 874 __entry->ino = dir->i_ino; 875 __assign_str(name); 876 __entry->cino = ino; 877 __entry->err = err; 878 ), 879 880 TP_printk("dev = (%d,%d), pino = %lu, name:%s, ino:%u, err:%d", 881 show_dev_ino(__entry), 882 __get_str(name), 883 __entry->cino, 884 __entry->err) 885 ); 886 887 TRACE_EVENT(f2fs_rename_start, 888 889 TP_PROTO(struct inode *old_dir, struct dentry *old_dentry, 890 struct inode *new_dir, struct dentry *new_dentry, 891 unsigned int flags), 892 893 TP_ARGS(old_dir, old_dentry, new_dir, new_dentry, flags), 894 895 TP_STRUCT__entry( 896 __field(dev_t, dev) 897 __field(ino_t, ino) 898 __string(old_name, old_dentry->d_name.name) 899 __field(ino_t, new_pino) 900 __string(new_name, new_dentry->d_name.name) 901 __field(unsigned int, flags) 902 ), 903 904 TP_fast_assign( 905 __entry->dev = old_dir->i_sb->s_dev; 906 __entry->ino = old_dir->i_ino; 907 __assign_str(old_name); 908 __entry->new_pino = new_dir->i_ino; 909 __assign_str(new_name); 910 __entry->flags = flags; 911 ), 912 913 TP_printk("dev = (%d,%d), old_dir = %lu, old_name: %s, " 914 "new_dir = %lu, new_name: %s, flags = %u", 915 show_dev_ino(__entry), 916 __get_str(old_name), 917 __entry->new_pino, 918 __get_str(new_name), 919 __entry->flags) 920 ); 921 922 TRACE_EVENT(f2fs_rename_end, 923 924 TP_PROTO(struct dentry *old_dentry, struct dentry *new_dentry, 925 unsigned int flags, int ret), 926 927 TP_ARGS(old_dentry, new_dentry, flags, ret), 928 929 TP_STRUCT__entry( 930 __field(dev_t, dev) 931 __field(ino_t, ino) 932 __string(old_name, old_dentry->d_name.name) 933 __string(new_name, new_dentry->d_name.name) 934 __field(unsigned int, flags) 935 __field(int, ret) 936 ), 937 938 TP_fast_assign( 939 __entry->dev = old_dentry->d_sb->s_dev; 940 __entry->ino = old_dentry->d_inode->i_ino; 941 __assign_str(old_name); 942 __assign_str(new_name); 943 __entry->flags = flags; 944 __entry->ret = ret; 945 ), 946 947 TP_printk("dev = (%d,%d), ino = %lu, old_name: %s, " 948 "new_name: %s, flags = %u, ret = %d", 949 show_dev_ino(__entry), 950 __get_str(old_name), 951 __get_str(new_name), 952 __entry->flags, 953 __entry->ret) 954 ); 955 956 TRACE_EVENT(f2fs_readdir, 957 958 TP_PROTO(struct inode *dir, loff_t start_pos, loff_t end_pos, int err), 959 960 TP_ARGS(dir, start_pos, end_pos, err), 961 962 TP_STRUCT__entry( 963 __field(dev_t, dev) 964 __field(ino_t, ino) 965 __field(loff_t, start) 966 __field(loff_t, end) 967 __field(int, err) 968 ), 969 970 TP_fast_assign( 971 __entry->dev = dir->i_sb->s_dev; 972 __entry->ino = dir->i_ino; 973 __entry->start = start_pos; 974 __entry->end = end_pos; 975 __entry->err = err; 976 ), 977 978 TP_printk("dev = (%d,%d), ino = %lu, start_pos:%llu, end_pos:%llu, err:%d", 979 show_dev_ino(__entry), 980 __entry->start, 981 __entry->end, 982 __entry->err) 983 ); 984 985 TRACE_EVENT(f2fs_fallocate, 986 987 TP_PROTO(struct inode *inode, int mode, 988 loff_t offset, loff_t len, int ret), 989 990 TP_ARGS(inode, mode, offset, len, ret), 991 992 TP_STRUCT__entry( 993 __field(dev_t, dev) 994 __field(ino_t, ino) 995 __field(int, mode) 996 __field(loff_t, offset) 997 __field(loff_t, len) 998 __field(loff_t, size) 999 __field(blkcnt_t, blocks) 1000 __field(int, ret) 1001 ), 1002 1003 TP_fast_assign( 1004 __entry->dev = inode->i_sb->s_dev; 1005 __entry->ino = inode->i_ino; 1006 __entry->mode = mode; 1007 __entry->offset = offset; 1008 __entry->len = len; 1009 __entry->size = inode->i_size; 1010 __entry->blocks = inode->i_blocks; 1011 __entry->ret = ret; 1012 ), 1013 1014 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, " 1015 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d", 1016 show_dev_ino(__entry), 1017 __entry->mode, 1018 (unsigned long long)__entry->offset, 1019 (unsigned long long)__entry->len, 1020 (unsigned long long)__entry->size, 1021 (unsigned long long)__entry->blocks, 1022 __entry->ret) 1023 ); 1024 1025 TRACE_EVENT(f2fs_direct_IO_enter, 1026 1027 TP_PROTO(struct inode *inode, struct kiocb *iocb, long len, int rw), 1028 1029 TP_ARGS(inode, iocb, len, rw), 1030 1031 TP_STRUCT__entry( 1032 __field(dev_t, dev) 1033 __field(ino_t, ino) 1034 __field(loff_t, ki_pos) 1035 __field(int, ki_flags) 1036 __field(u16, ki_ioprio) 1037 __field(unsigned long, len) 1038 __field(int, rw) 1039 ), 1040 1041 TP_fast_assign( 1042 __entry->dev = inode->i_sb->s_dev; 1043 __entry->ino = inode->i_ino; 1044 __entry->ki_pos = iocb->ki_pos; 1045 __entry->ki_flags = iocb->ki_flags; 1046 __entry->ki_ioprio = iocb->ki_ioprio; 1047 __entry->len = len; 1048 __entry->rw = rw; 1049 ), 1050 1051 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu ki_flags = %x ki_ioprio = %x rw = %d", 1052 show_dev_ino(__entry), 1053 __entry->ki_pos, 1054 __entry->len, 1055 __entry->ki_flags, 1056 __entry->ki_ioprio, 1057 __entry->rw) 1058 ); 1059 1060 TRACE_EVENT(f2fs_direct_IO_exit, 1061 1062 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, 1063 int rw, int ret), 1064 1065 TP_ARGS(inode, offset, len, rw, ret), 1066 1067 TP_STRUCT__entry( 1068 __field(dev_t, dev) 1069 __field(ino_t, ino) 1070 __field(loff_t, pos) 1071 __field(unsigned long, len) 1072 __field(int, rw) 1073 __field(int, ret) 1074 ), 1075 1076 TP_fast_assign( 1077 __entry->dev = inode->i_sb->s_dev; 1078 __entry->ino = inode->i_ino; 1079 __entry->pos = offset; 1080 __entry->len = len; 1081 __entry->rw = rw; 1082 __entry->ret = ret; 1083 ), 1084 1085 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu " 1086 "rw = %d ret = %d", 1087 show_dev_ino(__entry), 1088 __entry->pos, 1089 __entry->len, 1090 __entry->rw, 1091 __entry->ret) 1092 ); 1093 1094 TRACE_EVENT(f2fs_reserve_new_blocks, 1095 1096 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node, 1097 blkcnt_t count), 1098 1099 TP_ARGS(inode, nid, ofs_in_node, count), 1100 1101 TP_STRUCT__entry( 1102 __field(dev_t, dev) 1103 __field(nid_t, nid) 1104 __field(unsigned int, ofs_in_node) 1105 __field(blkcnt_t, count) 1106 ), 1107 1108 TP_fast_assign( 1109 __entry->dev = inode->i_sb->s_dev; 1110 __entry->nid = nid; 1111 __entry->ofs_in_node = ofs_in_node; 1112 __entry->count = count; 1113 ), 1114 1115 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu", 1116 show_dev(__entry->dev), 1117 (unsigned int)__entry->nid, 1118 __entry->ofs_in_node, 1119 (unsigned long long)__entry->count) 1120 ); 1121 1122 DECLARE_EVENT_CLASS(f2fs__submit_page_bio, 1123 1124 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 1125 1126 TP_ARGS(page, fio), 1127 1128 TP_STRUCT__entry( 1129 __field(dev_t, dev) 1130 __field(ino_t, ino) 1131 __field(pgoff_t, index) 1132 __field(block_t, old_blkaddr) 1133 __field(block_t, new_blkaddr) 1134 __field(enum req_op, op) 1135 __field(blk_opf_t, op_flags) 1136 __field(int, temp) 1137 __field(int, type) 1138 ), 1139 1140 TP_fast_assign( 1141 __entry->dev = page_file_mapping(page)->host->i_sb->s_dev; 1142 __entry->ino = page_file_mapping(page)->host->i_ino; 1143 __entry->index = page->index; 1144 __entry->old_blkaddr = fio->old_blkaddr; 1145 __entry->new_blkaddr = fio->new_blkaddr; 1146 __entry->op = fio->op; 1147 __entry->op_flags = fio->op_flags; 1148 __entry->temp = fio->temp; 1149 __entry->type = fio->type; 1150 ), 1151 1152 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, " 1153 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s(%s), type = %s_%s", 1154 show_dev_ino(__entry), 1155 (unsigned long)__entry->index, 1156 (unsigned long long)__entry->old_blkaddr, 1157 (unsigned long long)__entry->new_blkaddr, 1158 show_bio_type(__entry->op, __entry->op_flags), 1159 show_block_temp(__entry->temp), 1160 show_block_type(__entry->type)) 1161 ); 1162 1163 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio, 1164 1165 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 1166 1167 TP_ARGS(page, fio), 1168 1169 TP_CONDITION(page->mapping) 1170 ); 1171 1172 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_write, 1173 1174 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 1175 1176 TP_ARGS(page, fio), 1177 1178 TP_CONDITION(page->mapping) 1179 ); 1180 1181 DECLARE_EVENT_CLASS(f2fs__bio, 1182 1183 TP_PROTO(struct super_block *sb, int type, struct bio *bio), 1184 1185 TP_ARGS(sb, type, bio), 1186 1187 TP_STRUCT__entry( 1188 __field(dev_t, dev) 1189 __field(dev_t, target) 1190 __field(enum req_op, op) 1191 __field(blk_opf_t, op_flags) 1192 __field(int, type) 1193 __field(sector_t, sector) 1194 __field(unsigned int, size) 1195 ), 1196 1197 TP_fast_assign( 1198 __entry->dev = sb->s_dev; 1199 __entry->target = bio_dev(bio); 1200 __entry->op = bio_op(bio); 1201 __entry->op_flags = bio->bi_opf; 1202 __entry->type = type; 1203 __entry->sector = bio->bi_iter.bi_sector; 1204 __entry->size = bio->bi_iter.bi_size; 1205 ), 1206 1207 TP_printk("dev = (%d,%d)/(%d,%d), rw = %s(%s), %s, sector = %lld, size = %u", 1208 show_dev(__entry->target), 1209 show_dev(__entry->dev), 1210 show_bio_type(__entry->op, __entry->op_flags), 1211 show_block_type(__entry->type), 1212 (unsigned long long)__entry->sector, 1213 __entry->size) 1214 ); 1215 1216 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_write_bio, 1217 1218 TP_PROTO(struct super_block *sb, int type, struct bio *bio), 1219 1220 TP_ARGS(sb, type, bio), 1221 1222 TP_CONDITION(bio) 1223 ); 1224 1225 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_prepare_read_bio, 1226 1227 TP_PROTO(struct super_block *sb, int type, struct bio *bio), 1228 1229 TP_ARGS(sb, type, bio), 1230 1231 TP_CONDITION(bio) 1232 ); 1233 1234 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_read_bio, 1235 1236 TP_PROTO(struct super_block *sb, int type, struct bio *bio), 1237 1238 TP_ARGS(sb, type, bio), 1239 1240 TP_CONDITION(bio) 1241 ); 1242 1243 DEFINE_EVENT_CONDITION(f2fs__bio, f2fs_submit_write_bio, 1244 1245 TP_PROTO(struct super_block *sb, int type, struct bio *bio), 1246 1247 TP_ARGS(sb, type, bio), 1248 1249 TP_CONDITION(bio) 1250 ); 1251 1252 TRACE_EVENT(f2fs_write_begin, 1253 1254 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len), 1255 1256 TP_ARGS(inode, pos, len), 1257 1258 TP_STRUCT__entry( 1259 __field(dev_t, dev) 1260 __field(ino_t, ino) 1261 __field(loff_t, pos) 1262 __field(unsigned int, len) 1263 ), 1264 1265 TP_fast_assign( 1266 __entry->dev = inode->i_sb->s_dev; 1267 __entry->ino = inode->i_ino; 1268 __entry->pos = pos; 1269 __entry->len = len; 1270 ), 1271 1272 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u", 1273 show_dev_ino(__entry), 1274 (unsigned long long)__entry->pos, 1275 __entry->len) 1276 ); 1277 1278 TRACE_EVENT(f2fs_write_end, 1279 1280 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 1281 unsigned int copied), 1282 1283 TP_ARGS(inode, pos, len, copied), 1284 1285 TP_STRUCT__entry( 1286 __field(dev_t, dev) 1287 __field(ino_t, ino) 1288 __field(loff_t, pos) 1289 __field(unsigned int, len) 1290 __field(unsigned int, copied) 1291 ), 1292 1293 TP_fast_assign( 1294 __entry->dev = inode->i_sb->s_dev; 1295 __entry->ino = inode->i_ino; 1296 __entry->pos = pos; 1297 __entry->len = len; 1298 __entry->copied = copied; 1299 ), 1300 1301 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u", 1302 show_dev_ino(__entry), 1303 (unsigned long long)__entry->pos, 1304 __entry->len, 1305 __entry->copied) 1306 ); 1307 1308 DECLARE_EVENT_CLASS(f2fs__folio, 1309 1310 TP_PROTO(struct folio *folio, int type), 1311 1312 TP_ARGS(folio, type), 1313 1314 TP_STRUCT__entry( 1315 __field(dev_t, dev) 1316 __field(ino_t, ino) 1317 __field(int, type) 1318 __field(int, dir) 1319 __field(pgoff_t, index) 1320 __field(int, dirty) 1321 __field(int, uptodate) 1322 ), 1323 1324 TP_fast_assign( 1325 __entry->dev = folio_file_mapping(folio)->host->i_sb->s_dev; 1326 __entry->ino = folio_file_mapping(folio)->host->i_ino; 1327 __entry->type = type; 1328 __entry->dir = 1329 S_ISDIR(folio_file_mapping(folio)->host->i_mode); 1330 __entry->index = folio_index(folio); 1331 __entry->dirty = folio_test_dirty(folio); 1332 __entry->uptodate = folio_test_uptodate(folio); 1333 ), 1334 1335 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, " 1336 "dirty = %d, uptodate = %d", 1337 show_dev_ino(__entry), 1338 show_block_type(__entry->type), 1339 show_file_type(__entry->dir), 1340 (unsigned long)__entry->index, 1341 __entry->dirty, 1342 __entry->uptodate) 1343 ); 1344 1345 DEFINE_EVENT(f2fs__folio, f2fs_writepage, 1346 1347 TP_PROTO(struct folio *folio, int type), 1348 1349 TP_ARGS(folio, type) 1350 ); 1351 1352 DEFINE_EVENT(f2fs__folio, f2fs_do_write_data_page, 1353 1354 TP_PROTO(struct folio *folio, int type), 1355 1356 TP_ARGS(folio, type) 1357 ); 1358 1359 DEFINE_EVENT(f2fs__folio, f2fs_readpage, 1360 1361 TP_PROTO(struct folio *folio, int type), 1362 1363 TP_ARGS(folio, type) 1364 ); 1365 1366 DEFINE_EVENT(f2fs__folio, f2fs_set_page_dirty, 1367 1368 TP_PROTO(struct folio *folio, int type), 1369 1370 TP_ARGS(folio, type) 1371 ); 1372 1373 TRACE_EVENT(f2fs_replace_atomic_write_block, 1374 1375 TP_PROTO(struct inode *inode, struct inode *cow_inode, pgoff_t index, 1376 block_t old_addr, block_t new_addr, bool recovery), 1377 1378 TP_ARGS(inode, cow_inode, index, old_addr, new_addr, recovery), 1379 1380 TP_STRUCT__entry( 1381 __field(dev_t, dev) 1382 __field(ino_t, ino) 1383 __field(ino_t, cow_ino) 1384 __field(pgoff_t, index) 1385 __field(block_t, old_addr) 1386 __field(block_t, new_addr) 1387 __field(bool, recovery) 1388 ), 1389 1390 TP_fast_assign( 1391 __entry->dev = inode->i_sb->s_dev; 1392 __entry->ino = inode->i_ino; 1393 __entry->cow_ino = cow_inode->i_ino; 1394 __entry->index = index; 1395 __entry->old_addr = old_addr; 1396 __entry->new_addr = new_addr; 1397 __entry->recovery = recovery; 1398 ), 1399 1400 TP_printk("dev = (%d,%d), ino = %lu, cow_ino = %lu, index = %lu, " 1401 "old_addr = 0x%llx, new_addr = 0x%llx, recovery = %d", 1402 show_dev_ino(__entry), 1403 __entry->cow_ino, 1404 (unsigned long)__entry->index, 1405 (unsigned long long)__entry->old_addr, 1406 (unsigned long long)__entry->new_addr, 1407 __entry->recovery) 1408 ); 1409 1410 DECLARE_EVENT_CLASS(f2fs_mmap, 1411 1412 TP_PROTO(struct inode *inode, pgoff_t index, 1413 vm_flags_t flags, vm_fault_t ret), 1414 1415 TP_ARGS(inode, index, flags, ret), 1416 1417 TP_STRUCT__entry( 1418 __field(dev_t, dev) 1419 __field(ino_t, ino) 1420 __field(pgoff_t, index) 1421 __field(vm_flags_t, flags) 1422 __field(vm_fault_t, ret) 1423 ), 1424 1425 TP_fast_assign( 1426 __entry->dev = inode->i_sb->s_dev; 1427 __entry->ino = inode->i_ino; 1428 __entry->index = index; 1429 __entry->flags = flags; 1430 __entry->ret = ret; 1431 ), 1432 1433 TP_printk("dev = (%d,%d), ino = %lu, index = %lu, flags: %s, ret: %s", 1434 show_dev_ino(__entry), 1435 (unsigned long)__entry->index, 1436 __print_flags(__entry->flags, "|", FAULT_FLAG_TRACE), 1437 __print_flags(__entry->ret, "|", VM_FAULT_RESULT_TRACE)) 1438 ); 1439 1440 DEFINE_EVENT(f2fs_mmap, f2fs_filemap_fault, 1441 1442 TP_PROTO(struct inode *inode, pgoff_t index, 1443 vm_flags_t flags, vm_fault_t ret), 1444 1445 TP_ARGS(inode, index, flags, ret) 1446 ); 1447 1448 DEFINE_EVENT(f2fs_mmap, f2fs_vm_page_mkwrite, 1449 1450 TP_PROTO(struct inode *inode, pgoff_t index, 1451 vm_flags_t flags, vm_fault_t ret), 1452 1453 TP_ARGS(inode, index, flags, ret) 1454 ); 1455 1456 TRACE_EVENT(f2fs_writepages, 1457 1458 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type), 1459 1460 TP_ARGS(inode, wbc, type), 1461 1462 TP_STRUCT__entry( 1463 __field(dev_t, dev) 1464 __field(ino_t, ino) 1465 __field(int, type) 1466 __field(int, dir) 1467 __field(long, nr_to_write) 1468 __field(long, pages_skipped) 1469 __field(loff_t, range_start) 1470 __field(loff_t, range_end) 1471 __field(pgoff_t, writeback_index) 1472 __field(int, sync_mode) 1473 __field(char, for_kupdate) 1474 __field(char, for_background) 1475 __field(char, tagged_writepages) 1476 __field(char, for_reclaim) 1477 __field(char, range_cyclic) 1478 __field(char, for_sync) 1479 ), 1480 1481 TP_fast_assign( 1482 __entry->dev = inode->i_sb->s_dev; 1483 __entry->ino = inode->i_ino; 1484 __entry->type = type; 1485 __entry->dir = S_ISDIR(inode->i_mode); 1486 __entry->nr_to_write = wbc->nr_to_write; 1487 __entry->pages_skipped = wbc->pages_skipped; 1488 __entry->range_start = wbc->range_start; 1489 __entry->range_end = wbc->range_end; 1490 __entry->writeback_index = inode->i_mapping->writeback_index; 1491 __entry->sync_mode = wbc->sync_mode; 1492 __entry->for_kupdate = wbc->for_kupdate; 1493 __entry->for_background = wbc->for_background; 1494 __entry->tagged_writepages = wbc->tagged_writepages; 1495 __entry->for_reclaim = wbc->for_reclaim; 1496 __entry->range_cyclic = wbc->range_cyclic; 1497 __entry->for_sync = wbc->for_sync; 1498 ), 1499 1500 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, " 1501 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, " 1502 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u", 1503 show_dev_ino(__entry), 1504 show_block_type(__entry->type), 1505 show_file_type(__entry->dir), 1506 __entry->nr_to_write, 1507 __entry->pages_skipped, 1508 __entry->range_start, 1509 __entry->range_end, 1510 (unsigned long)__entry->writeback_index, 1511 __entry->sync_mode, 1512 __entry->for_kupdate, 1513 __entry->for_background, 1514 __entry->tagged_writepages, 1515 __entry->for_reclaim, 1516 __entry->range_cyclic, 1517 __entry->for_sync) 1518 ); 1519 1520 TRACE_EVENT(f2fs_readpages, 1521 1522 TP_PROTO(struct inode *inode, pgoff_t start, unsigned int nrpage), 1523 1524 TP_ARGS(inode, start, nrpage), 1525 1526 TP_STRUCT__entry( 1527 __field(dev_t, dev) 1528 __field(ino_t, ino) 1529 __field(pgoff_t, start) 1530 __field(unsigned int, nrpage) 1531 ), 1532 1533 TP_fast_assign( 1534 __entry->dev = inode->i_sb->s_dev; 1535 __entry->ino = inode->i_ino; 1536 __entry->start = start; 1537 __entry->nrpage = nrpage; 1538 ), 1539 1540 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u", 1541 show_dev_ino(__entry), 1542 (unsigned long)__entry->start, 1543 __entry->nrpage) 1544 ); 1545 1546 TRACE_EVENT(f2fs_write_checkpoint, 1547 1548 TP_PROTO(struct super_block *sb, int reason, const char *msg), 1549 1550 TP_ARGS(sb, reason, msg), 1551 1552 TP_STRUCT__entry( 1553 __field(dev_t, dev) 1554 __field(int, reason) 1555 __string(dest_msg, msg) 1556 ), 1557 1558 TP_fast_assign( 1559 __entry->dev = sb->s_dev; 1560 __entry->reason = reason; 1561 __assign_str(dest_msg); 1562 ), 1563 1564 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s", 1565 show_dev(__entry->dev), 1566 show_cpreason(__entry->reason), 1567 __get_str(dest_msg)) 1568 ); 1569 1570 DECLARE_EVENT_CLASS(f2fs_discard, 1571 1572 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen), 1573 1574 TP_ARGS(dev, blkstart, blklen), 1575 1576 TP_STRUCT__entry( 1577 __field(dev_t, dev) 1578 __field(block_t, blkstart) 1579 __field(block_t, blklen) 1580 ), 1581 1582 TP_fast_assign( 1583 __entry->dev = dev->bd_dev; 1584 __entry->blkstart = blkstart; 1585 __entry->blklen = blklen; 1586 ), 1587 1588 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx", 1589 show_dev(__entry->dev), 1590 (unsigned long long)__entry->blkstart, 1591 (unsigned long long)__entry->blklen) 1592 ); 1593 1594 DEFINE_EVENT(f2fs_discard, f2fs_queue_discard, 1595 1596 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen), 1597 1598 TP_ARGS(dev, blkstart, blklen) 1599 ); 1600 1601 DEFINE_EVENT(f2fs_discard, f2fs_issue_discard, 1602 1603 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen), 1604 1605 TP_ARGS(dev, blkstart, blklen) 1606 ); 1607 1608 DEFINE_EVENT(f2fs_discard, f2fs_remove_discard, 1609 1610 TP_PROTO(struct block_device *dev, block_t blkstart, block_t blklen), 1611 1612 TP_ARGS(dev, blkstart, blklen) 1613 ); 1614 1615 DECLARE_EVENT_CLASS(f2fs_reset_zone, 1616 1617 TP_PROTO(struct block_device *dev, block_t blkstart), 1618 1619 TP_ARGS(dev, blkstart), 1620 1621 TP_STRUCT__entry( 1622 __field(dev_t, dev) 1623 __field(block_t, blkstart) 1624 ), 1625 1626 TP_fast_assign( 1627 __entry->dev = dev->bd_dev; 1628 __entry->blkstart = blkstart; 1629 ), 1630 1631 TP_printk("dev = (%d,%d), zone at block = 0x%llx", 1632 show_dev(__entry->dev), 1633 (unsigned long long)__entry->blkstart) 1634 ); 1635 1636 DEFINE_EVENT(f2fs_reset_zone, f2fs_queue_reset_zone, 1637 1638 TP_PROTO(struct block_device *dev, block_t blkstart), 1639 1640 TP_ARGS(dev, blkstart) 1641 ); 1642 1643 DEFINE_EVENT(f2fs_reset_zone, f2fs_issue_reset_zone, 1644 1645 TP_PROTO(struct block_device *dev, block_t blkstart), 1646 1647 TP_ARGS(dev, blkstart) 1648 ); 1649 1650 TRACE_EVENT(f2fs_issue_flush, 1651 1652 TP_PROTO(struct block_device *dev, unsigned int nobarrier, 1653 unsigned int flush_merge, int ret), 1654 1655 TP_ARGS(dev, nobarrier, flush_merge, ret), 1656 1657 TP_STRUCT__entry( 1658 __field(dev_t, dev) 1659 __field(unsigned int, nobarrier) 1660 __field(unsigned int, flush_merge) 1661 __field(int, ret) 1662 ), 1663 1664 TP_fast_assign( 1665 __entry->dev = dev->bd_dev; 1666 __entry->nobarrier = nobarrier; 1667 __entry->flush_merge = flush_merge; 1668 __entry->ret = ret; 1669 ), 1670 1671 TP_printk("dev = (%d,%d), %s %s, ret = %d", 1672 show_dev(__entry->dev), 1673 __entry->nobarrier ? "skip (nobarrier)" : "issue", 1674 __entry->flush_merge ? " with flush_merge" : "", 1675 __entry->ret) 1676 ); 1677 1678 TRACE_EVENT(f2fs_lookup_extent_tree_start, 1679 1680 TP_PROTO(struct inode *inode, unsigned int pgofs, enum extent_type type), 1681 1682 TP_ARGS(inode, pgofs, type), 1683 1684 TP_STRUCT__entry( 1685 __field(dev_t, dev) 1686 __field(ino_t, ino) 1687 __field(unsigned int, pgofs) 1688 __field(enum extent_type, type) 1689 ), 1690 1691 TP_fast_assign( 1692 __entry->dev = inode->i_sb->s_dev; 1693 __entry->ino = inode->i_ino; 1694 __entry->pgofs = pgofs; 1695 __entry->type = type; 1696 ), 1697 1698 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, type = %s", 1699 show_dev_ino(__entry), 1700 __entry->pgofs, 1701 show_extent_type(__entry->type)) 1702 ); 1703 1704 TRACE_EVENT_CONDITION(f2fs_lookup_read_extent_tree_end, 1705 1706 TP_PROTO(struct inode *inode, unsigned int pgofs, 1707 struct extent_info *ei), 1708 1709 TP_ARGS(inode, pgofs, ei), 1710 1711 TP_CONDITION(ei), 1712 1713 TP_STRUCT__entry( 1714 __field(dev_t, dev) 1715 __field(ino_t, ino) 1716 __field(unsigned int, pgofs) 1717 __field(unsigned int, fofs) 1718 __field(unsigned int, len) 1719 __field(u32, blk) 1720 ), 1721 1722 TP_fast_assign( 1723 __entry->dev = inode->i_sb->s_dev; 1724 __entry->ino = inode->i_ino; 1725 __entry->pgofs = pgofs; 1726 __entry->fofs = ei->fofs; 1727 __entry->len = ei->len; 1728 __entry->blk = ei->blk; 1729 ), 1730 1731 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1732 "read_ext_info(fofs: %u, len: %u, blk: %u)", 1733 show_dev_ino(__entry), 1734 __entry->pgofs, 1735 __entry->fofs, 1736 __entry->len, 1737 __entry->blk) 1738 ); 1739 1740 TRACE_EVENT_CONDITION(f2fs_lookup_age_extent_tree_end, 1741 1742 TP_PROTO(struct inode *inode, unsigned int pgofs, 1743 struct extent_info *ei), 1744 1745 TP_ARGS(inode, pgofs, ei), 1746 1747 TP_CONDITION(ei), 1748 1749 TP_STRUCT__entry( 1750 __field(dev_t, dev) 1751 __field(ino_t, ino) 1752 __field(unsigned int, pgofs) 1753 __field(unsigned int, fofs) 1754 __field(unsigned int, len) 1755 __field(unsigned long long, age) 1756 __field(unsigned long long, blocks) 1757 ), 1758 1759 TP_fast_assign( 1760 __entry->dev = inode->i_sb->s_dev; 1761 __entry->ino = inode->i_ino; 1762 __entry->pgofs = pgofs; 1763 __entry->fofs = ei->fofs; 1764 __entry->len = ei->len; 1765 __entry->age = ei->age; 1766 __entry->blocks = ei->last_blocks; 1767 ), 1768 1769 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1770 "age_ext_info(fofs: %u, len: %u, age: %llu, blocks: %llu)", 1771 show_dev_ino(__entry), 1772 __entry->pgofs, 1773 __entry->fofs, 1774 __entry->len, 1775 __entry->age, 1776 __entry->blocks) 1777 ); 1778 1779 TRACE_EVENT(f2fs_update_read_extent_tree_range, 1780 1781 TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len, 1782 block_t blkaddr, 1783 unsigned int c_len), 1784 1785 TP_ARGS(inode, pgofs, len, blkaddr, c_len), 1786 1787 TP_STRUCT__entry( 1788 __field(dev_t, dev) 1789 __field(ino_t, ino) 1790 __field(unsigned int, pgofs) 1791 __field(u32, blk) 1792 __field(unsigned int, len) 1793 __field(unsigned int, c_len) 1794 ), 1795 1796 TP_fast_assign( 1797 __entry->dev = inode->i_sb->s_dev; 1798 __entry->ino = inode->i_ino; 1799 __entry->pgofs = pgofs; 1800 __entry->len = len; 1801 __entry->blk = blkaddr; 1802 __entry->c_len = c_len; 1803 ), 1804 1805 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1806 "len = %u, blkaddr = %u, c_len = %u", 1807 show_dev_ino(__entry), 1808 __entry->pgofs, 1809 __entry->len, 1810 __entry->blk, 1811 __entry->c_len) 1812 ); 1813 1814 TRACE_EVENT(f2fs_update_age_extent_tree_range, 1815 1816 TP_PROTO(struct inode *inode, unsigned int pgofs, unsigned int len, 1817 unsigned long long age, 1818 unsigned long long last_blks), 1819 1820 TP_ARGS(inode, pgofs, len, age, last_blks), 1821 1822 TP_STRUCT__entry( 1823 __field(dev_t, dev) 1824 __field(ino_t, ino) 1825 __field(unsigned int, pgofs) 1826 __field(unsigned int, len) 1827 __field(unsigned long long, age) 1828 __field(unsigned long long, blocks) 1829 ), 1830 1831 TP_fast_assign( 1832 __entry->dev = inode->i_sb->s_dev; 1833 __entry->ino = inode->i_ino; 1834 __entry->pgofs = pgofs; 1835 __entry->len = len; 1836 __entry->age = age; 1837 __entry->blocks = last_blks; 1838 ), 1839 1840 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1841 "len = %u, age = %llu, blocks = %llu", 1842 show_dev_ino(__entry), 1843 __entry->pgofs, 1844 __entry->len, 1845 __entry->age, 1846 __entry->blocks) 1847 ); 1848 1849 TRACE_EVENT(f2fs_shrink_extent_tree, 1850 1851 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt, 1852 unsigned int tree_cnt, enum extent_type type), 1853 1854 TP_ARGS(sbi, node_cnt, tree_cnt, type), 1855 1856 TP_STRUCT__entry( 1857 __field(dev_t, dev) 1858 __field(unsigned int, node_cnt) 1859 __field(unsigned int, tree_cnt) 1860 __field(enum extent_type, type) 1861 ), 1862 1863 TP_fast_assign( 1864 __entry->dev = sbi->sb->s_dev; 1865 __entry->node_cnt = node_cnt; 1866 __entry->tree_cnt = tree_cnt; 1867 __entry->type = type; 1868 ), 1869 1870 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u, type = %s", 1871 show_dev(__entry->dev), 1872 __entry->node_cnt, 1873 __entry->tree_cnt, 1874 show_extent_type(__entry->type)) 1875 ); 1876 1877 TRACE_EVENT(f2fs_destroy_extent_tree, 1878 1879 TP_PROTO(struct inode *inode, unsigned int node_cnt, 1880 enum extent_type type), 1881 1882 TP_ARGS(inode, node_cnt, type), 1883 1884 TP_STRUCT__entry( 1885 __field(dev_t, dev) 1886 __field(ino_t, ino) 1887 __field(unsigned int, node_cnt) 1888 __field(enum extent_type, type) 1889 ), 1890 1891 TP_fast_assign( 1892 __entry->dev = inode->i_sb->s_dev; 1893 __entry->ino = inode->i_ino; 1894 __entry->node_cnt = node_cnt; 1895 __entry->type = type; 1896 ), 1897 1898 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u, type = %s", 1899 show_dev_ino(__entry), 1900 __entry->node_cnt, 1901 show_extent_type(__entry->type)) 1902 ); 1903 1904 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes, 1905 1906 TP_PROTO(struct super_block *sb, int type, s64 count), 1907 1908 TP_ARGS(sb, type, count), 1909 1910 TP_STRUCT__entry( 1911 __field(dev_t, dev) 1912 __field(int, type) 1913 __field(s64, count) 1914 ), 1915 1916 TP_fast_assign( 1917 __entry->dev = sb->s_dev; 1918 __entry->type = type; 1919 __entry->count = count; 1920 ), 1921 1922 TP_printk("dev = (%d,%d), %s, dirty count = %lld", 1923 show_dev(__entry->dev), 1924 show_file_type(__entry->type), 1925 __entry->count) 1926 ); 1927 1928 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter, 1929 1930 TP_PROTO(struct super_block *sb, int type, s64 count), 1931 1932 TP_ARGS(sb, type, count) 1933 ); 1934 1935 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit, 1936 1937 TP_PROTO(struct super_block *sb, int type, s64 count), 1938 1939 TP_ARGS(sb, type, count) 1940 ); 1941 1942 TRACE_EVENT(f2fs_shutdown, 1943 1944 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int mode, int ret), 1945 1946 TP_ARGS(sbi, mode, ret), 1947 1948 TP_STRUCT__entry( 1949 __field(dev_t, dev) 1950 __field(unsigned int, mode) 1951 __field(int, ret) 1952 ), 1953 1954 TP_fast_assign( 1955 __entry->dev = sbi->sb->s_dev; 1956 __entry->mode = mode; 1957 __entry->ret = ret; 1958 ), 1959 1960 TP_printk("dev = (%d,%d), mode: %s, ret:%d", 1961 show_dev(__entry->dev), 1962 show_shutdown_mode(__entry->mode), 1963 __entry->ret) 1964 ); 1965 1966 DECLARE_EVENT_CLASS(f2fs_zip_start, 1967 1968 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 1969 unsigned int cluster_size, unsigned char algtype), 1970 1971 TP_ARGS(inode, cluster_idx, cluster_size, algtype), 1972 1973 TP_STRUCT__entry( 1974 __field(dev_t, dev) 1975 __field(ino_t, ino) 1976 __field(pgoff_t, idx) 1977 __field(unsigned int, size) 1978 __field(unsigned int, algtype) 1979 ), 1980 1981 TP_fast_assign( 1982 __entry->dev = inode->i_sb->s_dev; 1983 __entry->ino = inode->i_ino; 1984 __entry->idx = cluster_idx; 1985 __entry->size = cluster_size; 1986 __entry->algtype = algtype; 1987 ), 1988 1989 TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, " 1990 "cluster_size = %u, algorithm = %s", 1991 show_dev_ino(__entry), 1992 __entry->idx, 1993 __entry->size, 1994 show_compress_algorithm(__entry->algtype)) 1995 ); 1996 1997 DECLARE_EVENT_CLASS(f2fs_zip_end, 1998 1999 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 2000 unsigned int compressed_size, int ret), 2001 2002 TP_ARGS(inode, cluster_idx, compressed_size, ret), 2003 2004 TP_STRUCT__entry( 2005 __field(dev_t, dev) 2006 __field(ino_t, ino) 2007 __field(pgoff_t, idx) 2008 __field(unsigned int, size) 2009 __field(unsigned int, ret) 2010 ), 2011 2012 TP_fast_assign( 2013 __entry->dev = inode->i_sb->s_dev; 2014 __entry->ino = inode->i_ino; 2015 __entry->idx = cluster_idx; 2016 __entry->size = compressed_size; 2017 __entry->ret = ret; 2018 ), 2019 2020 TP_printk("dev = (%d,%d), ino = %lu, cluster_idx:%lu, " 2021 "compressed_size = %u, ret = %d", 2022 show_dev_ino(__entry), 2023 __entry->idx, 2024 __entry->size, 2025 __entry->ret) 2026 ); 2027 2028 DEFINE_EVENT(f2fs_zip_start, f2fs_compress_pages_start, 2029 2030 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 2031 unsigned int cluster_size, unsigned char algtype), 2032 2033 TP_ARGS(inode, cluster_idx, cluster_size, algtype) 2034 ); 2035 2036 DEFINE_EVENT(f2fs_zip_start, f2fs_decompress_pages_start, 2037 2038 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 2039 unsigned int cluster_size, unsigned char algtype), 2040 2041 TP_ARGS(inode, cluster_idx, cluster_size, algtype) 2042 ); 2043 2044 DEFINE_EVENT(f2fs_zip_end, f2fs_compress_pages_end, 2045 2046 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 2047 unsigned int compressed_size, int ret), 2048 2049 TP_ARGS(inode, cluster_idx, compressed_size, ret) 2050 ); 2051 2052 DEFINE_EVENT(f2fs_zip_end, f2fs_decompress_pages_end, 2053 2054 TP_PROTO(struct inode *inode, pgoff_t cluster_idx, 2055 unsigned int compressed_size, int ret), 2056 2057 TP_ARGS(inode, cluster_idx, compressed_size, ret) 2058 ); 2059 2060 #ifdef CONFIG_F2FS_IOSTAT 2061 TRACE_EVENT(f2fs_iostat, 2062 2063 TP_PROTO(struct f2fs_sb_info *sbi, unsigned long long *iostat), 2064 2065 TP_ARGS(sbi, iostat), 2066 2067 TP_STRUCT__entry( 2068 __field(dev_t, dev) 2069 __field(unsigned long long, app_dio) 2070 __field(unsigned long long, app_bio) 2071 __field(unsigned long long, app_wio) 2072 __field(unsigned long long, app_mio) 2073 __field(unsigned long long, app_bcdio) 2074 __field(unsigned long long, app_mcdio) 2075 __field(unsigned long long, fs_dio) 2076 __field(unsigned long long, fs_cdio) 2077 __field(unsigned long long, fs_nio) 2078 __field(unsigned long long, fs_mio) 2079 __field(unsigned long long, fs_gc_dio) 2080 __field(unsigned long long, fs_gc_nio) 2081 __field(unsigned long long, fs_cp_dio) 2082 __field(unsigned long long, fs_cp_nio) 2083 __field(unsigned long long, fs_cp_mio) 2084 __field(unsigned long long, app_drio) 2085 __field(unsigned long long, app_brio) 2086 __field(unsigned long long, app_rio) 2087 __field(unsigned long long, app_mrio) 2088 __field(unsigned long long, app_bcrio) 2089 __field(unsigned long long, app_mcrio) 2090 __field(unsigned long long, fs_drio) 2091 __field(unsigned long long, fs_gdrio) 2092 __field(unsigned long long, fs_cdrio) 2093 __field(unsigned long long, fs_nrio) 2094 __field(unsigned long long, fs_mrio) 2095 __field(unsigned long long, fs_discard) 2096 __field(unsigned long long, fs_reset_zone) 2097 ), 2098 2099 TP_fast_assign( 2100 __entry->dev = sbi->sb->s_dev; 2101 __entry->app_dio = iostat[APP_DIRECT_IO]; 2102 __entry->app_bio = iostat[APP_BUFFERED_IO]; 2103 __entry->app_wio = iostat[APP_WRITE_IO]; 2104 __entry->app_mio = iostat[APP_MAPPED_IO]; 2105 __entry->app_bcdio = iostat[APP_BUFFERED_CDATA_IO]; 2106 __entry->app_mcdio = iostat[APP_MAPPED_CDATA_IO]; 2107 __entry->fs_dio = iostat[FS_DATA_IO]; 2108 __entry->fs_cdio = iostat[FS_CDATA_IO]; 2109 __entry->fs_nio = iostat[FS_NODE_IO]; 2110 __entry->fs_mio = iostat[FS_META_IO]; 2111 __entry->fs_gc_dio = iostat[FS_GC_DATA_IO]; 2112 __entry->fs_gc_nio = iostat[FS_GC_NODE_IO]; 2113 __entry->fs_cp_dio = iostat[FS_CP_DATA_IO]; 2114 __entry->fs_cp_nio = iostat[FS_CP_NODE_IO]; 2115 __entry->fs_cp_mio = iostat[FS_CP_META_IO]; 2116 __entry->app_drio = iostat[APP_DIRECT_READ_IO]; 2117 __entry->app_brio = iostat[APP_BUFFERED_READ_IO]; 2118 __entry->app_rio = iostat[APP_READ_IO]; 2119 __entry->app_mrio = iostat[APP_MAPPED_READ_IO]; 2120 __entry->app_bcrio = iostat[APP_BUFFERED_CDATA_READ_IO]; 2121 __entry->app_mcrio = iostat[APP_MAPPED_CDATA_READ_IO]; 2122 __entry->fs_drio = iostat[FS_DATA_READ_IO]; 2123 __entry->fs_gdrio = iostat[FS_GDATA_READ_IO]; 2124 __entry->fs_cdrio = iostat[FS_CDATA_READ_IO]; 2125 __entry->fs_nrio = iostat[FS_NODE_READ_IO]; 2126 __entry->fs_mrio = iostat[FS_META_READ_IO]; 2127 __entry->fs_discard = iostat[FS_DISCARD_IO]; 2128 __entry->fs_reset_zone = iostat[FS_ZONE_RESET_IO]; 2129 ), 2130 2131 TP_printk("dev = (%d,%d), " 2132 "app [write=%llu (direct=%llu, buffered=%llu), mapped=%llu, " 2133 "compr(buffered=%llu, mapped=%llu)], " 2134 "fs [data=%llu, cdata=%llu, node=%llu, meta=%llu, discard=%llu, " 2135 "reset_zone=%llu], " 2136 "gc [data=%llu, node=%llu], " 2137 "cp [data=%llu, node=%llu, meta=%llu], " 2138 "app [read=%llu (direct=%llu, buffered=%llu), mapped=%llu], " 2139 "compr(buffered=%llu, mapped=%llu)], " 2140 "fs [data=%llu, (gc_data=%llu, cdata=%llu), " 2141 "node=%llu, meta=%llu]", 2142 show_dev(__entry->dev), __entry->app_wio, __entry->app_dio, 2143 __entry->app_bio, __entry->app_mio, __entry->app_bcdio, 2144 __entry->app_mcdio, __entry->fs_dio, __entry->fs_cdio, 2145 __entry->fs_nio, __entry->fs_mio, __entry->fs_discard, 2146 __entry->fs_reset_zone, 2147 __entry->fs_gc_dio, __entry->fs_gc_nio, __entry->fs_cp_dio, 2148 __entry->fs_cp_nio, __entry->fs_cp_mio, 2149 __entry->app_rio, __entry->app_drio, __entry->app_brio, 2150 __entry->app_mrio, __entry->app_bcrio, __entry->app_mcrio, 2151 __entry->fs_drio, __entry->fs_gdrio, 2152 __entry->fs_cdrio, __entry->fs_nrio, __entry->fs_mrio) 2153 ); 2154 2155 #ifndef __F2FS_IOSTAT_LATENCY_TYPE 2156 #define __F2FS_IOSTAT_LATENCY_TYPE 2157 struct f2fs_iostat_latency { 2158 unsigned int peak_lat; 2159 unsigned int avg_lat; 2160 unsigned int cnt; 2161 }; 2162 #endif /* __F2FS_IOSTAT_LATENCY_TYPE */ 2163 2164 TRACE_EVENT(f2fs_iostat_latency, 2165 2166 TP_PROTO(struct f2fs_sb_info *sbi, struct f2fs_iostat_latency (*iostat_lat)[NR_PAGE_TYPE]), 2167 2168 TP_ARGS(sbi, iostat_lat), 2169 2170 TP_STRUCT__entry( 2171 __field(dev_t, dev) 2172 __field(unsigned int, d_rd_peak) 2173 __field(unsigned int, d_rd_avg) 2174 __field(unsigned int, d_rd_cnt) 2175 __field(unsigned int, n_rd_peak) 2176 __field(unsigned int, n_rd_avg) 2177 __field(unsigned int, n_rd_cnt) 2178 __field(unsigned int, m_rd_peak) 2179 __field(unsigned int, m_rd_avg) 2180 __field(unsigned int, m_rd_cnt) 2181 __field(unsigned int, d_wr_s_peak) 2182 __field(unsigned int, d_wr_s_avg) 2183 __field(unsigned int, d_wr_s_cnt) 2184 __field(unsigned int, n_wr_s_peak) 2185 __field(unsigned int, n_wr_s_avg) 2186 __field(unsigned int, n_wr_s_cnt) 2187 __field(unsigned int, m_wr_s_peak) 2188 __field(unsigned int, m_wr_s_avg) 2189 __field(unsigned int, m_wr_s_cnt) 2190 __field(unsigned int, d_wr_as_peak) 2191 __field(unsigned int, d_wr_as_avg) 2192 __field(unsigned int, d_wr_as_cnt) 2193 __field(unsigned int, n_wr_as_peak) 2194 __field(unsigned int, n_wr_as_avg) 2195 __field(unsigned int, n_wr_as_cnt) 2196 __field(unsigned int, m_wr_as_peak) 2197 __field(unsigned int, m_wr_as_avg) 2198 __field(unsigned int, m_wr_as_cnt) 2199 ), 2200 2201 TP_fast_assign( 2202 __entry->dev = sbi->sb->s_dev; 2203 __entry->d_rd_peak = iostat_lat[READ_IO][DATA].peak_lat; 2204 __entry->d_rd_avg = iostat_lat[READ_IO][DATA].avg_lat; 2205 __entry->d_rd_cnt = iostat_lat[READ_IO][DATA].cnt; 2206 __entry->n_rd_peak = iostat_lat[READ_IO][NODE].peak_lat; 2207 __entry->n_rd_avg = iostat_lat[READ_IO][NODE].avg_lat; 2208 __entry->n_rd_cnt = iostat_lat[READ_IO][NODE].cnt; 2209 __entry->m_rd_peak = iostat_lat[READ_IO][META].peak_lat; 2210 __entry->m_rd_avg = iostat_lat[READ_IO][META].avg_lat; 2211 __entry->m_rd_cnt = iostat_lat[READ_IO][META].cnt; 2212 __entry->d_wr_s_peak = iostat_lat[WRITE_SYNC_IO][DATA].peak_lat; 2213 __entry->d_wr_s_avg = iostat_lat[WRITE_SYNC_IO][DATA].avg_lat; 2214 __entry->d_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][DATA].cnt; 2215 __entry->n_wr_s_peak = iostat_lat[WRITE_SYNC_IO][NODE].peak_lat; 2216 __entry->n_wr_s_avg = iostat_lat[WRITE_SYNC_IO][NODE].avg_lat; 2217 __entry->n_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][NODE].cnt; 2218 __entry->m_wr_s_peak = iostat_lat[WRITE_SYNC_IO][META].peak_lat; 2219 __entry->m_wr_s_avg = iostat_lat[WRITE_SYNC_IO][META].avg_lat; 2220 __entry->m_wr_s_cnt = iostat_lat[WRITE_SYNC_IO][META].cnt; 2221 __entry->d_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][DATA].peak_lat; 2222 __entry->d_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][DATA].avg_lat; 2223 __entry->d_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][DATA].cnt; 2224 __entry->n_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][NODE].peak_lat; 2225 __entry->n_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][NODE].avg_lat; 2226 __entry->n_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][NODE].cnt; 2227 __entry->m_wr_as_peak = iostat_lat[WRITE_ASYNC_IO][META].peak_lat; 2228 __entry->m_wr_as_avg = iostat_lat[WRITE_ASYNC_IO][META].avg_lat; 2229 __entry->m_wr_as_cnt = iostat_lat[WRITE_ASYNC_IO][META].cnt; 2230 ), 2231 2232 TP_printk("dev = (%d,%d), " 2233 "iotype [peak lat.(ms)/avg lat.(ms)/count], " 2234 "rd_data [%u/%u/%u], rd_node [%u/%u/%u], rd_meta [%u/%u/%u], " 2235 "wr_sync_data [%u/%u/%u], wr_sync_node [%u/%u/%u], " 2236 "wr_sync_meta [%u/%u/%u], wr_async_data [%u/%u/%u], " 2237 "wr_async_node [%u/%u/%u], wr_async_meta [%u/%u/%u]", 2238 show_dev(__entry->dev), 2239 __entry->d_rd_peak, __entry->d_rd_avg, __entry->d_rd_cnt, 2240 __entry->n_rd_peak, __entry->n_rd_avg, __entry->n_rd_cnt, 2241 __entry->m_rd_peak, __entry->m_rd_avg, __entry->m_rd_cnt, 2242 __entry->d_wr_s_peak, __entry->d_wr_s_avg, __entry->d_wr_s_cnt, 2243 __entry->n_wr_s_peak, __entry->n_wr_s_avg, __entry->n_wr_s_cnt, 2244 __entry->m_wr_s_peak, __entry->m_wr_s_avg, __entry->m_wr_s_cnt, 2245 __entry->d_wr_as_peak, __entry->d_wr_as_avg, __entry->d_wr_as_cnt, 2246 __entry->n_wr_as_peak, __entry->n_wr_as_avg, __entry->n_wr_as_cnt, 2247 __entry->m_wr_as_peak, __entry->m_wr_as_avg, __entry->m_wr_as_cnt) 2248 ); 2249 #endif 2250 2251 TRACE_EVENT(f2fs_bmap, 2252 2253 TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock), 2254 2255 TP_ARGS(inode, lblock, pblock), 2256 2257 TP_STRUCT__entry( 2258 __field(dev_t, dev) 2259 __field(ino_t, ino) 2260 __field(sector_t, lblock) 2261 __field(sector_t, pblock) 2262 ), 2263 2264 TP_fast_assign( 2265 __entry->dev = inode->i_sb->s_dev; 2266 __entry->ino = inode->i_ino; 2267 __entry->lblock = lblock; 2268 __entry->pblock = pblock; 2269 ), 2270 2271 TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld", 2272 show_dev_ino(__entry), 2273 (unsigned long long)__entry->lblock, 2274 (unsigned long long)__entry->pblock) 2275 ); 2276 2277 TRACE_EVENT(f2fs_fiemap, 2278 2279 TP_PROTO(struct inode *inode, sector_t lblock, sector_t pblock, 2280 unsigned long long len, unsigned int flags, int ret), 2281 2282 TP_ARGS(inode, lblock, pblock, len, flags, ret), 2283 2284 TP_STRUCT__entry( 2285 __field(dev_t, dev) 2286 __field(ino_t, ino) 2287 __field(sector_t, lblock) 2288 __field(sector_t, pblock) 2289 __field(unsigned long long, len) 2290 __field(unsigned int, flags) 2291 __field(int, ret) 2292 ), 2293 2294 TP_fast_assign( 2295 __entry->dev = inode->i_sb->s_dev; 2296 __entry->ino = inode->i_ino; 2297 __entry->lblock = lblock; 2298 __entry->pblock = pblock; 2299 __entry->len = len; 2300 __entry->flags = flags; 2301 __entry->ret = ret; 2302 ), 2303 2304 TP_printk("dev = (%d,%d), ino = %lu, lblock:%lld, pblock:%lld, " 2305 "len:%llu, flags:%u, ret:%d", 2306 show_dev_ino(__entry), 2307 (unsigned long long)__entry->lblock, 2308 (unsigned long long)__entry->pblock, 2309 __entry->len, 2310 __entry->flags, 2311 __entry->ret) 2312 ); 2313 2314 DECLARE_EVENT_CLASS(f2fs__rw_start, 2315 2316 TP_PROTO(struct inode *inode, loff_t offset, int bytes, 2317 pid_t pid, char *pathname, char *command), 2318 2319 TP_ARGS(inode, offset, bytes, pid, pathname, command), 2320 2321 TP_STRUCT__entry( 2322 __string(pathbuf, pathname) 2323 __field(loff_t, offset) 2324 __field(int, bytes) 2325 __field(loff_t, i_size) 2326 __string(cmdline, command) 2327 __field(pid_t, pid) 2328 __field(ino_t, ino) 2329 ), 2330 2331 TP_fast_assign( 2332 /* 2333 * Replace the spaces in filenames and cmdlines 2334 * because this screws up the tooling that parses 2335 * the traces. 2336 */ 2337 __assign_str(pathbuf); 2338 (void)strreplace(__get_str(pathbuf), ' ', '_'); 2339 __entry->offset = offset; 2340 __entry->bytes = bytes; 2341 __entry->i_size = i_size_read(inode); 2342 __assign_str(cmdline); 2343 (void)strreplace(__get_str(cmdline), ' ', '_'); 2344 __entry->pid = pid; 2345 __entry->ino = inode->i_ino; 2346 ), 2347 2348 TP_printk("entry_name %s, offset %llu, bytes %d, cmdline %s," 2349 " pid %d, i_size %llu, ino %lu", 2350 __get_str(pathbuf), __entry->offset, __entry->bytes, 2351 __get_str(cmdline), __entry->pid, __entry->i_size, 2352 (unsigned long) __entry->ino) 2353 ); 2354 2355 DECLARE_EVENT_CLASS(f2fs__rw_end, 2356 2357 TP_PROTO(struct inode *inode, loff_t offset, int bytes), 2358 2359 TP_ARGS(inode, offset, bytes), 2360 2361 TP_STRUCT__entry( 2362 __field(ino_t, ino) 2363 __field(loff_t, offset) 2364 __field(int, bytes) 2365 ), 2366 2367 TP_fast_assign( 2368 __entry->ino = inode->i_ino; 2369 __entry->offset = offset; 2370 __entry->bytes = bytes; 2371 ), 2372 2373 TP_printk("ino %lu, offset %llu, bytes %d", 2374 (unsigned long) __entry->ino, 2375 __entry->offset, __entry->bytes) 2376 ); 2377 2378 DEFINE_EVENT(f2fs__rw_start, f2fs_dataread_start, 2379 2380 TP_PROTO(struct inode *inode, loff_t offset, int bytes, 2381 pid_t pid, char *pathname, char *command), 2382 2383 TP_ARGS(inode, offset, bytes, pid, pathname, command) 2384 ); 2385 2386 DEFINE_EVENT(f2fs__rw_end, f2fs_dataread_end, 2387 2388 TP_PROTO(struct inode *inode, loff_t offset, int bytes), 2389 2390 TP_ARGS(inode, offset, bytes) 2391 ); 2392 2393 DEFINE_EVENT(f2fs__rw_start, f2fs_datawrite_start, 2394 2395 TP_PROTO(struct inode *inode, loff_t offset, int bytes, 2396 pid_t pid, char *pathname, char *command), 2397 2398 TP_ARGS(inode, offset, bytes, pid, pathname, command) 2399 ); 2400 2401 DEFINE_EVENT(f2fs__rw_end, f2fs_datawrite_end, 2402 2403 TP_PROTO(struct inode *inode, loff_t offset, int bytes), 2404 2405 TP_ARGS(inode, offset, bytes) 2406 ); 2407 2408 #endif /* _TRACE_F2FS_H */ 2409 2410 /* This part must be outside protection */ 2411 #include <trace/define_trace.h> 2412