diff options
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-crypt.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index ab6a61db63ce..13956437bc81 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -1216,9 +1216,24 @@ error: | |||
1216 | return -EINVAL; | 1216 | return -EINVAL; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | static int crypt_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | ||
1220 | struct bio_vec *biovec, int max_size) | ||
1221 | { | ||
1222 | struct crypt_config *cc = ti->private; | ||
1223 | struct request_queue *q = bdev_get_queue(cc->dev->bdev); | ||
1224 | |||
1225 | if (!q->merge_bvec_fn) | ||
1226 | return max_size; | ||
1227 | |||
1228 | bvm->bi_bdev = cc->dev->bdev; | ||
1229 | bvm->bi_sector = cc->start + bvm->bi_sector - ti->begin; | ||
1230 | |||
1231 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); | ||
1232 | } | ||
1233 | |||
1219 | static struct target_type crypt_target = { | 1234 | static struct target_type crypt_target = { |
1220 | .name = "crypt", | 1235 | .name = "crypt", |
1221 | .version= {1, 5, 0}, | 1236 | .version= {1, 6, 0}, |
1222 | .module = THIS_MODULE, | 1237 | .module = THIS_MODULE, |
1223 | .ctr = crypt_ctr, | 1238 | .ctr = crypt_ctr, |
1224 | .dtr = crypt_dtr, | 1239 | .dtr = crypt_dtr, |
@@ -1228,6 +1243,7 @@ static struct target_type crypt_target = { | |||
1228 | .preresume = crypt_preresume, | 1243 | .preresume = crypt_preresume, |
1229 | .resume = crypt_resume, | 1244 | .resume = crypt_resume, |
1230 | .message = crypt_message, | 1245 | .message = crypt_message, |
1246 | .merge = crypt_merge, | ||
1231 | }; | 1247 | }; |
1232 | 1248 | ||
1233 | static int __init dm_crypt_init(void) | 1249 | static int __init dm_crypt_init(void) |