@@ -743,7 +743,7 @@ static void free_cmd(struct nullb_cmd *cmd)
static enum hrtimer_restart null_cmd_timer_expired(struct hrtimer *timer);
-static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
+static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq, struct bio *bio)
{
struct nullb_cmd *cmd;
unsigned int tag;
@@ -754,6 +754,7 @@ static struct nullb_cmd *__alloc_cmd(struct nullb_queue *nq)
cmd->tag = tag;
cmd->error = BLK_STS_OK;
cmd->nq = nq;
+ cmd->bio = bio;
if (nq->dev->irqmode == NULL_IRQ_TIMER) {
hrtimer_init(&cmd->timer, CLOCK_MONOTONIC,
HRTIMER_MODE_REL);
@@ -775,11 +776,9 @@ static struct nullb_cmd *alloc_cmd(struct nullb_queue *nq, struct bio *bio)
* This avoids multiple return statements, multiple calls to
* __alloc_cmd() and a fast path call to prepare_to_wait().
*/
- cmd = __alloc_cmd(nq);
- if (cmd) {
- cmd->bio = bio;
+ cmd = __alloc_cmd(nq, bio);
+ if (cmd)
return cmd;
- }
prepare_to_wait(&nq->wait, &wait, TASK_UNINTERRUPTIBLE);
io_schedule();
finish_wait(&nq->wait, &wait);