block: Add bio_clone_bioset(), bio_clone_kmalloc()
[deliverable/linux.git] / drivers / md / dm-crypt.c
index 664743d6a6cdb7961ea7555544185ea4cff06357..bbf459bca61d9442e11b9ca544084877b2155268 100644 (file)
@@ -798,14 +798,6 @@ static int crypt_convert(struct crypt_config *cc,
        return 0;
 }
 
-static void dm_crypt_bio_destructor(struct bio *bio)
-{
-       struct dm_crypt_io *io = bio->bi_private;
-       struct crypt_config *cc = io->cc;
-
-       bio_free(bio, cc->bs);
-}
-
 /*
  * Generate a new unfragmented bio with the given size
  * This should never violate the device limitations
@@ -974,7 +966,6 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone)
        clone->bi_end_io  = crypt_endio;
        clone->bi_bdev    = cc->dev->bdev;
        clone->bi_rw      = io->base_bio->bi_rw;
-       clone->bi_destructor = dm_crypt_bio_destructor;
 }
 
 static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
@@ -988,19 +979,14 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
         * copy the required bvecs because we need the original
         * one in order to decrypt the whole bio data *afterwards*.
         */
-       clone = bio_alloc_bioset(gfp, bio_segments(base_bio), cc->bs);
+       clone = bio_clone_bioset(base_bio, gfp, cc->bs);
        if (!clone)
                return 1;
 
        crypt_inc_pending(io);
 
        clone_init(io, clone);
-       clone->bi_idx = 0;
-       clone->bi_vcnt = bio_segments(base_bio);
-       clone->bi_size = base_bio->bi_size;
        clone->bi_sector = cc->start + io->sector;
-       memcpy(clone->bi_io_vec, bio_iovec(base_bio),
-              sizeof(struct bio_vec) * clone->bi_vcnt);
 
        generic_make_request(clone);
        return 0;
This page took 0.024889 seconds and 5 git commands to generate.