[PATCH 19/22] md: Immutable bvecs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <koverstreet@xxxxxxxxxx>
Cc: Neil Brown <neilb@xxxxxxx>
---
 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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux