Browse Source

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>
Jens Axboe 9 years ago
parent
commit
48cc661e7f
1 changed files with 5 additions and 6 deletions
  1. 5 6
      drivers/block/null_blk.c

+ 5 - 6
drivers/block/null_blk.c

@@ -232,20 +232,19 @@ static void end_cmd(struct nullb_cmd *cmd)
 		break;
 		break;
 	case NULL_Q_BIO:
 	case NULL_Q_BIO:
 		bio_endio(cmd->bio);
 		bio_endio(cmd->bio);
-		goto free_cmd;
+		break;
 	}
 	}
 
 
+	free_cmd(cmd);
+
 	/* Restart queue if needed, as we are freeing a tag */
 	/* 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;
 		unsigned long flags;
 
 
 		spin_lock_irqsave(q->queue_lock, 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);
 		spin_unlock_irqrestore(q->queue_lock, flags);
 	}
 	}
-free_cmd:
-	free_cmd(cmd);
 }
 }
 
 
 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)
 static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)