diff options
author | Ming Lei <ming.lei@redhat.com> | 2019-02-27 13:40:12 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2019-02-27 14:18:55 +0100 |
commit | bbcbbd567cc15823a6e9d4e2c5899ea3defa7b6d (patch) | |
tree | 22cd9755657f63bd596496b2e59b866d3833f0d1 /block | |
parent | block: optimize __blk_segment_map_sg() for single-page bvec (diff) | |
download | linux-bbcbbd567cc15823a6e9d4e2c5899ea3defa7b6d.tar.xz linux-bbcbbd567cc15823a6e9d4e2c5899ea3defa7b6d.zip |
block: optimize blk_bio_segment_split for single-page bvec
Introduce a fast path for single-page bvec IO, then we can avoid
to call bvec_split_segs() unnecessarily.
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-merge.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/block/blk-merge.c b/block/blk-merge.c index c1ad8abbd9d6..9402a7c3ba22 100644 --- a/block/blk-merge.c +++ b/block/blk-merge.c @@ -286,10 +286,16 @@ new_segment: bvprv = bv; bvprvp = &bvprv; - if (bvec_split_segs(q, &bv, &nsegs, &seg_size, - &front_seg_size, §ors)) + if (bv.bv_offset + bv.bv_len <= PAGE_SIZE) { + nsegs++; + seg_size = bv.bv_len; + sectors += bv.bv_len >> 9; + if (nsegs == 1 && seg_size > front_seg_size) + front_seg_size = seg_size; + } else if (bvec_split_segs(q, &bv, &nsegs, &seg_size, + &front_seg_size, §ors)) { goto split; - + } } do_split = false; |