1 #undef TRACE_SYSTEM 2 #define TRACE_SYSTEM f2fs 3 4 #if !defined(_TRACE_F2FS_H) || defined(TRACE_HEADER_MULTI_READ) 5 #define _TRACE_F2FS_H 6 7 #include <linux/tracepoint.h> 8 9 #define show_dev(entry) MAJOR(entry->dev), MINOR(entry->dev) 10 #define show_dev_ino(entry) show_dev(entry), (unsigned long)entry->ino 11 12 TRACE_DEFINE_ENUM(NODE); 13 TRACE_DEFINE_ENUM(DATA); 14 TRACE_DEFINE_ENUM(META); 15 TRACE_DEFINE_ENUM(META_FLUSH); 16 TRACE_DEFINE_ENUM(INMEM); 17 TRACE_DEFINE_ENUM(INMEM_DROP); 18 TRACE_DEFINE_ENUM(IPU); 19 TRACE_DEFINE_ENUM(OPU); 20 TRACE_DEFINE_ENUM(CURSEG_HOT_DATA); 21 TRACE_DEFINE_ENUM(CURSEG_WARM_DATA); 22 TRACE_DEFINE_ENUM(CURSEG_COLD_DATA); 23 TRACE_DEFINE_ENUM(CURSEG_HOT_NODE); 24 TRACE_DEFINE_ENUM(CURSEG_WARM_NODE); 25 TRACE_DEFINE_ENUM(CURSEG_COLD_NODE); 26 TRACE_DEFINE_ENUM(NO_CHECK_TYPE); 27 TRACE_DEFINE_ENUM(GC_GREEDY); 28 TRACE_DEFINE_ENUM(GC_CB); 29 TRACE_DEFINE_ENUM(FG_GC); 30 TRACE_DEFINE_ENUM(BG_GC); 31 TRACE_DEFINE_ENUM(LFS); 32 TRACE_DEFINE_ENUM(SSR); 33 TRACE_DEFINE_ENUM(__REQ_RAHEAD); 34 TRACE_DEFINE_ENUM(__REQ_SYNC); 35 TRACE_DEFINE_ENUM(__REQ_NOIDLE); 36 TRACE_DEFINE_ENUM(__REQ_PREFLUSH); 37 TRACE_DEFINE_ENUM(__REQ_FUA); 38 TRACE_DEFINE_ENUM(__REQ_PRIO); 39 TRACE_DEFINE_ENUM(__REQ_META); 40 TRACE_DEFINE_ENUM(CP_UMOUNT); 41 TRACE_DEFINE_ENUM(CP_FASTBOOT); 42 TRACE_DEFINE_ENUM(CP_SYNC); 43 TRACE_DEFINE_ENUM(CP_RECOVERY); 44 TRACE_DEFINE_ENUM(CP_DISCARD); 45 46 #define show_block_type(type) \ 47 __print_symbolic(type, \ 48 { NODE, "NODE" }, \ 49 { DATA, "DATA" }, \ 50 { META, "META" }, \ 51 { META_FLUSH, "META_FLUSH" }, \ 52 { INMEM, "INMEM" }, \ 53 { INMEM_DROP, "INMEM_DROP" }, \ 54 { INMEM_REVOKE, "INMEM_REVOKE" }, \ 55 { IPU, "IN-PLACE" }, \ 56 { OPU, "OUT-OF-PLACE" }) 57 58 #define F2FS_BIO_FLAG_MASK(t) (t & (REQ_RAHEAD | WRITE_FLUSH_FUA)) 59 #define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO)) 60 61 #define show_bio_type(op_flags) show_bio_op_flags(op_flags), \ 62 show_bio_extra(op_flags) 63 64 #define show_bio_op_flags(flags) \ 65 __print_symbolic(F2FS_BIO_FLAG_MASK(flags), \ 66 { 0, "WRITE" }, \ 67 { REQ_RAHEAD, "READAHEAD" }, \ 68 { READ_SYNC, "READ_SYNC" }, \ 69 { WRITE_SYNC, "WRITE_SYNC" }, \ 70 { WRITE_FLUSH, "WRITE_FLUSH" }, \ 71 { WRITE_FUA, "WRITE_FUA" }, \ 72 { WRITE_FLUSH_FUA, "WRITE_FLUSH_FUA" }) 73 74 #define show_bio_extra(type) \ 75 __print_symbolic(F2FS_BIO_EXTRA_MASK(type), \ 76 { REQ_META, "(M)" }, \ 77 { REQ_PRIO, "(P)" }, \ 78 { REQ_META | REQ_PRIO, "(MP)" }, \ 79 { 0, " \b" }) 80 81 #define show_data_type(type) \ 82 __print_symbolic(type, \ 83 { CURSEG_HOT_DATA, "Hot DATA" }, \ 84 { CURSEG_WARM_DATA, "Warm DATA" }, \ 85 { CURSEG_COLD_DATA, "Cold DATA" }, \ 86 { CURSEG_HOT_NODE, "Hot NODE" }, \ 87 { CURSEG_WARM_NODE, "Warm NODE" }, \ 88 { CURSEG_COLD_NODE, "Cold NODE" }, \ 89 { NO_CHECK_TYPE, "No TYPE" }) 90 91 #define show_file_type(type) \ 92 __print_symbolic(type, \ 93 { 0, "FILE" }, \ 94 { 1, "DIR" }) 95 96 #define show_gc_type(type) \ 97 __print_symbolic(type, \ 98 { FG_GC, "Foreground GC" }, \ 99 { BG_GC, "Background GC" }) 100 101 #define show_alloc_mode(type) \ 102 __print_symbolic(type, \ 103 { LFS, "LFS-mode" }, \ 104 { SSR, "SSR-mode" }) 105 106 #define show_victim_policy(type) \ 107 __print_symbolic(type, \ 108 { GC_GREEDY, "Greedy" }, \ 109 { GC_CB, "Cost-Benefit" }) 110 111 #define show_cpreason(type) \ 112 __print_symbolic(type, \ 113 { CP_UMOUNT, "Umount" }, \ 114 { CP_FASTBOOT, "Fastboot" }, \ 115 { CP_SYNC, "Sync" }, \ 116 { CP_RECOVERY, "Recovery" }, \ 117 { CP_DISCARD, "Discard" }) 118 119 struct victim_sel_policy; 120 struct f2fs_map_blocks; 121 122 DECLARE_EVENT_CLASS(f2fs__inode, 123 124 TP_PROTO(struct inode *inode), 125 126 TP_ARGS(inode), 127 128 TP_STRUCT__entry( 129 __field(dev_t, dev) 130 __field(ino_t, ino) 131 __field(ino_t, pino) 132 __field(umode_t, mode) 133 __field(loff_t, size) 134 __field(unsigned int, nlink) 135 __field(blkcnt_t, blocks) 136 __field(__u8, advise) 137 ), 138 139 TP_fast_assign( 140 __entry->dev = inode->i_sb->s_dev; 141 __entry->ino = inode->i_ino; 142 __entry->pino = F2FS_I(inode)->i_pino; 143 __entry->mode = inode->i_mode; 144 __entry->nlink = inode->i_nlink; 145 __entry->size = inode->i_size; 146 __entry->blocks = inode->i_blocks; 147 __entry->advise = F2FS_I(inode)->i_advise; 148 ), 149 150 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, " 151 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x", 152 show_dev_ino(__entry), 153 (unsigned long)__entry->pino, 154 __entry->mode, 155 __entry->size, 156 (unsigned int)__entry->nlink, 157 (unsigned long long)__entry->blocks, 158 (unsigned char)__entry->advise) 159 ); 160 161 DECLARE_EVENT_CLASS(f2fs__inode_exit, 162 163 TP_PROTO(struct inode *inode, int ret), 164 165 TP_ARGS(inode, ret), 166 167 TP_STRUCT__entry( 168 __field(dev_t, dev) 169 __field(ino_t, ino) 170 __field(int, ret) 171 ), 172 173 TP_fast_assign( 174 __entry->dev = inode->i_sb->s_dev; 175 __entry->ino = inode->i_ino; 176 __entry->ret = ret; 177 ), 178 179 TP_printk("dev = (%d,%d), ino = %lu, ret = %d", 180 show_dev_ino(__entry), 181 __entry->ret) 182 ); 183 184 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter, 185 186 TP_PROTO(struct inode *inode), 187 188 TP_ARGS(inode) 189 ); 190 191 TRACE_EVENT(f2fs_sync_file_exit, 192 193 TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret), 194 195 TP_ARGS(inode, need_cp, datasync, ret), 196 197 TP_STRUCT__entry( 198 __field(dev_t, dev) 199 __field(ino_t, ino) 200 __field(int, need_cp) 201 __field(int, datasync) 202 __field(int, ret) 203 ), 204 205 TP_fast_assign( 206 __entry->dev = inode->i_sb->s_dev; 207 __entry->ino = inode->i_ino; 208 __entry->need_cp = need_cp; 209 __entry->datasync = datasync; 210 __entry->ret = ret; 211 ), 212 213 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, " 214 "datasync = %d, ret = %d", 215 show_dev_ino(__entry), 216 __entry->need_cp ? "needed" : "not needed", 217 __entry->datasync, 218 __entry->ret) 219 ); 220 221 TRACE_EVENT(f2fs_sync_fs, 222 223 TP_PROTO(struct super_block *sb, int wait), 224 225 TP_ARGS(sb, wait), 226 227 TP_STRUCT__entry( 228 __field(dev_t, dev) 229 __field(int, dirty) 230 __field(int, wait) 231 ), 232 233 TP_fast_assign( 234 __entry->dev = sb->s_dev; 235 __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY); 236 __entry->wait = wait; 237 ), 238 239 TP_printk("dev = (%d,%d), superblock is %s, wait = %d", 240 show_dev(__entry), 241 __entry->dirty ? "dirty" : "not dirty", 242 __entry->wait) 243 ); 244 245 DEFINE_EVENT(f2fs__inode, f2fs_iget, 246 247 TP_PROTO(struct inode *inode), 248 249 TP_ARGS(inode) 250 ); 251 252 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit, 253 254 TP_PROTO(struct inode *inode, int ret), 255 256 TP_ARGS(inode, ret) 257 ); 258 259 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode, 260 261 TP_PROTO(struct inode *inode), 262 263 TP_ARGS(inode) 264 ); 265 266 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode, 267 268 TP_PROTO(struct inode *inode, int ret), 269 270 TP_ARGS(inode, ret) 271 ); 272 273 TRACE_EVENT(f2fs_unlink_enter, 274 275 TP_PROTO(struct inode *dir, struct dentry *dentry), 276 277 TP_ARGS(dir, dentry), 278 279 TP_STRUCT__entry( 280 __field(dev_t, dev) 281 __field(ino_t, ino) 282 __field(loff_t, size) 283 __field(blkcnt_t, blocks) 284 __field(const char *, name) 285 ), 286 287 TP_fast_assign( 288 __entry->dev = dir->i_sb->s_dev; 289 __entry->ino = dir->i_ino; 290 __entry->size = dir->i_size; 291 __entry->blocks = dir->i_blocks; 292 __entry->name = dentry->d_name.name; 293 ), 294 295 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, " 296 "i_blocks = %llu, name = %s", 297 show_dev_ino(__entry), 298 __entry->size, 299 (unsigned long long)__entry->blocks, 300 __entry->name) 301 ); 302 303 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit, 304 305 TP_PROTO(struct inode *inode, int ret), 306 307 TP_ARGS(inode, ret) 308 ); 309 310 DEFINE_EVENT(f2fs__inode, f2fs_truncate, 311 312 TP_PROTO(struct inode *inode), 313 314 TP_ARGS(inode) 315 ); 316 317 TRACE_EVENT(f2fs_truncate_data_blocks_range, 318 319 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free), 320 321 TP_ARGS(inode, nid, ofs, free), 322 323 TP_STRUCT__entry( 324 __field(dev_t, dev) 325 __field(ino_t, ino) 326 __field(nid_t, nid) 327 __field(unsigned int, ofs) 328 __field(int, free) 329 ), 330 331 TP_fast_assign( 332 __entry->dev = inode->i_sb->s_dev; 333 __entry->ino = inode->i_ino; 334 __entry->nid = nid; 335 __entry->ofs = ofs; 336 __entry->free = free; 337 ), 338 339 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d", 340 show_dev_ino(__entry), 341 (unsigned int)__entry->nid, 342 __entry->ofs, 343 __entry->free) 344 ); 345 346 DECLARE_EVENT_CLASS(f2fs__truncate_op, 347 348 TP_PROTO(struct inode *inode, u64 from), 349 350 TP_ARGS(inode, from), 351 352 TP_STRUCT__entry( 353 __field(dev_t, dev) 354 __field(ino_t, ino) 355 __field(loff_t, size) 356 __field(blkcnt_t, blocks) 357 __field(u64, from) 358 ), 359 360 TP_fast_assign( 361 __entry->dev = inode->i_sb->s_dev; 362 __entry->ino = inode->i_ino; 363 __entry->size = inode->i_size; 364 __entry->blocks = inode->i_blocks; 365 __entry->from = from; 366 ), 367 368 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, " 369 "start file offset = %llu", 370 show_dev_ino(__entry), 371 __entry->size, 372 (unsigned long long)__entry->blocks, 373 (unsigned long long)__entry->from) 374 ); 375 376 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter, 377 378 TP_PROTO(struct inode *inode, u64 from), 379 380 TP_ARGS(inode, from) 381 ); 382 383 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit, 384 385 TP_PROTO(struct inode *inode, int ret), 386 387 TP_ARGS(inode, ret) 388 ); 389 390 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter, 391 392 TP_PROTO(struct inode *inode, u64 from), 393 394 TP_ARGS(inode, from) 395 ); 396 397 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit, 398 399 TP_PROTO(struct inode *inode, int ret), 400 401 TP_ARGS(inode, ret) 402 ); 403 404 DECLARE_EVENT_CLASS(f2fs__truncate_node, 405 406 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 407 408 TP_ARGS(inode, nid, blk_addr), 409 410 TP_STRUCT__entry( 411 __field(dev_t, dev) 412 __field(ino_t, ino) 413 __field(nid_t, nid) 414 __field(block_t, blk_addr) 415 ), 416 417 TP_fast_assign( 418 __entry->dev = inode->i_sb->s_dev; 419 __entry->ino = inode->i_ino; 420 __entry->nid = nid; 421 __entry->blk_addr = blk_addr; 422 ), 423 424 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx", 425 show_dev_ino(__entry), 426 (unsigned int)__entry->nid, 427 (unsigned long long)__entry->blk_addr) 428 ); 429 430 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter, 431 432 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 433 434 TP_ARGS(inode, nid, blk_addr) 435 ); 436 437 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit, 438 439 TP_PROTO(struct inode *inode, int ret), 440 441 TP_ARGS(inode, ret) 442 ); 443 444 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node, 445 446 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 447 448 TP_ARGS(inode, nid, blk_addr) 449 ); 450 451 TRACE_EVENT(f2fs_truncate_partial_nodes, 452 453 TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err), 454 455 TP_ARGS(inode, nid, depth, err), 456 457 TP_STRUCT__entry( 458 __field(dev_t, dev) 459 __field(ino_t, ino) 460 __field(nid_t, nid[3]) 461 __field(int, depth) 462 __field(int, err) 463 ), 464 465 TP_fast_assign( 466 __entry->dev = inode->i_sb->s_dev; 467 __entry->ino = inode->i_ino; 468 __entry->nid[0] = nid[0]; 469 __entry->nid[1] = nid[1]; 470 __entry->nid[2] = nid[2]; 471 __entry->depth = depth; 472 __entry->err = err; 473 ), 474 475 TP_printk("dev = (%d,%d), ino = %lu, " 476 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d", 477 show_dev_ino(__entry), 478 (unsigned int)__entry->nid[0], 479 (unsigned int)__entry->nid[1], 480 (unsigned int)__entry->nid[2], 481 __entry->depth, 482 __entry->err) 483 ); 484 485 TRACE_EVENT(f2fs_map_blocks, 486 TP_PROTO(struct inode *inode, struct f2fs_map_blocks *map, int ret), 487 488 TP_ARGS(inode, map, ret), 489 490 TP_STRUCT__entry( 491 __field(dev_t, dev) 492 __field(ino_t, ino) 493 __field(block_t, m_lblk) 494 __field(block_t, m_pblk) 495 __field(unsigned int, m_len) 496 __field(int, ret) 497 ), 498 499 TP_fast_assign( 500 __entry->dev = inode->i_sb->s_dev; 501 __entry->ino = inode->i_ino; 502 __entry->m_lblk = map->m_lblk; 503 __entry->m_pblk = map->m_pblk; 504 __entry->m_len = map->m_len; 505 __entry->ret = ret; 506 ), 507 508 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, " 509 "start blkaddr = 0x%llx, len = 0x%llx, err = %d", 510 show_dev_ino(__entry), 511 (unsigned long long)__entry->m_lblk, 512 (unsigned long long)__entry->m_pblk, 513 (unsigned long long)__entry->m_len, 514 __entry->ret) 515 ); 516 517 TRACE_EVENT(f2fs_background_gc, 518 519 TP_PROTO(struct super_block *sb, long wait_ms, 520 unsigned int prefree, unsigned int free), 521 522 TP_ARGS(sb, wait_ms, prefree, free), 523 524 TP_STRUCT__entry( 525 __field(dev_t, dev) 526 __field(long, wait_ms) 527 __field(unsigned int, prefree) 528 __field(unsigned int, free) 529 ), 530 531 TP_fast_assign( 532 __entry->dev = sb->s_dev; 533 __entry->wait_ms = wait_ms; 534 __entry->prefree = prefree; 535 __entry->free = free; 536 ), 537 538 TP_printk("dev = (%d,%d), wait_ms = %ld, prefree = %u, free = %u", 539 show_dev(__entry), 540 __entry->wait_ms, 541 __entry->prefree, 542 __entry->free) 543 ); 544 545 TRACE_EVENT(f2fs_get_victim, 546 547 TP_PROTO(struct super_block *sb, int type, int gc_type, 548 struct victim_sel_policy *p, unsigned int pre_victim, 549 unsigned int prefree, unsigned int free), 550 551 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free), 552 553 TP_STRUCT__entry( 554 __field(dev_t, dev) 555 __field(int, type) 556 __field(int, gc_type) 557 __field(int, alloc_mode) 558 __field(int, gc_mode) 559 __field(unsigned int, victim) 560 __field(unsigned int, ofs_unit) 561 __field(unsigned int, pre_victim) 562 __field(unsigned int, prefree) 563 __field(unsigned int, free) 564 ), 565 566 TP_fast_assign( 567 __entry->dev = sb->s_dev; 568 __entry->type = type; 569 __entry->gc_type = gc_type; 570 __entry->alloc_mode = p->alloc_mode; 571 __entry->gc_mode = p->gc_mode; 572 __entry->victim = p->min_segno; 573 __entry->ofs_unit = p->ofs_unit; 574 __entry->pre_victim = pre_victim; 575 __entry->prefree = prefree; 576 __entry->free = free; 577 ), 578 579 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u " 580 "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u", 581 show_dev(__entry), 582 show_data_type(__entry->type), 583 show_gc_type(__entry->gc_type), 584 show_alloc_mode(__entry->alloc_mode), 585 show_victim_policy(__entry->gc_mode), 586 __entry->victim, 587 __entry->ofs_unit, 588 (int)__entry->pre_victim, 589 __entry->prefree, 590 __entry->free) 591 ); 592 593 TRACE_EVENT(f2fs_fallocate, 594 595 TP_PROTO(struct inode *inode, int mode, 596 loff_t offset, loff_t len, int ret), 597 598 TP_ARGS(inode, mode, offset, len, ret), 599 600 TP_STRUCT__entry( 601 __field(dev_t, dev) 602 __field(ino_t, ino) 603 __field(int, mode) 604 __field(loff_t, offset) 605 __field(loff_t, len) 606 __field(loff_t, size) 607 __field(blkcnt_t, blocks) 608 __field(int, ret) 609 ), 610 611 TP_fast_assign( 612 __entry->dev = inode->i_sb->s_dev; 613 __entry->ino = inode->i_ino; 614 __entry->mode = mode; 615 __entry->offset = offset; 616 __entry->len = len; 617 __entry->size = inode->i_size; 618 __entry->blocks = inode->i_blocks; 619 __entry->ret = ret; 620 ), 621 622 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, " 623 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d", 624 show_dev_ino(__entry), 625 __entry->mode, 626 (unsigned long long)__entry->offset, 627 (unsigned long long)__entry->len, 628 (unsigned long long)__entry->size, 629 (unsigned long long)__entry->blocks, 630 __entry->ret) 631 ); 632 633 TRACE_EVENT(f2fs_direct_IO_enter, 634 635 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw), 636 637 TP_ARGS(inode, offset, len, rw), 638 639 TP_STRUCT__entry( 640 __field(dev_t, dev) 641 __field(ino_t, ino) 642 __field(loff_t, pos) 643 __field(unsigned long, len) 644 __field(int, rw) 645 ), 646 647 TP_fast_assign( 648 __entry->dev = inode->i_sb->s_dev; 649 __entry->ino = inode->i_ino; 650 __entry->pos = offset; 651 __entry->len = len; 652 __entry->rw = rw; 653 ), 654 655 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d", 656 show_dev_ino(__entry), 657 __entry->pos, 658 __entry->len, 659 __entry->rw) 660 ); 661 662 TRACE_EVENT(f2fs_direct_IO_exit, 663 664 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, 665 int rw, int ret), 666 667 TP_ARGS(inode, offset, len, rw, ret), 668 669 TP_STRUCT__entry( 670 __field(dev_t, dev) 671 __field(ino_t, ino) 672 __field(loff_t, pos) 673 __field(unsigned long, len) 674 __field(int, rw) 675 __field(int, ret) 676 ), 677 678 TP_fast_assign( 679 __entry->dev = inode->i_sb->s_dev; 680 __entry->ino = inode->i_ino; 681 __entry->pos = offset; 682 __entry->len = len; 683 __entry->rw = rw; 684 __entry->ret = ret; 685 ), 686 687 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu " 688 "rw = %d ret = %d", 689 show_dev_ino(__entry), 690 __entry->pos, 691 __entry->len, 692 __entry->rw, 693 __entry->ret) 694 ); 695 696 TRACE_EVENT(f2fs_reserve_new_blocks, 697 698 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node, 699 blkcnt_t count), 700 701 TP_ARGS(inode, nid, ofs_in_node, count), 702 703 TP_STRUCT__entry( 704 __field(dev_t, dev) 705 __field(nid_t, nid) 706 __field(unsigned int, ofs_in_node) 707 __field(blkcnt_t, count) 708 ), 709 710 TP_fast_assign( 711 __entry->dev = inode->i_sb->s_dev; 712 __entry->nid = nid; 713 __entry->ofs_in_node = ofs_in_node; 714 __entry->count = count; 715 ), 716 717 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u, count = %llu", 718 show_dev(__entry), 719 (unsigned int)__entry->nid, 720 __entry->ofs_in_node, 721 (unsigned long long)__entry->count) 722 ); 723 724 DECLARE_EVENT_CLASS(f2fs__submit_page_bio, 725 726 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 727 728 TP_ARGS(page, fio), 729 730 TP_STRUCT__entry( 731 __field(dev_t, dev) 732 __field(ino_t, ino) 733 __field(pgoff_t, index) 734 __field(block_t, old_blkaddr) 735 __field(block_t, new_blkaddr) 736 __field(int, op) 737 __field(int, op_flags) 738 __field(int, type) 739 ), 740 741 TP_fast_assign( 742 __entry->dev = page->mapping->host->i_sb->s_dev; 743 __entry->ino = page->mapping->host->i_ino; 744 __entry->index = page->index; 745 __entry->old_blkaddr = fio->old_blkaddr; 746 __entry->new_blkaddr = fio->new_blkaddr; 747 __entry->op = fio->op; 748 __entry->op_flags = fio->op_flags; 749 __entry->type = fio->type; 750 ), 751 752 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, " 753 "oldaddr = 0x%llx, newaddr = 0x%llx, rw = %s%s, type = %s", 754 show_dev_ino(__entry), 755 (unsigned long)__entry->index, 756 (unsigned long long)__entry->old_blkaddr, 757 (unsigned long long)__entry->new_blkaddr, 758 show_bio_type(__entry->op_flags), 759 show_block_type(__entry->type)) 760 ); 761 762 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio, 763 764 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 765 766 TP_ARGS(page, fio), 767 768 TP_CONDITION(page->mapping) 769 ); 770 771 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_mbio, 772 773 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 774 775 TP_ARGS(page, fio), 776 777 TP_CONDITION(page->mapping) 778 ); 779 780 DECLARE_EVENT_CLASS(f2fs__submit_bio, 781 782 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 783 struct bio *bio), 784 785 TP_ARGS(sb, fio, bio), 786 787 TP_STRUCT__entry( 788 __field(dev_t, dev) 789 __field(int, op) 790 __field(int, op_flags) 791 __field(int, type) 792 __field(sector_t, sector) 793 __field(unsigned int, size) 794 ), 795 796 TP_fast_assign( 797 __entry->dev = sb->s_dev; 798 __entry->op = fio->op; 799 __entry->op_flags = fio->op_flags; 800 __entry->type = fio->type; 801 __entry->sector = bio->bi_iter.bi_sector; 802 __entry->size = bio->bi_iter.bi_size; 803 ), 804 805 TP_printk("dev = (%d,%d), rw = %s%s, %s, sector = %lld, size = %u", 806 show_dev(__entry), 807 show_bio_type(__entry->op_flags), 808 show_block_type(__entry->type), 809 (unsigned long long)__entry->sector, 810 __entry->size) 811 ); 812 813 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio, 814 815 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 816 struct bio *bio), 817 818 TP_ARGS(sb, fio, bio), 819 820 TP_CONDITION(bio) 821 ); 822 823 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio, 824 825 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 826 struct bio *bio), 827 828 TP_ARGS(sb, fio, bio), 829 830 TP_CONDITION(bio) 831 ); 832 833 TRACE_EVENT(f2fs_write_begin, 834 835 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 836 unsigned int flags), 837 838 TP_ARGS(inode, pos, len, flags), 839 840 TP_STRUCT__entry( 841 __field(dev_t, dev) 842 __field(ino_t, ino) 843 __field(loff_t, pos) 844 __field(unsigned int, len) 845 __field(unsigned int, flags) 846 ), 847 848 TP_fast_assign( 849 __entry->dev = inode->i_sb->s_dev; 850 __entry->ino = inode->i_ino; 851 __entry->pos = pos; 852 __entry->len = len; 853 __entry->flags = flags; 854 ), 855 856 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u", 857 show_dev_ino(__entry), 858 (unsigned long long)__entry->pos, 859 __entry->len, 860 __entry->flags) 861 ); 862 863 TRACE_EVENT(f2fs_write_end, 864 865 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 866 unsigned int copied), 867 868 TP_ARGS(inode, pos, len, copied), 869 870 TP_STRUCT__entry( 871 __field(dev_t, dev) 872 __field(ino_t, ino) 873 __field(loff_t, pos) 874 __field(unsigned int, len) 875 __field(unsigned int, copied) 876 ), 877 878 TP_fast_assign( 879 __entry->dev = inode->i_sb->s_dev; 880 __entry->ino = inode->i_ino; 881 __entry->pos = pos; 882 __entry->len = len; 883 __entry->copied = copied; 884 ), 885 886 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u", 887 show_dev_ino(__entry), 888 (unsigned long long)__entry->pos, 889 __entry->len, 890 __entry->copied) 891 ); 892 893 DECLARE_EVENT_CLASS(f2fs__page, 894 895 TP_PROTO(struct page *page, int type), 896 897 TP_ARGS(page, type), 898 899 TP_STRUCT__entry( 900 __field(dev_t, dev) 901 __field(ino_t, ino) 902 __field(int, type) 903 __field(int, dir) 904 __field(pgoff_t, index) 905 __field(int, dirty) 906 __field(int, uptodate) 907 ), 908 909 TP_fast_assign( 910 __entry->dev = page->mapping->host->i_sb->s_dev; 911 __entry->ino = page->mapping->host->i_ino; 912 __entry->type = type; 913 __entry->dir = S_ISDIR(page->mapping->host->i_mode); 914 __entry->index = page->index; 915 __entry->dirty = PageDirty(page); 916 __entry->uptodate = PageUptodate(page); 917 ), 918 919 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, " 920 "dirty = %d, uptodate = %d", 921 show_dev_ino(__entry), 922 show_block_type(__entry->type), 923 show_file_type(__entry->dir), 924 (unsigned long)__entry->index, 925 __entry->dirty, 926 __entry->uptodate) 927 ); 928 929 DEFINE_EVENT(f2fs__page, f2fs_writepage, 930 931 TP_PROTO(struct page *page, int type), 932 933 TP_ARGS(page, type) 934 ); 935 936 DEFINE_EVENT(f2fs__page, f2fs_do_write_data_page, 937 938 TP_PROTO(struct page *page, int type), 939 940 TP_ARGS(page, type) 941 ); 942 943 DEFINE_EVENT(f2fs__page, f2fs_readpage, 944 945 TP_PROTO(struct page *page, int type), 946 947 TP_ARGS(page, type) 948 ); 949 950 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, 951 952 TP_PROTO(struct page *page, int type), 953 954 TP_ARGS(page, type) 955 ); 956 957 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite, 958 959 TP_PROTO(struct page *page, int type), 960 961 TP_ARGS(page, type) 962 ); 963 964 DEFINE_EVENT(f2fs__page, f2fs_register_inmem_page, 965 966 TP_PROTO(struct page *page, int type), 967 968 TP_ARGS(page, type) 969 ); 970 971 DEFINE_EVENT(f2fs__page, f2fs_commit_inmem_page, 972 973 TP_PROTO(struct page *page, int type), 974 975 TP_ARGS(page, type) 976 ); 977 978 TRACE_EVENT(f2fs_writepages, 979 980 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type), 981 982 TP_ARGS(inode, wbc, type), 983 984 TP_STRUCT__entry( 985 __field(dev_t, dev) 986 __field(ino_t, ino) 987 __field(int, type) 988 __field(int, dir) 989 __field(long, nr_to_write) 990 __field(long, pages_skipped) 991 __field(loff_t, range_start) 992 __field(loff_t, range_end) 993 __field(pgoff_t, writeback_index) 994 __field(int, sync_mode) 995 __field(char, for_kupdate) 996 __field(char, for_background) 997 __field(char, tagged_writepages) 998 __field(char, for_reclaim) 999 __field(char, range_cyclic) 1000 __field(char, for_sync) 1001 ), 1002 1003 TP_fast_assign( 1004 __entry->dev = inode->i_sb->s_dev; 1005 __entry->ino = inode->i_ino; 1006 __entry->type = type; 1007 __entry->dir = S_ISDIR(inode->i_mode); 1008 __entry->nr_to_write = wbc->nr_to_write; 1009 __entry->pages_skipped = wbc->pages_skipped; 1010 __entry->range_start = wbc->range_start; 1011 __entry->range_end = wbc->range_end; 1012 __entry->writeback_index = inode->i_mapping->writeback_index; 1013 __entry->sync_mode = wbc->sync_mode; 1014 __entry->for_kupdate = wbc->for_kupdate; 1015 __entry->for_background = wbc->for_background; 1016 __entry->tagged_writepages = wbc->tagged_writepages; 1017 __entry->for_reclaim = wbc->for_reclaim; 1018 __entry->range_cyclic = wbc->range_cyclic; 1019 __entry->for_sync = wbc->for_sync; 1020 ), 1021 1022 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, " 1023 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, " 1024 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u", 1025 show_dev_ino(__entry), 1026 show_block_type(__entry->type), 1027 show_file_type(__entry->dir), 1028 __entry->nr_to_write, 1029 __entry->pages_skipped, 1030 __entry->range_start, 1031 __entry->range_end, 1032 (unsigned long)__entry->writeback_index, 1033 __entry->sync_mode, 1034 __entry->for_kupdate, 1035 __entry->for_background, 1036 __entry->tagged_writepages, 1037 __entry->for_reclaim, 1038 __entry->range_cyclic, 1039 __entry->for_sync) 1040 ); 1041 1042 TRACE_EVENT(f2fs_readpages, 1043 1044 TP_PROTO(struct inode *inode, struct page *page, unsigned int nrpage), 1045 1046 TP_ARGS(inode, page, nrpage), 1047 1048 TP_STRUCT__entry( 1049 __field(dev_t, dev) 1050 __field(ino_t, ino) 1051 __field(pgoff_t, start) 1052 __field(unsigned int, nrpage) 1053 ), 1054 1055 TP_fast_assign( 1056 __entry->dev = inode->i_sb->s_dev; 1057 __entry->ino = inode->i_ino; 1058 __entry->start = page->index; 1059 __entry->nrpage = nrpage; 1060 ), 1061 1062 TP_printk("dev = (%d,%d), ino = %lu, start = %lu nrpage = %u", 1063 show_dev_ino(__entry), 1064 (unsigned long)__entry->start, 1065 __entry->nrpage) 1066 ); 1067 1068 TRACE_EVENT(f2fs_write_checkpoint, 1069 1070 TP_PROTO(struct super_block *sb, int reason, char *msg), 1071 1072 TP_ARGS(sb, reason, msg), 1073 1074 TP_STRUCT__entry( 1075 __field(dev_t, dev) 1076 __field(int, reason) 1077 __field(char *, msg) 1078 ), 1079 1080 TP_fast_assign( 1081 __entry->dev = sb->s_dev; 1082 __entry->reason = reason; 1083 __entry->msg = msg; 1084 ), 1085 1086 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s", 1087 show_dev(__entry), 1088 show_cpreason(__entry->reason), 1089 __entry->msg) 1090 ); 1091 1092 TRACE_EVENT(f2fs_issue_discard, 1093 1094 TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen), 1095 1096 TP_ARGS(sb, blkstart, blklen), 1097 1098 TP_STRUCT__entry( 1099 __field(dev_t, dev) 1100 __field(block_t, blkstart) 1101 __field(block_t, blklen) 1102 ), 1103 1104 TP_fast_assign( 1105 __entry->dev = sb->s_dev; 1106 __entry->blkstart = blkstart; 1107 __entry->blklen = blklen; 1108 ), 1109 1110 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx", 1111 show_dev(__entry), 1112 (unsigned long long)__entry->blkstart, 1113 (unsigned long long)__entry->blklen) 1114 ); 1115 1116 TRACE_EVENT(f2fs_issue_flush, 1117 1118 TP_PROTO(struct super_block *sb, unsigned int nobarrier, 1119 unsigned int flush_merge), 1120 1121 TP_ARGS(sb, nobarrier, flush_merge), 1122 1123 TP_STRUCT__entry( 1124 __field(dev_t, dev) 1125 __field(unsigned int, nobarrier) 1126 __field(unsigned int, flush_merge) 1127 ), 1128 1129 TP_fast_assign( 1130 __entry->dev = sb->s_dev; 1131 __entry->nobarrier = nobarrier; 1132 __entry->flush_merge = flush_merge; 1133 ), 1134 1135 TP_printk("dev = (%d,%d), %s %s", 1136 show_dev(__entry), 1137 __entry->nobarrier ? "skip (nobarrier)" : "issue", 1138 __entry->flush_merge ? " with flush_merge" : "") 1139 ); 1140 1141 TRACE_EVENT(f2fs_lookup_extent_tree_start, 1142 1143 TP_PROTO(struct inode *inode, unsigned int pgofs), 1144 1145 TP_ARGS(inode, pgofs), 1146 1147 TP_STRUCT__entry( 1148 __field(dev_t, dev) 1149 __field(ino_t, ino) 1150 __field(unsigned int, pgofs) 1151 ), 1152 1153 TP_fast_assign( 1154 __entry->dev = inode->i_sb->s_dev; 1155 __entry->ino = inode->i_ino; 1156 __entry->pgofs = pgofs; 1157 ), 1158 1159 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u", 1160 show_dev_ino(__entry), 1161 __entry->pgofs) 1162 ); 1163 1164 TRACE_EVENT_CONDITION(f2fs_lookup_extent_tree_end, 1165 1166 TP_PROTO(struct inode *inode, unsigned int pgofs, 1167 struct extent_info *ei), 1168 1169 TP_ARGS(inode, pgofs, ei), 1170 1171 TP_CONDITION(ei), 1172 1173 TP_STRUCT__entry( 1174 __field(dev_t, dev) 1175 __field(ino_t, ino) 1176 __field(unsigned int, pgofs) 1177 __field(unsigned int, fofs) 1178 __field(u32, blk) 1179 __field(unsigned int, len) 1180 ), 1181 1182 TP_fast_assign( 1183 __entry->dev = inode->i_sb->s_dev; 1184 __entry->ino = inode->i_ino; 1185 __entry->pgofs = pgofs; 1186 __entry->fofs = ei->fofs; 1187 __entry->blk = ei->blk; 1188 __entry->len = ei->len; 1189 ), 1190 1191 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1192 "ext_info(fofs: %u, blk: %u, len: %u)", 1193 show_dev_ino(__entry), 1194 __entry->pgofs, 1195 __entry->fofs, 1196 __entry->blk, 1197 __entry->len) 1198 ); 1199 1200 TRACE_EVENT(f2fs_update_extent_tree_range, 1201 1202 TP_PROTO(struct inode *inode, unsigned int pgofs, block_t blkaddr, 1203 unsigned int len), 1204 1205 TP_ARGS(inode, pgofs, blkaddr, len), 1206 1207 TP_STRUCT__entry( 1208 __field(dev_t, dev) 1209 __field(ino_t, ino) 1210 __field(unsigned int, pgofs) 1211 __field(u32, blk) 1212 __field(unsigned int, len) 1213 ), 1214 1215 TP_fast_assign( 1216 __entry->dev = inode->i_sb->s_dev; 1217 __entry->ino = inode->i_ino; 1218 __entry->pgofs = pgofs; 1219 __entry->blk = blkaddr; 1220 __entry->len = len; 1221 ), 1222 1223 TP_printk("dev = (%d,%d), ino = %lu, pgofs = %u, " 1224 "blkaddr = %u, len = %u", 1225 show_dev_ino(__entry), 1226 __entry->pgofs, 1227 __entry->blk, 1228 __entry->len) 1229 ); 1230 1231 TRACE_EVENT(f2fs_shrink_extent_tree, 1232 1233 TP_PROTO(struct f2fs_sb_info *sbi, unsigned int node_cnt, 1234 unsigned int tree_cnt), 1235 1236 TP_ARGS(sbi, node_cnt, tree_cnt), 1237 1238 TP_STRUCT__entry( 1239 __field(dev_t, dev) 1240 __field(unsigned int, node_cnt) 1241 __field(unsigned int, tree_cnt) 1242 ), 1243 1244 TP_fast_assign( 1245 __entry->dev = sbi->sb->s_dev; 1246 __entry->node_cnt = node_cnt; 1247 __entry->tree_cnt = tree_cnt; 1248 ), 1249 1250 TP_printk("dev = (%d,%d), shrunk: node_cnt = %u, tree_cnt = %u", 1251 show_dev(__entry), 1252 __entry->node_cnt, 1253 __entry->tree_cnt) 1254 ); 1255 1256 TRACE_EVENT(f2fs_destroy_extent_tree, 1257 1258 TP_PROTO(struct inode *inode, unsigned int node_cnt), 1259 1260 TP_ARGS(inode, node_cnt), 1261 1262 TP_STRUCT__entry( 1263 __field(dev_t, dev) 1264 __field(ino_t, ino) 1265 __field(unsigned int, node_cnt) 1266 ), 1267 1268 TP_fast_assign( 1269 __entry->dev = inode->i_sb->s_dev; 1270 __entry->ino = inode->i_ino; 1271 __entry->node_cnt = node_cnt; 1272 ), 1273 1274 TP_printk("dev = (%d,%d), ino = %lu, destroyed: node_cnt = %u", 1275 show_dev_ino(__entry), 1276 __entry->node_cnt) 1277 ); 1278 1279 DECLARE_EVENT_CLASS(f2fs_sync_dirty_inodes, 1280 1281 TP_PROTO(struct super_block *sb, int type, s64 count), 1282 1283 TP_ARGS(sb, type, count), 1284 1285 TP_STRUCT__entry( 1286 __field(dev_t, dev) 1287 __field(int, type) 1288 __field(s64, count) 1289 ), 1290 1291 TP_fast_assign( 1292 __entry->dev = sb->s_dev; 1293 __entry->type = type; 1294 __entry->count = count; 1295 ), 1296 1297 TP_printk("dev = (%d,%d), %s, dirty count = %lld", 1298 show_dev(__entry), 1299 show_file_type(__entry->type), 1300 __entry->count) 1301 ); 1302 1303 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_enter, 1304 1305 TP_PROTO(struct super_block *sb, int type, s64 count), 1306 1307 TP_ARGS(sb, type, count) 1308 ); 1309 1310 DEFINE_EVENT(f2fs_sync_dirty_inodes, f2fs_sync_dirty_inodes_exit, 1311 1312 TP_PROTO(struct super_block *sb, int type, s64 count), 1313 1314 TP_ARGS(sb, type, count) 1315 ); 1316 1317 #endif /* _TRACE_F2FS_H */ 1318 1319 /* This part must be outside protection */ 1320 #include <trace/define_trace.h> 1321