Two blk_mq_submit_bio() patches
v3 cover Two blk_mq_submit_bio() patches
Hi Jens,
This patch series includes two cleanup patches for blk_mq_submit_bio(). No functionality has been changed.
Please consider this patch series for the next merge window.
Thanks,
Bart.
Changes compared to v2 of this patch series:
- Changed the title of the first patch.
- Added unlikely() in the second patch.
- Dropped the patch that was added as the third patch.
Changes compared to v1 of this patch series:
- Addressed Christoph's comments on patch 2/3.
- Added patch 3/3 to this series.
Bart Van Assche (2):
block: Reorder the request allocation code in blk_mq_submit_bio()
blk-mq: Move more error handling into blk_mq_submit_bio()
block/blk-mq.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
PATCH v3 1/2 block: Reorder the request allocation code in blk_mq_submit_bio()
Help the CPU branch predictor in case of a cache hit by handling the cache hit scenario first.
--- block/blk-mq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
block/blk-mq.c +3 -3
@@ -3102,12 +3102,12 @@ void blk_mq_submit_bio(struct bio *bio) goto queue_exit; new_request: -if (!rq) { +if (rq) { +blk_mq_use_cached_rq (rq, plug, bio); + }else { rq =blk_mq_get_new_requests (q, plug, bio, nr_segs);if (unlikely (!rq)) goto queue_exit; - }else { -blk_mq_use_cached_rq (rq, plug, bio); }trace_block_getrq (bio);
Re: [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
Looks good:
Re: [PATCH v3 1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
In reply to Bart Van AsscheQuoted 6 lines · Bart Van Assche
Help the CPU branch predictor in case of a cache hit by handling the cache hit scenario first.
Reviewed-by Damien Le Moal<[email protected]>Cc Christoph Hellwig<[email protected]>Signed-off-by Bart Van Assche<[email protected]>
Looks good.
-ck
PATCH v3 2/2 blk-mq: Move more error handling into blk_mq_submit_bio()
In reply to Bart Van AsscheThe 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().
--- block/blk-mq.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
block/blk-mq.c +7 -7
@@ -2968,12 +2968,9 @@ static struct request *blk_mq_get_new_requests(struct request_queue *q, } rq =__blk_mq_alloc_requests (&data); -if (rq) -return rq; -rq_qos_cleanup (q, bio); -if (bio->bi_opf &REQ_NOWAIT ) -bio_wouldblock_error (bio); -return NULL ; +if (unlikely (!rq)) +rq_qos_cleanup (q, bio); +return rq; }/*
@@ -3106,8 +3103,11 @@ void blk_mq_submit_bio(struct bio *bio)blk_mq_use_cached_rq (rq, plug, bio); }else { rq =blk_mq_get_new_requests (q, plug, bio, nr_segs); -if (unlikely (!rq)) +if (unlikely (!rq)) { +if (bio->bi_opf &REQ_NOWAIT ) +bio_wouldblock_error (bio); goto queue_exit; + } }trace_block_getrq (bio);
Re: [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
Looks good:
Re: [PATCH v3 2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
In reply to Bart Van AsscheQuoted 9 lines · Bart Van Assche
The error handling code in
blk_mq_get_new_requests()cannot be understood without knowing that this function is only called byblk_mq_submit_bio(). Hence move the code for handlingblk_mq_get_new_requests()failures intoblk_mq_submit_bio().Cc Damien Le Moal<[email protected]>Cc Christoph Hellwig<[email protected]>Signed-off-by Bart Van Assche<[email protected]>---
Looks good.
-ck
Quoted 8 lines · Bart Van Assche
This patch series includes two cleanup patches for
blk_mq_submit_bio(). No functionality has been changed.Please consider this patch series for the next merge window.
Thanks,
[...]
Applied, thanks!
[1/2] block: Reorder the request allocation code in blk_mq_submit_bio()
commit: 44e41381591dc5b4ea67a9f170b4ec85c817586e
[2/2] blk-mq: Move more error handling into blk_mq_submit_bio()
commit: 659381520a3b13403c3051516317adc02e48259bBest regards,
Signature · 1 line
Jens Axboe