Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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 | |
Steven Rostedt (Red Hat) | f479447 | 2014-02-26 12:52:13 -0500 | [diff] [blame] | 7 | #include <linux/tracepoint.h> |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 8 | #include <linux/backing-dev.h> |
| 9 | #include <linux/writeback.h> |
| 10 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 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"}, \ |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 21 | {I_DIRTY_TIME, "I_DIRTY_TIME"}, \ |
| 22 | {I_DIRTY_TIME_EXPIRED, "I_DIRTY_TIME_EXPIRED"}, \ |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 23 | {I_REFERENCED, "I_REFERENCED"} \ |
| 24 | ) |
| 25 | |
Steven Rostedt (Red Hat) | 91df608 | 2015-03-27 17:08:41 -0400 | [diff] [blame] | 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 | |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 32 | #define WB_WORK_REASON \ |
Steven Rostedt (Red Hat) | 91df608 | 2015-03-27 17:08:41 -0400 | [diff] [blame] | 33 | EM( WB_REASON_BACKGROUND, "background") \ |
Johannes Weiner | 726d061f | 2017-02-24 14:56:14 -0800 | [diff] [blame] | 34 | EM( WB_REASON_VMSCAN, "vmscan") \ |
Steven Rostedt (Red Hat) | 91df608 | 2015-03-27 17:08:41 -0400 | [diff] [blame] | 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 } |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 52 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 53 | struct wb_writeback_work; |
| 54 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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, |
Christoph Hellwig | de1414a | 2015-01-14 10:42:36 +0100 | [diff] [blame] | 69 | mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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) |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 90 | __field(unsigned long, state) |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 91 | __field(unsigned long, flags) |
| 92 | ), |
| 93 | |
| 94 | TP_fast_assign( |
Christoph Hellwig | de1414a | 2015-01-14 10:42:36 +0100 | [diff] [blame] | 95 | struct backing_dev_info *bdi = inode_to_bdi(inode); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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; |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 101 | __entry->state = inode->i_state; |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 102 | __entry->flags = flags; |
| 103 | ), |
| 104 | |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 105 | TP_printk("bdi %s: ino=%lu state=%s flags=%s", |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 106 | __entry->name, |
| 107 | __entry->ino, |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 108 | show_inode_state(__entry->state), |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 109 | show_inode_state(__entry->flags) |
| 110 | ) |
| 111 | ); |
| 112 | |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 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 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 134 | #ifdef CREATE_TRACE_POINTS |
| 135 | #ifdef CONFIG_CGROUP_WRITEBACK |
| 136 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 137 | static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 138 | { |
Shaohua Li | c53cd49 | 2017-07-12 11:49:50 -0700 | [diff] [blame^] | 139 | return wb->memcg_css->cgroup->kn->id.ino; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 140 | } |
| 141 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 142 | static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 143 | { |
| 144 | if (wbc->wb) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 145 | return __trace_wb_assign_cgroup(wbc->wb); |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 146 | else |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 147 | return -1U; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 148 | } |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 149 | #else /* CONFIG_CGROUP_WRITEBACK */ |
| 150 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 151 | static inline unsigned int __trace_wb_assign_cgroup(struct bdi_writeback *wb) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 152 | { |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 153 | return -1U; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 156 | static inline unsigned int __trace_wbc_assign_cgroup(struct writeback_control *wbc) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 157 | { |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 158 | return -1U; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | #endif /* CONFIG_CGROUP_WRITEBACK */ |
| 162 | #endif /* CREATE_TRACE_POINTS */ |
| 163 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 164 | DECLARE_EVENT_CLASS(writeback_write_inode_template, |
| 165 | |
| 166 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 167 | |
| 168 | TP_ARGS(inode, wbc), |
| 169 | |
| 170 | TP_STRUCT__entry ( |
| 171 | __array(char, name, 32) |
| 172 | __field(unsigned long, ino) |
| 173 | __field(int, sync_mode) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 174 | __field(unsigned int, cgroup_ino) |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 175 | ), |
| 176 | |
| 177 | TP_fast_assign( |
| 178 | strncpy(__entry->name, |
Christoph Hellwig | de1414a | 2015-01-14 10:42:36 +0100 | [diff] [blame] | 179 | dev_name(inode_to_bdi(inode)->dev), 32); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 180 | __entry->ino = inode->i_ino; |
| 181 | __entry->sync_mode = wbc->sync_mode; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 182 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 183 | ), |
| 184 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 185 | TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup_ino=%u", |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 186 | __entry->name, |
| 187 | __entry->ino, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 188 | __entry->sync_mode, |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 189 | __entry->cgroup_ino |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 190 | ) |
| 191 | ); |
| 192 | |
| 193 | DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode_start, |
| 194 | |
| 195 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 196 | |
| 197 | TP_ARGS(inode, wbc) |
| 198 | ); |
| 199 | |
| 200 | DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode, |
| 201 | |
| 202 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 203 | |
| 204 | TP_ARGS(inode, wbc) |
| 205 | ); |
| 206 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 207 | DECLARE_EVENT_CLASS(writeback_work_class, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 208 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), |
| 209 | TP_ARGS(wb, work), |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 210 | TP_STRUCT__entry( |
| 211 | __array(char, name, 32) |
| 212 | __field(long, nr_pages) |
| 213 | __field(dev_t, sb_dev) |
| 214 | __field(int, sync_mode) |
| 215 | __field(int, for_kupdate) |
| 216 | __field(int, range_cyclic) |
| 217 | __field(int, for_background) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 218 | __field(int, reason) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 219 | __field(unsigned int, cgroup_ino) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 220 | ), |
| 221 | TP_fast_assign( |
Christoph Hellwig | df0ce26 | 2015-01-14 10:42:41 +0100 | [diff] [blame] | 222 | strncpy(__entry->name, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 223 | wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 224 | __entry->nr_pages = work->nr_pages; |
| 225 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; |
| 226 | __entry->sync_mode = work->sync_mode; |
| 227 | __entry->for_kupdate = work->for_kupdate; |
| 228 | __entry->range_cyclic = work->range_cyclic; |
| 229 | __entry->for_background = work->for_background; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 230 | __entry->reason = work->reason; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 231 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 232 | ), |
| 233 | TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 234 | "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup_ino=%u", |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 235 | __entry->name, |
| 236 | MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), |
| 237 | __entry->nr_pages, |
| 238 | __entry->sync_mode, |
| 239 | __entry->for_kupdate, |
| 240 | __entry->range_cyclic, |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 241 | __entry->for_background, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 242 | __print_symbolic(__entry->reason, WB_WORK_REASON), |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 243 | __entry->cgroup_ino |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 244 | ) |
| 245 | ); |
| 246 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
| 247 | DEFINE_EVENT(writeback_work_class, name, \ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 248 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \ |
| 249 | TP_ARGS(wb, work)) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 250 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); |
| 251 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 252 | DEFINE_WRITEBACK_WORK_EVENT(writeback_start); |
| 253 | DEFINE_WRITEBACK_WORK_EVENT(writeback_written); |
| 254 | DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 255 | |
| 256 | TRACE_EVENT(writeback_pages_written, |
| 257 | TP_PROTO(long pages_written), |
| 258 | TP_ARGS(pages_written), |
| 259 | TP_STRUCT__entry( |
| 260 | __field(long, pages) |
| 261 | ), |
| 262 | TP_fast_assign( |
| 263 | __entry->pages = pages_written; |
| 264 | ), |
| 265 | TP_printk("%ld", __entry->pages) |
| 266 | ); |
| 267 | |
| 268 | DECLARE_EVENT_CLASS(writeback_class, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 269 | TP_PROTO(struct bdi_writeback *wb), |
| 270 | TP_ARGS(wb), |
| 271 | TP_STRUCT__entry( |
| 272 | __array(char, name, 32) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 273 | __field(unsigned int, cgroup_ino) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 274 | ), |
| 275 | TP_fast_assign( |
| 276 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 277 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 278 | ), |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 279 | TP_printk("bdi %s: cgroup_ino=%u", |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 280 | __entry->name, |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 281 | __entry->cgroup_ino |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 282 | ) |
| 283 | ); |
| 284 | #define DEFINE_WRITEBACK_EVENT(name) \ |
| 285 | DEFINE_EVENT(writeback_class, name, \ |
| 286 | TP_PROTO(struct bdi_writeback *wb), \ |
| 287 | TP_ARGS(wb)) |
| 288 | |
| 289 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
| 290 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
| 291 | |
| 292 | TRACE_EVENT(writeback_bdi_register, |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 293 | TP_PROTO(struct backing_dev_info *bdi), |
| 294 | TP_ARGS(bdi), |
| 295 | TP_STRUCT__entry( |
| 296 | __array(char, name, 32) |
| 297 | ), |
| 298 | TP_fast_assign( |
| 299 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 300 | ), |
| 301 | TP_printk("bdi %s", |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 302 | __entry->name |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 303 | ) |
| 304 | ); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 305 | |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 306 | DECLARE_EVENT_CLASS(wbc_class, |
| 307 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
| 308 | TP_ARGS(wbc, bdi), |
| 309 | TP_STRUCT__entry( |
| 310 | __array(char, name, 32) |
| 311 | __field(long, nr_to_write) |
| 312 | __field(long, pages_skipped) |
| 313 | __field(int, sync_mode) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 314 | __field(int, for_kupdate) |
| 315 | __field(int, for_background) |
| 316 | __field(int, for_reclaim) |
| 317 | __field(int, range_cyclic) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 318 | __field(long, range_start) |
| 319 | __field(long, range_end) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 320 | __field(unsigned int, cgroup_ino) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 321 | ), |
| 322 | |
| 323 | TP_fast_assign( |
| 324 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 325 | __entry->nr_to_write = wbc->nr_to_write; |
| 326 | __entry->pages_skipped = wbc->pages_skipped; |
| 327 | __entry->sync_mode = wbc->sync_mode; |
| 328 | __entry->for_kupdate = wbc->for_kupdate; |
| 329 | __entry->for_background = wbc->for_background; |
| 330 | __entry->for_reclaim = wbc->for_reclaim; |
| 331 | __entry->range_cyclic = wbc->range_cyclic; |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 332 | __entry->range_start = (long)wbc->range_start; |
| 333 | __entry->range_end = (long)wbc->range_end; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 334 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 335 | ), |
| 336 | |
| 337 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 338 | "bgrd=%d reclm=%d cyclic=%d " |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 339 | "start=0x%lx end=0x%lx cgroup_ino=%u", |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 340 | __entry->name, |
| 341 | __entry->nr_to_write, |
| 342 | __entry->pages_skipped, |
| 343 | __entry->sync_mode, |
| 344 | __entry->for_kupdate, |
| 345 | __entry->for_background, |
| 346 | __entry->for_reclaim, |
| 347 | __entry->range_cyclic, |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 348 | __entry->range_start, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 349 | __entry->range_end, |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 350 | __entry->cgroup_ino |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 351 | ) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 352 | ) |
| 353 | |
| 354 | #define DEFINE_WBC_EVENT(name) \ |
| 355 | DEFINE_EVENT(wbc_class, name, \ |
| 356 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
| 357 | TP_ARGS(wbc, bdi)) |
Dave Chinner | 9e09438 | 2010-07-07 13:24:08 +1000 | [diff] [blame] | 358 | DEFINE_WBC_EVENT(wbc_writepage); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 359 | |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 360 | TRACE_EVENT(writeback_queue_io, |
| 361 | TP_PROTO(struct bdi_writeback *wb, |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 362 | struct wb_writeback_work *work, |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 363 | int moved), |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 364 | TP_ARGS(wb, work, moved), |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 365 | TP_STRUCT__entry( |
| 366 | __array(char, name, 32) |
| 367 | __field(unsigned long, older) |
| 368 | __field(long, age) |
| 369 | __field(int, moved) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 370 | __field(int, reason) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 371 | __field(unsigned int, cgroup_ino) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 372 | ), |
| 373 | TP_fast_assign( |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 374 | unsigned long *older_than_this = work->older_than_this; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 375 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 376 | __entry->older = older_than_this ? *older_than_this : 0; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 377 | __entry->age = older_than_this ? |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 378 | (jiffies - *older_than_this) * 1000 / HZ : -1; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 379 | __entry->moved = moved; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 380 | __entry->reason = work->reason; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 381 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 382 | ), |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 383 | TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup_ino=%u", |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 384 | __entry->name, |
| 385 | __entry->older, /* older_than_this in jiffies */ |
| 386 | __entry->age, /* older_than_this in relative milliseconds */ |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 387 | __entry->moved, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 388 | __print_symbolic(__entry->reason, WB_WORK_REASON), |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 389 | __entry->cgroup_ino |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 390 | ) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 391 | ); |
| 392 | |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 393 | TRACE_EVENT(global_dirty_state, |
| 394 | |
| 395 | TP_PROTO(unsigned long background_thresh, |
| 396 | unsigned long dirty_thresh |
| 397 | ), |
| 398 | |
| 399 | TP_ARGS(background_thresh, |
| 400 | dirty_thresh |
| 401 | ), |
| 402 | |
| 403 | TP_STRUCT__entry( |
| 404 | __field(unsigned long, nr_dirty) |
| 405 | __field(unsigned long, nr_writeback) |
| 406 | __field(unsigned long, nr_unstable) |
| 407 | __field(unsigned long, background_thresh) |
| 408 | __field(unsigned long, dirty_thresh) |
| 409 | __field(unsigned long, dirty_limit) |
| 410 | __field(unsigned long, nr_dirtied) |
| 411 | __field(unsigned long, nr_written) |
| 412 | ), |
| 413 | |
| 414 | TP_fast_assign( |
Mel Gorman | 11fb998 | 2016-07-28 15:46:20 -0700 | [diff] [blame] | 415 | __entry->nr_dirty = global_node_page_state(NR_FILE_DIRTY); |
| 416 | __entry->nr_writeback = global_node_page_state(NR_WRITEBACK); |
| 417 | __entry->nr_unstable = global_node_page_state(NR_UNSTABLE_NFS); |
Mel Gorman | c4a2563 | 2016-07-28 15:46:23 -0700 | [diff] [blame] | 418 | __entry->nr_dirtied = global_node_page_state(NR_DIRTIED); |
| 419 | __entry->nr_written = global_node_page_state(NR_WRITTEN); |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 420 | __entry->background_thresh = background_thresh; |
| 421 | __entry->dirty_thresh = dirty_thresh; |
Tejun Heo | dcc25ae | 2015-05-22 18:23:22 -0400 | [diff] [blame] | 422 | __entry->dirty_limit = global_wb_domain.dirty_limit; |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 423 | ), |
| 424 | |
| 425 | TP_printk("dirty=%lu writeback=%lu unstable=%lu " |
| 426 | "bg_thresh=%lu thresh=%lu limit=%lu " |
| 427 | "dirtied=%lu written=%lu", |
| 428 | __entry->nr_dirty, |
| 429 | __entry->nr_writeback, |
| 430 | __entry->nr_unstable, |
| 431 | __entry->background_thresh, |
| 432 | __entry->dirty_thresh, |
| 433 | __entry->dirty_limit, |
| 434 | __entry->nr_dirtied, |
| 435 | __entry->nr_written |
| 436 | ) |
| 437 | ); |
| 438 | |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 439 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) |
| 440 | |
| 441 | TRACE_EVENT(bdi_dirty_ratelimit, |
| 442 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 443 | TP_PROTO(struct bdi_writeback *wb, |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 444 | unsigned long dirty_rate, |
| 445 | unsigned long task_ratelimit), |
| 446 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 447 | TP_ARGS(wb, dirty_rate, task_ratelimit), |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 448 | |
| 449 | TP_STRUCT__entry( |
| 450 | __array(char, bdi, 32) |
| 451 | __field(unsigned long, write_bw) |
| 452 | __field(unsigned long, avg_write_bw) |
| 453 | __field(unsigned long, dirty_rate) |
| 454 | __field(unsigned long, dirty_ratelimit) |
| 455 | __field(unsigned long, task_ratelimit) |
| 456 | __field(unsigned long, balanced_dirty_ratelimit) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 457 | __field(unsigned int, cgroup_ino) |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 458 | ), |
| 459 | |
| 460 | TP_fast_assign( |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 461 | strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); |
| 462 | __entry->write_bw = KBps(wb->write_bandwidth); |
| 463 | __entry->avg_write_bw = KBps(wb->avg_write_bandwidth); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 464 | __entry->dirty_rate = KBps(dirty_rate); |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 465 | __entry->dirty_ratelimit = KBps(wb->dirty_ratelimit); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 466 | __entry->task_ratelimit = KBps(task_ratelimit); |
| 467 | __entry->balanced_dirty_ratelimit = |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 468 | KBps(wb->balanced_dirty_ratelimit); |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 469 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 470 | ), |
| 471 | |
| 472 | TP_printk("bdi %s: " |
| 473 | "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " |
| 474 | "dirty_ratelimit=%lu task_ratelimit=%lu " |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 475 | "balanced_dirty_ratelimit=%lu cgroup_ino=%u", |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 476 | __entry->bdi, |
| 477 | __entry->write_bw, /* write bandwidth */ |
| 478 | __entry->avg_write_bw, /* avg write bandwidth */ |
| 479 | __entry->dirty_rate, /* bdi dirty rate */ |
| 480 | __entry->dirty_ratelimit, /* base ratelimit */ |
| 481 | __entry->task_ratelimit, /* ratelimit with position control */ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 482 | __entry->balanced_dirty_ratelimit, /* the balanced ratelimit */ |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 483 | __entry->cgroup_ino |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 484 | ) |
| 485 | ); |
| 486 | |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 487 | TRACE_EVENT(balance_dirty_pages, |
| 488 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 489 | TP_PROTO(struct bdi_writeback *wb, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 490 | unsigned long thresh, |
| 491 | unsigned long bg_thresh, |
| 492 | unsigned long dirty, |
| 493 | unsigned long bdi_thresh, |
| 494 | unsigned long bdi_dirty, |
| 495 | unsigned long dirty_ratelimit, |
| 496 | unsigned long task_ratelimit, |
| 497 | unsigned long dirtied, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 498 | unsigned long period, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 499 | long pause, |
| 500 | unsigned long start_time), |
| 501 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 502 | TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 503 | dirty_ratelimit, task_ratelimit, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 504 | dirtied, period, pause, start_time), |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 505 | |
| 506 | TP_STRUCT__entry( |
| 507 | __array( char, bdi, 32) |
| 508 | __field(unsigned long, limit) |
| 509 | __field(unsigned long, setpoint) |
| 510 | __field(unsigned long, dirty) |
| 511 | __field(unsigned long, bdi_setpoint) |
| 512 | __field(unsigned long, bdi_dirty) |
| 513 | __field(unsigned long, dirty_ratelimit) |
| 514 | __field(unsigned long, task_ratelimit) |
| 515 | __field(unsigned int, dirtied) |
| 516 | __field(unsigned int, dirtied_pause) |
| 517 | __field(unsigned long, paused) |
| 518 | __field( long, pause) |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 519 | __field(unsigned long, period) |
| 520 | __field( long, think) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 521 | __field(unsigned int, cgroup_ino) |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 522 | ), |
| 523 | |
| 524 | TP_fast_assign( |
| 525 | unsigned long freerun = (thresh + bg_thresh) / 2; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 526 | strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 527 | |
Tejun Heo | dcc25ae | 2015-05-22 18:23:22 -0400 | [diff] [blame] | 528 | __entry->limit = global_wb_domain.dirty_limit; |
| 529 | __entry->setpoint = (global_wb_domain.dirty_limit + |
| 530 | freerun) / 2; |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 531 | __entry->dirty = dirty; |
| 532 | __entry->bdi_setpoint = __entry->setpoint * |
| 533 | bdi_thresh / (thresh + 1); |
| 534 | __entry->bdi_dirty = bdi_dirty; |
| 535 | __entry->dirty_ratelimit = KBps(dirty_ratelimit); |
| 536 | __entry->task_ratelimit = KBps(task_ratelimit); |
| 537 | __entry->dirtied = dirtied; |
| 538 | __entry->dirtied_pause = current->nr_dirtied_pause; |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 539 | __entry->think = current->dirty_paused_when == 0 ? 0 : |
| 540 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ; |
| 541 | __entry->period = period * 1000 / HZ; |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 542 | __entry->pause = pause * 1000 / HZ; |
| 543 | __entry->paused = (jiffies - start_time) * 1000 / HZ; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 544 | __entry->cgroup_ino = __trace_wb_assign_cgroup(wb); |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 545 | ), |
| 546 | |
| 547 | |
| 548 | TP_printk("bdi %s: " |
| 549 | "limit=%lu setpoint=%lu dirty=%lu " |
| 550 | "bdi_setpoint=%lu bdi_dirty=%lu " |
| 551 | "dirty_ratelimit=%lu task_ratelimit=%lu " |
| 552 | "dirtied=%u dirtied_pause=%u " |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 553 | "paused=%lu pause=%ld period=%lu think=%ld cgroup_ino=%u", |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 554 | __entry->bdi, |
| 555 | __entry->limit, |
| 556 | __entry->setpoint, |
| 557 | __entry->dirty, |
| 558 | __entry->bdi_setpoint, |
| 559 | __entry->bdi_dirty, |
| 560 | __entry->dirty_ratelimit, |
| 561 | __entry->task_ratelimit, |
| 562 | __entry->dirtied, |
| 563 | __entry->dirtied_pause, |
| 564 | __entry->paused, /* ms */ |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 565 | __entry->pause, /* ms */ |
| 566 | __entry->period, /* ms */ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 567 | __entry->think, /* ms */ |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 568 | __entry->cgroup_ino |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 569 | ) |
| 570 | ); |
| 571 | |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 572 | TRACE_EVENT(writeback_sb_inodes_requeue, |
| 573 | |
| 574 | TP_PROTO(struct inode *inode), |
| 575 | TP_ARGS(inode), |
| 576 | |
| 577 | TP_STRUCT__entry( |
| 578 | __array(char, name, 32) |
| 579 | __field(unsigned long, ino) |
| 580 | __field(unsigned long, state) |
| 581 | __field(unsigned long, dirtied_when) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 582 | __field(unsigned int, cgroup_ino) |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 583 | ), |
| 584 | |
| 585 | TP_fast_assign( |
| 586 | strncpy(__entry->name, |
| 587 | dev_name(inode_to_bdi(inode)->dev), 32); |
| 588 | __entry->ino = inode->i_ino; |
| 589 | __entry->state = inode->i_state; |
| 590 | __entry->dirtied_when = inode->dirtied_when; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 591 | __entry->cgroup_ino = __trace_wb_assign_cgroup(inode_to_wb(inode)); |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 592 | ), |
| 593 | |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 594 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup_ino=%u", |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 595 | __entry->name, |
| 596 | __entry->ino, |
| 597 | show_inode_state(__entry->state), |
| 598 | __entry->dirtied_when, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 599 | (jiffies - __entry->dirtied_when) / HZ, |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 600 | __entry->cgroup_ino |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 601 | ) |
| 602 | ); |
| 603 | |
Mel Gorman | 52bb919 | 2010-10-26 14:21:41 -0700 | [diff] [blame] | 604 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, |
| 605 | |
| 606 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 607 | |
| 608 | TP_ARGS(usec_timeout, usec_delayed), |
| 609 | |
| 610 | TP_STRUCT__entry( |
| 611 | __field( unsigned int, usec_timeout ) |
| 612 | __field( unsigned int, usec_delayed ) |
| 613 | ), |
| 614 | |
| 615 | TP_fast_assign( |
| 616 | __entry->usec_timeout = usec_timeout; |
| 617 | __entry->usec_delayed = usec_delayed; |
| 618 | ), |
| 619 | |
| 620 | TP_printk("usec_timeout=%u usec_delayed=%u", |
| 621 | __entry->usec_timeout, |
| 622 | __entry->usec_delayed) |
| 623 | ); |
| 624 | |
| 625 | DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, |
| 626 | |
| 627 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 628 | |
| 629 | TP_ARGS(usec_timeout, usec_delayed) |
| 630 | ); |
| 631 | |
Mel Gorman | 0e093d99 | 2010-10-26 14:21:45 -0700 | [diff] [blame] | 632 | DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, |
| 633 | |
| 634 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 635 | |
| 636 | TP_ARGS(usec_timeout, usec_delayed) |
| 637 | ); |
| 638 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 639 | DECLARE_EVENT_CLASS(writeback_single_inode_template, |
| 640 | |
| 641 | TP_PROTO(struct inode *inode, |
| 642 | struct writeback_control *wbc, |
| 643 | unsigned long nr_to_write |
| 644 | ), |
| 645 | |
| 646 | TP_ARGS(inode, wbc, nr_to_write), |
| 647 | |
| 648 | TP_STRUCT__entry( |
| 649 | __array(char, name, 32) |
| 650 | __field(unsigned long, ino) |
| 651 | __field(unsigned long, state) |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 652 | __field(unsigned long, dirtied_when) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 653 | __field(unsigned long, writeback_index) |
| 654 | __field(long, nr_to_write) |
| 655 | __field(unsigned long, wrote) |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 656 | __field(unsigned int, cgroup_ino) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 657 | ), |
| 658 | |
| 659 | TP_fast_assign( |
| 660 | strncpy(__entry->name, |
Wu Fengguang | 15eb77a | 2012-01-17 11:18:56 -0600 | [diff] [blame] | 661 | dev_name(inode_to_bdi(inode)->dev), 32); |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 662 | __entry->ino = inode->i_ino; |
| 663 | __entry->state = inode->i_state; |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 664 | __entry->dirtied_when = inode->dirtied_when; |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 665 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 666 | __entry->nr_to_write = nr_to_write; |
| 667 | __entry->wrote = nr_to_write - wbc->nr_to_write; |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 668 | __entry->cgroup_ino = __trace_wbc_assign_cgroup(wbc); |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 669 | ), |
| 670 | |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 671 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 672 | "index=%lu to_write=%ld wrote=%lu cgroup_ino=%u", |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 673 | __entry->name, |
| 674 | __entry->ino, |
| 675 | show_inode_state(__entry->state), |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 676 | __entry->dirtied_when, |
| 677 | (jiffies - __entry->dirtied_when) / HZ, |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 678 | __entry->writeback_index, |
| 679 | __entry->nr_to_write, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 680 | __entry->wrote, |
Yang Shi | a664edb | 2016-03-03 01:08:57 -0800 | [diff] [blame] | 681 | __entry->cgroup_ino |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 682 | ) |
| 683 | ); |
| 684 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 685 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_start, |
| 686 | TP_PROTO(struct inode *inode, |
| 687 | struct writeback_control *wbc, |
| 688 | unsigned long nr_to_write), |
| 689 | TP_ARGS(inode, wbc, nr_to_write) |
| 690 | ); |
| 691 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 692 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, |
| 693 | TP_PROTO(struct inode *inode, |
| 694 | struct writeback_control *wbc, |
| 695 | unsigned long nr_to_write), |
| 696 | TP_ARGS(inode, wbc, nr_to_write) |
| 697 | ); |
| 698 | |
Brian Foster | 9a46b04f | 2016-07-26 15:21:53 -0700 | [diff] [blame] | 699 | DECLARE_EVENT_CLASS(writeback_inode_template, |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 700 | TP_PROTO(struct inode *inode), |
| 701 | |
| 702 | TP_ARGS(inode), |
| 703 | |
| 704 | TP_STRUCT__entry( |
| 705 | __field( dev_t, dev ) |
| 706 | __field(unsigned long, ino ) |
| 707 | __field(unsigned long, state ) |
| 708 | __field( __u16, mode ) |
| 709 | __field(unsigned long, dirtied_when ) |
| 710 | ), |
| 711 | |
| 712 | TP_fast_assign( |
| 713 | __entry->dev = inode->i_sb->s_dev; |
| 714 | __entry->ino = inode->i_ino; |
| 715 | __entry->state = inode->i_state; |
| 716 | __entry->mode = inode->i_mode; |
| 717 | __entry->dirtied_when = inode->dirtied_when; |
| 718 | ), |
| 719 | |
| 720 | TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o", |
| 721 | MAJOR(__entry->dev), MINOR(__entry->dev), |
| 722 | __entry->ino, __entry->dirtied_when, |
| 723 | show_inode_state(__entry->state), __entry->mode) |
| 724 | ); |
| 725 | |
Brian Foster | 9a46b04f | 2016-07-26 15:21:53 -0700 | [diff] [blame] | 726 | DEFINE_EVENT(writeback_inode_template, writeback_lazytime, |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 727 | TP_PROTO(struct inode *inode), |
| 728 | |
| 729 | TP_ARGS(inode) |
| 730 | ); |
| 731 | |
Brian Foster | 9a46b04f | 2016-07-26 15:21:53 -0700 | [diff] [blame] | 732 | DEFINE_EVENT(writeback_inode_template, writeback_lazytime_iput, |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 733 | TP_PROTO(struct inode *inode), |
| 734 | |
| 735 | TP_ARGS(inode) |
| 736 | ); |
| 737 | |
Brian Foster | 9a46b04f | 2016-07-26 15:21:53 -0700 | [diff] [blame] | 738 | DEFINE_EVENT(writeback_inode_template, writeback_dirty_inode_enqueue, |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 739 | |
| 740 | TP_PROTO(struct inode *inode), |
| 741 | |
| 742 | TP_ARGS(inode) |
| 743 | ); |
| 744 | |
Brian Foster | 9a46b04f | 2016-07-26 15:21:53 -0700 | [diff] [blame] | 745 | /* |
| 746 | * Inode writeback list tracking. |
| 747 | */ |
| 748 | |
| 749 | DEFINE_EVENT(writeback_inode_template, sb_mark_inode_writeback, |
| 750 | TP_PROTO(struct inode *inode), |
| 751 | TP_ARGS(inode) |
| 752 | ); |
| 753 | |
| 754 | DEFINE_EVENT(writeback_inode_template, sb_clear_inode_writeback, |
| 755 | TP_PROTO(struct inode *inode), |
| 756 | TP_ARGS(inode) |
| 757 | ); |
| 758 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 759 | #endif /* _TRACE_WRITEBACK_H */ |
| 760 | |
| 761 | /* This part must be outside protection */ |
| 762 | #include <trace/define_trace.h> |