Skip to content

Commit 1d9e9bc

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: don't stop queue for quiescing
Queue can be started by other blk-mq APIs and can be used in different cases, this limits uses of blk_mq_quiesce_queue() if it is based on stopping queue, and make its usage very difficult, especially users have to use the stop queue APIs carefully for avoiding to break blk_mq_quiesce_queue(). We have applied the QUIESCED flag for draining and blocking dispatch, so it isn't necessary to stop queue any more. After stopping queue is removed, blk_mq_quiesce_queue() can be used safely and easily, then users won't worry about queue restarting during quiescing at all. Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 69e07c4 commit 1d9e9bc

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

block/blk-mq.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@ void blk_mq_quiesce_queue(struct request_queue *q)
169169
unsigned int i;
170170
bool rcu = false;
171171

172-
__blk_mq_stop_hw_queues(q, true);
173-
174-
spin_lock_irq(q->queue_lock);
175-
queue_flag_set(QUEUE_FLAG_QUIESCED, q);
176-
spin_unlock_irq(q->queue_lock);
172+
blk_mq_quiesce_queue_nowait(q);
177173

178174
queue_for_each_hw_ctx(q, hctx, i) {
179175
if (hctx->flags & BLK_MQ_F_BLOCKING)
@@ -199,7 +195,8 @@ void blk_mq_unquiesce_queue(struct request_queue *q)
199195
queue_flag_clear(QUEUE_FLAG_QUIESCED, q);
200196
spin_unlock_irq(q->queue_lock);
201197

202-
blk_mq_start_stopped_hw_queues(q, true);
198+
/* dispatch requests which are inserted during quiescing */
199+
blk_mq_run_hw_queues(q, true);
203200
}
204201
EXPORT_SYMBOL_GPL(blk_mq_unquiesce_queue);
205202

include/linux/blk-mq.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,6 @@ static inline void blk_mq_quiesce_queue_nowait(struct request_queue *q)
271271
spin_lock_irq(q->queue_lock);
272272
queue_flag_set(QUEUE_FLAG_QUIESCED, q);
273273
spin_unlock_irq(q->queue_lock);
274-
275-
blk_mq_stop_hw_queues(q);
276274
}
277275

278276
/*

0 commit comments

Comments
 (0)