From e90abc8ec323c1fd2a25600097ef7ae1e91f39b0 Mon Sep 17 00:00:00 2001 From: Kent Overstreet Date: Wed, 7 Aug 2013 14:31:42 -0700 Subject: block: Remove bi_idx hacks Now that drivers have been converted to the new bvec_iter primitives, there's no need to trim the bvec before we submit it; and we can't trim it once we start sharing bvecs. It used to be that passing a partially completed bio (i.e. one with nonzero bi_idx) to generic_make_request() was a dangerous thing - various drivers would choke on such things. But with immutable biovecs and our new bio splitting that shares the biovecs, submitting partially completed bios has to work (and should work, now that all the drivers have been completed to the new primitives) Signed-off-by: Kent Overstreet Cc: Jens Axboe --- fs/bio.c | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'fs/bio.c') diff --git a/fs/bio.c b/fs/bio.c index 9cff939b1bc6..e6dfa06773ac 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -1822,11 +1822,7 @@ void bio_trim(struct bio *bio, int offset, int size) { /* 'bio' is a cloned bio which we need to trim to match * the given offset and size. - * This requires adjusting bi_sector, bi_size, and bi_io_vec */ - int i; - struct bio_vec *bvec; - int sofar = 0; size <<= 9; if (offset == 0 && size == bio->bi_iter.bi_size) @@ -1837,25 +1833,6 @@ void bio_trim(struct bio *bio, int offset, int size) bio_advance(bio, offset << 9); bio->bi_iter.bi_size = size; - - /* avoid any complications with bi_idx being non-zero*/ - if (bio->bi_iter.bi_idx) { - memmove(bio->bi_io_vec, bio->bi_io_vec+bio->bi_iter.bi_idx, - (bio->bi_vcnt - bio->bi_iter.bi_idx) * - sizeof(struct bio_vec)); - bio->bi_vcnt -= bio->bi_iter.bi_idx; - bio->bi_iter.bi_idx = 0; - } - /* Make sure vcnt and last bv are not too big */ - bio_for_each_segment_all(bvec, bio, i) { - if (sofar + bvec->bv_len > size) - bvec->bv_len = size - sofar; - if (bvec->bv_len == 0) { - bio->bi_vcnt = i; - break; - } - sofar += bvec->bv_len; - } } EXPORT_SYMBOL_GPL(bio_trim); -- cgit v1.2.1