/* consolidated parameters for balance_dirty_pages() and its subroutines */
struct dirty_throttle_control {
+#ifdef CONFIG_CGROUP_WRITEBACK
+ struct wb_domain *dom;
+#endif
struct bdi_writeback *wb;
struct fprop_local_percpu *wb_completions;
unsigned long pos_ratio;
};
-#define GDTC_INIT(__wb) .wb = (__wb), \
+#define DTC_INIT_COMMON(__wb) .wb = (__wb), \
.wb_completions = &(__wb)->completions
/*
#ifdef CONFIG_CGROUP_WRITEBACK
+#define GDTC_INIT(__wb) .dom = &global_wb_domain, \
+ DTC_INIT_COMMON(__wb)
+
+static struct wb_domain *dtc_dom(struct dirty_throttle_control *dtc)
+{
+ return dtc->dom;
+}
+
static void wb_min_max_ratio(struct bdi_writeback *wb,
unsigned long *minp, unsigned long *maxp)
{
#else /* CONFIG_CGROUP_WRITEBACK */
+#define GDTC_INIT(__wb) DTC_INIT_COMMON(__wb)
+
+static struct wb_domain *dtc_dom(struct dirty_throttle_control *dtc)
+{
+ return &global_wb_domain;
+}
+
static void wb_min_max_ratio(struct bdi_writeback *wb,
unsigned long *minp, unsigned long *maxp)
{
*/
static unsigned long __wb_calc_thresh(struct dirty_throttle_control *dtc)
{
- struct wb_domain *dom = &global_wb_domain;
+ struct wb_domain *dom = dtc_dom(dtc);
unsigned long thresh = dtc->thresh;
u64 wb_thresh;
long numerator, denominator;
static void update_dirty_limit(struct dirty_throttle_control *dtc)
{
- struct wb_domain *dom = &global_wb_domain;
+ struct wb_domain *dom = dtc_dom(dtc);
unsigned long thresh = dtc->thresh;
unsigned long limit = dom->dirty_limit;
dom->dirty_limit = limit;
}
-static void global_update_bandwidth(struct dirty_throttle_control *dtc,
+static void domain_update_bandwidth(struct dirty_throttle_control *dtc,
unsigned long now)
{
- struct wb_domain *dom = &global_wb_domain;
+ struct wb_domain *dom = dtc_dom(dtc);
/*
* check locklessly first to optimize away locking for the most time
goto snapshot;
if (update_ratelimit) {
- global_update_bandwidth(dtc, now);
+ domain_update_bandwidth(dtc, now);
wb_update_dirty_ratelimit(dtc, dirtied, elapsed);
}
wb_update_write_bandwidth(wb, elapsed, written);