linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init()
@ 2022-10-09 10:10 Yu Kuai
  2022-10-09 11:47 ` Ming Lei
  2022-10-09 13:48 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Yu Kuai @ 2022-10-09 10:10 UTC (permalink / raw)
  To: fengwei.yin, ming.lei, axboe, yukuai3
  Cc: linux-block, linux-kernel, yukuai1, yi.zhang

From: Yu Kuai <yukuai3@huawei.com>

commit 8c5035dfbb94 ("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: 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized")
Reported-by: kernel test robot <yujie.liu@intel.com>
Link: https://lore.kernel.org/r/202210081045.77ddf59b-yujie.liu@intel.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/blk-wbt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 246467926253..c293e08b301f 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -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.
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init()
  2022-10-09 10:10 [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() Yu Kuai
@ 2022-10-09 11:47 ` Ming Lei
  2022-10-09 13:48 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Ming Lei @ 2022-10-09 11:47 UTC (permalink / raw)
  To: Yu Kuai; +Cc: fengwei.yin, axboe, yukuai3, linux-block, linux-kernel, yi.zhang

On Sun, Oct 09, 2022 at 06:10:38PM +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> commit 8c5035dfbb94 ("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: 8c5035dfbb94 ("blk-wbt: call rq_qos_add() after wb_normal is initialized")
> Reported-by: kernel test robot <yujie.liu@intel.com>
> Link: https://lore.kernel.org/r/202210081045.77ddf59b-yujie.liu@intel.com
> Signed-off-by: Yu Kuai <yukuai3@huawei.com>

Looks fine,

Reviewed-by: Ming Lei <ming.lei@redhat.com>

Thanks,
Ming


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init()
  2022-10-09 10:10 [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() Yu Kuai
  2022-10-09 11:47 ` Ming Lei
@ 2022-10-09 13:48 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-10-09 13:48 UTC (permalink / raw)
  To: Yu Kuai, fengwei.yin, yukuai3, ming.lei
  Cc: yi.zhang, linux-block, linux-kernel

On Sun, 9 Oct 2022 18:10:38 +0800, Yu Kuai wrote:
> From: Yu Kuai <yukuai3@huawei.com>
> 
> commit 8c5035dfbb94 ("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'.
> 
> [...]

Applied, thanks!

[1/1] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init()
      commit: 285febabac4a16655372d23ff43e89ff6f216691

Best regards,
-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-09 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-09 10:10 [PATCH] blk-wbt: fix that 'rwb->wc' is always set to 1 in wbt_init() Yu Kuai
2022-10-09 11:47 ` Ming Lei
2022-10-09 13:48 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).