aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2013-11-23 21:19:27 -0500
committerKent Overstreet <kmo@daterainc.com>2013-11-24 01:33:54 -0500
commit59d276fe02d7e887a4825ef05c80b8f8c54ba60a (patch)
treedbb8c78a922d47652c08d9f5e46d77708ac95543 /drivers/md/bcache
parentbdb53207411ae39b8a80dda0a66d1b468cbe1380 (diff)
block: Add bio_clone_fast()
bio_clone() just got more expensive - however, most users of bio_clone() don't actually need to modify the biovec. If they aren't modifying the biovec, and they can guarantee that the original bio isn't freed before the clone (also true in most cases), we can just point the clone at the original bio's biovec. Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache')
-rw-r--r--drivers/md/bcache/request.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 4c0a422fd49f..63451c724781 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -613,7 +613,6 @@ struct search {
613 613
614 struct btree_op op; 614 struct btree_op op;
615 struct data_insert_op iop; 615 struct data_insert_op iop;
616 struct bio_vec bv[BIO_MAX_PAGES];
617}; 616};
618 617
619static void bch_cache_read_endio(struct bio *bio, int error) 618static void bch_cache_read_endio(struct bio *bio, int error)
@@ -761,9 +760,7 @@ static void do_bio_hook(struct search *s)
761 struct bio *bio = &s->bio.bio; 760 struct bio *bio = &s->bio.bio;
762 761
763 bio_init(bio); 762 bio_init(bio);
764 bio->bi_io_vec = s->bv; 763 __bio_clone_fast(bio, s->orig_bio);
765 bio->bi_max_vecs = BIO_MAX_PAGES;
766 __bio_clone(bio, s->orig_bio);
767 bio->bi_end_io = request_endio; 764 bio->bi_end_io = request_endio;
768 bio->bi_private = &s->cl; 765 bio->bi_private = &s->cl;
769 766
@@ -1065,8 +1062,7 @@ static void cached_dev_write(struct cached_dev *dc, struct search *s)
1065 closure_bio_submit(flush, cl, s->d); 1062 closure_bio_submit(flush, cl, s->d);
1066 } 1063 }
1067 } else { 1064 } else {
1068 s->iop.bio = bio_clone_bioset(bio, GFP_NOIO, 1065 s->iop.bio = bio_clone_fast(bio, GFP_NOIO, dc->disk.bio_split);
1069 dc->disk.bio_split);
1070 1066
1071 closure_bio_submit(bio, cl, s->d); 1067 closure_bio_submit(bio, cl, s->d);
1072 } 1068 }