aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2014-10-09 15:24:12 -0400
committerMike Snitzer <snitzer@redhat.com>2014-11-10 15:25:27 -0500
commit36f12aeb714fc04752997d6c07b6afb2fa0ac947 (patch)
tree8f793a3116525db10450b28d01a4db009bab25c7 /drivers/md
parent148e51baf8e7ae2070ec47c2a0ec05ddf6a47da1 (diff)
dm thin: implement thin_merge
Introduce thin_merge so that any additional constraints from the data volume may be taken into account when determing the maximum number of sectors that can be issued relative to the specified logical offset. This is particularly important if/when the data volume is layered ontop of a more sophisticated device (e.g. dm-raid or some other DM target). Reviewed-by: Heinz Mauelshagen <heinzm@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-thin.c20
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
3637static 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
3637static int thin_iterate_devices(struct dm_target *ti, 3652static 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
3659static struct target_type thin_target = { 3674static 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