aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2008-07-21 07:00:40 -0400
committerAlasdair G Kergon <agk@redhat.com>2008-07-21 07:00:40 -0400
commitd41e26b901111f4e540aa2c27ec7a1681c782be9 (patch)
tree7f05c209b92c0dfc2a96daeac3a4812f34b70b10 /drivers
parent9980c638a666ecd88acaf0a7ab91043d4a3f44d1 (diff)
dm crypt: add merge
This patch implements biovec merge function for crypt target. If the underlying device has merge function defined, call it. If not, keep precomputed value. Signed-off-by: Milan Broz <mbroz@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/md/dm-crypt.c18
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
1219static 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
1219static struct target_type crypt_target = { 1234static 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
1233static int __init dm_crypt_init(void) 1249static int __init dm_crypt_init(void)