Skip to content

Commit 39a70c7

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: clarify dispatch may not be drained/blocked by stopping queue
BLK_MQ_S_STOPPED may not be observed in other concurrent I/O paths, we can't guarantee that dispatching won't happen after returning from the APIs of stopping queue. So clarify the fact and avoid potential misuse. Signed-off-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Bart Van Assche <Bart.VanAssche@sandisk.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 1d9e9bc commit 39a70c7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

block/blk-mq.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,15 @@ static void __blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx, bool sync)
12041204
set_bit(BLK_MQ_S_STOPPED, &hctx->state);
12051205
}
12061206

1207+
/*
1208+
* This function is often used for pausing .queue_rq() by driver when
1209+
* there isn't enough resource or some conditions aren't satisfied, and
1210+
* BLK_MQ_RQ_QUEUE_BUSY is usually returned.
1211+
*
1212+
* We do not guarantee that dispatch can be drained or blocked
1213+
* after blk_mq_stop_hw_queue() returns. Please use
1214+
* blk_mq_quiesce_queue() for that requirement.
1215+
*/
12071216
void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx)
12081217
{
12091218
__blk_mq_stop_hw_queue(hctx, false);
@@ -1219,6 +1228,15 @@ static void __blk_mq_stop_hw_queues(struct request_queue *q, bool sync)
12191228
__blk_mq_stop_hw_queue(hctx, sync);
12201229
}
12211230

1231+
/*
1232+
* This function is often used for pausing .queue_rq() by driver when
1233+
* there isn't enough resource or some conditions aren't satisfied, and
1234+
* BLK_MQ_RQ_QUEUE_BUSY is usually returned.
1235+
*
1236+
* We do not guarantee that dispatch can be drained or blocked
1237+
* after blk_mq_stop_hw_queues() returns. Please use
1238+
* blk_mq_quiesce_queue() for that requirement.
1239+
*/
12221240
void blk_mq_stop_hw_queues(struct request_queue *q)
12231241
{
12241242
__blk_mq_stop_hw_queues(q, false);

0 commit comments

Comments
 (0)