aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-08-07 17:24:32 -0400
committerKent Overstreet <kmo@daterainc.com>2013-11-24 01:33:49 -0500
commita4ad39b1d10584dfcfcfb0d510faab2c7f034399 (patch)
treea0747f9978fceb202975f43f15ed4489c6600894 /drivers/md
parent75d5d8156500cd3833d66806889372e294af514d (diff)
block: Convert bio_iovec() to bvec_iter
For immutable biovecs, we'll be introducing a new bio_iovec() that uses our new bvec iterator to construct a biovec, taking into account bvec_iter->bi_bvec_done - this patch updates existing users for the new usage. Some of the existing users really do need a pointer into the bvec array - those uses are all going to be removed, but we'll need the functionality from immutable to remove them - so for now rename the existing bio_iovec() -> __bio_iovec(), and it'll be removed in a couple patches. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: "Ed L. Cashin" <ecashin@coraid.com> Cc: Alasdair Kergon <agk@redhat.com> Cc: dm-devel@redhat.com Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/bcache/io.c13
-rw-r--r--drivers/md/dm-verity.c2
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/md/bcache/io.c b/drivers/md/bcache/io.c
index cc4ba2da5fb6..dc44f0689eb7 100644
--- a/drivers/md/bcache/io.c
+++ b/drivers/md/bcache/io.c
@@ -22,11 +22,12 @@ static void bch_bi_idx_hack_endio(struct bio *bio, int error)
22static void bch_generic_make_request_hack(struct bio *bio) 22static void bch_generic_make_request_hack(struct bio *bio)
23{ 23{
24 if (bio->bi_iter.bi_idx) { 24 if (bio->bi_iter.bi_idx) {
25 int i;
26 struct bio_vec *bv;
25 struct bio *clone = bio_alloc(GFP_NOIO, bio_segments(bio)); 27 struct bio *clone = bio_alloc(GFP_NOIO, bio_segments(bio));
26 28
27 memcpy(clone->bi_io_vec, 29 bio_for_each_segment(bv, bio, i)
28 bio_iovec(bio), 30 clone->bi_io_vec[clone->bi_vcnt++] = *bv;
29 bio_segments(bio) * sizeof(struct bio_vec));
30 31
31 clone->bi_iter.bi_sector = bio->bi_iter.bi_sector; 32 clone->bi_iter.bi_sector = bio->bi_iter.bi_sector;
32 clone->bi_bdev = bio->bi_bdev; 33 clone->bi_bdev = bio->bi_bdev;
@@ -97,7 +98,7 @@ struct bio *bch_bio_split(struct bio *bio, int sectors,
97 if (!ret) 98 if (!ret)
98 return NULL; 99 return NULL;
99 100
100 memcpy(ret->bi_io_vec, bio_iovec(bio), 101 memcpy(ret->bi_io_vec, __bio_iovec(bio),
101 sizeof(struct bio_vec) * vcnt); 102 sizeof(struct bio_vec) * vcnt);
102 103
103 break; 104 break;
@@ -106,7 +107,7 @@ struct bio *bch_bio_split(struct bio *bio, int sectors,
106 if (!ret) 107 if (!ret)
107 return NULL; 108 return NULL;
108 109
109 memcpy(ret->bi_io_vec, bio_iovec(bio), 110 memcpy(ret->bi_io_vec, __bio_iovec(bio),
110 sizeof(struct bio_vec) * vcnt); 111 sizeof(struct bio_vec) * vcnt);
111 112
112 ret->bi_io_vec[vcnt - 1].bv_len = nbytes; 113 ret->bi_io_vec[vcnt - 1].bv_len = nbytes;
@@ -182,7 +183,7 @@ static unsigned bch_bio_max_sectors(struct bio *bio)
182 ret = min(ret, queue_max_sectors(q)); 183 ret = min(ret, queue_max_sectors(q));
183 184
184 WARN_ON(!ret); 185 WARN_ON(!ret);
185 ret = max_t(int, ret, bio_iovec(bio)->bv_len >> 9); 186 ret = max_t(int, ret, bio_iovec(bio).bv_len >> 9);
186 187
187 return ret; 188 return ret;
188} 189}
diff --git a/drivers/md/dm-verity.c b/drivers/md/dm-verity.c
index 132b3154d466..5392135924ca 100644
--- a/drivers/md/dm-verity.c
+++ b/drivers/md/dm-verity.c
@@ -524,7 +524,7 @@ static int verity_map(struct dm_target *ti, struct bio *bio)
524 io->io_vec = io->io_vec_inline; 524 io->io_vec = io->io_vec_inline;
525 else 525 else
526 io->io_vec = mempool_alloc(v->vec_mempool, GFP_NOIO); 526 io->io_vec = mempool_alloc(v->vec_mempool, GFP_NOIO);
527 memcpy(io->io_vec, bio_iovec(bio), 527 memcpy(io->io_vec, __bio_iovec(bio),
528 io->io_vec_size * sizeof(struct bio_vec)); 528 io->io_vec_size * sizeof(struct bio_vec));
529 529
530 verity_submit_prefetch(v, io); 530 verity_submit_prefetch(v, io);