From d62118b6dd99b8f64350206a6ea6996083b28c9a Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 28 Nov 2016 09:40:34 -0700 Subject: blk-wbt: allow wbt to be enabled always through sysfs Currently there's no way to enable wbt if it's not enabled in the kernel config by default for a device. Allow a write to the 'wbt_lat_usec' queue sysfs file to enable wbt. This is useful for both the kernel config case, but also if the device is CFQ managed and it was turned off by default. Signed-off-by: Jens Axboe --- block/blk-wbt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'block/blk-wbt.c') diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 7c0e618d6e7d..b8647343141f 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -673,7 +673,7 @@ void wbt_disable_default(struct request_queue *q) { struct rq_wb *rwb = q->rq_wb; - if (rwb) { + if (rwb && rwb->enable_state == WBT_STATE_ON_DEFAULT) { del_timer_sync(&rwb->window_timer); rwb->win_nsec = rwb->min_lat_nsec = 0; wbt_update_limits(rwb); @@ -721,6 +721,7 @@ int wbt_init(struct request_queue *q) rwb->last_comp = rwb->last_issue = jiffies; rwb->queue = q; rwb->win_nsec = RWB_WINDOW_NSEC; + rwb->enable_state = WBT_STATE_ON_DEFAULT; wbt_update_limits(rwb); /* -- cgit v1.2.3