[PATCH] blk-mq: remove redundant call to blk_freeze_queue_start in blk_mq_destroy_queue

Jinlong Chen posted 1 patch 3 years, 5 months ago
block/blk-mq.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] blk-mq: remove redundant call to blk_freeze_queue_start in blk_mq_destroy_queue
Posted by Jinlong Chen 3 years, 5 months ago
The calling relationship in blk_mq_destroy_queue() is as follows:

blk_mq_destroy_queue()
    ...
    -> blk_queue_start_drain()
        -> blk_freeze_queue_start()  <- called
        ...
    -> blk_freeze_queue()
        -> blk_freeze_queue_start()  <- called again
        -> blk_mq_freeze_queue_wait()
    ...

So there is a redundant call to blk_freeze_queue_start().

Replace blk_freeze_queue() with blk_mq_freeze_queue_wait() to avoid the
redundant call.

Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
---
 block/blk-mq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 4cecf281123f..8ca49530bdf3 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4005,7 +4005,7 @@ void blk_mq_destroy_queue(struct request_queue *q)
 
 	blk_queue_flag_set(QUEUE_FLAG_DYING, q);
 	blk_queue_start_drain(q);
-	blk_freeze_queue(q);
+	blk_mq_freeze_queue_wait(q);
 
 	blk_sync_queue(q);
 	blk_mq_cancel_work_sync(q);
-- 
2.31.1
Re: [PATCH] blk-mq: remove redundant call to blk_freeze_queue_start in blk_mq_destroy_queue
Posted by Jens Axboe 3 years, 5 months ago
On Sun, 30 Oct 2022 16:32:12 +0800, Jinlong Chen wrote:
> The calling relationship in blk_mq_destroy_queue() is as follows:
> 
> blk_mq_destroy_queue()
>     ...
>     -> blk_queue_start_drain()
>         -> blk_freeze_queue_start()  <- called
>         ...
>     -> blk_freeze_queue()
>         -> blk_freeze_queue_start()  <- called again
>         -> blk_mq_freeze_queue_wait()
>     ...
> 
> [...]

Applied, thanks!

[1/1] blk-mq: remove redundant call to blk_freeze_queue_start in blk_mq_destroy_queue
      commit: 56c1ee92246a5099a626b955dd7f6636cdce6f93

Best regards,
-- 
Jens Axboe
Re: [PATCH] blk-mq: remove redundant call to blk_freeze_queue_start in blk_mq_destroy_queue
Posted by Christoph Hellwig 3 years, 5 months ago
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>