@@ -832,7 +832,7 @@ static int bdi_init(struct backing_dev_info *bdi)
kref_init(&bdi->refcnt);
bdi->min_ratio = 0;
bdi->max_ratio = 100;
- bdi->max_prop_frac = FPROP_FRAC_BASE;
+ bdi->max_prop_frac = FPROP_FRAC_BASE * PAGE_SIZE;
INIT_LIST_HEAD(&bdi->bdi_list);
INIT_LIST_HEAD(&bdi->wb_list);
init_waitqueue_head(&bdi->wb_waitq);
@@ -574,11 +574,11 @@ static unsigned long wp_next_time(unsigned long cur_time)
return cur_time;
}
-static void wb_domain_writeout_inc(struct wb_domain *dom,
+static void wb_domain_writeout_add(struct wb_domain *dom,
struct fprop_local_percpu *completions,
- unsigned int max_prop_frac)
+ long bytes, unsigned int max_prop_frac)
{
- __fprop_inc_percpu_max(&dom->completions, completions,
+ __fprop_add_percpu_max(&dom->completions, completions, bytes,
max_prop_frac);
/* First event after period switching was turned off? */
if (unlikely(!dom->period_time)) {
@@ -602,12 +602,12 @@ static inline void __wb_writeout_add(struct bdi_writeback *wb, long bytes)
struct wb_domain *cgdom;
__add_wb_stat(wb, WB_WRITTEN_BYTES, bytes);
- wb_domain_writeout_inc(&global_wb_domain, &wb->completions,
+ wb_domain_writeout_add(&global_wb_domain, &wb->completions, bytes,
wb->bdi->max_prop_frac);
cgdom = mem_cgroup_wb_domain(wb);
if (cgdom)
- wb_domain_writeout_inc(cgdom, wb_memcg_completions(wb),
+ wb_domain_writeout_add(cgdom, wb_memcg_completions(wb), bytes,
wb->bdi->max_prop_frac);
}
@@ -646,6 +646,7 @@ static void writeout_period(unsigned long t)
int wb_domain_init(struct wb_domain *dom, gfp_t gfp)
{
+ int ret;
memset(dom, 0, sizeof(*dom));
spin_lock_init(&dom->lock);
@@ -655,7 +656,10 @@ int wb_domain_init(struct wb_domain *dom, gfp_t gfp)
dom->dirty_limit_tstamp = jiffies;
- return fprop_global_init(&dom->completions, gfp);
+ ret = fprop_global_init(&dom->completions, gfp);
+ if (!ret)
+ dom->completions.batch_size *= PAGE_SIZE;
+ return ret;
}
#ifdef CONFIG_CGROUP_WRITEBACK
@@ -706,7 +710,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, unsigned max_ratio)
ret = -EINVAL;
} else {
bdi->max_ratio = max_ratio;
- bdi->max_prop_frac = (FPROP_FRAC_BASE * max_ratio) / 100;
+ bdi->max_prop_frac = ((FPROP_FRAC_BASE * max_ratio) / 100) *
+ PAGE_SIZE;
}
spin_unlock_bh(&bdi_lock);