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.85/lib/activate/dev_manager.c =================================================================== --- LVM2.2.02.85.orig/lib/activate/dev_manager.c 2011-05-20 14:56:55.000000000 +0200 +++ LVM2.2.02.85/lib/activate/dev_manager.c 2011-05-23 15:58:54.000000000 +0200 @@ -1265,7 +1265,7 @@ static int _add_snapshot_target_to_dtree return_0; } else if (!dm_tree_node_add_snapshot_target(dnode, size, origin_dlid, - cow_dlid, 1, snap_seg->chunk_size)) + cow_dlid, "P", snap_seg->chunk_size)) return_0; return 1; Index: LVM2.2.02.85/libdm/libdm-deptree.c =================================================================== --- LVM2.2.02.85.orig/libdm/libdm-deptree.c 2011-05-20 14:55:49.000000000 +0200 +++ LVM2.2.02.85/libdm/libdm-deptree.c 2011-05-23 15:58:55.000000000 +0200 @@ -102,7 +102,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 */ @@ -1696,8 +1696,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)) @@ -1971,7 +1971,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; @@ -2013,7 +2013,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; @@ -2043,7 +2043,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) { @@ -2071,11 +2075,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, @@ -2086,7 +2090,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.85/libdm/libdevmapper.h =================================================================== --- LVM2.2.02.85.orig/libdm/libdevmapper.h 2011-05-20 14:55:47.000000000 +0200 +++ LVM2.2.02.85/libdm/libdevmapper.h 2011-05-23 15:58:55.000000000 +0200 @@ -408,7 +408,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,