1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Replicator: support deactivate of replicator-dev nodes

Introducing dm_tree_node_set_presuspend_node() for presuspending child
node (i.e. replicator control target) before deactivation of parent node
(i.e. replicator-dev target).

This patch presents no functional change to current dtree - only
replicator target currently sets presuspend node for dev nodes.
This commit is contained in:
Zdenek Kabelac 2010-05-21 12:27:02 +00:00
parent b262f3e19e
commit 76d1aec8e0
4 changed files with 26 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.67 - Version 2.02.67 -
=============================== ===============================
Added dm_tree_node_set_presuspend_node() to presuspend child in deactivate.
Initial libdm support for Replicator target (API is not stable yet). Initial libdm support for Replicator target (API is not stable yet).
Extend process_each_lv_in_vg() with support for list of failed lvnames. Extend process_each_lv_in_vg() with support for list of failed lvnames.
Return ECMD_FAILED for break in process_each_lv() and process_each_segment_in_lv(). Return ECMD_FAILED for break in process_each_lv() and process_each_segment_in_lv().

View File

@ -82,6 +82,7 @@ dm_tree_node_add_mirror_target_log
dm_tree_node_add_target_area dm_tree_node_add_target_area
dm_tree_node_add_replicator_target dm_tree_node_add_replicator_target
dm_tree_node_add_replicator_dev_target dm_tree_node_add_replicator_dev_target
dm_tree_node_set_presuspend_node
dm_tree_node_set_read_ahead dm_tree_node_set_read_ahead
dm_tree_skip_lockfs dm_tree_skip_lockfs
dm_tree_use_no_flush_suspend dm_tree_use_no_flush_suspend

View File

@ -474,6 +474,9 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
uint32_t slog_region_size); uint32_t slog_region_size);
/* End of Replicator API */ /* End of Replicator API */
void dm_tree_node_set_presuspend_node(struct dm_tree_node *node,
struct dm_tree_node *presuspend_node);
int dm_tree_node_add_target_area(struct dm_tree_node *node, int dm_tree_node_add_target_area(struct dm_tree_node *node,
const char *dev_name, const char *dev_name,
const char *dlid, const char *dlid,

View File

@ -168,6 +168,12 @@ struct dm_tree_node {
void *context; /* External supplied context */ void *context; /* External supplied context */
struct load_properties props; /* For creation/table (re)load */ struct load_properties props; /* For creation/table (re)load */
/*
* If presuspend of child node is needed
* Note: only direct child is allowed
*/
struct dm_tree_node *presuspend_node;
}; };
struct dm_tree { struct dm_tree {
@ -684,6 +690,12 @@ void dm_tree_node_set_read_ahead(struct dm_tree_node *dnode,
dnode->props.read_ahead_flags = read_ahead_flags; dnode->props.read_ahead_flags = read_ahead_flags;
} }
void dm_tree_node_set_presuspend_node(struct dm_tree_node *node,
struct dm_tree_node *presuspend_node)
{
node->presuspend_node = presuspend_node;
}
int dm_tree_add_dev(struct dm_tree *dtree, uint32_t major, uint32_t minor) int dm_tree_add_dev(struct dm_tree *dtree, uint32_t major, uint32_t minor)
{ {
return _add_dev(dtree, &dtree->root, major, minor, 0) ? 1 : 0; return _add_dev(dtree, &dtree->root, major, minor, 0) ? 1 : 0;
@ -794,6 +806,10 @@ static int _children_suspended(struct dm_tree_node *node,
if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len)) if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len))
continue; continue;
/* Ignore if parent node wants to presuspend this node */
if (dlink->node->presuspend_node == node)
continue;
if (!(dinfo = dm_tree_node_get_info(dlink->node))) { if (!(dinfo = dm_tree_node_get_info(dlink->node))) {
stack; /* FIXME Is this normal? */ stack; /* FIXME Is this normal? */
return 0; return 0;
@ -1095,6 +1111,11 @@ static int _dm_tree_deactivate_children(struct dm_tree_node *dnode,
continue; continue;
} }
/* Suspend child node first if requested */
if (child->presuspend_node &&
!dm_tree_suspend_children(child, uuid_prefix, uuid_prefix_len))
continue;
if (!_deactivate_node(name, info.major, info.minor, if (!_deactivate_node(name, info.major, info.minor,
&child->dtree->cookie, child->udev_flags)) { &child->dtree->cookie, child->udev_flags)) {
log_error("Unable to deactivate %s (%" PRIu32 log_error("Unable to deactivate %s (%" PRIu32