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 | |
| 7 | #include <linux/backing-dev.h> |
| 8 | #include <linux/writeback.h> |
| 9 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 10 | #define show_inode_state(state) \ |
| 11 | __print_flags(state, "|", \ |
| 12 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ |
| 13 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ |
| 14 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ |
| 15 | {I_NEW, "I_NEW"}, \ |
| 16 | {I_WILL_FREE, "I_WILL_FREE"}, \ |
| 17 | {I_FREEING, "I_FREEING"}, \ |
| 18 | {I_CLEAR, "I_CLEAR"}, \ |
| 19 | {I_SYNC, "I_SYNC"}, \ |
| 20 | {I_REFERENCED, "I_REFERENCED"} \ |
| 21 | ) |
| 22 | |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 23 | #define WB_WORK_REASON \ |
| 24 | {WB_REASON_BACKGROUND, "background"}, \ |
| 25 | {WB_REASON_TRY_TO_FREE_PAGES, "try_to_free_pages"}, \ |
| 26 | {WB_REASON_SYNC, "sync"}, \ |
| 27 | {WB_REASON_PERIODIC, "periodic"}, \ |
| 28 | {WB_REASON_LAPTOP_TIMER, "laptop_timer"}, \ |
| 29 | {WB_REASON_FREE_MORE_MEM, "free_more_memory"}, \ |
| 30 | {WB_REASON_FS_FREE_SPACE, "fs_free_space"}, \ |
| 31 | {WB_REASON_FORKER_THREAD, "forker_thread"} |
| 32 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 33 | struct wb_writeback_work; |
| 34 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 35 | TRACE_EVENT(writeback_dirty_page, |
| 36 | |
| 37 | TP_PROTO(struct page *page, struct address_space *mapping), |
| 38 | |
| 39 | TP_ARGS(page, mapping), |
| 40 | |
| 41 | TP_STRUCT__entry ( |
| 42 | __array(char, name, 32) |
| 43 | __field(unsigned long, ino) |
| 44 | __field(pgoff_t, index) |
| 45 | ), |
| 46 | |
| 47 | TP_fast_assign( |
| 48 | strncpy(__entry->name, |
| 49 | mapping ? dev_name(mapping->backing_dev_info->dev) : "(unknown)", 32); |
| 50 | __entry->ino = mapping ? mapping->host->i_ino : 0; |
| 51 | __entry->index = page->index; |
| 52 | ), |
| 53 | |
| 54 | TP_printk("bdi %s: ino=%lu index=%lu", |
| 55 | __entry->name, |
| 56 | __entry->ino, |
| 57 | __entry->index |
| 58 | ) |
| 59 | ); |
| 60 | |
| 61 | DECLARE_EVENT_CLASS(writeback_dirty_inode_template, |
| 62 | |
| 63 | TP_PROTO(struct inode *inode, int flags), |
| 64 | |
| 65 | TP_ARGS(inode, flags), |
| 66 | |
| 67 | TP_STRUCT__entry ( |
| 68 | __array(char, name, 32) |
| 69 | __field(unsigned long, ino) |
| 70 | __field(unsigned long, flags) |
| 71 | ), |
| 72 | |
| 73 | TP_fast_assign( |
| 74 | struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; |
| 75 | |
| 76 | /* may be called for files on pseudo FSes w/ unregistered bdi */ |
| 77 | strncpy(__entry->name, |
| 78 | bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32); |
| 79 | __entry->ino = inode->i_ino; |
| 80 | __entry->flags = flags; |
| 81 | ), |
| 82 | |
| 83 | TP_printk("bdi %s: ino=%lu flags=%s", |
| 84 | __entry->name, |
| 85 | __entry->ino, |
| 86 | show_inode_state(__entry->flags) |
| 87 | ) |
| 88 | ); |
| 89 | |
| 90 | DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode_start, |
| 91 | |
| 92 | TP_PROTO(struct inode *inode, int flags), |
| 93 | |
| 94 | TP_ARGS(inode, flags) |
| 95 | ); |
| 96 | |
| 97 | DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode, |
| 98 | |
| 99 | TP_PROTO(struct inode *inode, int flags), |
| 100 | |
| 101 | TP_ARGS(inode, flags) |
| 102 | ); |
| 103 | |
| 104 | DECLARE_EVENT_CLASS(writeback_write_inode_template, |
| 105 | |
| 106 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 107 | |
| 108 | TP_ARGS(inode, wbc), |
| 109 | |
| 110 | TP_STRUCT__entry ( |
| 111 | __array(char, name, 32) |
| 112 | __field(unsigned long, ino) |
| 113 | __field(int, sync_mode) |
| 114 | ), |
| 115 | |
| 116 | TP_fast_assign( |
| 117 | strncpy(__entry->name, |
| 118 | dev_name(inode->i_mapping->backing_dev_info->dev), 32); |
| 119 | __entry->ino = inode->i_ino; |
| 120 | __entry->sync_mode = wbc->sync_mode; |
| 121 | ), |
| 122 | |
| 123 | TP_printk("bdi %s: ino=%lu sync_mode=%d", |
| 124 | __entry->name, |
| 125 | __entry->ino, |
| 126 | __entry->sync_mode |
| 127 | ) |
| 128 | ); |
| 129 | |
| 130 | DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode_start, |
| 131 | |
| 132 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 133 | |
| 134 | TP_ARGS(inode, wbc) |
| 135 | ); |
| 136 | |
| 137 | DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode, |
| 138 | |
| 139 | TP_PROTO(struct inode *inode, struct writeback_control *wbc), |
| 140 | |
| 141 | TP_ARGS(inode, wbc) |
| 142 | ); |
| 143 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 144 | DECLARE_EVENT_CLASS(writeback_work_class, |
| 145 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), |
| 146 | TP_ARGS(bdi, work), |
| 147 | TP_STRUCT__entry( |
| 148 | __array(char, name, 32) |
| 149 | __field(long, nr_pages) |
| 150 | __field(dev_t, sb_dev) |
| 151 | __field(int, sync_mode) |
| 152 | __field(int, for_kupdate) |
| 153 | __field(int, range_cyclic) |
| 154 | __field(int, for_background) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 155 | __field(int, reason) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 156 | ), |
| 157 | TP_fast_assign( |
Wu Fengguang | 977b7e3 | 2012-02-04 20:54:03 -0600 | [diff] [blame] | 158 | struct device *dev = bdi->dev; |
| 159 | if (!dev) |
| 160 | dev = default_backing_dev_info.dev; |
| 161 | strncpy(__entry->name, dev_name(dev), 32); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 162 | __entry->nr_pages = work->nr_pages; |
| 163 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; |
| 164 | __entry->sync_mode = work->sync_mode; |
| 165 | __entry->for_kupdate = work->for_kupdate; |
| 166 | __entry->range_cyclic = work->range_cyclic; |
| 167 | __entry->for_background = work->for_background; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 168 | __entry->reason = work->reason; |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 169 | ), |
| 170 | TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 171 | "kupdate=%d range_cyclic=%d background=%d reason=%s", |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 172 | __entry->name, |
| 173 | MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), |
| 174 | __entry->nr_pages, |
| 175 | __entry->sync_mode, |
| 176 | __entry->for_kupdate, |
| 177 | __entry->range_cyclic, |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 178 | __entry->for_background, |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 179 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 180 | ) |
| 181 | ); |
| 182 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
| 183 | DEFINE_EVENT(writeback_work_class, name, \ |
| 184 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ |
| 185 | TP_ARGS(bdi, work)) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 186 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); |
| 187 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 188 | DEFINE_WRITEBACK_WORK_EVENT(writeback_start); |
| 189 | DEFINE_WRITEBACK_WORK_EVENT(writeback_written); |
| 190 | DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 191 | |
| 192 | TRACE_EVENT(writeback_pages_written, |
| 193 | TP_PROTO(long pages_written), |
| 194 | TP_ARGS(pages_written), |
| 195 | TP_STRUCT__entry( |
| 196 | __field(long, pages) |
| 197 | ), |
| 198 | TP_fast_assign( |
| 199 | __entry->pages = pages_written; |
| 200 | ), |
| 201 | TP_printk("%ld", __entry->pages) |
| 202 | ); |
| 203 | |
| 204 | DECLARE_EVENT_CLASS(writeback_class, |
| 205 | TP_PROTO(struct backing_dev_info *bdi), |
| 206 | TP_ARGS(bdi), |
| 207 | TP_STRUCT__entry( |
| 208 | __array(char, name, 32) |
| 209 | ), |
| 210 | TP_fast_assign( |
| 211 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 212 | ), |
| 213 | TP_printk("bdi %s", |
| 214 | __entry->name |
| 215 | ) |
| 216 | ); |
| 217 | #define DEFINE_WRITEBACK_EVENT(name) \ |
| 218 | DEFINE_EVENT(writeback_class, name, \ |
| 219 | TP_PROTO(struct backing_dev_info *bdi), \ |
| 220 | TP_ARGS(bdi)) |
| 221 | |
| 222 | DEFINE_WRITEBACK_EVENT(writeback_nowork); |
Wu Fengguang | 71927e8 | 2011-01-13 15:45:46 -0800 | [diff] [blame] | 223 | DEFINE_WRITEBACK_EVENT(writeback_wake_background); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 224 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); |
| 225 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 226 | |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 227 | DECLARE_EVENT_CLASS(wbc_class, |
| 228 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
| 229 | TP_ARGS(wbc, bdi), |
| 230 | TP_STRUCT__entry( |
| 231 | __array(char, name, 32) |
| 232 | __field(long, nr_to_write) |
| 233 | __field(long, pages_skipped) |
| 234 | __field(int, sync_mode) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 235 | __field(int, for_kupdate) |
| 236 | __field(int, for_background) |
| 237 | __field(int, for_reclaim) |
| 238 | __field(int, range_cyclic) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 239 | __field(long, range_start) |
| 240 | __field(long, range_end) |
| 241 | ), |
| 242 | |
| 243 | TP_fast_assign( |
| 244 | strncpy(__entry->name, dev_name(bdi->dev), 32); |
| 245 | __entry->nr_to_write = wbc->nr_to_write; |
| 246 | __entry->pages_skipped = wbc->pages_skipped; |
| 247 | __entry->sync_mode = wbc->sync_mode; |
| 248 | __entry->for_kupdate = wbc->for_kupdate; |
| 249 | __entry->for_background = wbc->for_background; |
| 250 | __entry->for_reclaim = wbc->for_reclaim; |
| 251 | __entry->range_cyclic = wbc->range_cyclic; |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 252 | __entry->range_start = (long)wbc->range_start; |
| 253 | __entry->range_end = (long)wbc->range_end; |
| 254 | ), |
| 255 | |
| 256 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 257 | "bgrd=%d reclm=%d cyclic=%d " |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 258 | "start=0x%lx end=0x%lx", |
| 259 | __entry->name, |
| 260 | __entry->nr_to_write, |
| 261 | __entry->pages_skipped, |
| 262 | __entry->sync_mode, |
| 263 | __entry->for_kupdate, |
| 264 | __entry->for_background, |
| 265 | __entry->for_reclaim, |
| 266 | __entry->range_cyclic, |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 267 | __entry->range_start, |
| 268 | __entry->range_end) |
| 269 | ) |
| 270 | |
| 271 | #define DEFINE_WBC_EVENT(name) \ |
| 272 | DEFINE_EVENT(wbc_class, name, \ |
| 273 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
| 274 | TP_ARGS(wbc, bdi)) |
Dave Chinner | 9e09438 | 2010-07-07 13:24:08 +1000 | [diff] [blame] | 275 | DEFINE_WBC_EVENT(wbc_writepage); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 276 | |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 277 | TRACE_EVENT(writeback_queue_io, |
| 278 | TP_PROTO(struct bdi_writeback *wb, |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 279 | struct wb_writeback_work *work, |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 280 | int moved), |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 281 | TP_ARGS(wb, work, moved), |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 282 | TP_STRUCT__entry( |
| 283 | __array(char, name, 32) |
| 284 | __field(unsigned long, older) |
| 285 | __field(long, age) |
| 286 | __field(int, moved) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 287 | __field(int, reason) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 288 | ), |
| 289 | TP_fast_assign( |
Jan Kara | c4a391b | 2013-11-12 15:07:51 -0800 | [diff] [blame] | 290 | unsigned long older_than_this = work->older_than_this; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 291 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
Jan Kara | c4a391b | 2013-11-12 15:07:51 -0800 | [diff] [blame] | 292 | __entry->older = older_than_this; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 293 | __entry->age = older_than_this ? |
Jan Kara | c4a391b | 2013-11-12 15:07:51 -0800 | [diff] [blame] | 294 | (jiffies - older_than_this) * 1000 / HZ : -1; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 295 | __entry->moved = moved; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 296 | __entry->reason = work->reason; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 297 | ), |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 298 | TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s", |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 299 | __entry->name, |
| 300 | __entry->older, /* older_than_this in jiffies */ |
| 301 | __entry->age, /* older_than_this in relative milliseconds */ |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 302 | __entry->moved, |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 303 | __print_symbolic(__entry->reason, WB_WORK_REASON) |
| 304 | ) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 305 | ); |
| 306 | |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 307 | TRACE_EVENT(global_dirty_state, |
| 308 | |
| 309 | TP_PROTO(unsigned long background_thresh, |
| 310 | unsigned long dirty_thresh |
| 311 | ), |
| 312 | |
| 313 | TP_ARGS(background_thresh, |
| 314 | dirty_thresh |
| 315 | ), |
| 316 | |
| 317 | TP_STRUCT__entry( |
| 318 | __field(unsigned long, nr_dirty) |
| 319 | __field(unsigned long, nr_writeback) |
| 320 | __field(unsigned long, nr_unstable) |
| 321 | __field(unsigned long, background_thresh) |
| 322 | __field(unsigned long, dirty_thresh) |
| 323 | __field(unsigned long, dirty_limit) |
| 324 | __field(unsigned long, nr_dirtied) |
| 325 | __field(unsigned long, nr_written) |
| 326 | ), |
| 327 | |
| 328 | TP_fast_assign( |
| 329 | __entry->nr_dirty = global_page_state(NR_FILE_DIRTY); |
| 330 | __entry->nr_writeback = global_page_state(NR_WRITEBACK); |
| 331 | __entry->nr_unstable = global_page_state(NR_UNSTABLE_NFS); |
| 332 | __entry->nr_dirtied = global_page_state(NR_DIRTIED); |
| 333 | __entry->nr_written = global_page_state(NR_WRITTEN); |
| 334 | __entry->background_thresh = background_thresh; |
| 335 | __entry->dirty_thresh = dirty_thresh; |
| 336 | __entry->dirty_limit = global_dirty_limit; |
| 337 | ), |
| 338 | |
| 339 | TP_printk("dirty=%lu writeback=%lu unstable=%lu " |
| 340 | "bg_thresh=%lu thresh=%lu limit=%lu " |
| 341 | "dirtied=%lu written=%lu", |
| 342 | __entry->nr_dirty, |
| 343 | __entry->nr_writeback, |
| 344 | __entry->nr_unstable, |
| 345 | __entry->background_thresh, |
| 346 | __entry->dirty_thresh, |
| 347 | __entry->dirty_limit, |
| 348 | __entry->nr_dirtied, |
| 349 | __entry->nr_written |
| 350 | ) |
| 351 | ); |
| 352 | |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 353 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) |
| 354 | |
| 355 | TRACE_EVENT(bdi_dirty_ratelimit, |
| 356 | |
| 357 | TP_PROTO(struct backing_dev_info *bdi, |
| 358 | unsigned long dirty_rate, |
| 359 | unsigned long task_ratelimit), |
| 360 | |
| 361 | TP_ARGS(bdi, dirty_rate, task_ratelimit), |
| 362 | |
| 363 | TP_STRUCT__entry( |
| 364 | __array(char, bdi, 32) |
| 365 | __field(unsigned long, write_bw) |
| 366 | __field(unsigned long, avg_write_bw) |
| 367 | __field(unsigned long, dirty_rate) |
| 368 | __field(unsigned long, dirty_ratelimit) |
| 369 | __field(unsigned long, task_ratelimit) |
| 370 | __field(unsigned long, balanced_dirty_ratelimit) |
| 371 | ), |
| 372 | |
| 373 | TP_fast_assign( |
| 374 | strlcpy(__entry->bdi, dev_name(bdi->dev), 32); |
| 375 | __entry->write_bw = KBps(bdi->write_bandwidth); |
| 376 | __entry->avg_write_bw = KBps(bdi->avg_write_bandwidth); |
| 377 | __entry->dirty_rate = KBps(dirty_rate); |
| 378 | __entry->dirty_ratelimit = KBps(bdi->dirty_ratelimit); |
| 379 | __entry->task_ratelimit = KBps(task_ratelimit); |
| 380 | __entry->balanced_dirty_ratelimit = |
| 381 | KBps(bdi->balanced_dirty_ratelimit); |
| 382 | ), |
| 383 | |
| 384 | TP_printk("bdi %s: " |
| 385 | "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " |
| 386 | "dirty_ratelimit=%lu task_ratelimit=%lu " |
| 387 | "balanced_dirty_ratelimit=%lu", |
| 388 | __entry->bdi, |
| 389 | __entry->write_bw, /* write bandwidth */ |
| 390 | __entry->avg_write_bw, /* avg write bandwidth */ |
| 391 | __entry->dirty_rate, /* bdi dirty rate */ |
| 392 | __entry->dirty_ratelimit, /* base ratelimit */ |
| 393 | __entry->task_ratelimit, /* ratelimit with position control */ |
| 394 | __entry->balanced_dirty_ratelimit /* the balanced ratelimit */ |
| 395 | ) |
| 396 | ); |
| 397 | |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 398 | TRACE_EVENT(balance_dirty_pages, |
| 399 | |
| 400 | TP_PROTO(struct backing_dev_info *bdi, |
| 401 | unsigned long thresh, |
| 402 | unsigned long bg_thresh, |
| 403 | unsigned long dirty, |
| 404 | unsigned long bdi_thresh, |
| 405 | unsigned long bdi_dirty, |
| 406 | unsigned long dirty_ratelimit, |
| 407 | unsigned long task_ratelimit, |
| 408 | unsigned long dirtied, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 409 | unsigned long period, |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 410 | long pause, |
| 411 | unsigned long start_time), |
| 412 | |
| 413 | TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, |
| 414 | dirty_ratelimit, task_ratelimit, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 415 | dirtied, period, pause, start_time), |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 416 | |
| 417 | TP_STRUCT__entry( |
| 418 | __array( char, bdi, 32) |
| 419 | __field(unsigned long, limit) |
| 420 | __field(unsigned long, setpoint) |
| 421 | __field(unsigned long, dirty) |
| 422 | __field(unsigned long, bdi_setpoint) |
| 423 | __field(unsigned long, bdi_dirty) |
| 424 | __field(unsigned long, dirty_ratelimit) |
| 425 | __field(unsigned long, task_ratelimit) |
| 426 | __field(unsigned int, dirtied) |
| 427 | __field(unsigned int, dirtied_pause) |
| 428 | __field(unsigned long, paused) |
| 429 | __field( long, pause) |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 430 | __field(unsigned long, period) |
| 431 | __field( long, think) |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 432 | ), |
| 433 | |
| 434 | TP_fast_assign( |
| 435 | unsigned long freerun = (thresh + bg_thresh) / 2; |
| 436 | strlcpy(__entry->bdi, dev_name(bdi->dev), 32); |
| 437 | |
| 438 | __entry->limit = global_dirty_limit; |
| 439 | __entry->setpoint = (global_dirty_limit + freerun) / 2; |
| 440 | __entry->dirty = dirty; |
| 441 | __entry->bdi_setpoint = __entry->setpoint * |
| 442 | bdi_thresh / (thresh + 1); |
| 443 | __entry->bdi_dirty = bdi_dirty; |
| 444 | __entry->dirty_ratelimit = KBps(dirty_ratelimit); |
| 445 | __entry->task_ratelimit = KBps(task_ratelimit); |
| 446 | __entry->dirtied = dirtied; |
| 447 | __entry->dirtied_pause = current->nr_dirtied_pause; |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 448 | __entry->think = current->dirty_paused_when == 0 ? 0 : |
| 449 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ; |
| 450 | __entry->period = period * 1000 / HZ; |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 451 | __entry->pause = pause * 1000 / HZ; |
| 452 | __entry->paused = (jiffies - start_time) * 1000 / HZ; |
| 453 | ), |
| 454 | |
| 455 | |
| 456 | TP_printk("bdi %s: " |
| 457 | "limit=%lu setpoint=%lu dirty=%lu " |
| 458 | "bdi_setpoint=%lu bdi_dirty=%lu " |
| 459 | "dirty_ratelimit=%lu task_ratelimit=%lu " |
| 460 | "dirtied=%u dirtied_pause=%u " |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 461 | "paused=%lu pause=%ld period=%lu think=%ld", |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 462 | __entry->bdi, |
| 463 | __entry->limit, |
| 464 | __entry->setpoint, |
| 465 | __entry->dirty, |
| 466 | __entry->bdi_setpoint, |
| 467 | __entry->bdi_dirty, |
| 468 | __entry->dirty_ratelimit, |
| 469 | __entry->task_ratelimit, |
| 470 | __entry->dirtied, |
| 471 | __entry->dirtied_pause, |
| 472 | __entry->paused, /* ms */ |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 473 | __entry->pause, /* ms */ |
| 474 | __entry->period, /* ms */ |
| 475 | __entry->think /* ms */ |
Wu Fengguang | ece13ac | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 476 | ) |
| 477 | ); |
| 478 | |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 479 | TRACE_EVENT(writeback_sb_inodes_requeue, |
| 480 | |
| 481 | TP_PROTO(struct inode *inode), |
| 482 | TP_ARGS(inode), |
| 483 | |
| 484 | TP_STRUCT__entry( |
| 485 | __array(char, name, 32) |
| 486 | __field(unsigned long, ino) |
| 487 | __field(unsigned long, state) |
| 488 | __field(unsigned long, dirtied_when) |
| 489 | ), |
| 490 | |
| 491 | TP_fast_assign( |
| 492 | strncpy(__entry->name, |
| 493 | dev_name(inode_to_bdi(inode)->dev), 32); |
| 494 | __entry->ino = inode->i_ino; |
| 495 | __entry->state = inode->i_state; |
| 496 | __entry->dirtied_when = inode->dirtied_when; |
| 497 | ), |
| 498 | |
| 499 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu", |
| 500 | __entry->name, |
| 501 | __entry->ino, |
| 502 | show_inode_state(__entry->state), |
| 503 | __entry->dirtied_when, |
| 504 | (jiffies - __entry->dirtied_when) / HZ |
| 505 | ) |
| 506 | ); |
| 507 | |
Mel Gorman | 52bb919 | 2010-10-26 14:21:41 -0700 | [diff] [blame] | 508 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, |
| 509 | |
| 510 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 511 | |
| 512 | TP_ARGS(usec_timeout, usec_delayed), |
| 513 | |
| 514 | TP_STRUCT__entry( |
| 515 | __field( unsigned int, usec_timeout ) |
| 516 | __field( unsigned int, usec_delayed ) |
| 517 | ), |
| 518 | |
| 519 | TP_fast_assign( |
| 520 | __entry->usec_timeout = usec_timeout; |
| 521 | __entry->usec_delayed = usec_delayed; |
| 522 | ), |
| 523 | |
| 524 | TP_printk("usec_timeout=%u usec_delayed=%u", |
| 525 | __entry->usec_timeout, |
| 526 | __entry->usec_delayed) |
| 527 | ); |
| 528 | |
| 529 | DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait, |
| 530 | |
| 531 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 532 | |
| 533 | TP_ARGS(usec_timeout, usec_delayed) |
| 534 | ); |
| 535 | |
Mel Gorman | 0e093d99 | 2010-10-26 14:21:45 -0700 | [diff] [blame] | 536 | DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, |
| 537 | |
| 538 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
| 539 | |
| 540 | TP_ARGS(usec_timeout, usec_delayed) |
| 541 | ); |
| 542 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 543 | DECLARE_EVENT_CLASS(writeback_single_inode_template, |
| 544 | |
| 545 | TP_PROTO(struct inode *inode, |
| 546 | struct writeback_control *wbc, |
| 547 | unsigned long nr_to_write |
| 548 | ), |
| 549 | |
| 550 | TP_ARGS(inode, wbc, nr_to_write), |
| 551 | |
| 552 | TP_STRUCT__entry( |
| 553 | __array(char, name, 32) |
| 554 | __field(unsigned long, ino) |
| 555 | __field(unsigned long, state) |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 556 | __field(unsigned long, dirtied_when) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 557 | __field(unsigned long, writeback_index) |
| 558 | __field(long, nr_to_write) |
| 559 | __field(unsigned long, wrote) |
| 560 | ), |
| 561 | |
| 562 | TP_fast_assign( |
| 563 | strncpy(__entry->name, |
Wu Fengguang | 15eb77a | 2012-01-17 11:18:56 -0600 | [diff] [blame] | 564 | dev_name(inode_to_bdi(inode)->dev), 32); |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 565 | __entry->ino = inode->i_ino; |
| 566 | __entry->state = inode->i_state; |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 567 | __entry->dirtied_when = inode->dirtied_when; |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 568 | __entry->writeback_index = inode->i_mapping->writeback_index; |
| 569 | __entry->nr_to_write = nr_to_write; |
| 570 | __entry->wrote = nr_to_write - wbc->nr_to_write; |
| 571 | ), |
| 572 | |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 573 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 574 | "index=%lu to_write=%ld wrote=%lu", |
| 575 | __entry->name, |
| 576 | __entry->ino, |
| 577 | show_inode_state(__entry->state), |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 578 | __entry->dirtied_when, |
| 579 | (jiffies - __entry->dirtied_when) / HZ, |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 580 | __entry->writeback_index, |
| 581 | __entry->nr_to_write, |
| 582 | __entry->wrote |
| 583 | ) |
| 584 | ); |
| 585 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 586 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_start, |
| 587 | TP_PROTO(struct inode *inode, |
| 588 | struct writeback_control *wbc, |
| 589 | unsigned long nr_to_write), |
| 590 | TP_ARGS(inode, wbc, nr_to_write) |
| 591 | ); |
| 592 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 593 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, |
| 594 | TP_PROTO(struct inode *inode, |
| 595 | struct writeback_control *wbc, |
| 596 | unsigned long nr_to_write), |
| 597 | TP_ARGS(inode, wbc, nr_to_write) |
| 598 | ); |
| 599 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 600 | #endif /* _TRACE_WRITEBACK_H */ |
| 601 | |
| 602 | /* This part must be outside protection */ |
| 603 | #include <trace/define_trace.h> |