diff options
| -rw-r--r-- | drivers/md/dm-stripe.c | 13 | ||||
| -rw-r--r-- | drivers/md/dm-table.c | 4 | ||||
| -rw-r--r-- | include/linux/device-mapper.h | 4 |
3 files changed, 20 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c index 4e0e5937e42a..3e563d251733 100644 --- a/drivers/md/dm-stripe.c +++ b/drivers/md/dm-stripe.c | |||
| @@ -329,9 +329,19 @@ static int stripe_iterate_devices(struct dm_target *ti, | |||
| 329 | return ret; | 329 | return ret; |
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | static void stripe_io_hints(struct dm_target *ti, | ||
| 333 | struct queue_limits *limits) | ||
| 334 | { | ||
| 335 | struct stripe_c *sc = ti->private; | ||
| 336 | unsigned chunk_size = (sc->chunk_mask + 1) << 9; | ||
| 337 | |||
| 338 | blk_limits_io_min(limits, chunk_size); | ||
| 339 | limits->io_opt = chunk_size * sc->stripes; | ||
| 340 | } | ||
| 341 | |||
| 332 | static struct target_type stripe_target = { | 342 | static struct target_type stripe_target = { |
| 333 | .name = "striped", | 343 | .name = "striped", |
| 334 | .version = {1, 2, 0}, | 344 | .version = {1, 3, 0}, |
| 335 | .module = THIS_MODULE, | 345 | .module = THIS_MODULE, |
| 336 | .ctr = stripe_ctr, | 346 | .ctr = stripe_ctr, |
| 337 | .dtr = stripe_dtr, | 347 | .dtr = stripe_dtr, |
| @@ -339,6 +349,7 @@ static struct target_type stripe_target = { | |||
| 339 | .end_io = stripe_end_io, | 349 | .end_io = stripe_end_io, |
| 340 | .status = stripe_status, | 350 | .status = stripe_status, |
| 341 | .iterate_devices = stripe_iterate_devices, | 351 | .iterate_devices = stripe_iterate_devices, |
| 352 | .io_hints = stripe_io_hints, | ||
| 342 | }; | 353 | }; |
| 343 | 354 | ||
| 344 | int __init dm_stripe_init(void) | 355 | int __init dm_stripe_init(void) |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index c90e662d2802..1a6cb3c7822e 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
| @@ -1007,6 +1007,10 @@ int dm_calculate_queue_limits(struct dm_table *table, | |||
| 1007 | ti->type->iterate_devices(ti, dm_set_device_limits, | 1007 | ti->type->iterate_devices(ti, dm_set_device_limits, |
| 1008 | &ti_limits); | 1008 | &ti_limits); |
| 1009 | 1009 | ||
| 1010 | /* Set I/O hints portion of queue limits */ | ||
| 1011 | if (ti->type->io_hints) | ||
| 1012 | ti->type->io_hints(ti, &ti_limits); | ||
| 1013 | |||
| 1010 | /* | 1014 | /* |
| 1011 | * Check each device area is consistent with the target's | 1015 | * Check each device area is consistent with the target's |
| 1012 | * overall queue limits. | 1016 | * overall queue limits. |
diff --git a/include/linux/device-mapper.h b/include/linux/device-mapper.h index 655e7721580a..df7607e6dce8 100644 --- a/include/linux/device-mapper.h +++ b/include/linux/device-mapper.h | |||
| @@ -91,6 +91,9 @@ typedef int (*dm_iterate_devices_fn) (struct dm_target *ti, | |||
| 91 | iterate_devices_callout_fn fn, | 91 | iterate_devices_callout_fn fn, |
| 92 | void *data); | 92 | void *data); |
| 93 | 93 | ||
| 94 | typedef void (*dm_io_hints_fn) (struct dm_target *ti, | ||
| 95 | struct queue_limits *limits); | ||
| 96 | |||
| 94 | /* | 97 | /* |
| 95 | * Returns: | 98 | * Returns: |
| 96 | * 0: The target can handle the next I/O immediately. | 99 | * 0: The target can handle the next I/O immediately. |
| @@ -151,6 +154,7 @@ struct target_type { | |||
| 151 | dm_merge_fn merge; | 154 | dm_merge_fn merge; |
| 152 | dm_busy_fn busy; | 155 | dm_busy_fn busy; |
| 153 | dm_iterate_devices_fn iterate_devices; | 156 | dm_iterate_devices_fn iterate_devices; |
| 157 | dm_io_hints_fn io_hints; | ||
| 154 | 158 | ||
| 155 | /* For internal device-mapper use. */ | 159 | /* For internal device-mapper use. */ |
| 156 | struct list_head list; | 160 | struct list_head list; |
