Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bbcbbd56 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe
Browse files

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: default avatarMing Lei <ming.lei@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 48d7727c
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -286,10 +286,16 @@ static struct bio *blk_bio_segment_split(struct request_queue *q,
		bvprv = bv;
		bvprvp = &bvprv;

		if (bvec_split_segs(q, &bv, &nsegs, &seg_size,
				    &front_seg_size, &sectors))
		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, &sectors)) {
			goto split;

		}
	}

	do_split = false;