A method to hand over an exception store to another snapshot. You copy the exception store structure to another place, change "snap" pointer and call handover to fix internal pointers. Signed-off-by: Mikulas Patocka --- drivers/md/dm-exception-store.c | 13 +++++++++++++ drivers/md/dm-snap.h | 5 +++++ 2 files changed, 18 insertions(+) Index: linux-2.6.28-rc3-devel/drivers/md/dm-exception-store.c =================================================================== --- linux-2.6.28-rc3-devel.orig/drivers/md/dm-exception-store.c 2008-11-05 09:01:10.000000000 +0100 +++ linux-2.6.28-rc3-devel/drivers/md/dm-exception-store.c 2008-11-05 09:01:16.000000000 +0100 @@ -655,6 +655,13 @@ static void persistent_drop(struct excep DMWARN("write header failed"); } +static void persistent_handover(struct exception_store *store) +{ + struct pstore *ps = get_info(store); + + ps->snap = store->snap; +} + int dm_create_persistent(struct exception_store *store) { struct pstore *ps; @@ -688,6 +695,7 @@ int dm_create_persistent(struct exceptio store->commit_exception = persistent_commit; store->drop_snapshot = persistent_drop; store->fraction_full = persistent_fraction_full; + store->handover = persistent_handover; store->context = ps; return 0; @@ -741,6 +749,10 @@ static void transient_fraction_full(stru *denominator = get_dev_size(store->snap->cow->bdev); } +static void transient_handover(struct exception_store *store) +{ +} + int dm_create_transient(struct exception_store *store) { struct transient_c *tc; @@ -751,6 +763,7 @@ int dm_create_transient(struct exception store->commit_exception = transient_commit; store->drop_snapshot = NULL; store->fraction_full = transient_fraction_full; + store->handover = transient_handover; tc = kmalloc(sizeof(struct transient_c), GFP_KERNEL); if (!tc) Index: linux-2.6.28-rc3-devel/drivers/md/dm-snap.h =================================================================== --- linux-2.6.28-rc3-devel.orig/drivers/md/dm-snap.h 2008-11-05 09:01:15.000000000 +0100 +++ linux-2.6.28-rc3-devel/drivers/md/dm-snap.h 2008-11-05 09:01:16.000000000 +0100 @@ -137,6 +137,11 @@ struct exception_store { sector_t *numerator, sector_t *denominator); + /* + * Must be called when you move store to different snapshot. + */ + void (*handover) (struct exception_store *store); + struct dm_snapshot *snap; void *context; };