diff options
-rw-r--r-- | drivers/md/dm-thin.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index de55ae9d4926..068607828691 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -3307,7 +3307,7 @@ static struct target_type pool_target = { | |||
3307 | .name = "thin-pool", | 3307 | .name = "thin-pool", |
3308 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | | 3308 | .features = DM_TARGET_SINGLETON | DM_TARGET_ALWAYS_WRITEABLE | |
3309 | DM_TARGET_IMMUTABLE, | 3309 | DM_TARGET_IMMUTABLE, |
3310 | .version = {1, 13, 0}, | 3310 | .version = {1, 14, 0}, |
3311 | .module = THIS_MODULE, | 3311 | .module = THIS_MODULE, |
3312 | .ctr = pool_ctr, | 3312 | .ctr = pool_ctr, |
3313 | .dtr = pool_dtr, | 3313 | .dtr = pool_dtr, |
@@ -3634,6 +3634,21 @@ err: | |||
3634 | DMEMIT("Error"); | 3634 | DMEMIT("Error"); |
3635 | } | 3635 | } |
3636 | 3636 | ||
3637 | static int thin_merge(struct dm_target *ti, struct bvec_merge_data *bvm, | ||
3638 | struct bio_vec *biovec, int max_size) | ||
3639 | { | ||
3640 | struct thin_c *tc = ti->private; | ||
3641 | struct request_queue *q = bdev_get_queue(tc->pool_dev->bdev); | ||
3642 | |||
3643 | if (!q->merge_bvec_fn) | ||
3644 | return max_size; | ||
3645 | |||
3646 | bvm->bi_bdev = tc->pool_dev->bdev; | ||
3647 | bvm->bi_sector = dm_target_offset(ti, bvm->bi_sector); | ||
3648 | |||
3649 | return min(max_size, q->merge_bvec_fn(q, bvm, biovec)); | ||
3650 | } | ||
3651 | |||
3637 | static int thin_iterate_devices(struct dm_target *ti, | 3652 | static int thin_iterate_devices(struct dm_target *ti, |
3638 | iterate_devices_callout_fn fn, void *data) | 3653 | iterate_devices_callout_fn fn, void *data) |
3639 | { | 3654 | { |
@@ -3658,7 +3673,7 @@ static int thin_iterate_devices(struct dm_target *ti, | |||
3658 | 3673 | ||
3659 | static struct target_type thin_target = { | 3674 | static struct target_type thin_target = { |
3660 | .name = "thin", | 3675 | .name = "thin", |
3661 | .version = {1, 13, 0}, | 3676 | .version = {1, 14, 0}, |
3662 | .module = THIS_MODULE, | 3677 | .module = THIS_MODULE, |
3663 | .ctr = thin_ctr, | 3678 | .ctr = thin_ctr, |
3664 | .dtr = thin_dtr, | 3679 | .dtr = thin_dtr, |
@@ -3668,6 +3683,7 @@ static struct target_type thin_target = { | |||
3668 | .presuspend = thin_presuspend, | 3683 | .presuspend = thin_presuspend, |
3669 | .postsuspend = thin_postsuspend, | 3684 | .postsuspend = thin_postsuspend, |
3670 | .status = thin_status, | 3685 | .status = thin_status, |
3686 | .merge = thin_merge, | ||
3671 | .iterate_devices = thin_iterate_devices, | 3687 | .iterate_devices = thin_iterate_devices, |
3672 | }; | 3688 | }; |
3673 | 3689 | ||