1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

device_mapper: split _node_send_message

For better code reuse split _node_send_messages into commont
messaging part and separate _thin_pool_node_send_messages.

Patch makes it possible to better reuse common code for messaging
other targets.
This commit is contained in:
Zdenek Kabelac 2018-06-23 20:50:36 +02:00
parent 19b92ae3f3
commit a1c81c009a

View File

@ -1510,34 +1510,14 @@ static struct load_segment *_get_last_load_segment(struct dm_tree_node *node)
}
/* For preload pass only validate pool's transaction_id */
static int _node_send_messages(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len,
int send)
static int _thin_pool_node_send_messages(struct dm_tree_node *dnode,
struct load_segment *seg,
int send)
{
struct load_segment *seg;
struct thin_message *tmsg;
struct dm_status_thin_pool stp;
const char *uuid;
int have_messages;
if (!dnode->info.exists)
return 1;
if (!(seg = _get_last_load_segment(dnode)))
return_0;
if (seg->type != SEG_THIN_POOL)
return 1;
if (!(uuid = dm_tree_node_get_uuid(dnode)))
return_0;
if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len)) {
log_debug_activation("UUID \"%s\" does not match.", uuid);
return 1;
}
if (!_thin_pool_get_status(dnode, &stp))
return_0;
@ -1582,6 +1562,36 @@ static int _node_send_messages(struct dm_tree_node *dnode,
return 1;
}
static int _node_send_messages(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len,
int send)
{
struct load_segment *seg;
const char *uuid;
if (!dnode->info.exists || !dnode->info.live_table)
return 1;
if (!(uuid = dm_tree_node_get_uuid(dnode)))
return_0;
if (!_uuid_prefix_matches(uuid, uuid_prefix, uuid_prefix_len)) {
log_debug_activation("UUID \"%s\" does not match.", uuid);
return 1;
}
if (!(seg = _get_last_load_segment(dnode)))
return_0;
switch (seg->type) {
case SEG_THIN_POOL: return _thin_pool_node_send_messages(dnode, seg, send);
}
return 1;
}
/*
* FIXME Don't attempt to deactivate known internal dependencies.
*/