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.70/lib/activate/dev_manager.c =================================================================== --- LVM2.2.02.70.orig/lib/activate/dev_manager.c 2010-05-24 17:32:20.000000000 +0200 +++ LVM2.2.02.70/lib/activate/dev_manager.c 2010-07-10 04:07:27.000000000 +0200 @@ -1234,7 +1234,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.70/libdm/libdm-deptree.c =================================================================== --- LVM2.2.02.70.orig/libdm/libdm-deptree.c 2010-07-02 23:16:51.000000000 +0200 +++ LVM2.2.02.70/libdm/libdm-deptree.c 2010-07-10 04:07:27.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)) @@ -1972,7 +1972,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; @@ -2014,7 +2014,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; @@ -2044,7 +2044,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) { @@ -2072,11 +2076,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, @@ -2087,7 +2091,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.70/libdm/libdevmapper.h =================================================================== --- LVM2.2.02.70.orig/libdm/libdevmapper.h 2010-07-06 00:22:43.000000000 +0200 +++ LVM2.2.02.70/libdm/libdevmapper.h 2010-07-10 04:07:27.000000000 +0200 @@ -401,7 +401,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,