Skip to contentSkip to conversation

blk-mq: properly drain stopped queues

PATCH Applied Christoph Hellwig 2 participants 3 messages Jun 13, 2014 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 blk-mq: properly drain stopped queues

If we need to drain a queue we need to run all queues, even if they are marked stopped to make sure the driver has a chance to error out on all queued requests.

This fixes surprise removal with scsi-mq.

---
 block/blk-mq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
index 3d868d3..15b3ccd 100644
@@ -120,7 +120,7 @@ static void __blk_mq_drain_queue(struct request_queue *q)
 
 		if (count == 0)
 			break;
-		blk_mq_run_queues(q, false);
+		blk_mq_start_hw_queues(q);
 		msleep(10);
 	}
 }
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 2/2 blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue

---
 block/blk-mq.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
block/blk-mq.c +2 -7
index 15b3ccd..a719340 100644
@@ -109,7 +109,7 @@ static void blk_mq_queue_exit(struct request_queue *q)
 	__percpu_counter_add(&q->mq_usage_counter, -1, 1000000);
 }
 
-static void __blk_mq_drain_queue(struct request_queue *q)
+void blk_mq_drain_queue(struct request_queue *q)
 {
 	while (true) {
 		s64 count;
@@ -139,12 +139,7 @@ static void blk_mq_freeze_queue(struct request_queue *q)
 	spin_unlock_irq(q->queue_lock);
 
 	if (drain)
-		__blk_mq_drain_queue(q);
-}
-
-void blk_mq_drain_queue(struct request_queue *q)
-{
-	__blk_mq_drain_queue(q);
+		blk_mq_drain_queue(q);
 }
 
 static void blk_mq_unfreeze_queue(struct request_queue *q)
Signature · 1 line
1.7.10.4
maintainer Applied
#2 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

If we need to drain a queue we need to run all queues, even if they are marked stopped to make sure the driver has a chance to error out on all queued requests.

This fixes surprise removal with scsi-mq.

Applied this and 2/2 as well, thanks!

Signature · 1 line
Jens Axboe