Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

block: blk-mq: make blk_sync_queue support mq

This patch moves synchronization on mq->delay_work
from blk_mq_free_queue() to blk_sync_queue(), so that
blk_sync_queue can work on mq.

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Ming Lei and committed by
Jens Axboe
f04c1fe7 43a5e4e2

+10 -2
+10 -1
block/blk-core.c
··· 246 246 void blk_sync_queue(struct request_queue *q) 247 247 { 248 248 del_timer_sync(&q->timeout); 249 - cancel_delayed_work_sync(&q->delay_work); 249 + 250 + if (q->mq_ops) { 251 + struct blk_mq_hw_ctx *hctx; 252 + int i; 253 + 254 + queue_for_each_hw_ctx(q, hctx, i) 255 + cancel_delayed_work_sync(&hctx->delayed_work); 256 + } else { 257 + cancel_delayed_work_sync(&q->delay_work); 258 + } 250 259 } 251 260 EXPORT_SYMBOL(blk_sync_queue); 252 261
-1
block/blk-mq.c
··· 1440 1440 int i; 1441 1441 1442 1442 queue_for_each_hw_ctx(q, hctx, i) { 1443 - cancel_delayed_work_sync(&hctx->delayed_work); 1444 1443 kfree(hctx->ctx_map); 1445 1444 kfree(hctx->ctxs); 1446 1445 blk_mq_free_rq_map(hctx);