diff options
author | Mike Snitzer <snitzer@redhat.com> | 2009-06-22 05:12:33 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2009-06-22 05:12:33 -0400 |
commit | af4874e03ed82f050d5872d8c39ce64bf16b5c38 (patch) | |
tree | 38aa5dee43b4bb7a369995d4f38dee992cb051e0 /drivers/md/dm-delay.c | |
parent | 1197764e403d97231eb6da2b1e16f511a7fd3101 (diff) |
dm target:s introduce iterate devices fn
Add .iterate_devices to 'struct target_type' to allow a function to be
called for all devices in a DM target. Implemented it for all targets
except those in dm-snap.c (origin and snapshot).
(The raid1 version number jumps to 1.12 because we originally reserved
1.1 to 1.11 for 'block_on_error' but ended up using 'handle_errors'
instead.)
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: martin.petersen@oracle.com
Diffstat (limited to 'drivers/md/dm-delay.c')
-rw-r--r-- | drivers/md/dm-delay.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/md/dm-delay.c b/drivers/md/dm-delay.c index 8ad8a9044bbf..4e5b843cd4d7 100644 --- a/drivers/md/dm-delay.c +++ b/drivers/md/dm-delay.c | |||
@@ -318,9 +318,26 @@ static int delay_status(struct dm_target *ti, status_type_t type, | |||
318 | return 0; | 318 | return 0; |
319 | } | 319 | } |
320 | 320 | ||
321 | static int delay_iterate_devices(struct dm_target *ti, | ||
322 | iterate_devices_callout_fn fn, void *data) | ||
323 | { | ||
324 | struct delay_c *dc = ti->private; | ||
325 | int ret = 0; | ||
326 | |||
327 | ret = fn(ti, dc->dev_read, dc->start_read, data); | ||
328 | if (ret) | ||
329 | goto out; | ||
330 | |||
331 | if (dc->dev_write) | ||
332 | ret = fn(ti, dc->dev_write, dc->start_write, data); | ||
333 | |||
334 | out: | ||
335 | return ret; | ||
336 | } | ||
337 | |||
321 | static struct target_type delay_target = { | 338 | static struct target_type delay_target = { |
322 | .name = "delay", | 339 | .name = "delay", |
323 | .version = {1, 0, 2}, | 340 | .version = {1, 1, 0}, |
324 | .module = THIS_MODULE, | 341 | .module = THIS_MODULE, |
325 | .ctr = delay_ctr, | 342 | .ctr = delay_ctr, |
326 | .dtr = delay_dtr, | 343 | .dtr = delay_dtr, |
@@ -328,6 +345,7 @@ static struct target_type delay_target = { | |||
328 | .presuspend = delay_presuspend, | 345 | .presuspend = delay_presuspend, |
329 | .resume = delay_resume, | 346 | .resume = delay_resume, |
330 | .status = delay_status, | 347 | .status = delay_status, |
348 | .iterate_devices = delay_iterate_devices, | ||
331 | }; | 349 | }; |
332 | 350 | ||
333 | static int __init dm_delay_init(void) | 351 | static int __init dm_delay_init(void) |