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