aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2012-09-06 18:35:02 -0400
committerJens Axboe <axboe@kernel.dk>2012-09-09 04:35:39 -0400
commitbf800ef1816b4283a885e55ad38068aec9711e4d (patch)
treec99cbe70b68ede65b478b3006a7ed7e34b453f3d /drivers/md/dm-crypt.c
parent3f86a82aeb03e6100f7ab39f4702e033a5e38166 (diff)
block: Add bio_clone_bioset(), bio_clone_kmalloc()
Previously, there was bio_clone() but it only allocated from the fs bio set; as a result various users were open coding it and using __bio_clone(). This changes bio_clone() to become bio_clone_bioset(), and then we add bio_clone() and bio_clone_kmalloc() as wrappers around it, making use of the functionality the last patch adedd. This will also help in a later patch changing how bio cloning works. Signed-off-by: Kent Overstreet <koverstreet@google.com> CC: Jens Axboe <axboe@kernel.dk> CC: NeilBrown <neilb@suse.de> CC: Alasdair Kergon <agk@redhat.com> CC: Boaz Harrosh <bharrosh@panasas.com> CC: Jeff Garzik <jeff@garzik.org> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 3c0acba042b6..bbf459bca61d 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -979,19 +979,14 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
979 * copy the required bvecs because we need the original 979 * copy the required bvecs because we need the original
980 * one in order to decrypt the whole bio data *afterwards*. 980 * one in order to decrypt the whole bio data *afterwards*.
981 */ 981 */
982 clone = bio_alloc_bioset(gfp, bio_segments(base_bio), cc->bs); 982 clone = bio_clone_bioset(base_bio, gfp, cc->bs);
983 if (!clone) 983 if (!clone)
984 return 1; 984 return 1;
985 985
986 crypt_inc_pending(io); 986 crypt_inc_pending(io);
987 987
988 clone_init(io, clone); 988 clone_init(io, clone);
989 clone->bi_idx = 0;
990 clone->bi_vcnt = bio_segments(base_bio);
991 clone->bi_size = base_bio->bi_size;
992 clone->bi_sector = cc->start + io->sector; 989 clone->bi_sector = cc->start + io->sector;
993 memcpy(clone->bi_io_vec, bio_iovec(base_bio),
994 sizeof(struct bio_vec) * clone->bi_vcnt);
995 990
996 generic_make_request(clone); 991 generic_make_request(clone);
997 return 0; 992 return 0;