aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/blk-core.c9
-rw-r--r--block/blk-mq.c2
-rw-r--r--block/blk.h2
3 files changed, 11 insertions, 2 deletions
diff --git a/block/blk-core.c b/block/blk-core.c
index b8881750a3ac..3ba4326a63b5 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -562,6 +562,13 @@ static void __blk_drain_queue(struct request_queue *q, bool drain_all)
562 } 562 }
563} 563}
564 564
565void blk_drain_queue(struct request_queue *q)
566{
567 spin_lock_irq(q->queue_lock);
568 __blk_drain_queue(q, true);
569 spin_unlock_irq(q->queue_lock);
570}
571
565/** 572/**
566 * blk_queue_bypass_start - enter queue bypass mode 573 * blk_queue_bypass_start - enter queue bypass mode
567 * @q: queue of interest 574 * @q: queue of interest
@@ -689,8 +696,6 @@ void blk_cleanup_queue(struct request_queue *q)
689 */ 696 */
690 blk_freeze_queue(q); 697 blk_freeze_queue(q);
691 spin_lock_irq(lock); 698 spin_lock_irq(lock);
692 if (!q->mq_ops)
693 __blk_drain_queue(q, true);
694 queue_flag_set(QUEUE_FLAG_DEAD, q); 699 queue_flag_set(QUEUE_FLAG_DEAD, q);
695 spin_unlock_irq(lock); 700 spin_unlock_irq(lock);
696 701
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 11097477eeab..3d3797327491 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -161,6 +161,8 @@ void blk_freeze_queue(struct request_queue *q)
161 * exported to drivers as the only user for unfreeze is blk_mq. 161 * exported to drivers as the only user for unfreeze is blk_mq.
162 */ 162 */
163 blk_freeze_queue_start(q); 163 blk_freeze_queue_start(q);
164 if (!q->mq_ops)
165 blk_drain_queue(q);
164 blk_mq_freeze_queue_wait(q); 166 blk_mq_freeze_queue_wait(q);
165} 167}
166 168
diff --git a/block/blk.h b/block/blk.h
index 3f1446937aec..442098aa9463 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -330,4 +330,6 @@ static inline void blk_queue_bounce(struct request_queue *q, struct bio **bio)
330} 330}
331#endif /* CONFIG_BOUNCE */ 331#endif /* CONFIG_BOUNCE */
332 332
333extern void blk_drain_queue(struct request_queue *q);
334
333#endif /* BLK_INTERNAL_H */ 335#endif /* BLK_INTERNAL_H */