Add arguments for exception store type. Add an argument representing an exception store type to vg_add_snapshot. Add an exception_store entry to struct lv_segment. Signed-off-by: Mikulas Patocka --- lib/format1/import-export.c | 2 +- lib/metadata/lv_manip.c | 3 ++- lib/metadata/metadata-exported.h | 8 +++++--- lib/metadata/snapshot_manip.c | 23 +++++++++++++++++------ lib/snapshot/snapshot.c | 4 +--- tools/lvconvert.c | 2 +- 6 files changed, 27 insertions(+), 15 deletions(-) Index: LVM2.2.02.53/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.53.orig/lib/metadata/lv_manip.c 2009-10-13 00:30:44.000000000 +0200 +++ LVM2.2.02.53/lib/metadata/lv_manip.c 2009-10-14 16:03:13.000000000 +0200 @@ -3108,7 +3108,8 @@ int lv_create_single(struct volume_group /* cow LV remains active and becomes snapshot LV */ if (!vg_add_snapshot(org, lv, NULL, - org->le_count, lp->chunk_size)) { + org->le_count, lp->shared_store, + lp->chunk_size)) { log_error("Couldn't create snapshot."); goto deactivate_and_revert_new_lv; } Index: LVM2.2.02.53/lib/metadata/metadata-exported.h =================================================================== --- LVM2.2.02.53.orig/lib/metadata/metadata-exported.h 2009-10-13 00:30:44.000000000 +0200 +++ LVM2.2.02.53/lib/metadata/metadata-exported.h 2009-10-14 16:03:12.000000000 +0200 @@ -291,6 +291,7 @@ struct lv_segment { uint32_t region_size; /* For mirrors - in sectors */ uint32_t extents_copied; struct logical_volume *log_lv; + const char *exception_store; struct dm_list tags; @@ -615,12 +616,13 @@ struct lv_segment *find_cow(const struct /* Given a cow LV, return its origin */ struct logical_volume *origin_from_cow(const struct logical_volume *lv); -void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, - struct logical_volume *cow, uint32_t chunk_size); +int init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, + struct logical_volume *cow, + const char *exception_store, uint32_t chunk_size); int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, union lvid *lvid, uint32_t extent_count, - uint32_t chunk_size); + const char *exception_store, uint32_t chunk_size); int vg_remove_snapshot(struct logical_volume *cow); Index: LVM2.2.02.53/lib/metadata/snapshot_manip.c =================================================================== --- LVM2.2.02.53.orig/lib/metadata/snapshot_manip.c 2009-10-13 00:30:44.000000000 +0200 +++ LVM2.2.02.53/lib/metadata/snapshot_manip.c 2009-10-14 16:03:12.000000000 +0200 @@ -61,8 +61,9 @@ struct logical_volume *origin_from_cow(c return lv->snapshot->origin; } -void init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, - struct logical_volume *cow, uint32_t chunk_size) +int init_snapshot_seg(struct lv_segment *seg, struct logical_volume *origin, + struct logical_volume *cow, const char *exception_store, + uint32_t chunk_size) { seg->chunk_size = chunk_size; seg->origin = origin; @@ -80,12 +81,24 @@ void init_snapshot_seg(struct lv_segment seg->lv->status |= (SNAPSHOT | VIRTUAL); + if (exception_store) { + seg->exception_store = dm_pool_strdup(seg->lv->vg->cmd->mem, + exception_store); + if (!seg->exception_store) { + log_error("Out of memory."); + return_0; + } + } + dm_list_add(&origin->snapshot_segs, &seg->origin_list); + + return 1; } int vg_add_snapshot(struct logical_volume *origin, struct logical_volume *cow, union lvid *lvid, - uint32_t extent_count, uint32_t chunk_size) + uint32_t extent_count, const char *exception_store, + uint32_t chunk_size) { struct logical_volume *snap; struct lv_segment *seg; @@ -113,9 +126,7 @@ int vg_add_snapshot(struct logical_volum if (!(seg = alloc_snapshot_seg(snap, 0, 0))) return_0; - init_snapshot_seg(seg, origin, cow, chunk_size); - - return 1; + return init_snapshot_seg(seg, origin, cow, exception_store, chunk_size); } int vg_remove_snapshot(struct logical_volume *cow) Index: LVM2.2.02.53/lib/format1/import-export.c =================================================================== --- LVM2.2.02.53.orig/lib/format1/import-export.c 2009-10-13 00:30:44.000000000 +0200 +++ LVM2.2.02.53/lib/format1/import-export.c 2009-10-14 16:03:12.000000000 +0200 @@ -613,7 +613,7 @@ int import_snapshots(struct dm_pool *mem /* insert the snapshot */ if (!vg_add_snapshot(org, cow, NULL, - org->le_count, + org->le_count, NULL, lvd->lv_chunk_size)) { log_error("Couldn't add snapshot."); return 0; Index: LVM2.2.02.53/tools/lvconvert.c =================================================================== --- LVM2.2.02.53.orig/tools/lvconvert.c 2009-10-13 00:30:44.000000000 +0200 +++ LVM2.2.02.53/tools/lvconvert.c 2009-10-14 16:03:12.000000000 +0200 @@ -837,7 +837,7 @@ static int lvconvert_snapshot(struct cmd return 0; } - if (!vg_add_snapshot(org, lv, NULL, org->le_count, lp->chunk_size)) { + if (!vg_add_snapshot(org, lv, NULL, org->le_count, NULL, lp->chunk_size)) { log_error("Couldn't create snapshot."); return 0; } Index: LVM2.2.02.53/lib/snapshot/snapshot.c =================================================================== --- LVM2.2.02.53.orig/lib/snapshot/snapshot.c 2009-10-13 01:07:43.000000000 +0200 +++ LVM2.2.02.53/lib/snapshot/snapshot.c 2009-10-14 16:03:07.000000000 +0200 @@ -72,9 +72,7 @@ static int _snap_text_import(struct lv_s return 0; } - init_snapshot_seg(seg, org, cow, chunk_size); - - return 1; + return init_snapshot_seg(seg, org, cow, NULL, chunk_size); } static int _snap_text_export(const struct lv_segment *seg, struct formatter *f)