From 5658ec2bdc9e5ea816a1dd227ffbb74d6cbfb8f5 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 15 Jul 2013 11:53:30 +0200 Subject: [PATCH] libdm: thin pool target sends messages once Clear send_messages flag when they have been delivered successfully. There is no need to validate it for all other activations of the same node in the dm_tree. Also add extra debug message which shows the reason for skipping sending of messages because the transaction_id has already the matching value. --- WHATS_NEW_DM | 1 + libdm/libdm-deptree.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index e784ada2f..b269f556f 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.78 - =================================== + Process thin messages once to active thin pool target for dm_tree. Optimize out setting the same value or read_ahead. Add DM_ARRAY_SIZE public macro. Move syslog code out of signal handle in dmeventd. diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c index fae944507..34cd960c8 100644 --- a/libdm/libdm-deptree.c +++ b/libdm/libdm-deptree.c @@ -1484,8 +1484,12 @@ static int _node_send_messages(struct dm_tree_node *dnode, if (!_thin_pool_status_transaction_id(dnode, &trans_id)) goto_bad; - if (trans_id == seg->transaction_id) + if (trans_id == seg->transaction_id) { + if (!dm_list_empty(&seg->thin_messages)) + log_debug_activation("Thin pool transaction_id matches %" PRIu64 + ", skipping messages.", trans_id); return 1; /* In sync - skip messages */ + } if (trans_id != (seg->transaction_id - 1)) { log_error("Thin pool transaction_id=%" PRIu64 ", while expected: %" PRIu64 ".", @@ -1784,9 +1788,12 @@ int dm_tree_activate_children(struct dm_tree_node *dnode, * resume should continue further, just whole command * has to report failure. */ - if (r && dnode->props.send_messages && - !(r = _node_send_messages(dnode, uuid_prefix, uuid_prefix_len))) - stack; + if (r && dnode->props.send_messages) { + if (!(r = _node_send_messages(dnode, uuid_prefix, uuid_prefix_len))) + stack; + else + dnode->props.send_messages = 0; /* messages posted */ + } handle = NULL;