aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-10-11 18:45:43 -0400
committerKent Overstreet <kmo@daterainc.com>2013-11-24 01:33:51 -0500
commit003b5c5719f159f4f4bf97511c4702a0638313dd (patch)
tree1b3cac74e22ae5a87fdb6e3066f2d728913e6e0c /fs
parent458b76ed2f9517becb74dcc8eedd70d3068ea6e4 (diff)
block: Convert drivers to immutable biovecs
Now that we've got a mechanism for immutable biovecs - bi_iter.bi_bvec_done - we need to convert drivers to use primitives that respect it instead of using the bvec array directly. Signed-off-by: Kent Overstreet <kmo@daterainc.com> Cc: Jens Axboe <axboe@kernel.dk> Cc: NeilBrown <neilb@suse.de> Cc: Alasdair Kergon <agk@redhat.com> Cc: dm-devel@redhat.com
Diffstat (limited to 'fs')
-rw-r--r--fs/bio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/bio.c b/fs/bio.c
index e32f2ffc3f33..a082ce2d197b 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -525,8 +525,17 @@ EXPORT_SYMBOL(bio_phys_segments);
525 */ 525 */
526void __bio_clone(struct bio *bio, struct bio *bio_src) 526void __bio_clone(struct bio *bio, struct bio *bio_src)
527{ 527{
528 memcpy(bio->bi_io_vec, bio_src->bi_io_vec, 528 if (bio_is_rw(bio_src)) {
529 bio_src->bi_max_vecs * sizeof(struct bio_vec)); 529 struct bio_vec bv;
530 struct bvec_iter iter;
531
532 bio_for_each_segment(bv, bio_src, iter)
533 bio->bi_io_vec[bio->bi_vcnt++] = bv;
534 } else if (bio_has_data(bio_src)) {
535 memcpy(bio->bi_io_vec, bio_src->bi_io_vec,
536 bio_src->bi_max_vecs * sizeof(struct bio_vec));
537 bio->bi_vcnt = bio_src->bi_vcnt;
538 }
530 539
531 /* 540 /*
532 * most users will be overriding ->bi_bdev with a new target, 541 * most users will be overriding ->bi_bdev with a new target,
@@ -535,7 +544,6 @@ void __bio_clone(struct bio *bio, struct bio *bio_src)
535 bio->bi_bdev = bio_src->bi_bdev; 544 bio->bi_bdev = bio_src->bi_bdev;
536 bio->bi_flags |= 1 << BIO_CLONED; 545 bio->bi_flags |= 1 << BIO_CLONED;
537 bio->bi_rw = bio_src->bi_rw; 546 bio->bi_rw = bio_src->bi_rw;
538 bio->bi_vcnt = bio_src->bi_vcnt;
539 bio->bi_iter = bio_src->bi_iter; 547 bio->bi_iter = bio_src->bi_iter;
540} 548}
541EXPORT_SYMBOL(__bio_clone); 549EXPORT_SYMBOL(__bio_clone);