Store pointer to the snapshot device to tracked chunk. This is needed for the following patch that reroutes origin to the merging snapshot --- requests directed to the origin are tracked at the snapshot and it is not possible to identify the snapshot in origin's end_io (finding the snapshot needs to take a semaphore). Signed-off-by: Mikulas Patocka --- drivers/md/dm-snap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) Index: linux-2.6.26-rc5-devel/drivers/md/dm-snap.c =================================================================== --- linux-2.6.26-rc5-devel.orig/drivers/md/dm-snap.c 2008-06-17 01:20:04.000000000 +0200 +++ linux-2.6.26-rc5-devel/drivers/md/dm-snap.c 2008-06-17 01:20:09.000000000 +0200 @@ -81,6 +81,7 @@ struct dm_snap_tracked_chunk { struct hlist_node node; chunk_t chunk; + struct dm_snapshot *snap; }; static struct kmem_cache *tracked_chunk_cache; @@ -93,6 +94,7 @@ unsigned long flags; c->chunk = chunk; + c->snap = s; spin_lock_irqsave(&s->tracked_chunk_lock, flags); hlist_add_head(&c->node, @@ -102,9 +104,10 @@ return c; } -static void stop_tracking_chunk(struct dm_snapshot *s, struct dm_snap_tracked_chunk *c) +static void stop_tracking_chunk(struct dm_snap_tracked_chunk *c) { unsigned long flags; + struct dm_snapshot *s = c->snap; spin_lock_irqsave(&s->tracked_chunk_lock, flags); hlist_del(&c->node); @@ -1381,11 +1384,10 @@ static int snapshot_end_io(struct dm_target *ti, struct bio *bio, int error, union map_info *map_context) { - struct dm_snapshot *s = ti->private; struct dm_snap_tracked_chunk *c = map_context->ptr; if (c) - stop_tracking_chunk(s, c); + stop_tracking_chunk(c); return 0; }