Skip to content

Commit

Permalink
dm snapshot: implement iterate devices
Browse files Browse the repository at this point in the history
Implement the .iterate_devices for the origin and snapshot targets.
dm-snapshot's lack of .iterate_devices resulted in the inability to
properly establish queue_limits for both targets.

With 4K sector drives: an unfortunate side-effect of not establishing
proper limits in either targets' DM device was that IO to the devices
would fail even though both had been created without error.

Commit af4874e ("dm target:s introduce
iterate devices fn") in 2.6.31-rc1 should have implemented .iterate_devices
for dm-snap.c's origin and snapshot targets.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Mike Snitzer authored and Alasdair G Kergon committed Sep 4, 2009
1 parent a77e28c commit 8811f46
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions drivers/md/dm-snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,6 +1176,15 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
return 0;
}

static int snapshot_iterate_devices(struct dm_target *ti,
iterate_devices_callout_fn fn, void *data)
{
struct dm_snapshot *snap = ti->private;

return fn(ti, snap->origin, 0, ti->len, data);
}


/*-----------------------------------------------------------------
* Origin methods
*---------------------------------------------------------------*/
Expand Down Expand Up @@ -1410,27 +1419,37 @@ static int origin_status(struct dm_target *ti, status_type_t type, char *result,
return 0;
}

static int origin_iterate_devices(struct dm_target *ti,
iterate_devices_callout_fn fn, void *data)
{
struct dm_dev *dev = ti->private;

return fn(ti, dev, 0, ti->len, data);
}

static struct target_type origin_target = {
.name = "snapshot-origin",
.version = {1, 6, 0},
.version = {1, 7, 0},
.module = THIS_MODULE,
.ctr = origin_ctr,
.dtr = origin_dtr,
.map = origin_map,
.resume = origin_resume,
.status = origin_status,
.iterate_devices = origin_iterate_devices,
};

static struct target_type snapshot_target = {
.name = "snapshot",
.version = {1, 6, 0},
.version = {1, 7, 0},
.module = THIS_MODULE,
.ctr = snapshot_ctr,
.dtr = snapshot_dtr,
.map = snapshot_map,
.end_io = snapshot_end_io,
.resume = snapshot_resume,
.status = snapshot_status,
.iterate_devices = snapshot_iterate_devices,
};

static int __init dm_snapshot_init(void)
Expand Down

0 comments on commit 8811f46

Please sign in to comment.