Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1547630
| From | Ming Lei <tom.leiming@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v1 24/54] blk-merge: compute bio->bi_seg_front_size efficiently |
| Date | 2016-12-27 17:10 +0100 |
| Message-ID | <sT2u6-4eA-19@gated-at.bofh.it> (permalink) |
| References | <sT2u5-4eA-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
It is enough to check and compute bio->bi_seg_front_size just after the 1st segment is found, but current code checks that for each bvec, which is inefficient. This patch follows the way in __blk_recalc_rq_segments() for computing bio->bi_seg_front_size, and it is more efficient and code becomes more readable too. Signed-off-by: Ming Lei <tom.leiming@gmail.com> --- block/blk-merge.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/block/blk-merge.c b/block/blk-merge.c index 182398cb1524..e3abc835e4b7 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -153,22 +153,21 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, bvprvp = &bvprv; sectors += bv.bv_len >> 9; - if (nsegs == 1 && seg_size > front_seg_size) - front_seg_size = seg_size; continue; } new_segment: if (nsegs == queue_max_segments(q)) goto split; + if (nsegs == 1 && seg_size > front_seg_size) + front_seg_size = seg_size; + nsegs++; bvprv = bv; bvprvp = &bvprv; seg_size = bv.bv_len; sectors += bv.bv_len >> 9; - if (nsegs == 1 && seg_size > front_seg_size) - front_seg_size = seg_size; } do_split = false; @@ -181,6 +180,8 @@ static struct bio *blk_bio_segment_split(struct request_queue *q, bio = new; } + if (nsegs == 1 && seg_size > front_seg_size) + front_seg_size = seg_size; bio->bi_seg_front_size = front_seg_size; if (seg_size > bio->bi_seg_back_size) bio->bi_seg_back_size = seg_size; -- 2.7.4
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH v1 24/54] blk-merge: compute bio->bi_seg_front_size efficiently Ming Lei <tom.leiming@gmail.com> - 2016-12-27 17:10 +0100
csiph-web