1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-23 21:35:29 +03:00

add clustered log uuid

This commit is contained in:
Alasdair Kergon 2006-02-06 20:18:10 +00:00
parent b0473bffcb
commit 74dd29f843

View File

@ -86,6 +86,7 @@ struct load_segment {
unsigned clustered; /* Mirror */
unsigned mirror_area_count; /* Mirror */
uint32_t flags; /* Mirror log */
char *uuid; /* Clustered mirror log */
};
/* Per-device properties */
@ -1238,7 +1239,12 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin
case SEG_LINEAR:
break;
case SEG_MIRRORED:
log_parm_count = 1; /* Region size */
log_parm_count = hweight32(seg->flags); /* [no]sync, block_on_error etc. */
if (seg->clustered) {
if (seg->uuid)
log_parm_count++; /* uuid */
if ((tw = _dm_snprintf(params + pos, paramsize - pos, "clustered_")) < 0) {
stack; /* Out of space */
return -1;
@ -1246,9 +1252,6 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin
pos += tw;
}
log_parm_count = 1; /* Region size */
log_parm_count = hweight32(seg->flags); /* [no]sync, block_on_error etc. */
if (!seg->log)
logtype = "core";
else {
@ -1278,6 +1281,14 @@ static int _emit_segment_line(struct dm_task *dmt, struct load_segment *seg, uin
}
pos += tw;
if (seg->clustered && seg->uuid) {
if ((tw = _dm_snprintf(params + pos, paramsize - pos, "%s ", seg->uuid)) < 0) {
stack; /* Out of space */
return -1;
}
pos += tw;
}
if ((seg->flags & DM_NOSYNC)) {
if ((tw = _dm_snprintf(params + pos, paramsize - pos, "nosync ")) < 0) {
stack; /* Out of space */
@ -1694,8 +1705,14 @@ int dm_tree_node_add_mirror_target_log(struct dm_tree_node *node,
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;
}
}
seg->log = log_node;