Use a string instead of an integer to specify the exception store type. It will be used for shared snapshots. Signed-off-by: Mikulas Patocka --- lib/activate/dev_manager.c | 2 +- libdm/libdevmapper.h | 2 +- libdm/libdm-deptree.c | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 11 deletions(-) Index: LVM2.2.02.60/lib/activate/dev_manager.c =================================================================== --- LVM2.2.02.60.orig/lib/activate/dev_manager.c 2010-02-10 22:39:59.000000000 +0100 +++ LVM2.2.02.60/lib/activate/dev_manager.c 2010-02-10 22:42:20.000000000 +0100 @@ -1045,7 +1045,7 @@ static int _add_snapshot_target_to_dtree size = (uint64_t) snap_seg->len * snap_seg->origin->vg->extent_size; - if (!dm_tree_node_add_snapshot_target(dnode, size, origin_dlid, cow_dlid, 1, snap_seg->chunk_size)) + if (!dm_tree_node_add_snapshot_target(dnode, size, origin_dlid, cow_dlid, "P", snap_seg->chunk_size)) return_0; return 1; Index: LVM2.2.02.60/libdm/libdm-deptree.c =================================================================== --- LVM2.2.02.60.orig/libdm/libdm-deptree.c 2010-02-10 22:39:59.000000000 +0100 +++ LVM2.2.02.60/libdm/libdm-deptree.c 2010-02-10 22:42:20.000000000 +0100 @@ -79,7 +79,7 @@ struct load_segment { uint32_t stripe_size; /* Striped */ - int persistent; /* Snapshot */ + const char *exception_store; /* Snapshot */ uint32_t chunk_size; /* Snapshot */ struct dm_tree_node *cow; /* Snapshot */ struct dm_tree_node *origin; /* Snapshot + Snapshot origin */ @@ -1482,8 +1482,8 @@ static int _emit_segment_line(struct dm_ return_0; if (!_build_dev_string(cowbuf, sizeof(cowbuf), seg->cow)) return_0; - EMIT_PARAMS(pos, "%s %s %c %d", originbuf, cowbuf, - seg->persistent ? 'P' : 'N', seg->chunk_size); + EMIT_PARAMS(pos, "%s %s %s %d", originbuf, cowbuf, + seg->exception_store, seg->chunk_size); break; case SEG_SNAPSHOT_ORIGIN: if (!_build_dev_string(originbuf, sizeof(originbuf), seg->origin)) @@ -1739,7 +1739,7 @@ static struct load_segment *_add_segment seg->area_count = 0; dm_list_init(&seg->areas); seg->stripe_size = 0; - seg->persistent = 0; + seg->exception_store = NULL; seg->chunk_size = 0; seg->cow = NULL; seg->origin = NULL; @@ -1781,7 +1781,7 @@ static int _add_snapshot_target(struct d const char *origin_uuid, const char *cow_uuid, const char *merge_uuid, - int persistent, + const char *exception_store, uint32_t chunk_size) { struct load_segment *seg; @@ -1811,7 +1811,11 @@ static int _add_snapshot_target(struct d if (!_link_tree_nodes(node, cow_node)) return_0; - seg->persistent = persistent ? 1 : 0; + seg->exception_store = dm_pool_strdup(node->dtree->mem, exception_store); + if (!seg->exception_store) { + log_error("exception_store allocation failed"); + return_0; + } seg->chunk_size = chunk_size; if (merge_uuid) { @@ -1839,11 +1843,11 @@ int dm_tree_node_add_snapshot_target(str uint64_t size, const char *origin_uuid, const char *cow_uuid, - int persistent, + const char *exception_store, uint32_t chunk_size) { return _add_snapshot_target(node, size, origin_uuid, cow_uuid, - NULL, persistent, chunk_size); + NULL, exception_store, chunk_size); } int dm_tree_node_add_snapshot_merge_target(struct dm_tree_node *node, @@ -1854,7 +1858,7 @@ int dm_tree_node_add_snapshot_merge_targ uint32_t chunk_size) { return _add_snapshot_target(node, size, origin_uuid, cow_uuid, - merge_uuid, 1, chunk_size); + merge_uuid, "P", chunk_size); } int dm_tree_node_add_error_target(struct dm_tree_node *node, Index: LVM2.2.02.60/libdm/libdevmapper.h =================================================================== --- LVM2.2.02.60.orig/libdm/libdevmapper.h 2010-02-10 22:39:59.000000000 +0100 +++ LVM2.2.02.60/libdm/libdevmapper.h 2010-02-10 22:42:20.000000000 +0100 @@ -392,7 +392,7 @@ int dm_tree_node_add_snapshot_target(str uint64_t size, const char *origin_uuid, const char *cow_uuid, - int persistent, + const char *exception_store, uint32_t chunk_size); int dm_tree_node_add_snapshot_merge_target(struct dm_tree_node *node, uint64_t size,