* [PATCH] dm snapshot: implement .iterate_devices
@ 2009-08-23 6:11 Mike Snitzer
2009-08-24 21:15 ` Andrew Morton
2009-08-26 14:50 ` [dm-devel] [PATCH] " Alasdair G Kergon
0 siblings, 2 replies; 6+ messages in thread
From: Mike Snitzer @ 2009-08-23 6:11 UTC (permalink / raw)
To: dm-devel; +Cc: linux-kernel
This patch implements .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 af4874e03ed82f050d5872d8c39ce64bf16b5c38 should have implemented
.iterate_devices for dm-snap.c's origin and snapshot targets.
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
---
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
index d573165..57f1bf7 100644
--- a/drivers/md/dm-snap.c
+++ b/drivers/md/dm-snap.c
@@ -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
*---------------------------------------------------------------*/
@@ -1410,20 +1419,29 @@ 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,
@@ -1431,6 +1449,7 @@ static struct target_type snapshot_target = {
.end_io = snapshot_end_io,
.resume = snapshot_resume,
.status = snapshot_status,
+ .iterate_devices = snapshot_iterate_devices,
};
static int __init dm_snapshot_init(void)
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] dm snapshot: implement .iterate_devices
2009-08-23 6:11 [PATCH] dm snapshot: implement .iterate_devices Mike Snitzer
@ 2009-08-24 21:15 ` Andrew Morton
2009-08-24 22:55 ` Mike Snitzer
2009-08-26 14:50 ` [dm-devel] [PATCH] " Alasdair G Kergon
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Morton @ 2009-08-24 21:15 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel, linux-kernel
On Sun, 23 Aug 2009 02:11:07 -0400
Mike Snitzer <snitzer@redhat.com> wrote:
> This patch implements .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.
Does this make the patch a regression fix?
> Commit af4874e03ed82f050d5872d8c39ce64bf16b5c38 should have implemented
> .iterate_devices for dm-snap.c's origin and snapshot targets.
Please use the form af4874e03ed82f050d5872d8c39ce64bf16b5c38 ("dm
target:s introduce iterate devices fn") when referring to commits.
Because commits might have different IDs in different trees (I think
that's the reason).
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: dm snapshot: implement .iterate_devices
2009-08-24 21:15 ` Andrew Morton
@ 2009-08-24 22:55 ` Mike Snitzer
0 siblings, 0 replies; 6+ messages in thread
From: Mike Snitzer @ 2009-08-24 22:55 UTC (permalink / raw)
To: Andrew Morton; +Cc: dm-devel, linux-kernel
On Mon, Aug 24 2009 at 5:15pm -0400,
Andrew Morton <akpm@linux-foundation.org> wrote:
> On Sun, 23 Aug 2009 02:11:07 -0400
> Mike Snitzer <snitzer@redhat.com> wrote:
>
> > This patch implements .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.
>
> Does this make the patch a regression fix?
Yes.
> > Commit af4874e03ed82f050d5872d8c39ce64bf16b5c38 should have implemented
> > .iterate_devices for dm-snap.c's origin and snapshot targets.
>
> Please use the form af4874e03ed82f050d5872d8c39ce64bf16b5c38 ("dm
> target:s introduce iterate devices fn") when referring to commits.
> Because commits might have different IDs in different trees (I think
> that's the reason).
OK, thanks for picking this up. I believe Alasdair is back from
vacation tomorrow and will be pushing other remaining DM fixes for
2.6.31 final.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dm-devel] [PATCH] dm snapshot: implement .iterate_devices
2009-08-23 6:11 [PATCH] dm snapshot: implement .iterate_devices Mike Snitzer
2009-08-24 21:15 ` Andrew Morton
@ 2009-08-26 14:50 ` Alasdair G Kergon
2009-08-26 18:19 ` Mike Snitzer
1 sibling, 1 reply; 6+ messages in thread
From: Alasdair G Kergon @ 2009-08-26 14:50 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel, linux-kernel
On Sun, Aug 23, 2009 at 02:11:07AM -0400, Mike Snitzer wrote:
> This patch implements .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 af4874e03ed82f050d5872d8c39ce64bf16b5c38 should have implemented
> .iterate_devices for dm-snap.c's origin and snapshot targets.
> +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);
> +}
> +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);
> +}
Why are these both seemingly the same? Is one sufficient?
And where are the characteristics of the 'cow' device taken into account?
Alasdair
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: dm snapshot: implement .iterate_devices
2009-08-26 14:50 ` [dm-devel] [PATCH] " Alasdair G Kergon
@ 2009-08-26 18:19 ` Mike Snitzer
2009-08-26 19:32 ` [dm-devel] " Alasdair G Kergon
0 siblings, 1 reply; 6+ messages in thread
From: Mike Snitzer @ 2009-08-26 18:19 UTC (permalink / raw)
To: Alasdair G Kergon; +Cc: dm-devel, linux-kernel
On Wed, Aug 26 2009 at 10:50am -0400,
Alasdair G Kergon <agk@redhat.com> wrote:
> On Sun, Aug 23, 2009 at 02:11:07AM -0400, Mike Snitzer wrote:
> > This patch implements .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 af4874e03ed82f050d5872d8c39ce64bf16b5c38 should have implemented
> > .iterate_devices for dm-snap.c's origin and snapshot targets.
>
> > +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);
> > +}
>
> > +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);
> > +}
>
> Why are these both seemingly the same? Is one sufficient?
One is not sufficient. If snapshot_iterate_devices() isn't provided the
snapshot fails IO on 4K drives; e.g. an ext3 mount in my test case:
sd 13:0:0:0: [sdc] Bad block number requested
EXT3-fs: unable to read superblock
> And where are the characteristics of the 'cow' device taken into account?
As we discussed, the snapshot_iterate_devices() needs more intelligence.
For now the current snapshot_iterate_devices() is a means to establish
more reasonable limits based on the origin. So in my 4K drive case it
was a means to an end but it was naively incomplete. One _could_ have a
cow with different logical_block_size, etc. (e.g. 512B origin + 4K cow).
So stacking the cow limits is clearly needed.
I'll work on a proper solution for snapshot_iterate_devices() and get
that to you ASAP.
Thanks for the review.
Mike
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [dm-devel] Re: dm snapshot: implement .iterate_devices
2009-08-26 18:19 ` Mike Snitzer
@ 2009-08-26 19:32 ` Alasdair G Kergon
0 siblings, 0 replies; 6+ messages in thread
From: Alasdair G Kergon @ 2009-08-26 19:32 UTC (permalink / raw)
To: Mike Snitzer; +Cc: dm-devel, linux-kernel
On Wed, Aug 26, 2009 at 02:19:08PM -0400, Mike Snitzer wrote:
> I'll work on a proper solution for snapshot_iterate_devices() and get
> that to you ASAP.
So let's push this patch as-is for 2.6.31 as it clearly fixes one problem,
and determine the right way of handling the characteristics of the 'cow'
device in a supplementary patch.
Alasdair
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-08-26 19:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-23 6:11 [PATCH] dm snapshot: implement .iterate_devices Mike Snitzer
2009-08-24 21:15 ` Andrew Morton
2009-08-24 22:55 ` Mike Snitzer
2009-08-26 14:50 ` [dm-devel] [PATCH] " Alasdair G Kergon
2009-08-26 18:19 ` Mike Snitzer
2009-08-26 19:32 ` [dm-devel] " Alasdair G Kergon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox