Skip to content

Commit

Permalink
blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init()
Browse files Browse the repository at this point in the history
commit 8c5035d ("blk-wbt: call rq_qos_add() after wb_normal is
initialized") moves wbt_set_write_cache() before rq_qos_add(), which
is wrong because wbt_rq_qos() is still NULL.

Fix the problem by removing wbt_set_write_cache() and setting 'rwb->wc'
directly. Noted that this patch also remove the redundant setting of
'rab->wc'.

Fixes: 8c5035d ("blk-wbt: call rq_qos_add() after wb_normal is initialized")
Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Yu Kuai <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
YuKuai-huawei authored and axboe committed Oct 9, 2022
1 parent 340e134 commit 285feba
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions block/blk-wbt.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,12 +841,11 @@ int wbt_init(struct request_queue *q)
rwb->last_comp = rwb->last_issue = jiffies;
rwb->win_nsec = RWB_WINDOW_NSEC;
rwb->enable_state = WBT_STATE_ON_DEFAULT;
rwb->wc = 1;
rwb->wc = test_bit(QUEUE_FLAG_WC, &q->queue_flags);
rwb->rq_depth.default_depth = RWB_DEF_DEPTH;
rwb->min_lat_nsec = wbt_default_latency_nsec(q);

wbt_queue_depth_changed(&rwb->rqos);
wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags));

/*
* Assign rwb and add the stats callback.
Expand Down

0 comments on commit 285feba

Please sign in to comment.