Skip to content

Commit

Permalink
blk-wbt: make sure throttle is enabled properly
Browse files Browse the repository at this point in the history
After commit a790504 ("blk-rq-qos: refactor out common elements of
blk-wbt"), if throttle was disabled by wbt_disable_default(), we could
not enable again, fix this by set enable_state back to
WBT_STATE_ON_DEFAULT.

Fixes: a790504 ("blk-rq-qos: refactor out common elements of blk-wbt")
Signed-off-by: Zhang Yi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
zhangyi089 authored and axboe committed Jun 21, 2021
1 parent 1d0903d commit 76a8040
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion block/blk-wbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,13 @@ void wbt_set_write_cache(struct request_queue *q, bool write_cache_on)
void wbt_enable_default(struct request_queue *q)
{
struct rq_qos *rqos = wbt_rq_qos(q);

/* Throttling already enabled? */
if (rqos)
if (rqos) {
if (RQWB(rqos)->enable_state == WBT_STATE_OFF_DEFAULT)
RQWB(rqos)->enable_state = WBT_STATE_ON_DEFAULT;
return;
}

/* Queue not registered? Maybe shutting down... */
if (!blk_queue_registered(q))
Expand Down

0 comments on commit 76a8040

Please sign in to comment.