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 #define show_block_type(type) \ 13 __print_symbolic(type, \ 14 { NODE, "NODE" }, \ 15 { DATA, "DATA" }, \ 16 { META, "META" }, \ 17 { META_FLUSH, "META_FLUSH" }) 18 19 #define F2FS_BIO_MASK(t) (t & (READA | WRITE_FLUSH_FUA)) 20 #define F2FS_BIO_EXTRA_MASK(t) (t & (REQ_META | REQ_PRIO)) 21 22 #define show_bio_type(type) show_bio_base(type), show_bio_extra(type) 23 24 #define show_bio_base(type) \ 25 __print_symbolic(F2FS_BIO_MASK(type), \ 26 { READ, "READ" }, \ 27 { READA, "READAHEAD" }, \ 28 { READ_SYNC, "READ_SYNC" }, \ 29 { WRITE, "WRITE" }, \ 30 { WRITE_SYNC, "WRITE_SYNC" }, \ 31 { WRITE_FLUSH, "WRITE_FLUSH" }, \ 32 { WRITE_FUA, "WRITE_FUA" }, \ 33 { WRITE_FLUSH_FUA, "WRITE_FLUSH_FUA" }) 34 35 #define show_bio_extra(type) \ 36 __print_symbolic(F2FS_BIO_EXTRA_MASK(type), \ 37 { REQ_META, "(M)" }, \ 38 { REQ_PRIO, "(P)" }, \ 39 { REQ_META | REQ_PRIO, "(MP)" }, \ 40 { 0, " \b" }) 41 42 #define show_data_type(type) \ 43 __print_symbolic(type, \ 44 { CURSEG_HOT_DATA, "Hot DATA" }, \ 45 { CURSEG_WARM_DATA, "Warm DATA" }, \ 46 { CURSEG_COLD_DATA, "Cold DATA" }, \ 47 { CURSEG_HOT_NODE, "Hot NODE" }, \ 48 { CURSEG_WARM_NODE, "Warm NODE" }, \ 49 { CURSEG_COLD_NODE, "Cold NODE" }, \ 50 { NO_CHECK_TYPE, "No TYPE" }) 51 52 #define show_file_type(type) \ 53 __print_symbolic(type, \ 54 { 0, "FILE" }, \ 55 { 1, "DIR" }) 56 57 #define show_gc_type(type) \ 58 __print_symbolic(type, \ 59 { FG_GC, "Foreground GC" }, \ 60 { BG_GC, "Background GC" }) 61 62 #define show_alloc_mode(type) \ 63 __print_symbolic(type, \ 64 { LFS, "LFS-mode" }, \ 65 { SSR, "SSR-mode" }) 66 67 #define show_victim_policy(type) \ 68 __print_symbolic(type, \ 69 { GC_GREEDY, "Greedy" }, \ 70 { GC_CB, "Cost-Benefit" }) 71 72 #define show_cpreason(type) \ 73 __print_symbolic(type, \ 74 { CP_UMOUNT, "Umount" }, \ 75 { CP_FASTBOOT, "Fastboot" }, \ 76 { CP_SYNC, "Sync" }, \ 77 { CP_DISCARD, "Discard" }) 78 79 struct victim_sel_policy; 80 81 DECLARE_EVENT_CLASS(f2fs__inode, 82 83 TP_PROTO(struct inode *inode), 84 85 TP_ARGS(inode), 86 87 TP_STRUCT__entry( 88 __field(dev_t, dev) 89 __field(ino_t, ino) 90 __field(ino_t, pino) 91 __field(umode_t, mode) 92 __field(loff_t, size) 93 __field(unsigned int, nlink) 94 __field(blkcnt_t, blocks) 95 __field(__u8, advise) 96 ), 97 98 TP_fast_assign( 99 __entry->dev = inode->i_sb->s_dev; 100 __entry->ino = inode->i_ino; 101 __entry->pino = F2FS_I(inode)->i_pino; 102 __entry->mode = inode->i_mode; 103 __entry->nlink = inode->i_nlink; 104 __entry->size = inode->i_size; 105 __entry->blocks = inode->i_blocks; 106 __entry->advise = F2FS_I(inode)->i_advise; 107 ), 108 109 TP_printk("dev = (%d,%d), ino = %lu, pino = %lu, i_mode = 0x%hx, " 110 "i_size = %lld, i_nlink = %u, i_blocks = %llu, i_advise = 0x%x", 111 show_dev_ino(__entry), 112 (unsigned long)__entry->pino, 113 __entry->mode, 114 __entry->size, 115 (unsigned int)__entry->nlink, 116 (unsigned long long)__entry->blocks, 117 (unsigned char)__entry->advise) 118 ); 119 120 DECLARE_EVENT_CLASS(f2fs__inode_exit, 121 122 TP_PROTO(struct inode *inode, int ret), 123 124 TP_ARGS(inode, ret), 125 126 TP_STRUCT__entry( 127 __field(dev_t, dev) 128 __field(ino_t, ino) 129 __field(int, ret) 130 ), 131 132 TP_fast_assign( 133 __entry->dev = inode->i_sb->s_dev; 134 __entry->ino = inode->i_ino; 135 __entry->ret = ret; 136 ), 137 138 TP_printk("dev = (%d,%d), ino = %lu, ret = %d", 139 show_dev_ino(__entry), 140 __entry->ret) 141 ); 142 143 DEFINE_EVENT(f2fs__inode, f2fs_sync_file_enter, 144 145 TP_PROTO(struct inode *inode), 146 147 TP_ARGS(inode) 148 ); 149 150 TRACE_EVENT(f2fs_sync_file_exit, 151 152 TP_PROTO(struct inode *inode, int need_cp, int datasync, int ret), 153 154 TP_ARGS(inode, need_cp, datasync, ret), 155 156 TP_STRUCT__entry( 157 __field(dev_t, dev) 158 __field(ino_t, ino) 159 __field(int, need_cp) 160 __field(int, datasync) 161 __field(int, ret) 162 ), 163 164 TP_fast_assign( 165 __entry->dev = inode->i_sb->s_dev; 166 __entry->ino = inode->i_ino; 167 __entry->need_cp = need_cp; 168 __entry->datasync = datasync; 169 __entry->ret = ret; 170 ), 171 172 TP_printk("dev = (%d,%d), ino = %lu, checkpoint is %s, " 173 "datasync = %d, ret = %d", 174 show_dev_ino(__entry), 175 __entry->need_cp ? "needed" : "not needed", 176 __entry->datasync, 177 __entry->ret) 178 ); 179 180 TRACE_EVENT(f2fs_sync_fs, 181 182 TP_PROTO(struct super_block *sb, int wait), 183 184 TP_ARGS(sb, wait), 185 186 TP_STRUCT__entry( 187 __field(dev_t, dev) 188 __field(int, dirty) 189 __field(int, wait) 190 ), 191 192 TP_fast_assign( 193 __entry->dev = sb->s_dev; 194 __entry->dirty = is_sbi_flag_set(F2FS_SB(sb), SBI_IS_DIRTY); 195 __entry->wait = wait; 196 ), 197 198 TP_printk("dev = (%d,%d), superblock is %s, wait = %d", 199 show_dev(__entry), 200 __entry->dirty ? "dirty" : "not dirty", 201 __entry->wait) 202 ); 203 204 DEFINE_EVENT(f2fs__inode, f2fs_iget, 205 206 TP_PROTO(struct inode *inode), 207 208 TP_ARGS(inode) 209 ); 210 211 DEFINE_EVENT(f2fs__inode_exit, f2fs_iget_exit, 212 213 TP_PROTO(struct inode *inode, int ret), 214 215 TP_ARGS(inode, ret) 216 ); 217 218 DEFINE_EVENT(f2fs__inode, f2fs_evict_inode, 219 220 TP_PROTO(struct inode *inode), 221 222 TP_ARGS(inode) 223 ); 224 225 DEFINE_EVENT(f2fs__inode_exit, f2fs_new_inode, 226 227 TP_PROTO(struct inode *inode, int ret), 228 229 TP_ARGS(inode, ret) 230 ); 231 232 TRACE_EVENT(f2fs_unlink_enter, 233 234 TP_PROTO(struct inode *dir, struct dentry *dentry), 235 236 TP_ARGS(dir, dentry), 237 238 TP_STRUCT__entry( 239 __field(dev_t, dev) 240 __field(ino_t, ino) 241 __field(loff_t, size) 242 __field(blkcnt_t, blocks) 243 __field(const char *, name) 244 ), 245 246 TP_fast_assign( 247 __entry->dev = dir->i_sb->s_dev; 248 __entry->ino = dir->i_ino; 249 __entry->size = dir->i_size; 250 __entry->blocks = dir->i_blocks; 251 __entry->name = dentry->d_name.name; 252 ), 253 254 TP_printk("dev = (%d,%d), dir ino = %lu, i_size = %lld, " 255 "i_blocks = %llu, name = %s", 256 show_dev_ino(__entry), 257 __entry->size, 258 (unsigned long long)__entry->blocks, 259 __entry->name) 260 ); 261 262 DEFINE_EVENT(f2fs__inode_exit, f2fs_unlink_exit, 263 264 TP_PROTO(struct inode *inode, int ret), 265 266 TP_ARGS(inode, ret) 267 ); 268 269 DEFINE_EVENT(f2fs__inode, f2fs_truncate, 270 271 TP_PROTO(struct inode *inode), 272 273 TP_ARGS(inode) 274 ); 275 276 TRACE_EVENT(f2fs_truncate_data_blocks_range, 277 278 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs, int free), 279 280 TP_ARGS(inode, nid, ofs, free), 281 282 TP_STRUCT__entry( 283 __field(dev_t, dev) 284 __field(ino_t, ino) 285 __field(nid_t, nid) 286 __field(unsigned int, ofs) 287 __field(int, free) 288 ), 289 290 TP_fast_assign( 291 __entry->dev = inode->i_sb->s_dev; 292 __entry->ino = inode->i_ino; 293 __entry->nid = nid; 294 __entry->ofs = ofs; 295 __entry->free = free; 296 ), 297 298 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, offset = %u, freed = %d", 299 show_dev_ino(__entry), 300 (unsigned int)__entry->nid, 301 __entry->ofs, 302 __entry->free) 303 ); 304 305 DECLARE_EVENT_CLASS(f2fs__truncate_op, 306 307 TP_PROTO(struct inode *inode, u64 from), 308 309 TP_ARGS(inode, from), 310 311 TP_STRUCT__entry( 312 __field(dev_t, dev) 313 __field(ino_t, ino) 314 __field(loff_t, size) 315 __field(blkcnt_t, blocks) 316 __field(u64, from) 317 ), 318 319 TP_fast_assign( 320 __entry->dev = inode->i_sb->s_dev; 321 __entry->ino = inode->i_ino; 322 __entry->size = inode->i_size; 323 __entry->blocks = inode->i_blocks; 324 __entry->from = from; 325 ), 326 327 TP_printk("dev = (%d,%d), ino = %lu, i_size = %lld, i_blocks = %llu, " 328 "start file offset = %llu", 329 show_dev_ino(__entry), 330 __entry->size, 331 (unsigned long long)__entry->blocks, 332 (unsigned long long)__entry->from) 333 ); 334 335 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_blocks_enter, 336 337 TP_PROTO(struct inode *inode, u64 from), 338 339 TP_ARGS(inode, from) 340 ); 341 342 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_blocks_exit, 343 344 TP_PROTO(struct inode *inode, int ret), 345 346 TP_ARGS(inode, ret) 347 ); 348 349 DEFINE_EVENT(f2fs__truncate_op, f2fs_truncate_inode_blocks_enter, 350 351 TP_PROTO(struct inode *inode, u64 from), 352 353 TP_ARGS(inode, from) 354 ); 355 356 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_inode_blocks_exit, 357 358 TP_PROTO(struct inode *inode, int ret), 359 360 TP_ARGS(inode, ret) 361 ); 362 363 DECLARE_EVENT_CLASS(f2fs__truncate_node, 364 365 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 366 367 TP_ARGS(inode, nid, blk_addr), 368 369 TP_STRUCT__entry( 370 __field(dev_t, dev) 371 __field(ino_t, ino) 372 __field(nid_t, nid) 373 __field(block_t, blk_addr) 374 ), 375 376 TP_fast_assign( 377 __entry->dev = inode->i_sb->s_dev; 378 __entry->ino = inode->i_ino; 379 __entry->nid = nid; 380 __entry->blk_addr = blk_addr; 381 ), 382 383 TP_printk("dev = (%d,%d), ino = %lu, nid = %u, block_address = 0x%llx", 384 show_dev_ino(__entry), 385 (unsigned int)__entry->nid, 386 (unsigned long long)__entry->blk_addr) 387 ); 388 389 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_nodes_enter, 390 391 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 392 393 TP_ARGS(inode, nid, blk_addr) 394 ); 395 396 DEFINE_EVENT(f2fs__inode_exit, f2fs_truncate_nodes_exit, 397 398 TP_PROTO(struct inode *inode, int ret), 399 400 TP_ARGS(inode, ret) 401 ); 402 403 DEFINE_EVENT(f2fs__truncate_node, f2fs_truncate_node, 404 405 TP_PROTO(struct inode *inode, nid_t nid, block_t blk_addr), 406 407 TP_ARGS(inode, nid, blk_addr) 408 ); 409 410 TRACE_EVENT(f2fs_truncate_partial_nodes, 411 412 TP_PROTO(struct inode *inode, nid_t nid[], int depth, int err), 413 414 TP_ARGS(inode, nid, depth, err), 415 416 TP_STRUCT__entry( 417 __field(dev_t, dev) 418 __field(ino_t, ino) 419 __field(nid_t, nid[3]) 420 __field(int, depth) 421 __field(int, err) 422 ), 423 424 TP_fast_assign( 425 __entry->dev = inode->i_sb->s_dev; 426 __entry->ino = inode->i_ino; 427 __entry->nid[0] = nid[0]; 428 __entry->nid[1] = nid[1]; 429 __entry->nid[2] = nid[2]; 430 __entry->depth = depth; 431 __entry->err = err; 432 ), 433 434 TP_printk("dev = (%d,%d), ino = %lu, " 435 "nid[0] = %u, nid[1] = %u, nid[2] = %u, depth = %d, err = %d", 436 show_dev_ino(__entry), 437 (unsigned int)__entry->nid[0], 438 (unsigned int)__entry->nid[1], 439 (unsigned int)__entry->nid[2], 440 __entry->depth, 441 __entry->err) 442 ); 443 444 TRACE_EVENT(f2fs_get_data_block, 445 TP_PROTO(struct inode *inode, sector_t iblock, 446 struct buffer_head *bh, int ret), 447 448 TP_ARGS(inode, iblock, bh, ret), 449 450 TP_STRUCT__entry( 451 __field(dev_t, dev) 452 __field(ino_t, ino) 453 __field(sector_t, iblock) 454 __field(sector_t, bh_start) 455 __field(size_t, bh_size) 456 __field(int, ret) 457 ), 458 459 TP_fast_assign( 460 __entry->dev = inode->i_sb->s_dev; 461 __entry->ino = inode->i_ino; 462 __entry->iblock = iblock; 463 __entry->bh_start = bh->b_blocknr; 464 __entry->bh_size = bh->b_size; 465 __entry->ret = ret; 466 ), 467 468 TP_printk("dev = (%d,%d), ino = %lu, file offset = %llu, " 469 "start blkaddr = 0x%llx, len = 0x%llx bytes, err = %d", 470 show_dev_ino(__entry), 471 (unsigned long long)__entry->iblock, 472 (unsigned long long)__entry->bh_start, 473 (unsigned long long)__entry->bh_size, 474 __entry->ret) 475 ); 476 477 TRACE_EVENT(f2fs_get_victim, 478 479 TP_PROTO(struct super_block *sb, int type, int gc_type, 480 struct victim_sel_policy *p, unsigned int pre_victim, 481 unsigned int prefree, unsigned int free), 482 483 TP_ARGS(sb, type, gc_type, p, pre_victim, prefree, free), 484 485 TP_STRUCT__entry( 486 __field(dev_t, dev) 487 __field(int, type) 488 __field(int, gc_type) 489 __field(int, alloc_mode) 490 __field(int, gc_mode) 491 __field(unsigned int, victim) 492 __field(unsigned int, ofs_unit) 493 __field(unsigned int, pre_victim) 494 __field(unsigned int, prefree) 495 __field(unsigned int, free) 496 ), 497 498 TP_fast_assign( 499 __entry->dev = sb->s_dev; 500 __entry->type = type; 501 __entry->gc_type = gc_type; 502 __entry->alloc_mode = p->alloc_mode; 503 __entry->gc_mode = p->gc_mode; 504 __entry->victim = p->min_segno; 505 __entry->ofs_unit = p->ofs_unit; 506 __entry->pre_victim = pre_victim; 507 __entry->prefree = prefree; 508 __entry->free = free; 509 ), 510 511 TP_printk("dev = (%d,%d), type = %s, policy = (%s, %s, %s), victim = %u " 512 "ofs_unit = %u, pre_victim_secno = %d, prefree = %u, free = %u", 513 show_dev(__entry), 514 show_data_type(__entry->type), 515 show_gc_type(__entry->gc_type), 516 show_alloc_mode(__entry->alloc_mode), 517 show_victim_policy(__entry->gc_mode), 518 __entry->victim, 519 __entry->ofs_unit, 520 (int)__entry->pre_victim, 521 __entry->prefree, 522 __entry->free) 523 ); 524 525 TRACE_EVENT(f2fs_fallocate, 526 527 TP_PROTO(struct inode *inode, int mode, 528 loff_t offset, loff_t len, int ret), 529 530 TP_ARGS(inode, mode, offset, len, ret), 531 532 TP_STRUCT__entry( 533 __field(dev_t, dev) 534 __field(ino_t, ino) 535 __field(int, mode) 536 __field(loff_t, offset) 537 __field(loff_t, len) 538 __field(loff_t, size) 539 __field(blkcnt_t, blocks) 540 __field(int, ret) 541 ), 542 543 TP_fast_assign( 544 __entry->dev = inode->i_sb->s_dev; 545 __entry->ino = inode->i_ino; 546 __entry->mode = mode; 547 __entry->offset = offset; 548 __entry->len = len; 549 __entry->size = inode->i_size; 550 __entry->blocks = inode->i_blocks; 551 __entry->ret = ret; 552 ), 553 554 TP_printk("dev = (%d,%d), ino = %lu, mode = %x, offset = %lld, " 555 "len = %lld, i_size = %lld, i_blocks = %llu, ret = %d", 556 show_dev_ino(__entry), 557 __entry->mode, 558 (unsigned long long)__entry->offset, 559 (unsigned long long)__entry->len, 560 (unsigned long long)__entry->size, 561 (unsigned long long)__entry->blocks, 562 __entry->ret) 563 ); 564 565 TRACE_EVENT(f2fs_direct_IO_enter, 566 567 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, int rw), 568 569 TP_ARGS(inode, offset, len, rw), 570 571 TP_STRUCT__entry( 572 __field(dev_t, dev) 573 __field(ino_t, ino) 574 __field(loff_t, pos) 575 __field(unsigned long, len) 576 __field(int, rw) 577 ), 578 579 TP_fast_assign( 580 __entry->dev = inode->i_sb->s_dev; 581 __entry->ino = inode->i_ino; 582 __entry->pos = offset; 583 __entry->len = len; 584 __entry->rw = rw; 585 ), 586 587 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu rw = %d", 588 show_dev_ino(__entry), 589 __entry->pos, 590 __entry->len, 591 __entry->rw) 592 ); 593 594 TRACE_EVENT(f2fs_direct_IO_exit, 595 596 TP_PROTO(struct inode *inode, loff_t offset, unsigned long len, 597 int rw, int ret), 598 599 TP_ARGS(inode, offset, len, rw, ret), 600 601 TP_STRUCT__entry( 602 __field(dev_t, dev) 603 __field(ino_t, ino) 604 __field(loff_t, pos) 605 __field(unsigned long, len) 606 __field(int, rw) 607 __field(int, ret) 608 ), 609 610 TP_fast_assign( 611 __entry->dev = inode->i_sb->s_dev; 612 __entry->ino = inode->i_ino; 613 __entry->pos = offset; 614 __entry->len = len; 615 __entry->rw = rw; 616 __entry->ret = ret; 617 ), 618 619 TP_printk("dev = (%d,%d), ino = %lu pos = %lld len = %lu " 620 "rw = %d ret = %d", 621 show_dev_ino(__entry), 622 __entry->pos, 623 __entry->len, 624 __entry->rw, 625 __entry->ret) 626 ); 627 628 TRACE_EVENT(f2fs_reserve_new_block, 629 630 TP_PROTO(struct inode *inode, nid_t nid, unsigned int ofs_in_node), 631 632 TP_ARGS(inode, nid, ofs_in_node), 633 634 TP_STRUCT__entry( 635 __field(dev_t, dev) 636 __field(nid_t, nid) 637 __field(unsigned int, ofs_in_node) 638 ), 639 640 TP_fast_assign( 641 __entry->dev = inode->i_sb->s_dev; 642 __entry->nid = nid; 643 __entry->ofs_in_node = ofs_in_node; 644 ), 645 646 TP_printk("dev = (%d,%d), nid = %u, ofs_in_node = %u", 647 show_dev(__entry), 648 (unsigned int)__entry->nid, 649 __entry->ofs_in_node) 650 ); 651 652 DECLARE_EVENT_CLASS(f2fs__submit_page_bio, 653 654 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 655 656 TP_ARGS(page, fio), 657 658 TP_STRUCT__entry( 659 __field(dev_t, dev) 660 __field(ino_t, ino) 661 __field(pgoff_t, index) 662 __field(block_t, blkaddr) 663 __field(int, rw) 664 __field(int, type) 665 ), 666 667 TP_fast_assign( 668 __entry->dev = page->mapping->host->i_sb->s_dev; 669 __entry->ino = page->mapping->host->i_ino; 670 __entry->index = page->index; 671 __entry->blkaddr = fio->blk_addr; 672 __entry->rw = fio->rw; 673 __entry->type = fio->type; 674 ), 675 676 TP_printk("dev = (%d,%d), ino = %lu, page_index = 0x%lx, " 677 "blkaddr = 0x%llx, rw = %s%s, type = %s", 678 show_dev_ino(__entry), 679 (unsigned long)__entry->index, 680 (unsigned long long)__entry->blkaddr, 681 show_bio_type(__entry->rw), 682 show_block_type(__entry->type)) 683 ); 684 685 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_bio, 686 687 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 688 689 TP_ARGS(page, fio), 690 691 TP_CONDITION(page->mapping) 692 ); 693 694 DEFINE_EVENT_CONDITION(f2fs__submit_page_bio, f2fs_submit_page_mbio, 695 696 TP_PROTO(struct page *page, struct f2fs_io_info *fio), 697 698 TP_ARGS(page, fio), 699 700 TP_CONDITION(page->mapping) 701 ); 702 703 DECLARE_EVENT_CLASS(f2fs__submit_bio, 704 705 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 706 struct bio *bio), 707 708 TP_ARGS(sb, fio, bio), 709 710 TP_STRUCT__entry( 711 __field(dev_t, dev) 712 __field(int, rw) 713 __field(int, type) 714 __field(sector_t, sector) 715 __field(unsigned int, size) 716 ), 717 718 TP_fast_assign( 719 __entry->dev = sb->s_dev; 720 __entry->rw = fio->rw; 721 __entry->type = fio->type; 722 __entry->sector = bio->bi_iter.bi_sector; 723 __entry->size = bio->bi_iter.bi_size; 724 ), 725 726 TP_printk("dev = (%d,%d), %s%s, %s, sector = %lld, size = %u", 727 show_dev(__entry), 728 show_bio_type(__entry->rw), 729 show_block_type(__entry->type), 730 (unsigned long long)__entry->sector, 731 __entry->size) 732 ); 733 734 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_write_bio, 735 736 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 737 struct bio *bio), 738 739 TP_ARGS(sb, fio, bio), 740 741 TP_CONDITION(bio) 742 ); 743 744 DEFINE_EVENT_CONDITION(f2fs__submit_bio, f2fs_submit_read_bio, 745 746 TP_PROTO(struct super_block *sb, struct f2fs_io_info *fio, 747 struct bio *bio), 748 749 TP_ARGS(sb, fio, bio), 750 751 TP_CONDITION(bio) 752 ); 753 754 TRACE_EVENT(f2fs_write_begin, 755 756 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 757 unsigned int flags), 758 759 TP_ARGS(inode, pos, len, flags), 760 761 TP_STRUCT__entry( 762 __field(dev_t, dev) 763 __field(ino_t, ino) 764 __field(loff_t, pos) 765 __field(unsigned int, len) 766 __field(unsigned int, flags) 767 ), 768 769 TP_fast_assign( 770 __entry->dev = inode->i_sb->s_dev; 771 __entry->ino = inode->i_ino; 772 __entry->pos = pos; 773 __entry->len = len; 774 __entry->flags = flags; 775 ), 776 777 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, flags = %u", 778 show_dev_ino(__entry), 779 (unsigned long long)__entry->pos, 780 __entry->len, 781 __entry->flags) 782 ); 783 784 TRACE_EVENT(f2fs_write_end, 785 786 TP_PROTO(struct inode *inode, loff_t pos, unsigned int len, 787 unsigned int copied), 788 789 TP_ARGS(inode, pos, len, copied), 790 791 TP_STRUCT__entry( 792 __field(dev_t, dev) 793 __field(ino_t, ino) 794 __field(loff_t, pos) 795 __field(unsigned int, len) 796 __field(unsigned int, copied) 797 ), 798 799 TP_fast_assign( 800 __entry->dev = inode->i_sb->s_dev; 801 __entry->ino = inode->i_ino; 802 __entry->pos = pos; 803 __entry->len = len; 804 __entry->copied = copied; 805 ), 806 807 TP_printk("dev = (%d,%d), ino = %lu, pos = %llu, len = %u, copied = %u", 808 show_dev_ino(__entry), 809 (unsigned long long)__entry->pos, 810 __entry->len, 811 __entry->copied) 812 ); 813 814 DECLARE_EVENT_CLASS(f2fs__page, 815 816 TP_PROTO(struct page *page, int type), 817 818 TP_ARGS(page, type), 819 820 TP_STRUCT__entry( 821 __field(dev_t, dev) 822 __field(ino_t, ino) 823 __field(int, type) 824 __field(int, dir) 825 __field(pgoff_t, index) 826 __field(int, dirty) 827 __field(int, uptodate) 828 ), 829 830 TP_fast_assign( 831 __entry->dev = page->mapping->host->i_sb->s_dev; 832 __entry->ino = page->mapping->host->i_ino; 833 __entry->type = type; 834 __entry->dir = S_ISDIR(page->mapping->host->i_mode); 835 __entry->index = page->index; 836 __entry->dirty = PageDirty(page); 837 __entry->uptodate = PageUptodate(page); 838 ), 839 840 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, index = %lu, " 841 "dirty = %d, uptodate = %d", 842 show_dev_ino(__entry), 843 show_block_type(__entry->type), 844 show_file_type(__entry->dir), 845 (unsigned long)__entry->index, 846 __entry->dirty, 847 __entry->uptodate) 848 ); 849 850 DEFINE_EVENT(f2fs__page, f2fs_writepage, 851 852 TP_PROTO(struct page *page, int type), 853 854 TP_ARGS(page, type) 855 ); 856 857 DEFINE_EVENT(f2fs__page, f2fs_readpage, 858 859 TP_PROTO(struct page *page, int type), 860 861 TP_ARGS(page, type) 862 ); 863 864 DEFINE_EVENT(f2fs__page, f2fs_set_page_dirty, 865 866 TP_PROTO(struct page *page, int type), 867 868 TP_ARGS(page, type) 869 ); 870 871 DEFINE_EVENT(f2fs__page, f2fs_vm_page_mkwrite, 872 873 TP_PROTO(struct page *page, int type), 874 875 TP_ARGS(page, type) 876 ); 877 878 TRACE_EVENT(f2fs_writepages, 879 880 TP_PROTO(struct inode *inode, struct writeback_control *wbc, int type), 881 882 TP_ARGS(inode, wbc, type), 883 884 TP_STRUCT__entry( 885 __field(dev_t, dev) 886 __field(ino_t, ino) 887 __field(int, type) 888 __field(int, dir) 889 __field(long, nr_to_write) 890 __field(long, pages_skipped) 891 __field(loff_t, range_start) 892 __field(loff_t, range_end) 893 __field(pgoff_t, writeback_index) 894 __field(int, sync_mode) 895 __field(char, for_kupdate) 896 __field(char, for_background) 897 __field(char, tagged_writepages) 898 __field(char, for_reclaim) 899 __field(char, range_cyclic) 900 __field(char, for_sync) 901 ), 902 903 TP_fast_assign( 904 __entry->dev = inode->i_sb->s_dev; 905 __entry->ino = inode->i_ino; 906 __entry->type = type; 907 __entry->dir = S_ISDIR(inode->i_mode); 908 __entry->nr_to_write = wbc->nr_to_write; 909 __entry->pages_skipped = wbc->pages_skipped; 910 __entry->range_start = wbc->range_start; 911 __entry->range_end = wbc->range_end; 912 __entry->writeback_index = inode->i_mapping->writeback_index; 913 __entry->sync_mode = wbc->sync_mode; 914 __entry->for_kupdate = wbc->for_kupdate; 915 __entry->for_background = wbc->for_background; 916 __entry->tagged_writepages = wbc->tagged_writepages; 917 __entry->for_reclaim = wbc->for_reclaim; 918 __entry->range_cyclic = wbc->range_cyclic; 919 __entry->for_sync = wbc->for_sync; 920 ), 921 922 TP_printk("dev = (%d,%d), ino = %lu, %s, %s, nr_to_write %ld, " 923 "skipped %ld, start %lld, end %lld, wb_idx %lu, sync_mode %d, " 924 "kupdate %u background %u tagged %u reclaim %u cyclic %u sync %u", 925 show_dev_ino(__entry), 926 show_block_type(__entry->type), 927 show_file_type(__entry->dir), 928 __entry->nr_to_write, 929 __entry->pages_skipped, 930 __entry->range_start, 931 __entry->range_end, 932 (unsigned long)__entry->writeback_index, 933 __entry->sync_mode, 934 __entry->for_kupdate, 935 __entry->for_background, 936 __entry->tagged_writepages, 937 __entry->for_reclaim, 938 __entry->range_cyclic, 939 __entry->for_sync) 940 ); 941 942 TRACE_EVENT(f2fs_write_checkpoint, 943 944 TP_PROTO(struct super_block *sb, int reason, char *msg), 945 946 TP_ARGS(sb, reason, msg), 947 948 TP_STRUCT__entry( 949 __field(dev_t, dev) 950 __field(int, reason) 951 __field(char *, msg) 952 ), 953 954 TP_fast_assign( 955 __entry->dev = sb->s_dev; 956 __entry->reason = reason; 957 __entry->msg = msg; 958 ), 959 960 TP_printk("dev = (%d,%d), checkpoint for %s, state = %s", 961 show_dev(__entry), 962 show_cpreason(__entry->reason), 963 __entry->msg) 964 ); 965 966 TRACE_EVENT(f2fs_issue_discard, 967 968 TP_PROTO(struct super_block *sb, block_t blkstart, block_t blklen), 969 970 TP_ARGS(sb, blkstart, blklen), 971 972 TP_STRUCT__entry( 973 __field(dev_t, dev) 974 __field(block_t, blkstart) 975 __field(block_t, blklen) 976 ), 977 978 TP_fast_assign( 979 __entry->dev = sb->s_dev; 980 __entry->blkstart = blkstart; 981 __entry->blklen = blklen; 982 ), 983 984 TP_printk("dev = (%d,%d), blkstart = 0x%llx, blklen = 0x%llx", 985 show_dev(__entry), 986 (unsigned long long)__entry->blkstart, 987 (unsigned long long)__entry->blklen) 988 ); 989 990 TRACE_EVENT(f2fs_issue_flush, 991 992 TP_PROTO(struct super_block *sb, unsigned int nobarrier, 993 unsigned int flush_merge), 994 995 TP_ARGS(sb, nobarrier, flush_merge), 996 997 TP_STRUCT__entry( 998 __field(dev_t, dev) 999 __field(unsigned int, nobarrier) 1000 __field(unsigned int, flush_merge) 1001 ), 1002 1003 TP_fast_assign( 1004 __entry->dev = sb->s_dev; 1005 __entry->nobarrier = nobarrier; 1006 __entry->flush_merge = flush_merge; 1007 ), 1008 1009 TP_printk("dev = (%d,%d), %s %s", 1010 show_dev(__entry), 1011 __entry->nobarrier ? "skip (nobarrier)" : "issue", 1012 __entry->flush_merge ? " with flush_merge" : "") 1013 ); 1014 #endif /* _TRACE_F2FS_H */ 1015 1016 /* This part must be outside protection */ 1017 #include <trace/define_trace.h> 1018