aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-mpath.c
diff options
context:
space:
mode:
authorMike Snitzer <snitzer@redhat.com>2009-06-22 05:12:33 -0400
committerAlasdair G Kergon <agk@redhat.com>2009-06-22 05:12:33 -0400
commitaf4874e03ed82f050d5872d8c39ce64bf16b5c38 (patch)
tree38aa5dee43b4bb7a369995d4f38dee992cb051e0 /drivers/md/dm-mpath.c
parent1197764e403d97231eb6da2b1e16f511a7fd3101 (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-mpath.c')
-rw-r--r--drivers/md/dm-mpath.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 890c0e8ed13e..f8aeaaa54afe 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1450,12 +1450,32 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
1450 return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg); 1450 return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);
1451} 1451}
1452 1452
1453static int multipath_iterate_devices(struct dm_target *ti,
1454 iterate_devices_callout_fn fn, void *data)
1455{
1456 struct multipath *m = ti->private;
1457 struct priority_group *pg;
1458 struct pgpath *p;
1459 int ret = 0;
1460
1461 list_for_each_entry(pg, &m->priority_groups, list) {
1462 list_for_each_entry(p, &pg->pgpaths, list) {
1463 ret = fn(ti, p->path.dev, ti->begin, data);
1464 if (ret)
1465 goto out;
1466 }
1467 }
1468
1469out:
1470 return ret;
1471}
1472
1453/*----------------------------------------------------------------- 1473/*-----------------------------------------------------------------
1454 * Module setup 1474 * Module setup
1455 *---------------------------------------------------------------*/ 1475 *---------------------------------------------------------------*/
1456static struct target_type multipath_target = { 1476static struct target_type multipath_target = {
1457 .name = "multipath", 1477 .name = "multipath",
1458 .version = {1, 0, 5}, 1478 .version = {1, 1, 0},
1459 .module = THIS_MODULE, 1479 .module = THIS_MODULE,
1460 .ctr = multipath_ctr, 1480 .ctr = multipath_ctr,
1461 .dtr = multipath_dtr, 1481 .dtr = multipath_dtr,
@@ -1466,6 +1486,7 @@ static struct target_type multipath_target = {
1466 .status = multipath_status, 1486 .status = multipath_status,
1467 .message = multipath_message, 1487 .message = multipath_message,
1468 .ioctl = multipath_ioctl, 1488 .ioctl = multipath_ioctl,
1489 .iterate_devices = multipath_iterate_devices,
1469}; 1490};
1470 1491
1471static int __init dm_multipath_init(void) 1492static int __init dm_multipath_init(void)