|
@@ -599,6 +599,7 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
|
|
*/
|
|
*/
|
|
if (unlikely(bdi_thresh > thresh))
|
|
if (unlikely(bdi_thresh > thresh))
|
|
bdi_thresh = thresh;
|
|
bdi_thresh = thresh;
|
|
|
|
+ bdi_thresh = max(bdi_thresh, (limit - dirty) / 8);
|
|
/*
|
|
/*
|
|
* scale global setpoint to bdi's:
|
|
* scale global setpoint to bdi's:
|
|
* bdi_setpoint = setpoint * bdi_thresh / thresh
|
|
* bdi_setpoint = setpoint * bdi_thresh / thresh
|
|
@@ -622,6 +623,20 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
|
|
} else
|
|
} else
|
|
pos_ratio /= 4;
|
|
pos_ratio /= 4;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * bdi reserve area, safeguard against dirty pool underrun and disk idle
|
|
|
|
+ * It may push the desired control point of global dirty pages higher
|
|
|
|
+ * than setpoint.
|
|
|
|
+ */
|
|
|
|
+ x_intercept = bdi_thresh / 2;
|
|
|
|
+ if (bdi_dirty < x_intercept) {
|
|
|
|
+ if (bdi_dirty > x_intercept / 8) {
|
|
|
|
+ pos_ratio *= x_intercept;
|
|
|
|
+ do_div(pos_ratio, bdi_dirty);
|
|
|
|
+ } else
|
|
|
|
+ pos_ratio *= 8;
|
|
|
|
+ }
|
|
|
|
+
|
|
return pos_ratio;
|
|
return pos_ratio;
|
|
}
|
|
}
|
|
|
|
|