aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-crypt.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2015-04-09 16:53:24 -0400
committerMike Snitzer <snitzer@redhat.com>2015-04-15 12:10:25 -0400
commit5977907937afa2b5584a874d44ba6c0f56aeaa9c (patch)
tree804a59300745efce20cacd1a79fbff035bf409ab /drivers/md/dm-crypt.c
parente44f23b32dc7916b2bc12817e2f723fefa21ba41 (diff)
dm crypt: leverage immutable biovecs when decrypting on read
Commit 003b5c571 ("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 <snitzer@redhat.com>
Diffstat (limited to 'drivers/md/dm-crypt.c')
-rw-r--r--drivers/md/dm-crypt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index ea09d5464a9f..aa1238facbeb 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1124,15 +1124,15 @@ static void clone_init(struct dm_crypt_io *io, struct bio *clone)
1124static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp) 1124static int kcryptd_io_read(struct dm_crypt_io *io, gfp_t gfp)
1125{ 1125{
1126 struct crypt_config *cc = io->cc; 1126 struct crypt_config *cc = io->cc;
1127 struct bio *base_bio = io->base_bio;
1128 struct bio *clone; 1127 struct bio *clone;
1129 1128
1130 /* 1129 /*
1131 * The block layer might modify the bvec array, so always 1130 * We need the original biovec array in order to decrypt
1132 * copy the required bvecs because we need the original 1131 * the whole bio data *afterwards* -- thanks to immutable
1133 * one in order to decrypt the whole bio data *afterwards*. 1132 * biovecs we don't need to worry about the block layer
1133 * modifying the biovec array; so leverage bio_clone_fast().
1134 */ 1134 */
1135 clone = bio_clone_bioset(base_bio, gfp, cc->bs); 1135 clone = bio_clone_fast(io->base_bio, gfp, cc->bs);
1136 if (!clone) 1136 if (!clone)
1137 return 1; 1137 return 1;
1138 1138