Skip to content

Commit 6593815

Browse files
bvanasscheaxboe
authored andcommitted
blk-mq: Move more error handling into blk_mq_submit_bio()
The error handling code in blk_mq_get_new_requests() cannot be understood without knowing that this function is only called by blk_mq_submit_bio(). Hence move the code for handling blk_mq_get_new_requests() failures into blk_mq_submit_bio(). Cc: Damien Le Moal <dlemoal@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Link: https://lore.kernel.org/r/20241218212246.1073149-3-bvanassche@acm.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 44e4138 commit 6593815

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

block/blk-mq.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2984,12 +2984,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q,
29842984
}
29852985

29862986
rq = __blk_mq_alloc_requests(&data);
2987-
if (rq)
2988-
return rq;
2989-
rq_qos_cleanup(q, bio);
2990-
if (bio->bi_opf & REQ_NOWAIT)
2991-
bio_wouldblock_error(bio);
2992-
return NULL;
2987+
if (unlikely(!rq))
2988+
rq_qos_cleanup(q, bio);
2989+
return rq;
29932990
}
29942991

29952992
/*
@@ -3129,8 +3126,11 @@ void blk_mq_submit_bio(struct bio *bio)
31293126
blk_mq_use_cached_rq(rq, plug, bio);
31303127
} else {
31313128
rq = blk_mq_get_new_requests(q, plug, bio, nr_segs);
3132-
if (unlikely(!rq))
3129+
if (unlikely(!rq)) {
3130+
if (bio->bi_opf & REQ_NOWAIT)
3131+
bio_wouldblock_error(bio);
31333132
goto queue_exit;
3133+
}
31343134
}
31353135

31363136
trace_block_getrq(bio);

0 commit comments

Comments
 (0)