block: blk-mq: make blk_sync_queue support mq
authorMing Lei <tom.leiming@gmail.com>
Thu, 26 Dec 2013 13:31:36 +0000 (21:31 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 31 Dec 2013 16:53:05 +0000 (09:53 -0700)
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>
block/blk-core.c
block/blk-mq.c

index accb7fc6ec944a59651e1e8a43a4319eb2df1cca..c00e0bdeab4ab4724c42b379717200d405d9c584 100644 (file)
@@ -246,7 +246,16 @@ EXPORT_SYMBOL(blk_stop_queue);
 void blk_sync_queue(struct request_queue *q)
 {
        del_timer_sync(&q->timeout);
-       cancel_delayed_work_sync(&q->delay_work);
+
+       if (q->mq_ops) {
+               struct blk_mq_hw_ctx *hctx;
+               int i;
+
+               queue_for_each_hw_ctx(q, hctx, i)
+                       cancel_delayed_work_sync(&hctx->delayed_work);
+       } else {
+               cancel_delayed_work_sync(&q->delay_work);
+       }
 }
 EXPORT_SYMBOL(blk_sync_queue);
 
index e2f811cba4170e1048c1046c2955e881e05736a9..edbd2536f942376f49d6acf663be884b7fc8d4e9 100644 (file)
@@ -1440,7 +1440,6 @@ void blk_mq_free_queue(struct request_queue *q)
        int i;
 
        queue_for_each_hw_ctx(q, hctx, i) {
-               cancel_delayed_work_sync(&hctx->delayed_work);
                kfree(hctx->ctx_map);
                kfree(hctx->ctxs);
                blk_mq_free_rq_map(hctx);