1 #undef TRACE_SYSTEM 2 #define TRACE_SYSTEM writeback 3 4 #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) 5 #define _TRACE_WRITEBACK_H 6 7 #include <linux/tracepoint.h> 8 #include <linux/backing-dev.h> 9 #include <linux/writeback.h> 10 11 #define show_inode_state(state) \ 12 __print_flags(state, "|", \ 13 {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ 14 {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ 15 {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ 16 {I_NEW, "I_NEW"}, \ 17 {I_WILL_FREE, "I_WILL_FREE"}, \ 18 {I_FREEING, "I_FREEING"}, \ 19 {I_CLEAR, "I_CLEAR"}, \ 20 {I_SYNC, "I_SYNC"}, \ 21 {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ 22 {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \ 23 {I_REFERENCED, "I_REFERENCED"} \ 24 ) 25 26 /* enums need to be exported to user space */ 27 #undef EM 28 #undef EMe 29 #define EM(a,b) TRACE_DEFINE_ENUM(a); 30 #define EMe(a,b) TRACE_DEFINE_ENUM(a); 31 32 #define WB_WORK_REASON \ 33 EM( WB_REASON_BACKGROUND, "background") \ 34 EM( WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages") \ 35 EM( WB_REASON_SYNC, "sync") \ 36 EM( WB_REASON_PERIODIC, "periodic") \ 37 EM( WB_REASON_LAPTOP_TIMER, "laptop_timer") \ 38 EM( WB_REASON_FREE_MORE_MEM, "free_more_memory") \ 39 EM( WB_REASON_FS_FREE_SPACE, "fs_free_space") \ 40 EMe(WB_REASON_FORKER_THREAD, "forker_thread") 41 42 WB_WORK_REASON 43 44 /* 45 * Now redefine the EM() and EMe() macros to map the enums to the strings 46 * that will be printed in the output. 47 */ 48 #undef EM 49 #undef EMe 50 #define EM(a,b) { a, b }, 51 #define EMe(a,b) { a, b } 52 53 struct wb_writeback_work; 54 55 TRACE_EVENT(writeback_dirty_page, 56 57 TP_PROTO(struct page *page, struct address_space *mapping), 58 59 TP_ARGS(page, mapping), 60 61 TP_STRUCT__entry ( 62 __array(char, name, 32) 63 __field(unsigned long, ino) 64 __field(pgoff_t, index) 65 ), 66 67 TP_fast_assign( 68 strncpy(__entry->name, 69 mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32); 70 __entry->ino = mapping ? mapping->host->i_ino : 0; 71 __entry->index = page->index; 72 ), 73 74 TP_printk("bdi %s: ino=%lu index=%lu", 75 __entry->name, 76 __entry->ino, 77 __entry->index 78 ) 79 ); 80 81 DECLARE_EVENT_CLASS(writeback_dirty_inode_template, 82 83 TP_PROTO(struct inode *inode, int flags), 84 85 TP_ARGS(inode, flags), 86 87 TP_STRUCT__entry ( 88 __array(char, name, 32) 89 __field(unsigned long, ino) 90 __field(unsigned long, state) 91 __field(unsigned long, flags) 92 ), 93 94 TP_fast_assign( 95 struct backing_dev_info *bdi = inode_to_bdi(inode); 96 97 /* may be called for files on pseudo FSes w/ unregistered bdi */ 98 strncpy(__entry->name, 99 bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); 100 __entry->ino = inode->i_ino; 101 __entry->state = inode->i_state; 102 __entry->flags = flags; 103 ), 104 105 TP_printk("bdi %s: ino=%lu state=%s flags=%s", 106 __entry->name, 107 __entry->ino, 108 show_inode_state(__entry->state), 109 show_inode_state(__entry->flags) 110 ) 111 ); 112 113 DEFINE_EVENT(writeback_dirty_inode_template, writeback_mark_inode_dirty, 114 115 TP_PROTO(struct inode *inode, int flags), 116 117 TP_ARGS(inode, flags) 118 ); 119 120 DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode_start, 121 122 TP_PROTO(struct inode *inode, int flags), 123 124 TP_ARGS(inode, flags) 125 ); 126 127 DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode, 128 129 TP_PROTO(struct inode *inode, int flags), 130 131 TP_ARGS(inode, flags) 132 ); 133 134 #ifdef CREATE_TRACE_POINTS 135 #ifdef CONFIG_CGROUP_WRITEBACK 136 137 static inline size_t __trace_wb_cgroup_size(struct bdi_writeback *wb) 138 { 139 return kernfs_path_len(wb->memcg_css->cgroup->kn) + 1; 140 } 141 142 static inline void __trace_wb_assign_cgroup(char *buf, struct bdi_writeback *wb) 143 { 144 struct cgroup *cgrp = wb->memcg_css->cgroup; 145 char *path; 146 147 path = cgroup_path(cgrp, buf, kernfs_path_len(cgrp->kn) + 1); 148 WARN_ON_ONCE(path != buf); 149 } 150 151 static inline size_t __trace_wbc_cgroup_size(struct writeback_control *wbc) 152 { 153 if (wbc->wb) 154 return __trace_wb_cgroup_size(wbc->wb); 155 else 156 return 2; 157 } 158 159 static inline void __trace_wbc_assign_cgroup(char *buf, 160 struct writeback_control *wbc) 161 { 162 if (wbc->wb) 163 __trace_wb_assign_cgroup(buf, wbc->wb); 164 else 165 strcpy(buf, "/"); 166 } 167 168 #else /* CONFIG_CGROUP_WRITEBACK */ 169 170 static inline size_t __trace_wb_cgroup_size(struct bdi_writeback *wb) 171 { 172 return 2; 173 } 174 175 static inline void __trace_wb_assign_cgroup(char *buf, struct bdi_writeback *wb) 176 { 177 strcpy(buf, "/"); 178 } 179 180 static inline size_t __trace_wbc_cgroup_size(struct writeback_control *wbc) 181 { 182 return 2; 183 } 184 185 static inline void __trace_wbc_assign_cgroup(char *buf, 186 struct writeback_control *wbc) 187 { 188 strcpy(buf, "/"); 189 } 190 191 #endif /* CONFIG_CGROUP_WRITEBACK */ 192 #endif /* CREATE_TRACE_POINTS */ 193 194 DECLARE_EVENT_CLASS(writeback_write_inode_template, 195 196 TP_PROTO(struct inode *inode, struct writeback_control *wbc), 197 198 TP_ARGS(inode, wbc), 199 200 TP_STRUCT__entry ( 201 __array(char, name, 32) 202 __field(unsigned long, ino) 203 __field(int, sync_mode) 204 __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) 205 ), 206 207 TP_fast_assign( 208 strncpy(__entry->name, 209 dev_name(inode_to_bdi(inode)->dev), 32); 210 __entry->ino = inode->i_ino; 211 __entry->sync_mode = wbc->sync_mode; 212 __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); 213 ), 214 215 TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup=%s", 216 __entry->name, 217 __entry->ino, 218 __entry->sync_mode, 219 __get_str(cgroup) 220 ) 221 ); 222 223 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode_start, 224 225 TP_PROTO(struct inode *inode, struct writeback_control *wbc), 226 227 TP_ARGS(inode, wbc) 228 ); 229 230 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode, 231 232 TP_PROTO(struct inode *inode, struct writeback_control *wbc), 233 234 TP_ARGS(inode, wbc) 235 ); 236 237 DECLARE_EVENT_CLASS(writeback_work_class, 238 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), 239 TP_ARGS(wb, work), 240 TP_STRUCT__entry( 241 __array(char, name, 32) 242 __field(long, nr_pages) 243 __field(dev_t, sb_dev) 244 __field(int, sync_mode) 245 __field(int, for_kupdate) 246 __field(int, range_cyclic) 247 __field(int, for_background) 248 __field(int, reason) 249 __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) 250 ), 251 TP_fast_assign( 252 strncpy(__entry->name, 253 wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32); 254 __entry->nr_pages = work->nr_pages; 255 __entry->sb_dev = work->sb ? work->sb->s_dev : 0; 256 __entry->sync_mode = work->sync_mode; 257 __entry->for_kupdate = work->for_kupdate; 258 __entry->range_cyclic = work->range_cyclic; 259 __entry->for_background = work->for_background; 260 __entry->reason = work->reason; 261 __trace_wb_assign_cgroup(__get_str(cgroup), wb); 262 ), 263 TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " 264 "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup=%s", 265 __entry->name, 266 MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), 267 __entry->nr_pages, 268 __entry->sync_mode, 269 __entry->for_kupdate, 270 __entry->range_cyclic, 271 __entry->for_background, 272 __print_symbolic(__entry->reason, WB_WORK_REASON), 273 __get_str(cgroup) 274 ) 275 ); 276 #define DEFINE_WRITEBACK_WORK_EVENT(name) \ 277 DEFINE_EVENT(writeback_work_class, name, \ 278 TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \ 279 TP_ARGS(wb, work)) 280 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); 281 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); 282 DEFINE_WRITEBACK_WORK_EVENT(writeback_start); 283 DEFINE_WRITEBACK_WORK_EVENT(writeback_written); 284 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); 285 286 TRACE_EVENT(writeback_pages_written, 287 TP_PROTO(long pages_written), 288 TP_ARGS(pages_written), 289 TP_STRUCT__entry( 290 __field(long, pages) 291 ), 292 TP_fast_assign( 293 __entry->pages = pages_written; 294 ), 295 TP_printk("%ld", __entry->pages) 296 ); 297 298 DECLARE_EVENT_CLASS(writeback_class, 299 TP_PROTO(struct bdi_writeback *wb), 300 TP_ARGS(wb), 301 TP_STRUCT__entry( 302 __array(char, name, 32) 303 __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) 304 ), 305 TP_fast_assign( 306 strncpy(__entry->name, dev_name(wb->bdi->dev), 32); 307 __trace_wb_assign_cgroup(__get_str(cgroup), wb); 308 ), 309 TP_printk("bdi %s: cgroup=%s", 310 __entry->name, 311 __get_str(cgroup) 312 ) 313 ); 314 #define DEFINE_WRITEBACK_EVENT(name) \ 315 DEFINE_EVENT(writeback_class, name, \ 316 TP_PROTO(struct bdi_writeback *wb), \ 317 TP_ARGS(wb)) 318 319 DEFINE_WRITEBACK_EVENT(writeback_nowork); 320 DEFINE_WRITEBACK_EVENT(writeback_wake_background); 321 322 TRACE_EVENT(writeback_bdi_register, 323 TP_PROTO(struct backing_dev_info *bdi), 324 TP_ARGS(bdi), 325 TP_STRUCT__entry( 326 __array(char, name, 32) 327 ), 328 TP_fast_assign( 329 strncpy(__entry->name, dev_name(bdi->dev), 32); 330 ), 331 TP_printk("bdi %s", 332 __entry->name 333 ) 334 ); 335 336 DECLARE_EVENT_CLASS(wbc_class, 337 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), 338 TP_ARGS(wbc, bdi), 339 TP_STRUCT__entry( 340 __array(char, name, 32) 341 __field(long, nr_to_write) 342 __field(long, pages_skipped) 343 __field(int, sync_mode) 344 __field(int, for_kupdate) 345 __field(int, for_background) 346 __field(int, for_reclaim) 347 __field(int, range_cyclic) 348 __field(long, range_start) 349 __field(long, range_end) 350 __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) 351 ), 352 353 TP_fast_assign( 354 strncpy(__entry->name, dev_name(bdi->dev), 32); 355 __entry->nr_to_write = wbc->nr_to_write; 356 __entry->pages_skipped = wbc->pages_skipped; 357 __entry->sync_mode = wbc->sync_mode; 358 __entry->for_kupdate = wbc->for_kupdate; 359 __entry->for_background = wbc->for_background; 360 __entry->for_reclaim = wbc->for_reclaim; 361 __entry->range_cyclic = wbc->range_cyclic; 362 __entry->range_start = (long)wbc->range_start; 363 __entry->range_end = (long)wbc->range_end; 364 __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); 365 ), 366 367 TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " 368 "bgrd=%d reclm=%d cyclic=%d " 369 "start=0x%lx end=0x%lx cgroup=%s", 370 __entry->name, 371 __entry->nr_to_write, 372 __entry->pages_skipped, 373 __entry->sync_mode, 374 __entry->for_kupdate, 375 __entry->for_background, 376 __entry->for_reclaim, 377 __entry->range_cyclic, 378 __entry->range_start, 379 __entry->range_end, 380 __get_str(cgroup) 381 ) 382 ) 383 384 #define DEFINE_WBC_EVENT(name) \ 385 DEFINE_EVENT(wbc_class, name, \ 386 TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ 387 TP_ARGS(wbc, bdi)) 388 DEFINE_WBC_EVENT(wbc_writepage); 389 390 TRACE_EVENT(writeback_queue_io, 391 TP_PROTO(struct bdi_writeback *wb, 392 struct wb_writeback_work *work, 393 int moved), 394 TP_ARGS(wb, work, moved), 395 TP_STRUCT__entry( 396 __array(char, name, 32) 397 __field(unsigned long, older) 398 __field(long, age) 399 __field(int, moved) 400 __field(int, reason) 401 __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) 402 ), 403 TP_fast_assign( 404 unsigned long *older_than_this = work->older_than_this; 405 strncpy(__entry->name, dev_name(wb->bdi->dev), 32); 406 __entry->older = older_than_this ? *older_than_this : 0; 407 __entry->age = older_than_this ? 408 (jiffies - *older_than_this) * 1000 / HZ : -1; 409 __entry->moved = moved; 410 __entry->reason = work->reason; 411 __trace_wb_assign_cgroup(__get_str(cgroup), wb); 412 ), 413 TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup=%s", 414 __entry->name, 415 __entry->older, /* older_than_this in jiffies */ 416 __entry->age, /* older_than_this in relative milliseconds */ 417 __entry->moved, 418 __print_symbolic(__entry->reason, WB_WORK_REASON), 419 __get_str(cgroup) 420 ) 421 ); 422 423 TRACE_EVENT(global_dirty_state, 424 425 TP_PROTO(unsigned long background_thresh, 426 unsigned long dirty_thresh 427 ), 428 429 TP_ARGS(background_thresh, 430 dirty_thresh 431 ), 432 433 TP_STRUCT__entry( 434 __field(unsigned long, nr_dirty) 435 __field(unsigned long, nr_writeback) 436 __field(unsigned long, nr_unstable) 437 __field(unsigned long, background_thresh) 438 __field(unsigned long, dirty_thresh) 439 __field(unsigned long, dirty_limit) 440 __field(unsigned long, nr_dirtied) 441 __field(unsigned long, nr_written) 442 ), 443 444 TP_fast_assign( 445 __entry->nr_dirty = global_page_state(NR_FILE_DIRTY); 446 __entry->nr_writeback = global_page_state(NR_WRITEBACK); 447 __entry->nr_unstable = global_page_state(NR_UNSTABLE_NFS); 448 __entry->nr_dirtied = global_page_state(NR_DIRTIED); 449 __entry->nr_written = global_page_state(NR_WRITTEN); 450 __entry->background_thresh = background_thresh; 451 __entry->dirty_thresh = dirty_thresh; 452 __entry->dirty_limit = global_wb_domain.dirty_limit; 453 ), 454 455 TP_printk("dirty=%lu writeback=%lu unstable=%lu " 456 "bg_thresh=%lu thresh=%lu limit=%lu " 457 "dirtied=%lu written=%lu", 458 __entry->nr_dirty, 459 __entry->nr_writeback, 460 __entry->nr_unstable, 461 __entry->background_thresh, 462 __entry->dirty_thresh, 463 __entry->dirty_limit, 464 __entry->nr_dirtied, 465 __entry->nr_written 466 ) 467 ); 468 469 #define KBps(x) ((x) << (PAGE_SHIFT - 10)) 470 471 TRACE_EVENT(bdi_dirty_ratelimit, 472 473 TP_PROTO(struct bdi_writeback *wb, 474 unsigned long dirty_rate, 475 unsigned long task_ratelimit), 476 477 TP_ARGS(wb, dirty_rate, task_ratelimit), 478 479 TP_STRUCT__entry( 480 __array(char, bdi, 32) 481 __field(unsigned long, write_bw) 482 __field(unsigned long, avg_write_bw) 483 __field(unsigned long, dirty_rate) 484 __field(unsigned long, dirty_ratelimit) 485 __field(unsigned long, task_ratelimit) 486 __field(unsigned long, balanced_dirty_ratelimit) 487 __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) 488 ), 489 490 TP_fast_assign( 491 strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); 492 __entry->write_bw = KBps(wb->write_bandwidth); 493 __entry->avg_write_bw = KBps(wb->avg_write_bandwidth); 494 __entry->dirty_rate = KBps(dirty_rate); 495 __entry->dirty_ratelimit = KBps(wb->dirty_ratelimit); 496 __entry->task_ratelimit = KBps(task_ratelimit); 497 __entry->balanced_dirty_ratelimit = 498 KBps(wb->balanced_dirty_ratelimit); 499 __trace_wb_assign_cgroup(__get_str(cgroup), wb); 500 ), 501 502 TP_printk("bdi %s: " 503 "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " 504 "dirty_ratelimit=%lu task_ratelimit=%lu " 505 "balanced_dirty_ratelimit=%lu cgroup=%s", 506 __entry->bdi, 507 __entry->write_bw, /* write bandwidth */ 508 __entry->avg_write_bw, /* avg write bandwidth */ 509 __entry->dirty_rate, /* bdi dirty rate */ 510 __entry->dirty_ratelimit, /* base ratelimit */ 511 __entry->task_ratelimit, /* ratelimit with position control */ 512 __entry->balanced_dirty_ratelimit, /* the balanced ratelimit */ 513 __get_str(cgroup) 514 ) 515 ); 516 517 TRACE_EVENT(balance_dirty_pages, 518 519 TP_PROTO(struct bdi_writeback *wb, 520 unsigned long thresh, 521 unsigned long bg_thresh, 522 unsigned long dirty, 523 unsigned long bdi_thresh, 524 unsigned long bdi_dirty, 525 unsigned long dirty_ratelimit, 526 unsigned long task_ratelimit, 527 unsigned long dirtied, 528 unsigned long period, 529 long pause, 530 unsigned long start_time), 531 532 TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, 533 dirty_ratelimit, task_ratelimit, 534 dirtied, period, pause, start_time), 535 536 TP_STRUCT__entry( 537 __array( char, bdi, 32) 538 __field(unsigned long, limit) 539 __field(unsigned long, setpoint) 540 __field(unsigned long, dirty) 541 __field(unsigned long, bdi_setpoint) 542 __field(unsigned long, bdi_dirty) 543 __field(unsigned long, dirty_ratelimit) 544 __field(unsigned long, task_ratelimit) 545 __field(unsigned int, dirtied) 546 __field(unsigned int, dirtied_pause) 547 __field(unsigned long, paused) 548 __field( long, pause) 549 __field(unsigned long, period) 550 __field( long, think) 551 __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) 552 ), 553 554 TP_fast_assign( 555 unsigned long freerun = (thresh + bg_thresh) / 2; 556 strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); 557 558 __entry->limit = global_wb_domain.dirty_limit; 559 __entry->setpoint = (global_wb_domain.dirty_limit + 560 freerun) / 2; 561 __entry->dirty = dirty; 562 __entry->bdi_setpoint = __entry->setpoint * 563 bdi_thresh / (thresh + 1); 564 __entry->bdi_dirty = bdi_dirty; 565 __entry->dirty_ratelimit = KBps(dirty_ratelimit); 566 __entry->task_ratelimit = KBps(task_ratelimit); 567 __entry->dirtied = dirtied; 568 __entry->dirtied_pause = current->nr_dirtied_pause; 569 __entry->think = current->dirty_paused_when == 0 ? 0 : 570 (long)(jiffies - current->dirty_paused_when) * 1000/HZ; 571 __entry->period = period * 1000 / HZ; 572 __entry->pause = pause * 1000 / HZ; 573 __entry->paused = (jiffies - start_time) * 1000 / HZ; 574 __trace_wb_assign_cgroup(__get_str(cgroup), wb); 575 ), 576 577 578 TP_printk("bdi %s: " 579 "limit=%lu setpoint=%lu dirty=%lu " 580 "bdi_setpoint=%lu bdi_dirty=%lu " 581 "dirty_ratelimit=%lu task_ratelimit=%lu " 582 "dirtied=%u dirtied_pause=%u " 583 "paused=%lu pause=%ld period=%lu think=%ld cgroup=%s", 584 __entry->bdi, 585 __entry->limit, 586 __entry->setpoint, 587 __entry->dirty, 588 __entry->bdi_setpoint, 589 __entry->bdi_dirty, 590 __entry->dirty_ratelimit, 591 __entry->task_ratelimit, 592 __entry->dirtied, 593 __entry->dirtied_pause, 594 __entry->paused, /* ms */ 595 __entry->pause, /* ms */ 596 __entry->period, /* ms */ 597 __entry->think, /* ms */ 598 __get_str(cgroup) 599 ) 600 ); 601 602 TRACE_EVENT(writeback_sb_inodes_requeue, 603 604 TP_PROTO(struct inode *inode), 605 TP_ARGS(inode), 606 607 TP_STRUCT__entry( 608 __array(char, name, 32) 609 __field(unsigned long, ino) 610 __field(unsigned long, state) 611 __field(unsigned long, dirtied_when) 612 __dynamic_array(char, cgroup, 613 __trace_wb_cgroup_size(inode_to_wb(inode))) 614 ), 615 616 TP_fast_assign( 617 strncpy(__entry->name, 618 dev_name(inode_to_bdi(inode)->dev), 32); 619 __entry->ino = inode->i_ino; 620 __entry->state = inode->i_state; 621 __entry->dirtied_when = inode->dirtied_when; 622 __trace_wb_assign_cgroup(__get_str(cgroup), inode_to_wb(inode)); 623 ), 624 625 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup=%s", 626 __entry->name, 627 __entry->ino, 628 show_inode_state(__entry->state), 629 __entry->dirtied_when, 630 (jiffies - __entry->dirtied_when) / HZ, 631 __get_str(cgroup) 632 ) 633 ); 634 635 DECLARE_EVENT_CLASS(writeback_congest_waited_template, 636 637 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 638 639 TP_ARGS(usec_timeout, usec_delayed), 640 641 TP_STRUCT__entry( 642 __field( unsigned int, usec_timeout ) 643 __field( unsigned int, usec_delayed ) 644 ), 645 646 TP_fast_assign( 647 __entry->usec_timeout = usec_timeout; 648 __entry->usec_delayed = usec_delayed; 649 ), 650 651 TP_printk("usec_timeout=%u usec_delayed=%u", 652 __entry->usec_timeout, 653 __entry->usec_delayed) 654 ); 655 656 DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, 657 658 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 659 660 TP_ARGS(usec_timeout, usec_delayed) 661 ); 662 663 DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, 664 665 TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 666 667 TP_ARGS(usec_timeout, usec_delayed) 668 ); 669 670 DECLARE_EVENT_CLASS(writeback_single_inode_template, 671 672 TP_PROTO(struct inode *inode, 673 struct writeback_control *wbc, 674 unsigned long nr_to_write 675 ), 676 677 TP_ARGS(inode, wbc, nr_to_write), 678 679 TP_STRUCT__entry( 680 __array(char, name, 32) 681 __field(unsigned long, ino) 682 __field(unsigned long, state) 683 __field(unsigned long, dirtied_when) 684 __field(unsigned long, writeback_index) 685 __field(long, nr_to_write) 686 __field(unsigned long, wrote) 687 __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) 688 ), 689 690 TP_fast_assign( 691 strncpy(__entry->name, 692 dev_name(inode_to_bdi(inode)->dev), 32); 693 __entry->ino = inode->i_ino; 694 __entry->state = inode->i_state; 695 __entry->dirtied_when = inode->dirtied_when; 696 __entry->writeback_index = inode->i_mapping->writeback_index; 697 __entry->nr_to_write = nr_to_write; 698 __entry->wrote = nr_to_write - wbc->nr_to_write; 699 __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); 700 ), 701 702 TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " 703 "index=%lu to_write=%ld wrote=%lu cgroup=%s", 704 __entry->name, 705 __entry->ino, 706 show_inode_state(__entry->state), 707 __entry->dirtied_when, 708 (jiffies - __entry->dirtied_when) / HZ, 709 __entry->writeback_index, 710 __entry->nr_to_write, 711 __entry->wrote, 712 __get_str(cgroup) 713 ) 714 ); 715 716 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_start, 717 TP_PROTO(struct inode *inode, 718 struct writeback_control *wbc, 719 unsigned long nr_to_write), 720 TP_ARGS(inode, wbc, nr_to_write) 721 ); 722 723 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, 724 TP_PROTO(struct inode *inode, 725 struct writeback_control *wbc, 726 unsigned long nr_to_write), 727 TP_ARGS(inode, wbc, nr_to_write) 728 ); 729 730 DECLARE_EVENT_CLASS(writeback_lazytime_template, 731 TP_PROTO(struct inode *inode), 732 733 TP_ARGS(inode), 734 735 TP_STRUCT__entry( 736 __field( dev_t, dev ) 737 __field(unsigned long, ino ) 738 __field(unsigned long, state ) 739 __field( __u16, mode ) 740 __field(unsigned long, dirtied_when ) 741 ), 742 743 TP_fast_assign( 744 __entry->dev = inode->i_sb->s_dev; 745 __entry->ino = inode->i_ino; 746 __entry->state = inode->i_state; 747 __entry->mode = inode->i_mode; 748 __entry->dirtied_when = inode->dirtied_when; 749 ), 750 751 TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o", 752 MAJOR(__entry->dev), MINOR(__entry->dev), 753 __entry->ino, __entry->dirtied_when, 754 show_inode_state(__entry->state), __entry->mode) 755 ); 756 757 DEFINE_EVENT(writeback_lazytime_template, writeback_lazytime, 758 TP_PROTO(struct inode *inode), 759 760 TP_ARGS(inode) 761 ); 762 763 DEFINE_EVENT(writeback_lazytime_template, writeback_lazytime_iput, 764 TP_PROTO(struct inode *inode), 765 766 TP_ARGS(inode) 767 ); 768 769 DEFINE_EVENT(writeback_lazytime_template, writeback_dirty_inode_enqueue, 770 771 TP_PROTO(struct inode *inode), 772 773 TP_ARGS(inode) 774 ); 775 776 #endif /* _TRACE_WRITEBACK_H */ 777 778 /* This part must be outside protection */ 779 #include <trace/define_trace.h> 780