diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 13:39:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 13:39:54 -0400 |
commit | f01ef569cddb1a8627b1c6b3a134998ad1cf4b22 (patch) | |
tree | 29ea1a0942c8549c24411e976cd6891c7e995e89 /include | |
parent | a93a1329271038f0e8337061d3b41b3b212a851e (diff) | |
parent | bcff25fc8aa47a13faff8b4b992589813f7b450a (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/writeback
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/writeback: (27 commits)
mm: properly reflect task dirty limits in dirty_exceeded logic
writeback: don't busy retry writeback on new/freeing inodes
writeback: scale IO chunk size up to half device bandwidth
writeback: trace global_dirty_state
writeback: introduce max-pause and pass-good dirty limits
writeback: introduce smoothed global dirty limit
writeback: consolidate variable names in balance_dirty_pages()
writeback: show bdi write bandwidth in debugfs
writeback: bdi write bandwidth estimation
writeback: account per-bdi accumulated written pages
writeback: make writeback_control.nr_to_write straight
writeback: skip tmpfs early in balance_dirty_pages_ratelimited_nr()
writeback: trace event writeback_queue_io
writeback: trace event writeback_single_inode
writeback: remove .nonblocking and .encountered_congestion
writeback: remove writeback_control.more_io
writeback: skip balance_dirty_pages() for in-memory fs
writeback: add bdi_dirty_limit() kernel-doc
writeback: avoid extra sync work at enqueue time
writeback: elevate queue_io() into wb_writeback()
...
Fix up trivial conflicts in fs/fs-writeback.c and mm/filemap.c
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/backing-dev.h | 8 | ||||
-rw-r--r-- | include/linux/writeback.h | 55 | ||||
-rw-r--r-- | include/trace/events/btrfs.h | 6 | ||||
-rw-r--r-- | include/trace/events/ext4.h | 6 | ||||
-rw-r--r-- | include/trace/events/writeback.h | 183 |
5 files changed, 224 insertions, 34 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 96f4094b706d..a008982e7c08 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -40,6 +40,7 @@ typedef int (congested_fn)(void *, int); | |||
40 | enum bdi_stat_item { | 40 | enum bdi_stat_item { |
41 | BDI_RECLAIMABLE, | 41 | BDI_RECLAIMABLE, |
42 | BDI_WRITEBACK, | 42 | BDI_WRITEBACK, |
43 | BDI_WRITTEN, | ||
43 | NR_BDI_STAT_ITEMS | 44 | NR_BDI_STAT_ITEMS |
44 | }; | 45 | }; |
45 | 46 | ||
@@ -57,6 +58,7 @@ struct bdi_writeback { | |||
57 | struct list_head b_dirty; /* dirty inodes */ | 58 | struct list_head b_dirty; /* dirty inodes */ |
58 | struct list_head b_io; /* parked for writeback */ | 59 | struct list_head b_io; /* parked for writeback */ |
59 | struct list_head b_more_io; /* parked for more writeback */ | 60 | struct list_head b_more_io; /* parked for more writeback */ |
61 | spinlock_t list_lock; /* protects the b_* lists */ | ||
60 | }; | 62 | }; |
61 | 63 | ||
62 | struct backing_dev_info { | 64 | struct backing_dev_info { |
@@ -71,6 +73,11 @@ struct backing_dev_info { | |||
71 | 73 | ||
72 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; | 74 | struct percpu_counter bdi_stat[NR_BDI_STAT_ITEMS]; |
73 | 75 | ||
76 | unsigned long bw_time_stamp; /* last time write bw is updated */ | ||
77 | unsigned long written_stamp; /* pages written at bw_time_stamp */ | ||
78 | unsigned long write_bandwidth; /* the estimated write bandwidth */ | ||
79 | unsigned long avg_write_bandwidth; /* further smoothed write bw */ | ||
80 | |||
74 | struct prop_local_percpu completions; | 81 | struct prop_local_percpu completions; |
75 | int dirty_exceeded; | 82 | int dirty_exceeded; |
76 | 83 | ||
@@ -106,6 +113,7 @@ int bdi_writeback_thread(void *data); | |||
106 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | 113 | int bdi_has_dirty_io(struct backing_dev_info *bdi); |
107 | void bdi_arm_supers_timer(void); | 114 | void bdi_arm_supers_timer(void); |
108 | void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); | 115 | void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); |
116 | void bdi_lock_two(struct bdi_writeback *wb1, struct bdi_writeback *wb2); | ||
109 | 117 | ||
110 | extern spinlock_t bdi_lock; | 118 | extern spinlock_t bdi_lock; |
111 | extern struct list_head bdi_list; | 119 | extern struct list_head bdi_list; |
diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 17e7ccc322a5..f1bfa12ea246 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
@@ -7,9 +7,39 @@ | |||
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | 9 | ||
10 | struct backing_dev_info; | 10 | /* |
11 | * The 1/4 region under the global dirty thresh is for smooth dirty throttling: | ||
12 | * | ||
13 | * (thresh - thresh/DIRTY_FULL_SCOPE, thresh) | ||
14 | * | ||
15 | * The 1/16 region above the global dirty limit will be put to maximum pauses: | ||
16 | * | ||
17 | * (limit, limit + limit/DIRTY_MAXPAUSE_AREA) | ||
18 | * | ||
19 | * The 1/16 region above the max-pause region, dirty exceeded bdi's will be put | ||
20 | * to loops: | ||
21 | * | ||
22 | * (limit + limit/DIRTY_MAXPAUSE_AREA, limit + limit/DIRTY_PASSGOOD_AREA) | ||
23 | * | ||
24 | * Further beyond, all dirtier tasks will enter a loop waiting (possibly long | ||
25 | * time) for the dirty pages to drop, unless written enough pages. | ||
26 | * | ||
27 | * The global dirty threshold is normally equal to the global dirty limit, | ||
28 | * except when the system suddenly allocates a lot of anonymous memory and | ||
29 | * knocks down the global dirty threshold quickly, in which case the global | ||
30 | * dirty limit will follow down slowly to prevent livelocking all dirtier tasks. | ||
31 | */ | ||
32 | #define DIRTY_SCOPE 8 | ||
33 | #define DIRTY_FULL_SCOPE (DIRTY_SCOPE / 2) | ||
34 | #define DIRTY_MAXPAUSE_AREA 16 | ||
35 | #define DIRTY_PASSGOOD_AREA 8 | ||
11 | 36 | ||
12 | extern spinlock_t inode_wb_list_lock; | 37 | /* |
38 | * 4MB minimal write chunk size | ||
39 | */ | ||
40 | #define MIN_WRITEBACK_PAGES (4096UL >> (PAGE_CACHE_SHIFT - 10)) | ||
41 | |||
42 | struct backing_dev_info; | ||
13 | 43 | ||
14 | /* | 44 | /* |
15 | * fs/fs-writeback.c | 45 | * fs/fs-writeback.c |
@@ -26,11 +56,6 @@ enum writeback_sync_modes { | |||
26 | */ | 56 | */ |
27 | struct writeback_control { | 57 | struct writeback_control { |
28 | enum writeback_sync_modes sync_mode; | 58 | enum writeback_sync_modes sync_mode; |
29 | unsigned long *older_than_this; /* If !NULL, only write back inodes | ||
30 | older than this */ | ||
31 | unsigned long wb_start; /* Time writeback_inodes_wb was | ||
32 | called. This is needed to avoid | ||
33 | extra jobs and livelock */ | ||
34 | long nr_to_write; /* Write this many pages, and decrement | 59 | long nr_to_write; /* Write this many pages, and decrement |
35 | this for each page written */ | 60 | this for each page written */ |
36 | long pages_skipped; /* Pages which were not written */ | 61 | long pages_skipped; /* Pages which were not written */ |
@@ -43,13 +68,11 @@ struct writeback_control { | |||
43 | loff_t range_start; | 68 | loff_t range_start; |
44 | loff_t range_end; | 69 | loff_t range_end; |
45 | 70 | ||
46 | unsigned nonblocking:1; /* Don't get stuck on request queues */ | ||
47 | unsigned encountered_congestion:1; /* An output: a queue is full */ | ||
48 | unsigned for_kupdate:1; /* A kupdate writeback */ | 71 | unsigned for_kupdate:1; /* A kupdate writeback */ |
49 | unsigned for_background:1; /* A background writeback */ | 72 | unsigned for_background:1; /* A background writeback */ |
73 | unsigned tagged_writepages:1; /* tag-and-write to avoid livelock */ | ||
50 | unsigned for_reclaim:1; /* Invoked from the page allocator */ | 74 | unsigned for_reclaim:1; /* Invoked from the page allocator */ |
51 | unsigned range_cyclic:1; /* range_start is cyclic */ | 75 | unsigned range_cyclic:1; /* range_start is cyclic */ |
52 | unsigned more_io:1; /* more io to be dispatched */ | ||
53 | }; | 76 | }; |
54 | 77 | ||
55 | /* | 78 | /* |
@@ -62,8 +85,7 @@ void writeback_inodes_sb_nr(struct super_block *, unsigned long nr); | |||
62 | int writeback_inodes_sb_if_idle(struct super_block *); | 85 | int writeback_inodes_sb_if_idle(struct super_block *); |
63 | int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr); | 86 | int writeback_inodes_sb_nr_if_idle(struct super_block *, unsigned long nr); |
64 | void sync_inodes_sb(struct super_block *); | 87 | void sync_inodes_sb(struct super_block *); |
65 | void writeback_inodes_wb(struct bdi_writeback *wb, | 88 | long writeback_inodes_wb(struct bdi_writeback *wb, long nr_pages); |
66 | struct writeback_control *wbc); | ||
67 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | 89 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); |
68 | void wakeup_flusher_threads(long nr_pages); | 90 | void wakeup_flusher_threads(long nr_pages); |
69 | 91 | ||
@@ -94,6 +116,8 @@ static inline void laptop_sync_completion(void) { } | |||
94 | #endif | 116 | #endif |
95 | void throttle_vm_writeout(gfp_t gfp_mask); | 117 | void throttle_vm_writeout(gfp_t gfp_mask); |
96 | 118 | ||
119 | extern unsigned long global_dirty_limit; | ||
120 | |||
97 | /* These are exported to sysctl. */ | 121 | /* These are exported to sysctl. */ |
98 | extern int dirty_background_ratio; | 122 | extern int dirty_background_ratio; |
99 | extern unsigned long dirty_background_bytes; | 123 | extern unsigned long dirty_background_bytes; |
@@ -128,6 +152,13 @@ void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); | |||
128 | unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, | 152 | unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, |
129 | unsigned long dirty); | 153 | unsigned long dirty); |
130 | 154 | ||
155 | void __bdi_update_bandwidth(struct backing_dev_info *bdi, | ||
156 | unsigned long thresh, | ||
157 | unsigned long dirty, | ||
158 | unsigned long bdi_thresh, | ||
159 | unsigned long bdi_dirty, | ||
160 | unsigned long start_time); | ||
161 | |||
131 | void page_writeback_init(void); | 162 | void page_writeback_init(void); |
132 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, | 163 | void balance_dirty_pages_ratelimited_nr(struct address_space *mapping, |
133 | unsigned long nr_pages_dirtied); | 164 | unsigned long nr_pages_dirtied); |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index 4114129f0794..b31702ac15be 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
@@ -284,7 +284,6 @@ DECLARE_EVENT_CLASS(btrfs__writepage, | |||
284 | __field( long, pages_skipped ) | 284 | __field( long, pages_skipped ) |
285 | __field( loff_t, range_start ) | 285 | __field( loff_t, range_start ) |
286 | __field( loff_t, range_end ) | 286 | __field( loff_t, range_end ) |
287 | __field( char, nonblocking ) | ||
288 | __field( char, for_kupdate ) | 287 | __field( char, for_kupdate ) |
289 | __field( char, for_reclaim ) | 288 | __field( char, for_reclaim ) |
290 | __field( char, range_cyclic ) | 289 | __field( char, range_cyclic ) |
@@ -299,7 +298,6 @@ DECLARE_EVENT_CLASS(btrfs__writepage, | |||
299 | __entry->pages_skipped = wbc->pages_skipped; | 298 | __entry->pages_skipped = wbc->pages_skipped; |
300 | __entry->range_start = wbc->range_start; | 299 | __entry->range_start = wbc->range_start; |
301 | __entry->range_end = wbc->range_end; | 300 | __entry->range_end = wbc->range_end; |
302 | __entry->nonblocking = wbc->nonblocking; | ||
303 | __entry->for_kupdate = wbc->for_kupdate; | 301 | __entry->for_kupdate = wbc->for_kupdate; |
304 | __entry->for_reclaim = wbc->for_reclaim; | 302 | __entry->for_reclaim = wbc->for_reclaim; |
305 | __entry->range_cyclic = wbc->range_cyclic; | 303 | __entry->range_cyclic = wbc->range_cyclic; |
@@ -310,13 +308,13 @@ DECLARE_EVENT_CLASS(btrfs__writepage, | |||
310 | 308 | ||
311 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " | 309 | TP_printk("root = %llu(%s), ino = %lu, page_index = %lu, " |
312 | "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " | 310 | "nr_to_write = %ld, pages_skipped = %ld, range_start = %llu, " |
313 | "range_end = %llu, nonblocking = %d, for_kupdate = %d, " | 311 | "range_end = %llu, for_kupdate = %d, " |
314 | "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", | 312 | "for_reclaim = %d, range_cyclic = %d, writeback_index = %lu", |
315 | show_root_type(__entry->root_objectid), | 313 | show_root_type(__entry->root_objectid), |
316 | (unsigned long)__entry->ino, __entry->index, | 314 | (unsigned long)__entry->ino, __entry->index, |
317 | __entry->nr_to_write, __entry->pages_skipped, | 315 | __entry->nr_to_write, __entry->pages_skipped, |
318 | __entry->range_start, __entry->range_end, | 316 | __entry->range_start, __entry->range_end, |
319 | __entry->nonblocking, __entry->for_kupdate, | 317 | __entry->for_kupdate, |
320 | __entry->for_reclaim, __entry->range_cyclic, | 318 | __entry->for_reclaim, __entry->range_cyclic, |
321 | (unsigned long)__entry->writeback_index) | 319 | (unsigned long)__entry->writeback_index) |
322 | ); | 320 | ); |
diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h index 5ce2b2f5f524..6363193a3418 100644 --- a/include/trace/events/ext4.h +++ b/include/trace/events/ext4.h | |||
@@ -380,7 +380,6 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
380 | __field( int, pages_written ) | 380 | __field( int, pages_written ) |
381 | __field( long, pages_skipped ) | 381 | __field( long, pages_skipped ) |
382 | __field( int, sync_mode ) | 382 | __field( int, sync_mode ) |
383 | __field( char, more_io ) | ||
384 | __field( pgoff_t, writeback_index ) | 383 | __field( pgoff_t, writeback_index ) |
385 | ), | 384 | ), |
386 | 385 | ||
@@ -391,16 +390,15 @@ TRACE_EVENT(ext4_da_writepages_result, | |||
391 | __entry->pages_written = pages_written; | 390 | __entry->pages_written = pages_written; |
392 | __entry->pages_skipped = wbc->pages_skipped; | 391 | __entry->pages_skipped = wbc->pages_skipped; |
393 | __entry->sync_mode = wbc->sync_mode; | 392 | __entry->sync_mode = wbc->sync_mode; |
394 | __entry->more_io = wbc->more_io; | ||
395 | __entry->writeback_index = inode->i_mapping->writeback_index; | 393 | __entry->writeback_index = inode->i_mapping->writeback_index; |
396 | ), | 394 | ), |
397 | 395 | ||
398 | TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " | 396 | TP_printk("dev %d,%d ino %lu ret %d pages_written %d pages_skipped %ld " |
399 | " more_io %d sync_mode %d writeback_index %lu", | 397 | "sync_mode %d writeback_index %lu", |
400 | MAJOR(__entry->dev), MINOR(__entry->dev), | 398 | MAJOR(__entry->dev), MINOR(__entry->dev), |
401 | (unsigned long) __entry->ino, __entry->ret, | 399 | (unsigned long) __entry->ino, __entry->ret, |
402 | __entry->pages_written, __entry->pages_skipped, | 400 | __entry->pages_written, __entry->pages_skipped, |
403 | __entry->more_io, __entry->sync_mode, | 401 | __entry->sync_mode, |
404 | (unsigned long) __entry->writeback_index) | 402 | (unsigned long) __entry->writeback_index) |
405 | ); | 403 | ); |
406 | 404 | ||
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h index 4e249b927eaa..6bca4cc0063c 100644 --- a/include/trace/events/writeback.h +++ b/include/trace/events/writeback.h | |||
@@ -8,6 +8,19 @@ | |||
8 | #include <linux/device.h> | 8 | #include <linux/device.h> |
9 | #include <linux/writeback.h> | 9 | #include <linux/writeback.h> |
10 | 10 | ||
11 | #define show_inode_state(state) \ | ||
12 | __print_flags(state, "|", \ | ||
13 | {I_DIRTY_SYNC, "I_DIRTY_SYNC"}, \ | ||
14 | {I_DIRTY_DATASYNC, "I_DIRTY_DATASYNC"}, \ | ||
15 | {I_DIRTY_PAGES, "I_DIRTY_PAGES"}, \ | ||
16 | {I_NEW, "I_NEW"}, \ | ||
17 | {I_WILL_FREE, "I_WILL_FREE"}, \ | ||
18 | {I_FREEING, "I_FREEING"}, \ | ||
19 | {I_CLEAR, "I_CLEAR"}, \ | ||
20 | {I_SYNC, "I_SYNC"}, \ | ||
21 | {I_REFERENCED, "I_REFERENCED"} \ | ||
22 | ) | ||
23 | |||
11 | struct wb_writeback_work; | 24 | struct wb_writeback_work; |
12 | 25 | ||
13 | DECLARE_EVENT_CLASS(writeback_work_class, | 26 | DECLARE_EVENT_CLASS(writeback_work_class, |
@@ -49,6 +62,9 @@ DEFINE_EVENT(writeback_work_class, name, \ | |||
49 | DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); | 62 | DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); |
50 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); | 63 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); |
51 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); | 64 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); |
65 | DEFINE_WRITEBACK_WORK_EVENT(writeback_start); | ||
66 | DEFINE_WRITEBACK_WORK_EVENT(writeback_written); | ||
67 | DEFINE_WRITEBACK_WORK_EVENT(writeback_wait); | ||
52 | 68 | ||
53 | TRACE_EVENT(writeback_pages_written, | 69 | TRACE_EVENT(writeback_pages_written, |
54 | TP_PROTO(long pages_written), | 70 | TP_PROTO(long pages_written), |
@@ -88,6 +104,30 @@ DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | |||
88 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | 104 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); |
89 | DEFINE_WRITEBACK_EVENT(writeback_thread_start); | 105 | DEFINE_WRITEBACK_EVENT(writeback_thread_start); |
90 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop); | 106 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop); |
107 | DEFINE_WRITEBACK_EVENT(balance_dirty_start); | ||
108 | DEFINE_WRITEBACK_EVENT(balance_dirty_wait); | ||
109 | |||
110 | TRACE_EVENT(balance_dirty_written, | ||
111 | |||
112 | TP_PROTO(struct backing_dev_info *bdi, int written), | ||
113 | |||
114 | TP_ARGS(bdi, written), | ||
115 | |||
116 | TP_STRUCT__entry( | ||
117 | __array(char, name, 32) | ||
118 | __field(int, written) | ||
119 | ), | ||
120 | |||
121 | TP_fast_assign( | ||
122 | strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
123 | __entry->written = written; | ||
124 | ), | ||
125 | |||
126 | TP_printk("bdi %s written %d", | ||
127 | __entry->name, | ||
128 | __entry->written | ||
129 | ) | ||
130 | ); | ||
91 | 131 | ||
92 | DECLARE_EVENT_CLASS(wbc_class, | 132 | DECLARE_EVENT_CLASS(wbc_class, |
93 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), | 133 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), |
@@ -101,8 +141,6 @@ DECLARE_EVENT_CLASS(wbc_class, | |||
101 | __field(int, for_background) | 141 | __field(int, for_background) |
102 | __field(int, for_reclaim) | 142 | __field(int, for_reclaim) |
103 | __field(int, range_cyclic) | 143 | __field(int, range_cyclic) |
104 | __field(int, more_io) | ||
105 | __field(unsigned long, older_than_this) | ||
106 | __field(long, range_start) | 144 | __field(long, range_start) |
107 | __field(long, range_end) | 145 | __field(long, range_end) |
108 | ), | 146 | ), |
@@ -116,15 +154,12 @@ DECLARE_EVENT_CLASS(wbc_class, | |||
116 | __entry->for_background = wbc->for_background; | 154 | __entry->for_background = wbc->for_background; |
117 | __entry->for_reclaim = wbc->for_reclaim; | 155 | __entry->for_reclaim = wbc->for_reclaim; |
118 | __entry->range_cyclic = wbc->range_cyclic; | 156 | __entry->range_cyclic = wbc->range_cyclic; |
119 | __entry->more_io = wbc->more_io; | ||
120 | __entry->older_than_this = wbc->older_than_this ? | ||
121 | *wbc->older_than_this : 0; | ||
122 | __entry->range_start = (long)wbc->range_start; | 157 | __entry->range_start = (long)wbc->range_start; |
123 | __entry->range_end = (long)wbc->range_end; | 158 | __entry->range_end = (long)wbc->range_end; |
124 | ), | 159 | ), |
125 | 160 | ||
126 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " | 161 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " |
127 | "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx " | 162 | "bgrd=%d reclm=%d cyclic=%d " |
128 | "start=0x%lx end=0x%lx", | 163 | "start=0x%lx end=0x%lx", |
129 | __entry->name, | 164 | __entry->name, |
130 | __entry->nr_to_write, | 165 | __entry->nr_to_write, |
@@ -134,8 +169,6 @@ DECLARE_EVENT_CLASS(wbc_class, | |||
134 | __entry->for_background, | 169 | __entry->for_background, |
135 | __entry->for_reclaim, | 170 | __entry->for_reclaim, |
136 | __entry->range_cyclic, | 171 | __entry->range_cyclic, |
137 | __entry->more_io, | ||
138 | __entry->older_than_this, | ||
139 | __entry->range_start, | 172 | __entry->range_start, |
140 | __entry->range_end) | 173 | __entry->range_end) |
141 | ) | 174 | ) |
@@ -144,14 +177,79 @@ DECLARE_EVENT_CLASS(wbc_class, | |||
144 | DEFINE_EVENT(wbc_class, name, \ | 177 | DEFINE_EVENT(wbc_class, name, \ |
145 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ | 178 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ |
146 | TP_ARGS(wbc, bdi)) | 179 | TP_ARGS(wbc, bdi)) |
147 | DEFINE_WBC_EVENT(wbc_writeback_start); | ||
148 | DEFINE_WBC_EVENT(wbc_writeback_written); | ||
149 | DEFINE_WBC_EVENT(wbc_writeback_wait); | ||
150 | DEFINE_WBC_EVENT(wbc_balance_dirty_start); | ||
151 | DEFINE_WBC_EVENT(wbc_balance_dirty_written); | ||
152 | DEFINE_WBC_EVENT(wbc_balance_dirty_wait); | ||
153 | DEFINE_WBC_EVENT(wbc_writepage); | 180 | DEFINE_WBC_EVENT(wbc_writepage); |
154 | 181 | ||
182 | TRACE_EVENT(writeback_queue_io, | ||
183 | TP_PROTO(struct bdi_writeback *wb, | ||
184 | unsigned long *older_than_this, | ||
185 | int moved), | ||
186 | TP_ARGS(wb, older_than_this, moved), | ||
187 | TP_STRUCT__entry( | ||
188 | __array(char, name, 32) | ||
189 | __field(unsigned long, older) | ||
190 | __field(long, age) | ||
191 | __field(int, moved) | ||
192 | ), | ||
193 | TP_fast_assign( | ||
194 | strncpy(__entry->name, dev_name(wb->bdi->dev), 32); | ||
195 | __entry->older = older_than_this ? *older_than_this : 0; | ||
196 | __entry->age = older_than_this ? | ||
197 | (jiffies - *older_than_this) * 1000 / HZ : -1; | ||
198 | __entry->moved = moved; | ||
199 | ), | ||
200 | TP_printk("bdi %s: older=%lu age=%ld enqueue=%d", | ||
201 | __entry->name, | ||
202 | __entry->older, /* older_than_this in jiffies */ | ||
203 | __entry->age, /* older_than_this in relative milliseconds */ | ||
204 | __entry->moved) | ||
205 | ); | ||
206 | |||
207 | TRACE_EVENT(global_dirty_state, | ||
208 | |||
209 | TP_PROTO(unsigned long background_thresh, | ||
210 | unsigned long dirty_thresh | ||
211 | ), | ||
212 | |||
213 | TP_ARGS(background_thresh, | ||
214 | dirty_thresh | ||
215 | ), | ||
216 | |||
217 | TP_STRUCT__entry( | ||
218 | __field(unsigned long, nr_dirty) | ||
219 | __field(unsigned long, nr_writeback) | ||
220 | __field(unsigned long, nr_unstable) | ||
221 | __field(unsigned long, background_thresh) | ||
222 | __field(unsigned long, dirty_thresh) | ||
223 | __field(unsigned long, dirty_limit) | ||
224 | __field(unsigned long, nr_dirtied) | ||
225 | __field(unsigned long, nr_written) | ||
226 | ), | ||
227 | |||
228 | TP_fast_assign( | ||
229 | __entry->nr_dirty = global_page_state(NR_FILE_DIRTY); | ||
230 | __entry->nr_writeback = global_page_state(NR_WRITEBACK); | ||
231 | __entry->nr_unstable = global_page_state(NR_UNSTABLE_NFS); | ||
232 | __entry->nr_dirtied = global_page_state(NR_DIRTIED); | ||
233 | __entry->nr_written = global_page_state(NR_WRITTEN); | ||
234 | __entry->background_thresh = background_thresh; | ||
235 | __entry->dirty_thresh = dirty_thresh; | ||
236 | __entry->dirty_limit = global_dirty_limit; | ||
237 | ), | ||
238 | |||
239 | TP_printk("dirty=%lu writeback=%lu unstable=%lu " | ||
240 | "bg_thresh=%lu thresh=%lu limit=%lu " | ||
241 | "dirtied=%lu written=%lu", | ||
242 | __entry->nr_dirty, | ||
243 | __entry->nr_writeback, | ||
244 | __entry->nr_unstable, | ||
245 | __entry->background_thresh, | ||
246 | __entry->dirty_thresh, | ||
247 | __entry->dirty_limit, | ||
248 | __entry->nr_dirtied, | ||
249 | __entry->nr_written | ||
250 | ) | ||
251 | ); | ||
252 | |||
155 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, | 253 | DECLARE_EVENT_CLASS(writeback_congest_waited_template, |
156 | 254 | ||
157 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), | 255 | TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed), |
@@ -187,6 +285,63 @@ DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested, | |||
187 | TP_ARGS(usec_timeout, usec_delayed) | 285 | TP_ARGS(usec_timeout, usec_delayed) |
188 | ); | 286 | ); |
189 | 287 | ||
288 | DECLARE_EVENT_CLASS(writeback_single_inode_template, | ||
289 | |||
290 | TP_PROTO(struct inode *inode, | ||
291 | struct writeback_control *wbc, | ||
292 | unsigned long nr_to_write | ||
293 | ), | ||
294 | |||
295 | TP_ARGS(inode, wbc, nr_to_write), | ||
296 | |||
297 | TP_STRUCT__entry( | ||
298 | __array(char, name, 32) | ||
299 | __field(unsigned long, ino) | ||
300 | __field(unsigned long, state) | ||
301 | __field(unsigned long, age) | ||
302 | __field(unsigned long, writeback_index) | ||
303 | __field(long, nr_to_write) | ||
304 | __field(unsigned long, wrote) | ||
305 | ), | ||
306 | |||
307 | TP_fast_assign( | ||
308 | strncpy(__entry->name, | ||
309 | dev_name(inode->i_mapping->backing_dev_info->dev), 32); | ||
310 | __entry->ino = inode->i_ino; | ||
311 | __entry->state = inode->i_state; | ||
312 | __entry->age = (jiffies - inode->dirtied_when) * | ||
313 | 1000 / HZ; | ||
314 | __entry->writeback_index = inode->i_mapping->writeback_index; | ||
315 | __entry->nr_to_write = nr_to_write; | ||
316 | __entry->wrote = nr_to_write - wbc->nr_to_write; | ||
317 | ), | ||
318 | |||
319 | TP_printk("bdi %s: ino=%lu state=%s age=%lu " | ||
320 | "index=%lu to_write=%ld wrote=%lu", | ||
321 | __entry->name, | ||
322 | __entry->ino, | ||
323 | show_inode_state(__entry->state), | ||
324 | __entry->age, | ||
325 | __entry->writeback_index, | ||
326 | __entry->nr_to_write, | ||
327 | __entry->wrote | ||
328 | ) | ||
329 | ); | ||
330 | |||
331 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_requeue, | ||
332 | TP_PROTO(struct inode *inode, | ||
333 | struct writeback_control *wbc, | ||
334 | unsigned long nr_to_write), | ||
335 | TP_ARGS(inode, wbc, nr_to_write) | ||
336 | ); | ||
337 | |||
338 | DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode, | ||
339 | TP_PROTO(struct inode *inode, | ||
340 | struct writeback_control *wbc, | ||
341 | unsigned long nr_to_write), | ||
342 | TP_ARGS(inode, wbc, nr_to_write) | ||
343 | ); | ||
344 | |||
190 | #endif /* _TRACE_WRITEBACK_H */ | 345 | #endif /* _TRACE_WRITEBACK_H */ |
191 | 346 | ||
192 | /* This part must be outside protection */ | 347 | /* This part must be outside protection */ |