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