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
This commit is contained in:

committed by
Alasdair G Kergon

parent
1197764e40
commit
af4874e03e
@@ -318,9 +318,26 @@ static int delay_status(struct dm_target *ti, status_type_t type,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int delay_iterate_devices(struct dm_target *ti,
|
||||
iterate_devices_callout_fn fn, void *data)
|
||||
{
|
||||
struct delay_c *dc = ti->private;
|
||||
int ret = 0;
|
||||
|
||||
ret = fn(ti, dc->dev_read, dc->start_read, data);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
if (dc->dev_write)
|
||||
ret = fn(ti, dc->dev_write, dc->start_write, data);
|
||||
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct target_type delay_target = {
|
||||
.name = "delay",
|
||||
.version = {1, 0, 2},
|
||||
.version = {1, 1, 0},
|
||||
.module = THIS_MODULE,
|
||||
.ctr = delay_ctr,
|
||||
.dtr = delay_dtr,
|
||||
@@ -328,6 +345,7 @@ static struct target_type delay_target = {
|
||||
.presuspend = delay_presuspend,
|
||||
.resume = delay_resume,
|
||||
.status = delay_status,
|
||||
.iterate_devices = delay_iterate_devices,
|
||||
};
|
||||
|
||||
static int __init dm_delay_init(void)
|
||||
|
Reference in New Issue
Block a user