From 9e5ef44f32fad6606bd95e619f0720a72344e441 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 7 Feb 2014 14:28:54 +1100 Subject: ctdb-recoverd: Optimise check for rebalance candidates in LCP2 Currently this can be checked many times. However, there's no point calling the rebalance/failback code at all if there are no rebalance candidates. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/server/ctdb_takeover.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index d3a6e25aa3..bdf45603e4 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -1998,28 +1998,13 @@ static void lcp2_failback(struct ctdb_context *ctdb, uint32_t *lcp2_imbalances, bool *rebalance_candidates) { - int i, num_rebalance_candidates, numnodes; + int i, numnodes; struct lcp2_imbalance_pnn * lips; bool again; numnodes = talloc_array_length(ipflags); try_again: - - /* It is only worth continuing if we have suitable target - * nodes to transfer IPs to. This check is much cheaper than - * continuing on... - */ - num_rebalance_candidates = 0; - for (i=0; i