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