summary refs log tree commit diff
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2015-12-28 13:02:47 -0700
committerJens Axboe <axboe@fb.com>2015-12-28 13:07:09 -0700
commit48cc661e7f4cec80b6aa894cc6902c292f201ea8 (patch)
tree8f26e4e6c720eb7b9b707f3e73b6914fc4e22720
parent21491412f2ec6f13d4104de734dec0ba659d092e (diff)
downloadlinux-48cc661e7f4cec80b6aa894cc6902c292f201ea8.tar.gz
null_blk: use async queue restart helper
If null_blk is run in NULL_IRQ_TIMER mode and with queue_mode NULL_Q_RQ,
we need to restart the queue from the hrtimer interrupt. We can't
directly invoke the request_fn from that context, so punt the queue run
to async kblockd context.

Tested-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/block/null_blk.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
index a428e4ef71fd..09e3c0d87ecc 100644
--- a/drivers/block/null_blk.c
+++ b/drivers/block/null_blk.c
@@ -232,20 +232,19 @@ static void end_cmd(struct nullb_cmd *cmd)
 		break;
 	case NULL_Q_BIO:
 		bio_endio(cmd->bio);
-		goto free_cmd;
+		break;
 	}
 
+	free_cmd(cmd);
+
 	/* Restart queue if needed, as we are freeing a tag */
-	if (q && !q->mq_ops && blk_queue_stopped(q)) {
+	if (queue_mode == NULL_Q_RQ && blk_queue_stopped(q)) {
 		unsigned long flags;
 
 		spin_lock_irqsave(q->queue_lock, flags);
-		if (blk_queue_stopped(q))
-			blk_start_queue(q);
+		blk_start_queue_async(q);
 		spin_unlock_irqrestore(q->queue_lock, flags);
 	}
-free_cmd:
-	free_cmd(cmd);
 }
 
 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)