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.

Signed-off-by: Kent Overstreet <[email protected]>
Cc: Neil Brown <[email protected]>
---
 drivers/md/md.c | 22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2421ccf..8af6226 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -186,9 +186,6 @@ void md_trim_bio(struct bio *bio, int offset, int size)
         * the given offset and size.
         * This requires adjusting bi_sector, bi_size, and bi_io_vec
         */
-       struct bio_vec bvec;
-       struct bvec_iter iter;
-       int sofar = 0;
 
        size <<= 9;
        if (offset == 0 && size == bio->bi_iter.bi_size)
@@ -199,25 +196,6 @@ void md_trim_bio(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(bvec, bio, iter) {
-               if (sofar + bvec.bv_len > size)
-                       bvec.bv_len = size - sofar;
-               if (bvec.bv_len == 0) {
-                       bio->bi_vcnt = iter.bi_idx;
-                       break;
-               }
-               sofar += bvec.bv_len;
-       }
 }
 EXPORT_SYMBOL_GPL(md_trim_bio);
 
-- 
1.8.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to