1455b2864SDave Chinner #undef TRACE_SYSTEM 2455b2864SDave Chinner #define TRACE_SYSTEM writeback 3455b2864SDave Chinner 4455b2864SDave Chinner #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) 5455b2864SDave Chinner #define _TRACE_WRITEBACK_H 6455b2864SDave Chinner 7455b2864SDave Chinner #include <linux/backing-dev.h> 896dccab1SRandy Dunlap #include <linux/device.h> 9455b2864SDave Chinner #include <linux/writeback.h> 10455b2864SDave Chinner 11455b2864SDave Chinner struct wb_writeback_work; 12455b2864SDave Chinner 13455b2864SDave Chinner DECLARE_EVENT_CLASS(writeback_work_class, 14455b2864SDave Chinner TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), 15455b2864SDave Chinner TP_ARGS(bdi, work), 16455b2864SDave Chinner TP_STRUCT__entry( 17455b2864SDave Chinner __array(char, name, 32) 18455b2864SDave Chinner __field(long, nr_pages) 19455b2864SDave Chinner __field(dev_t, sb_dev) 20455b2864SDave Chinner __field(int, sync_mode) 21455b2864SDave Chinner __field(int, for_kupdate) 22455b2864SDave Chinner __field(int, range_cyclic) 23455b2864SDave Chinner __field(int, for_background) 24455b2864SDave Chinner ), 25455b2864SDave Chinner TP_fast_assign( 26455b2864SDave Chinner strncpy(__entry->name, dev_name(bdi->dev), 32); 27455b2864SDave Chinner __entry->nr_pages = work->nr_pages; 28455b2864SDave Chinner __entry->sb_dev = work->sb ? work->sb->s_dev : 0; 29455b2864SDave Chinner __entry->sync_mode = work->sync_mode; 30455b2864SDave Chinner __entry->for_kupdate = work->for_kupdate; 31455b2864SDave Chinner __entry->range_cyclic = work->range_cyclic; 32455b2864SDave Chinner __entry->for_background = work->for_background; 33455b2864SDave Chinner ), 34455b2864SDave Chinner TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " 35455b2864SDave Chinner "kupdate=%d range_cyclic=%d background=%d", 36455b2864SDave Chinner __entry->name, 37455b2864SDave Chinner MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), 38455b2864SDave Chinner __entry->nr_pages, 39455b2864SDave Chinner __entry->sync_mode, 40455b2864SDave Chinner __entry->for_kupdate, 41455b2864SDave Chinner __entry->range_cyclic, 42455b2864SDave Chinner __entry->for_background 43455b2864SDave Chinner ) 44455b2864SDave Chinner ); 45455b2864SDave Chinner #define DEFINE_WRITEBACK_WORK_EVENT(name) \ 46455b2864SDave Chinner DEFINE_EVENT(writeback_work_class, name, \ 47455b2864SDave Chinner TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ 48455b2864SDave Chinner TP_ARGS(bdi, work)) 49455b2864SDave Chinner DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); 50455b2864SDave Chinner DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); 51455b2864SDave Chinner DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); 52455b2864SDave Chinner 53455b2864SDave Chinner TRACE_EVENT(writeback_pages_written, 54455b2864SDave Chinner TP_PROTO(long pages_written), 55455b2864SDave Chinner TP_ARGS(pages_written), 56455b2864SDave Chinner TP_STRUCT__entry( 57455b2864SDave Chinner __field(long, pages) 58455b2864SDave Chinner ), 59455b2864SDave Chinner TP_fast_assign( 60455b2864SDave Chinner __entry->pages = pages_written; 61455b2864SDave Chinner ), 62455b2864SDave Chinner TP_printk("%ld", __entry->pages) 63455b2864SDave Chinner ); 64455b2864SDave Chinner 65455b2864SDave Chinner DECLARE_EVENT_CLASS(writeback_class, 66455b2864SDave Chinner TP_PROTO(struct backing_dev_info *bdi), 67455b2864SDave Chinner TP_ARGS(bdi), 68455b2864SDave Chinner TP_STRUCT__entry( 69455b2864SDave Chinner __array(char, name, 32) 70455b2864SDave Chinner ), 71455b2864SDave Chinner TP_fast_assign( 72455b2864SDave Chinner strncpy(__entry->name, dev_name(bdi->dev), 32); 73455b2864SDave Chinner ), 74455b2864SDave Chinner TP_printk("bdi %s", 75455b2864SDave Chinner __entry->name 76455b2864SDave Chinner ) 77455b2864SDave Chinner ); 78455b2864SDave Chinner #define DEFINE_WRITEBACK_EVENT(name) \ 79455b2864SDave Chinner DEFINE_EVENT(writeback_class, name, \ 80455b2864SDave Chinner TP_PROTO(struct backing_dev_info *bdi), \ 81455b2864SDave Chinner TP_ARGS(bdi)) 82455b2864SDave Chinner 83455b2864SDave Chinner DEFINE_WRITEBACK_EVENT(writeback_nowork); 8471927e84SWu Fengguang DEFINE_WRITEBACK_EVENT(writeback_wake_background); 8560332023SArtem Bityutskiy DEFINE_WRITEBACK_EVENT(writeback_wake_thread); 8660332023SArtem Bityutskiy DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread); 87455b2864SDave Chinner DEFINE_WRITEBACK_EVENT(writeback_bdi_register); 88455b2864SDave Chinner DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); 89455b2864SDave Chinner DEFINE_WRITEBACK_EVENT(writeback_thread_start); 90455b2864SDave Chinner DEFINE_WRITEBACK_EVENT(writeback_thread_stop); 91455b2864SDave Chinner 92028c2dd1SDave Chinner DECLARE_EVENT_CLASS(wbc_class, 93028c2dd1SDave Chinner TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), 94028c2dd1SDave Chinner TP_ARGS(wbc, bdi), 95028c2dd1SDave Chinner TP_STRUCT__entry( 96028c2dd1SDave Chinner __array(char, name, 32) 97028c2dd1SDave Chinner __field(long, nr_to_write) 98028c2dd1SDave Chinner __field(long, pages_skipped) 99028c2dd1SDave Chinner __field(int, sync_mode) 100028c2dd1SDave Chinner __field(int, for_kupdate) 101028c2dd1SDave Chinner __field(int, for_background) 102028c2dd1SDave Chinner __field(int, for_reclaim) 103028c2dd1SDave Chinner __field(int, range_cyclic) 104028c2dd1SDave Chinner __field(unsigned long, older_than_this) 105028c2dd1SDave Chinner __field(long, range_start) 106028c2dd1SDave Chinner __field(long, range_end) 107028c2dd1SDave Chinner ), 108028c2dd1SDave Chinner 109028c2dd1SDave Chinner TP_fast_assign( 110028c2dd1SDave Chinner strncpy(__entry->name, dev_name(bdi->dev), 32); 111028c2dd1SDave Chinner __entry->nr_to_write = wbc->nr_to_write; 112028c2dd1SDave Chinner __entry->pages_skipped = wbc->pages_skipped; 113028c2dd1SDave Chinner __entry->sync_mode = wbc->sync_mode; 114028c2dd1SDave Chinner __entry->for_kupdate = wbc->for_kupdate; 115028c2dd1SDave Chinner __entry->for_background = wbc->for_background; 116028c2dd1SDave Chinner __entry->for_reclaim = wbc->for_reclaim; 117028c2dd1SDave Chinner __entry->range_cyclic = wbc->range_cyclic; 118028c2dd1SDave Chinner __entry->older_than_this = wbc->older_than_this ? 119028c2dd1SDave Chinner *wbc->older_than_this : 0; 120028c2dd1SDave Chinner __entry->range_start = (long)wbc->range_start; 121028c2dd1SDave Chinner __entry->range_end = (long)wbc->range_end; 122028c2dd1SDave Chinner ), 123028c2dd1SDave Chinner 124028c2dd1SDave Chinner TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " 125*b7a2441fSWu Fengguang "bgrd=%d reclm=%d cyclic=%d older=0x%lx " 126028c2dd1SDave Chinner "start=0x%lx end=0x%lx", 127028c2dd1SDave Chinner __entry->name, 128028c2dd1SDave Chinner __entry->nr_to_write, 129028c2dd1SDave Chinner __entry->pages_skipped, 130028c2dd1SDave Chinner __entry->sync_mode, 131028c2dd1SDave Chinner __entry->for_kupdate, 132028c2dd1SDave Chinner __entry->for_background, 133028c2dd1SDave Chinner __entry->for_reclaim, 134028c2dd1SDave Chinner __entry->range_cyclic, 135028c2dd1SDave Chinner __entry->older_than_this, 136028c2dd1SDave Chinner __entry->range_start, 137028c2dd1SDave Chinner __entry->range_end) 138028c2dd1SDave Chinner ) 139028c2dd1SDave Chinner 140028c2dd1SDave Chinner #define DEFINE_WBC_EVENT(name) \ 141028c2dd1SDave Chinner DEFINE_EVENT(wbc_class, name, \ 142028c2dd1SDave Chinner TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ 143028c2dd1SDave Chinner TP_ARGS(wbc, bdi)) 144028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_writeback_start); 145028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_writeback_written); 146028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_writeback_wait); 147028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_balance_dirty_start); 148028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_balance_dirty_written); 149028c2dd1SDave Chinner DEFINE_WBC_EVENT(wbc_balance_dirty_wait); 1509e094383SDave Chinner DEFINE_WBC_EVENT(wbc_writepage); 151028c2dd1SDave Chinner 15252bb9198SMel Gorman DECLARE_EVENT_CLASS(writeback_congest_waited_template, 15352bb9198SMel Gorman 15452bb9198SMel Gorman TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 15552bb9198SMel Gorman 15652bb9198SMel Gorman TP_ARGS(usec_timeout, usec_delayed), 15752bb9198SMel Gorman 15852bb9198SMel Gorman TP_STRUCT__entry( 15952bb9198SMel Gorman __field( unsigned int, usec_timeout ) 16052bb9198SMel Gorman __field( unsigned int, usec_delayed ) 16152bb9198SMel Gorman ), 16252bb9198SMel Gorman 16352bb9198SMel Gorman TP_fast_assign( 16452bb9198SMel Gorman __entry->usec_timeout = usec_timeout; 16552bb9198SMel Gorman __entry->usec_delayed = usec_delayed; 16652bb9198SMel Gorman ), 16752bb9198SMel Gorman 16852bb9198SMel Gorman TP_printk("usec_timeout=%u usec_delayed=%u", 16952bb9198SMel Gorman __entry->usec_timeout, 17052bb9198SMel Gorman __entry->usec_delayed) 17152bb9198SMel Gorman ); 17252bb9198SMel Gorman 17352bb9198SMel Gorman DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, 17452bb9198SMel Gorman 17552bb9198SMel Gorman TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 17652bb9198SMel Gorman 17752bb9198SMel Gorman TP_ARGS(usec_timeout, usec_delayed) 17852bb9198SMel Gorman ); 17952bb9198SMel Gorman 1800e093d99SMel Gorman DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, 1810e093d99SMel Gorman 1820e093d99SMel Gorman TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), 1830e093d99SMel Gorman 1840e093d99SMel Gorman TP_ARGS(usec_timeout, usec_delayed) 1850e093d99SMel Gorman ); 1860e093d99SMel Gorman 187455b2864SDave Chinner #endif /* _TRACE_WRITEBACK_H */ 188455b2864SDave Chinner 189455b2864SDave Chinner /* This part must be outside protection */ 190455b2864SDave Chinner #include <trace/define_trace.h> 191