From 9723090c920f522e12448c20d522efa9db09b1e8 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Thu, 11 May 2006 19:10:55 +0000 Subject: [PATCH] Add DM_CORELOG flag to dm_tree_node_add_mirror_target(). --- WHATS_NEW_DM | 1 + libdm/libdevmapper.h | 1 + libdm/libdm-deptree.c | 21 +++++++++++---------- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 071e5d8fd..29b7700b8 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.07 - ============================= + Add DM_CORELOG flag to dm_tree_node_add_mirror_target(). Avoid a dmeventd compiler warning. Version 1.02.06 - 10 May 2006 diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 9b6d3fa13..ecfd72c6e 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -350,6 +350,7 @@ int dm_tree_node_add_mirror_target(struct dm_tree_node *node, #define DM_NOSYNC 0x00000001 /* Known already in sync */ #define DM_FORCESYNC 0x00000002 /* Force resync */ #define DM_BLOCK_ON_ERROR 0x00000004 /* On error, suspend I/O */ +#define DM_CORELOG 0x00000008 /* In-memory log */ int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node, uint32_t region_size, diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index 82b54ec6b..99ac6c651 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1243,8 +1243,8 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin log_parm_count += hweight32(seg->flags); /* [no]sync, block_on_error etc. */ if (seg->clustered) { - if (seg->uuid) - log_parm_count++; /* uuid */ + if (seg->uuid && !(seg->flags & DM_CORELOG)) + log_parm_count++; /* uuid (already counted for core log) */ if ((tw = _dm_snprintf(params + pos, paramsize - pos, "clustered_")) < 0) { stack; /* Out of space */ return -1; @@ -1701,18 +1701,19 @@ int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node, seg = list_item(list_last(&node->props.segs), struct load_segment); if (log_uuid) { - if (!(log_node = dm_tree_find_node_by_uuid(node->dtree, log_uuid))) { - log_error("Couldn't find mirror log uuid %s.", log_uuid); - return 0; - } - - if (!_link_tree_nodes(node, log_node)) - return_0; - if (!(seg->uuid = dm_pool_strdup(node->dtree->mem, log_uuid))) { log_error("log uuid pool_strdup failed"); return 0; } + if (!(flags & DM_CORELOG)) { + if (!(log_node = dm_tree_find_node_by_uuid(node->dtree, log_uuid))) { + log_error("Couldn't find mirror log uuid %s.", log_uuid); + return 0; + } + + if (!_link_tree_nodes(node, log_node)) + return_0; + } } seg->log = log_node;