[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACVXFVPiwKq2PzkueAm0+-Kf8N-_d4k0HR4v5QkFsBX7ysMCSg@mail.gmail.com>
Date: Thu, 10 Mar 2016 11:41:49 +0800
From: Ming Lei <ming.lei@...onical.com>
To: Jens Axboe <axboe@...nel.dk>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc: linux-block@...r.kernel.org, Christoph Hellwig <hch@...radead.org>,
Ming Lei <ming.lei@...onical.com>
Subject: Re: [PATCH] blk-merge: compute bio->bi_seg_front_size efficiently
On Tue, Mar 1, 2016 at 8:51 PM, Ming Lei <ming.lei@...onical.com> wrote:
> 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.
Gentle ping, :-)
IMO, it is nice to follow the logic in __blk_recalc_rq_segments(),
so hope this one can be merged in for-next soon.
Thanks,
Ming
>
> Signed-off-by: Ming Lei <ming.lei@...onical.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 2613531..e4c74a0 100644
> --- a/block/blk-merge.c
> +++ b/block/blk-merge.c
> @@ -131,22 +131,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;
> @@ -159,6 +158,8 @@ split:
> 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;
> --
> 1.9.1
>
Powered by blists - more mailing lists