]> www.infradead.org Git - users/hch/block.git/commitdiff
dm-crypt: remove clone_init
authorChristoph Hellwig <hch@lst.de>
Mon, 25 Jan 2021 15:22:52 +0000 (16:22 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 2 Feb 2021 09:39:30 +0000 (10:39 +0100)
Open code clone_init in the two callers.  This brings the bi_bdev
setup closer to bio_alloc_bioset, which is required for some changes
to that function.  It also remove the bi_opf assignment already done
by bio_clone_fast.

Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/md/dm-crypt.c

index 5a55617a08e687c0ef2f454d6b8754f8af0bfade..990759c223413769e274ea2138f1d0e51eff014a 100644 (file)
@@ -230,7 +230,7 @@ static volatile unsigned long dm_crypt_pages_per_client;
 #define DM_CRYPT_MEMORY_PERCENT                        2
 #define DM_CRYPT_MIN_PAGES_PER_CLIENT          (BIO_MAX_PAGES * 16)
 
-static void clone_init(struct dm_crypt_io *, struct bio *);
+static void crypt_endio(struct bio *clone);
 static void kcryptd_queue_crypt(struct dm_crypt_io *io);
 static struct scatterlist *crypt_get_sg_data(struct crypt_config *cc,
                                             struct scatterlist *sg);
@@ -1668,7 +1668,10 @@ retry:
        if (!clone)
                goto out;
 
-       clone_init(io, clone);
+       clone->bi_private = io;
+       clone->bi_end_io = crypt_endio;
+       bio_set_dev(clone, io->cc->dev->bdev);
+       clone->bi_opf = io->base_bio->bi_opf;
 
        remaining_size = size;
 
@@ -1821,16 +1824,6 @@ static void crypt_endio(struct bio *clone)
        crypt_dec_pending(io);
 }
 
-static void clone_init(struct dm_crypt_io *io, struct bio *clone)
-{
-       struct crypt_config *cc = io->cc;
-
-       clone->bi_private = io;
-       clone->bi_end_io  = crypt_endio;
-       bio_set_dev(clone, cc->dev->bdev);
-       clone->bi_opf     = io->base_bio->bi_opf;
-}
-
 static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
 {
        struct crypt_config *cc = io->cc;
@@ -1848,7 +1841,9 @@ static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
 
        crypt_inc_pending(io);
 
-       clone_init(io, clone);
+       clone->bi_private = io;
+       clone->bi_end_io = crypt_endio;
+       bio_set_dev(clone, io->cc->dev->bdev);
        clone->bi_iter.bi_sector = cc->start + io->sector;
 
        if (dm_crypt_integrity_io_alloc(io, clone)) {