summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-05-22 17:13:28 -0400
committerJens Axboe <axboe@fb.com>2015-06-02 10:33:34 -0400
commita88a341a73be4ef035ca26170c849f002797da27 (patch)
tree3b9ba08daa3fdfb00d02ba21dfbce702a03826bc /include/linux
parent93f78d882865cb90020d0f80a9523c99cf46924c (diff)
writeback: move bandwidth related fields from backing_dev_info into bdi_writeback
Currently, a bdi (backing_dev_info) embeds single wb (bdi_writeback) and the role of the separation is unclear. For cgroup support for writeback IOs, a bdi will be updated to host multiple wb's where each wb serves writeback IOs of a different cgroup on the bdi. To achieve that, a wb should carry all states necessary for servicing writeback IOs for a cgroup independently. This patch moves bandwidth related fields from backing_dev_info into bdi_writeback. * The moved fields are: bw_time_stamp, dirtied_stamp, written_stamp, write_bandwidth, avg_write_bandwidth, dirty_ratelimit, balanced_dirty_ratelimit, completions and dirty_exceeded. * writeback_chunk_size() and over_bground_thresh() now take @wb instead of @bdi. * bdi_writeout_fraction(bdi, ...) -> wb_writeout_fraction(wb, ...) bdi_dirty_limit(bdi, ...) -> wb_dirty_limit(wb, ...) bdi_position_ration(bdi, ...) -> wb_position_ratio(wb, ...) bdi_update_writebandwidth(bdi, ...) -> wb_update_write_bandwidth(wb, ...) [__]bdi_update_bandwidth(bdi, ...) -> [__]wb_update_bandwidth(wb, ...) bdi_{max|min}_pause(bdi, ...) -> wb_{max|min}_pause(wb, ...) bdi_dirty_limits(bdi, ...) -> wb_dirty_limits(wb, ...) * Init/exits of the relocated fields are moved to bdi_wb_init/exit() respectively. Note that explicit zeroing is dropped in the process as wb's are cleared in entirety anyway. * As there's still only one bdi_writeback per backing_dev_info, all uses of bdi->stat[] are mechanically replaced with bdi->wb.stat[] introducing no behavior changes. v2: Typo in description fixed as suggested by Jan. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Jan Kara <jack@suse.cz> Cc: Jens Axboe <axboe@kernel.dk> Cc: Wu Fengguang <fengguang.wu@intel.com> Cc: Jaegeuk Kim <jaegeuk@kernel.org> Cc: Steven Whitehouse <swhiteho@redhat.com> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/backing-dev.h20
-rw-r--r--include/linux/writeback.h19
2 files changed, 19 insertions, 20 deletions
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
index fe7a907a4e16..2ab06049d812 100644
--- a/include/linux/backing-dev.h
+++ b/include/linux/backing-dev.h
@@ -60,16 +60,6 @@ struct bdi_writeback {
60 spinlock_t list_lock; /* protects the b_* lists */ 60 spinlock_t list_lock; /* protects the b_* lists */
61 61
62 struct percpu_counter stat[NR_WB_STAT_ITEMS]; 62 struct percpu_counter stat[NR_WB_STAT_ITEMS];
63};
64
65struct backing_dev_info {
66 struct list_head bdi_list;
67 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
68 unsigned int capabilities; /* Device capabilities */
69 congested_fn *congested_fn; /* Function pointer if device is md/dm */
70 void *congested_data; /* Pointer to aux data for congested func */
71
72 char *name;
73 63
74 unsigned long bw_time_stamp; /* last time write bw is updated */ 64 unsigned long bw_time_stamp; /* last time write bw is updated */
75 unsigned long dirtied_stamp; 65 unsigned long dirtied_stamp;
@@ -88,6 +78,16 @@ struct backing_dev_info {
88 78
89 struct fprop_local_percpu completions; 79 struct fprop_local_percpu completions;
90 int dirty_exceeded; 80 int dirty_exceeded;
81};
82
83struct backing_dev_info {
84 struct list_head bdi_list;
85 unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
86 unsigned int capabilities; /* Device capabilities */
87 congested_fn *congested_fn; /* Function pointer if device is md/dm */
88 void *congested_data; /* Pointer to aux data for congested func */
89
90 char *name;
91 91
92 unsigned int min_ratio; 92 unsigned int min_ratio;
93 unsigned int max_ratio, max_prop_frac; 93 unsigned int max_ratio, max_prop_frac;
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
index b2dd371ec0ca..a6b9db7fcee8 100644
--- a/include/linux/writeback.h
+++ b/include/linux/writeback.h
@@ -155,16 +155,15 @@ int dirty_writeback_centisecs_handler(struct ctl_table *, int,
155 void __user *, size_t *, loff_t *); 155 void __user *, size_t *, loff_t *);
156 156
157void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty); 157void global_dirty_limits(unsigned long *pbackground, unsigned long *pdirty);
158unsigned long bdi_dirty_limit(struct backing_dev_info *bdi, 158unsigned long wb_dirty_limit(struct bdi_writeback *wb, unsigned long dirty);
159 unsigned long dirty); 159
160 160void __wb_update_bandwidth(struct bdi_writeback *wb,
161void __bdi_update_bandwidth(struct backing_dev_info *bdi, 161 unsigned long thresh,
162 unsigned long thresh, 162 unsigned long bg_thresh,
163 unsigned long bg_thresh, 163 unsigned long dirty,
164 unsigned long dirty, 164 unsigned long bdi_thresh,
165 unsigned long bdi_thresh, 165 unsigned long bdi_dirty,
166 unsigned long bdi_dirty, 166 unsigned long start_time);
167 unsigned long start_time);
168 167
169void page_writeback_init(void); 168void page_writeback_init(void);
170void balance_dirty_pages_ratelimited(struct address_space *mapping); 169void balance_dirty_pages_ratelimited(struct address_space *mapping);