diff options
author | Martin Schwenke <martin@meltin.net> | 2014-02-07 17:32:12 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@gmail.com> | 2014-02-19 12:04:47 +1100 |
commit | 24b734f084de36160d065dc639100eab3b186f6c (patch) | |
tree | 8b3b30856e5c8dcf36348ee4eb5153eae7fe17d3 | |
parent | 9e5ef44f32fad6606bd95e619f0720a72344e441 (diff) | |
download | samba-24b734f084de36160d065dc639100eab3b186f6c.tar.gz samba-24b734f084de36160d065dc639100eab3b186f6c.tar.xz samba-24b734f084de36160d065dc639100eab3b186f6c.zip |
ctdb-recoverd: LCP2 cleanups
* Remove unnecessary candimbl parameter.
This parameter can be cheaply calculated in
lcp2_failback_candidate(). The compiler will probably do an
excellent job optimising it. :-)
* Clarify a debug statement
This is much clearer than doing a complex recalculation of a known
value.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r-- | ctdb/server/ctdb_takeover.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index bdf45603e4..d2b2a9e1e1 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -1880,7 +1880,6 @@ static bool lcp2_failback_candidate(struct ctdb_context *ctdb, struct ctdb_ipflags *ipflags, struct ctdb_public_ip_list *all_ips, int srcnode, - uint32_t candimbl, uint32_t *lcp2_imbalances, bool *rebalance_candidates) { @@ -1900,7 +1899,8 @@ static bool lcp2_failback_candidate(struct ctdb_context *ctdb, numnodes = talloc_array_length(ipflags); DEBUG(DEBUG_DEBUG,(" ----------------------------------------\n")); - DEBUG(DEBUG_DEBUG,(" CONSIDERING MOVES FROM %d [%d]\n", srcnode, candimbl)); + DEBUG(DEBUG_DEBUG,(" CONSIDERING MOVES FROM %d [%d]\n", + srcnode, lcp2_imbalances[srcnode])); for (tmp_ip=all_ips; tmp_ip; tmp_ip=tmp_ip->next) { /* Only consider addresses on srcnode. */ @@ -1910,7 +1910,7 @@ static bool lcp2_failback_candidate(struct ctdb_context *ctdb, /* What is this IP address costing the source node? */ srcdsum = ip_distance_2_sum(&(tmp_ip->addr), all_ips, srcnode); - srcimbl = candimbl - srcdsum; + srcimbl = lcp2_imbalances[srcnode] - srcdsum; /* Consider this IP address would cost each potential * destination node. Destination nodes are limited to @@ -1933,11 +1933,12 @@ static bool lcp2_failback_candidate(struct ctdb_context *ctdb, dstdsum = ip_distance_2_sum(&(tmp_ip->addr), all_ips, dstnode); dstimbl = lcp2_imbalances[dstnode] + dstdsum; DEBUG(DEBUG_DEBUG,(" %d [%d] -> %s -> %d [+%d]\n", - srcnode, srcimbl - lcp2_imbalances[srcnode], + srcnode, -srcdsum, ctdb_addr_to_str(&(tmp_ip->addr)), - dstnode, dstimbl - lcp2_imbalances[dstnode])); + dstnode, dstdsum)); - if ((dstimbl < candimbl) && (dstdsum < srcdsum) && \ + if ((dstimbl < lcp2_imbalances[srcnode]) && + (dstdsum < srcdsum) && \ ((mindstnode == -1) || \ ((srcimbl + dstimbl) < (minsrcimbl + mindstimbl)))) { @@ -2033,7 +2034,6 @@ try_again: ipflags, all_ips, lips[i].pnn, - lips[i].imbalance, lcp2_imbalances, rebalance_candidates)) { again = true; |