linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync
@ 2022-10-30  9:47 Jinlong Chen
  2022-10-30  9:57 ` Christoph Hellwig
  2022-10-31 13:32 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Jinlong Chen @ 2022-10-30  9:47 UTC (permalink / raw)
  To: axboe; +Cc: hch, linux-block, linux-kernel, nickyc975

The only caller that needs queue_is_mq check is del_gendisk, so move the
check into it.

Signed-off-by: Jinlong Chen <nickyc975@zju.edu.cn>
---
 block/blk-mq.c | 12 +++++-------
 block/genhd.c  |  4 +++-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 8ca49530bdf3..e2a332786ebd 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -4851,15 +4851,13 @@ EXPORT_SYMBOL(blk_mq_rq_cpu);
 
 void blk_mq_cancel_work_sync(struct request_queue *q)
 {
-	if (queue_is_mq(q)) {
-		struct blk_mq_hw_ctx *hctx;
-		unsigned long i;
+	struct blk_mq_hw_ctx *hctx;
+	unsigned long i;
 
-		cancel_delayed_work_sync(&q->requeue_work);
+	cancel_delayed_work_sync(&q->requeue_work);
 
-		queue_for_each_hw_ctx(q, hctx, i)
-			cancel_delayed_work_sync(&hctx->run_work);
-	}
+	queue_for_each_hw_ctx(q, hctx, i)
+		cancel_delayed_work_sync(&hctx->run_work);
 }
 
 static int __init blk_mq_init(void)
diff --git a/block/genhd.c b/block/genhd.c
index 17b33c62423d..493b93faee9c 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -638,7 +638,9 @@ void del_gendisk(struct gendisk *disk)
 
 	blk_sync_queue(q);
 	blk_flush_integrity();
-	blk_mq_cancel_work_sync(q);
+
+	if (queue_is_mq(q))
+		blk_mq_cancel_work_sync(q);
 
 	blk_mq_quiesce_queue(q);
 	if (q->elevator) {
-- 
2.31.1


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

* Re: [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync
  2022-10-30  9:47 [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync Jinlong Chen
@ 2022-10-30  9:57 ` Christoph Hellwig
  2022-10-31 13:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-10-30  9:57 UTC (permalink / raw)
  To: Jinlong Chen; +Cc: axboe, hch, linux-block, linux-kernel

Looks good:

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

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

* Re: [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync
  2022-10-30  9:47 [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync Jinlong Chen
  2022-10-30  9:57 ` Christoph Hellwig
@ 2022-10-31 13:32 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2022-10-31 13:32 UTC (permalink / raw)
  To: Jinlong Chen; +Cc: linux-kernel, linux-block, hch

On Sun, 30 Oct 2022 17:47:30 +0800, Jinlong Chen wrote:
> The only caller that needs queue_is_mq check is del_gendisk, so move the
> check into it.
> 
> 

Applied, thanks!

[1/1] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync
      commit: 219cf43c552a49a7710b7b341bf616682a2643f0

Best regards,
-- 
Jens Axboe



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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-30  9:47 [PATCH] blk-mq: move queue_is_mq out of blk_mq_cancel_work_sync Jinlong Chen
2022-10-30  9:57 ` Christoph Hellwig
2022-10-31 13:32 ` 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).