lkml.org 
[lkml]   [2012]   [Sep]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2 04/26] md: Convert md_trim_bio() to use bio_advance()
    Date
    Signed-off-by: Kent Overstreet <koverstreet@google.com>
    CC: Jens Axboe <axboe@kernel.dk>
    CC: NeilBrown <neilb@suse.de>
    ---
    drivers/md/md.c | 19 +++++--------------
    1 file changed, 5 insertions(+), 14 deletions(-)

    diff --git a/drivers/md/md.c b/drivers/md/md.c
    index 7a2b079..51ce48c 100644
    --- a/drivers/md/md.c
    +++ b/drivers/md/md.c
    @@ -190,25 +190,16 @@ void md_trim_bio(struct bio *bio, int offset, int size)
    struct bio_vec *bvec;
    int sofar = 0;

    - size <<= 9;
    if (offset == 0 && size == bio->bi_size)
    return;

    - bio->bi_sector += offset;
    - bio->bi_size = size;
    - offset <<= 9;
    clear_bit(BIO_SEG_VALID, &bio->bi_flags);

    - while (bio->bi_idx < bio->bi_vcnt &&
    - bio->bi_io_vec[bio->bi_idx].bv_len <= offset) {
    - /* remove this whole bio_vec */
    - offset -= bio->bi_io_vec[bio->bi_idx].bv_len;
    - bio->bi_idx++;
    - }
    - if (bio->bi_idx < bio->bi_vcnt) {
    - bio->bi_io_vec[bio->bi_idx].bv_offset += offset;
    - bio->bi_io_vec[bio->bi_idx].bv_len -= offset;
    - }
    + bio_advance(bio, offset << 9);
    +
    + size <<= 9;
    + bio->bi_size = size;
    +
    /* avoid any complications with bi_idx being non-zero*/
    if (bio->bi_idx) {
    memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_idx,
    --
    1.7.12


    \
     
     \ /
      Last update: 2012-09-11 03:41    [W:0.036 / U:31.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site