Skip to content

Commit 48cc661

Browse files
committed
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>
1 parent 2149141 commit 48cc661

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/block/null_blk.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,20 +232,19 @@ static void end_cmd(struct nullb_cmd *cmd)
232232
break;
233233
case NULL_Q_BIO:
234234
bio_endio(cmd->bio);
235-
goto free_cmd;
235+
break;
236236
}
237237

238+
free_cmd(cmd);
239+
238240
/* Restart queue if needed, as we are freeing a tag */
239-
if (q && !q->mq_ops && blk_queue_stopped(q)) {
241+
if (queue_mode == NULL_Q_RQ && blk_queue_stopped(q)) {
240242
unsigned long flags;
241243

242244
spin_lock_irqsave(q->queue_lock, flags);
243-
if (blk_queue_stopped(q))
244-
blk_start_queue(q);
245+
blk_start_queue_async(q);
245246
spin_unlock_irqrestore(q->queue_lock, flags);
246247
}
247-
free_cmd:
248-
free_cmd(cmd);
249248
}
250249

251250
static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer)

0 commit comments

Comments
 (0)