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") \ |
| 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 } |
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 | |
| 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 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 204 | __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 205 | ), |
| 206 | |
| 207 | TP_fast_assign( |
| 208 | strncpy(__entry->name, |
Christoph Hellwig | de1414a | 2015-01-14 10:42:36 +0100 | [diff] [blame] | 209 | dev_name(inode_to_bdi(inode)->dev), 32); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 210 | __entry->ino = inode->i_ino; |
| 211 | __entry->sync_mode = wbc->sync_mode; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 212 | __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 213 | ), |
| 214 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 215 | TP_printk("bdi %s: ino=%lu sync_mode=%d cgroup=%s", |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 216 | __entry->name, |
| 217 | __entry->ino, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 218 | __entry->sync_mode, |
| 219 | __get_str(cgroup) |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 237 | DECLARE_EVENT_CLASS(writeback_work_class, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 238 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), |
| 239 | TP_ARGS(wb, work), |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 248 | __field(int, reason) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 249 | __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 250 | ), |
| 251 | TP_fast_assign( |
Christoph Hellwig | df0ce26 | 2015-01-14 10:42:41 +0100 | [diff] [blame] | 252 | strncpy(__entry->name, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 253 | wb->bdi->dev ? dev_name(wb->bdi->dev) : "(unknown)", 32); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 260 | __entry->reason = work->reason; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 261 | __trace_wb_assign_cgroup(__get_str(cgroup), wb); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 262 | ), |
| 263 | TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 264 | "kupdate=%d range_cyclic=%d background=%d reason=%s cgroup=%s", |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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, |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 271 | __entry->for_background, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 272 | __print_symbolic(__entry->reason, WB_WORK_REASON), |
| 273 | __get_str(cgroup) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 274 | ) |
| 275 | ); |
| 276 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ |
| 277 | DEFINE_EVENT(writeback_work_class, name, \ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 278 | TP_PROTO(struct bdi_writeback *wb, struct wb_writeback_work *work), \ |
| 279 | TP_ARGS(wb, work)) |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 280 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); |
| 281 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 282 | DEFINE_WRITEBACK_WORK_EVENT(writeback_start); |
| 283 | DEFINE_WRITEBACK_WORK_EVENT(writeback_written); |
| 284 | DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 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, |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 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", |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 332 | __entry->name |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 333 | ) |
| 334 | ); |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 335 | |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 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) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 344 | __field(int, for_kupdate) |
| 345 | __field(int, for_background) |
| 346 | __field(int, for_reclaim) |
| 347 | __field(int, range_cyclic) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 348 | __field(long, range_start) |
| 349 | __field(long, range_end) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 350 | __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 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; |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 362 | __entry->range_start = (long)wbc->range_start; |
| 363 | __entry->range_end = (long)wbc->range_end; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 364 | __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 365 | ), |
| 366 | |
| 367 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " |
Wu Fengguang | d46db3d | 2011-05-04 19:54:37 -0600 | [diff] [blame] | 368 | "bgrd=%d reclm=%d cyclic=%d " |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 369 | "start=0x%lx end=0x%lx cgroup=%s", |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 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, |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 378 | __entry->range_start, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 379 | __entry->range_end, |
| 380 | __get_str(cgroup) |
| 381 | ) |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 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)) |
Dave Chinner | 9e09438 | 2010-07-07 13:24:08 +1000 | [diff] [blame] | 388 | DEFINE_WBC_EVENT(wbc_writepage); |
Dave Chinner | 028c2dd | 2010-07-07 13:24:07 +1000 | [diff] [blame] | 389 | |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 390 | TRACE_EVENT(writeback_queue_io, |
| 391 | TP_PROTO(struct bdi_writeback *wb, |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 392 | struct wb_writeback_work *work, |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 393 | int moved), |
Curt Wohlgemuth | ad4e38d | 2011-10-07 21:51:56 -0600 | [diff] [blame] | 394 | TP_ARGS(wb, work, moved), |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 395 | TP_STRUCT__entry( |
| 396 | __array(char, name, 32) |
| 397 | __field(unsigned long, older) |
| 398 | __field(long, age) |
| 399 | __field(int, moved) |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 400 | __field(int, reason) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 401 | __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 402 | ), |
| 403 | TP_fast_assign( |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 404 | unsigned long *older_than_this = work->older_than_this; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 405 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 406 | __entry->older = older_than_this ? *older_than_this : 0; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 407 | __entry->age = older_than_this ? |
Jan Kara | 0dc83bd | 2014-02-21 11:19:04 +0100 | [diff] [blame] | 408 | (jiffies - *older_than_this) * 1000 / HZ : -1; |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 409 | __entry->moved = moved; |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 410 | __entry->reason = work->reason; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 411 | __trace_wb_assign_cgroup(__get_str(cgroup), wb); |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 412 | ), |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 413 | TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s cgroup=%s", |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 414 | __entry->name, |
| 415 | __entry->older, /* older_than_this in jiffies */ |
| 416 | __entry->age, /* older_than_this in relative milliseconds */ |
Curt Wohlgemuth | 0e175a1 | 2011-10-07 21:54:10 -0600 | [diff] [blame] | 417 | __entry->moved, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 418 | __print_symbolic(__entry->reason, WB_WORK_REASON), |
| 419 | __get_str(cgroup) |
Wu Fengguang | b3bba872 | 2011-12-08 16:53:54 -0600 | [diff] [blame] | 420 | ) |
Wu Fengguang | e84d0a4 | 2011-04-23 12:27:27 -0600 | [diff] [blame] | 421 | ); |
| 422 | |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 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; |
Tejun Heo | dcc25ae | 2015-05-22 18:23:22 -0400 | [diff] [blame] | 452 | __entry->dirty_limit = global_wb_domain.dirty_limit; |
Wu Fengguang | e1cbe23 | 2010-12-06 22:34:29 -0600 | [diff] [blame] | 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 | |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 469 | #define KBps(x) ((x) << (PAGE_SHIFT - 10)) |
| 470 | |
| 471 | TRACE_EVENT(bdi_dirty_ratelimit, |
| 472 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 473 | TP_PROTO(struct bdi_writeback *wb, |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 474 | unsigned long dirty_rate, |
| 475 | unsigned long task_ratelimit), |
| 476 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 477 | TP_ARGS(wb, dirty_rate, task_ratelimit), |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 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) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 487 | __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 488 | ), |
| 489 | |
| 490 | TP_fast_assign( |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 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); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 494 | __entry->dirty_rate = KBps(dirty_rate); |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 495 | __entry->dirty_ratelimit = KBps(wb->dirty_ratelimit); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 496 | __entry->task_ratelimit = KBps(task_ratelimit); |
| 497 | __entry->balanced_dirty_ratelimit = |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 498 | KBps(wb->balanced_dirty_ratelimit); |
| 499 | __trace_wb_assign_cgroup(__get_str(cgroup), wb); |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 500 | ), |
| 501 | |
| 502 | TP_printk("bdi %s: " |
| 503 | "write_bw=%lu awrite_bw=%lu dirty_rate=%lu " |
| 504 | "dirty_ratelimit=%lu task_ratelimit=%lu " |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 505 | "balanced_dirty_ratelimit=%lu cgroup=%s", |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 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 */ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 512 | __entry->balanced_dirty_ratelimit, /* the balanced ratelimit */ |
| 513 | __get_str(cgroup) |
Wu Fengguang | b48c104 | 2011-03-02 17:22:49 -0600 | [diff] [blame] | 514 | ) |
| 515 | ); |
| 516 | |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 517 | TRACE_EVENT(balance_dirty_pages, |
| 518 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 519 | TP_PROTO(struct bdi_writeback *wb, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 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, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 528 | unsigned long period, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 529 | long pause, |
| 530 | unsigned long start_time), |
| 531 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 532 | TP_ARGS(wb, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty, |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 533 | dirty_ratelimit, task_ratelimit, |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 534 | dirtied, period, pause, start_time), |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 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) |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 549 | __field(unsigned long, period) |
| 550 | __field( long, think) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 551 | __dynamic_array(char, cgroup, __trace_wb_cgroup_size(wb)) |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 552 | ), |
| 553 | |
| 554 | TP_fast_assign( |
| 555 | unsigned long freerun = (thresh + bg_thresh) / 2; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 556 | strlcpy(__entry->bdi, dev_name(wb->bdi->dev), 32); |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 557 | |
Tejun Heo | dcc25ae | 2015-05-22 18:23:22 -0400 | [diff] [blame] | 558 | __entry->limit = global_wb_domain.dirty_limit; |
| 559 | __entry->setpoint = (global_wb_domain.dirty_limit + |
| 560 | freerun) / 2; |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 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; |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 569 | __entry->think = current->dirty_paused_when == 0 ? 0 : |
| 570 | (long)(jiffies - current->dirty_paused_when) * 1000/HZ; |
| 571 | __entry->period = period * 1000 / HZ; |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 572 | __entry->pause = pause * 1000 / HZ; |
| 573 | __entry->paused = (jiffies - start_time) * 1000 / HZ; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 574 | __trace_wb_assign_cgroup(__get_str(cgroup), wb); |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 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 " |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 583 | "paused=%lu pause=%ld period=%lu think=%ld cgroup=%s", |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 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 */ |
Wu Fengguang | 8371235 | 2011-06-11 19:25:42 -0600 | [diff] [blame] | 595 | __entry->pause, /* ms */ |
| 596 | __entry->period, /* ms */ |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 597 | __entry->think, /* ms */ |
| 598 | __get_str(cgroup) |
Wu Fengguang | ece13ac3 | 2010-08-29 23:33:20 -0600 | [diff] [blame] | 599 | ) |
| 600 | ); |
| 601 | |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 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) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 612 | __dynamic_array(char, cgroup, |
| 613 | __trace_wb_cgroup_size(inode_to_wb(inode))) |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 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; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 622 | __trace_wb_assign_cgroup(__get_str(cgroup), inode_to_wb(inode)); |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 623 | ), |
| 624 | |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 625 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu cgroup=%s", |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 626 | __entry->name, |
| 627 | __entry->ino, |
| 628 | show_inode_state(__entry->state), |
| 629 | __entry->dirtied_when, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 630 | (jiffies - __entry->dirtied_when) / HZ, |
| 631 | __get_str(cgroup) |
Jan Kara | cc1676d | 2012-05-03 14:47:56 +0200 | [diff] [blame] | 632 | ) |
| 633 | ); |
| 634 | |
Mel Gorman | 52bb919 | 2010-10-26 14:21:41 -0700 | [diff] [blame] | 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 | |
Mel Gorman | 0e093d99 | 2010-10-26 14:21:45 -0700 | [diff] [blame] | 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 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 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) |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 683 | __field(unsigned long, dirtied_when) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 684 | __field(unsigned long, writeback_index) |
| 685 | __field(long, nr_to_write) |
| 686 | __field(unsigned long, wrote) |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 687 | __dynamic_array(char, cgroup, __trace_wbc_cgroup_size(wbc)) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 688 | ), |
| 689 | |
| 690 | TP_fast_assign( |
| 691 | strncpy(__entry->name, |
Wu Fengguang | 15eb77a | 2012-01-17 11:18:56 -0600 | [diff] [blame] | 692 | dev_name(inode_to_bdi(inode)->dev), 32); |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 693 | __entry->ino = inode->i_ino; |
| 694 | __entry->state = inode->i_state; |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 695 | __entry->dirtied_when = inode->dirtied_when; |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 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; |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 699 | __trace_wbc_assign_cgroup(__get_str(cgroup), wbc); |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 700 | ), |
| 701 | |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 702 | TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu " |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 703 | "index=%lu to_write=%ld wrote=%lu cgroup=%s", |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 704 | __entry->name, |
| 705 | __entry->ino, |
| 706 | show_inode_state(__entry->state), |
Wu Fengguang | c8ad620 | 2011-08-29 09:52:23 -0600 | [diff] [blame] | 707 | __entry->dirtied_when, |
| 708 | (jiffies - __entry->dirtied_when) / HZ, |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 709 | __entry->writeback_index, |
| 710 | __entry->nr_to_write, |
Tejun Heo | 5634cc2 | 2015-08-18 14:54:56 -0700 | [diff] [blame] | 711 | __entry->wrote, |
| 712 | __get_str(cgroup) |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 713 | ) |
| 714 | ); |
| 715 | |
Tejun Heo | 9fb0a7d | 2013-01-11 13:06:37 -0800 | [diff] [blame] | 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 | |
Wu Fengguang | 251d6a4 | 2010-12-01 17:33:37 -0600 | [diff] [blame] | 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 | |
Theodore Ts'o | 0ae45f6 | 2015-02-02 00:37:00 -0500 | [diff] [blame] | 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 | |
Dave Chinner | 455b286 | 2010-07-07 13:24:06 +1000 | [diff] [blame] | 776 | #endif /* _TRACE_WRITEBACK_H */ |
| 777 | |
| 778 | /* This part must be outside protection */ |
| 779 | #include <trace/define_trace.h> |