aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-stripe.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-stripe.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-stripe.c')
-rw-r--r--drivers/md/dm-stripe.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/md/dm-stripe.c b/drivers/md/dm-stripe.c
index c64fe827a5f1..b240e85ae39a 100644
--- a/drivers/md/dm-stripe.c
+++ b/drivers/md/dm-stripe.c
@@ -313,15 +313,31 @@ static int stripe_end_io(struct dm_target *ti, struct bio *bio,
313 return error; 313 return error;
314} 314}
315 315
316static int stripe_iterate_devices(struct dm_target *ti,
317 iterate_devices_callout_fn fn, void *data)
318{
319 struct stripe_c *sc = ti->private;
320 int ret = 0;
321 unsigned i = 0;
322
323 do
324 ret = fn(ti, sc->stripe[i].dev,
325 sc->stripe[i].physical_start, data);
326 while (!ret && ++i < sc->stripes);
327
328 return ret;
329}
330
316static struct target_type stripe_target = { 331static struct target_type stripe_target = {
317 .name = "striped", 332 .name = "striped",
318 .version = {1, 1, 0}, 333 .version = {1, 2, 0},
319 .module = THIS_MODULE, 334 .module = THIS_MODULE,
320 .ctr = stripe_ctr, 335 .ctr = stripe_ctr,
321 .dtr = stripe_dtr, 336 .dtr = stripe_dtr,
322 .map = stripe_map, 337 .map = stripe_map,
323 .end_io = stripe_end_io, 338 .end_io = stripe_end_io,
324 .status = stripe_status, 339 .status = stripe_status,
340 .iterate_devices = stripe_iterate_devices,
325}; 341};
326 342
327int __init dm_stripe_init(void) 343int __init dm_stripe_init(void)