Skip to content

Commit 5977907

Browse files
committed
dm crypt: leverage immutable biovecs when decrypting on read
Commit 003b5c5 ("block: Convert drivers to immutable biovecs") stopped short of changing dm-crypt to leverage the fact that the biovec array of a bio will no longer be modified. Switch to using bio_clone_fast() when cloning bios for decryption after read. Signed-off-by: Mike Snitzer <[email protected]>
1 parent e44f23b commit 5977907

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/md/dm-crypt.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1124,15 +1124,15 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone)
11241124
static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
11251125
{
11261126
struct crypt_config *cc = io->cc;
1127-
struct bio *base_bio = io->base_bio;
11281127
struct bio *clone;
11291128

11301129
/*
1131-
* The block layer might modify the bvec array, so always
1132-
* copy the required bvecs because we need the original
1133-
* one in order to decrypt the whole bio data *afterwards*.
1130+
* We need the original biovec array in order to decrypt
1131+
* the whole bio data *afterwards* -- thanks to immutable
1132+
* biovecs we don't need to worry about the block layer
1133+
* modifying the biovec array; so leverage bio_clone_fast().
11341134
*/
1135-
clone = bio_clone_bioset(base_bio, gfp, cc->bs);
1135+
clone = bio_clone_fast(io->base_bio, gfp, cc->bs);
11361136
if (!clone)
11371137
return 1;
11381138

0 commit comments

Comments
 (0)