diff --git a/ctdb/server/ipalloc.c b/ctdb/server/ipalloc.c index dce2b03cad29..e18c8994b878 100644 --- a/ctdb/server/ipalloc.c +++ b/ctdb/server/ipalloc.c @@ -92,7 +92,7 @@ static int getips_count_callback(void *param, void *data) static struct public_ip_list * create_merged_ip_list(struct ipalloc_state *ipalloc_state) { - int i, j; + unsigned int i, j; struct public_ip_list *ip_list; struct ctdb_public_ip_list *public_ips; struct trbt_tree *ip_tree; @@ -147,7 +147,7 @@ create_merged_ip_list(struct ipalloc_state *ipalloc_state) static bool populate_bitmap(struct ipalloc_state *ipalloc_state) { struct public_ip_list *ip = NULL; - int i, j; + unsigned int i, j; for (ip = ipalloc_state->all_ips; ip != NULL; ip = ip->next) { @@ -210,14 +210,14 @@ void ipalloc_set_public_ips(struct ipalloc_state *ipalloc_state, * right now... */ bool ipalloc_can_host_ips(struct ipalloc_state *ipalloc_state) { - int i; + unsigned int i; bool have_ips = false; for (i=0; i < ipalloc_state->num; i++) { struct ctdb_public_ip_list *ips = ipalloc_state->known_public_ips; if (ips[i].num != 0) { - int j; + unsigned int j; have_ips = true; /* Succeed if an address is hosted on node i */ for (j=0; j < ips[i].num; j++) { diff --git a/ctdb/server/ipalloc_common.c b/ctdb/server/ipalloc_common.c index b8784dd71ad6..a0152e3285dd 100644 --- a/ctdb/server/ipalloc_common.c +++ b/ctdb/server/ipalloc_common.c @@ -41,7 +41,7 @@ /* Given a physical node, return the number of public addresses that is currently assigned to this node. */ -int node_ip_coverage(int32_t pnn, struct public_ip_list *ips) +int node_ip_coverage(uint32_t pnn, struct public_ip_list *ips) { int num=0; @@ -82,8 +82,9 @@ bool can_node_takeover_ip(struct ipalloc_state *ipalloc_state, int find_takeover_node(struct ipalloc_state *ipalloc_state, struct public_ip_list *ip) { - int pnn, min=0, num; - int i, numnodes; + unsigned int pnn; + int min=0, num; + unsigned int i, numnodes; numnodes = ipalloc_state->num; pnn = -1; diff --git a/ctdb/server/ipalloc_lcp2.c b/ctdb/server/ipalloc_lcp2.c index 1146bb60f160..dc42a852edbc 100644 --- a/ctdb/server/ipalloc_lcp2.c +++ b/ctdb/server/ipalloc_lcp2.c @@ -74,7 +74,7 @@ static uint32_t ip_distance(ctdb_sock_addr *ip1, ctdb_sock_addr *ip2) */ static uint32_t ip_distance_2_sum(ctdb_sock_addr *ip, struct public_ip_list *ips, - int pnn) + unsigned int pnn) { struct public_ip_list *t; uint32_t d; @@ -109,7 +109,8 @@ static uint32_t ip_distance_2_sum(ctdb_sock_addr *ip, /* Return the LCP2 imbalance metric for addresses currently assigned to the given node. */ -static uint32_t lcp2_imbalance(struct public_ip_list * all_ips, int pnn) +static uint32_t lcp2_imbalance(struct public_ip_list * all_ips, + unsigned int pnn) { struct public_ip_list *t; @@ -132,7 +133,7 @@ static bool lcp2_init(struct ipalloc_state *ipalloc_state, uint32_t **lcp2_imbalances, bool **rebalance_candidates) { - int i, numnodes; + unsigned int i, numnodes; struct public_ip_list *t; numnodes = ipalloc_state->num; @@ -198,9 +199,9 @@ static void lcp2_allocate_unassigned(struct ipalloc_state *ipalloc_state, uint32_t *lcp2_imbalances) { struct public_ip_list *t; - int dstnode, numnodes; + unsigned int dstnode, numnodes; - int minnode; + unsigned int minnode; uint32_t mindsum, dstdsum, dstimbl; uint32_t minimbl = 0; struct public_ip_list *minip; @@ -302,11 +303,11 @@ static void lcp2_allocate_unassigned(struct ipalloc_state *ipalloc_state, * combination to move from the source node. */ static bool lcp2_failback_candidate(struct ipalloc_state *ipalloc_state, - int srcnode, + unsigned int srcnode, uint32_t *lcp2_imbalances, bool *rebalance_candidates) { - int dstnode, mindstnode, numnodes; + unsigned int dstnode, mindstnode, numnodes; uint32_t srcimbl, srcdsum, dstimbl, dstdsum; uint32_t minsrcimbl, mindstimbl; struct public_ip_list *minip; @@ -402,7 +403,7 @@ static bool lcp2_failback_candidate(struct ipalloc_state *ipalloc_state, struct lcp2_imbalance_pnn { uint32_t imbalance; - int pnn; + unsigned int pnn; }; static int lcp2_cmp_imbalance_pnn(const void * a, const void * b) diff --git a/ctdb/server/ipalloc_nondeterministic.c b/ctdb/server/ipalloc_nondeterministic.c index 534ac5b9ee74..3c2bdea06cb1 100644 --- a/ctdb/server/ipalloc_nondeterministic.c +++ b/ctdb/server/ipalloc_nondeterministic.c @@ -37,8 +37,8 @@ static void basic_failback(struct ipalloc_state *ipalloc_state, int num_ips) { - int i, numnodes; - int maxnode, maxnum, minnode, minnum, num, retries; + unsigned int i, numnodes, maxnode, minnode; + int maxnum, minnum, num, retries; struct public_ip_list *t; numnodes = ipalloc_state->num; diff --git a/ctdb/server/ipalloc_private.h b/ctdb/server/ipalloc_private.h index bfa872904d63..3ea3d3100405 100644 --- a/ctdb/server/ipalloc_private.h +++ b/ctdb/server/ipalloc_private.h @@ -43,7 +43,7 @@ struct ipalloc_state { bool can_node_takeover_ip(struct ipalloc_state *ipalloc_state, int32_t pnn, struct public_ip_list *ip); -int node_ip_coverage(int32_t pnn, struct public_ip_list *ips); +int node_ip_coverage(uint32_t pnn, struct public_ip_list *ips); int find_takeover_node(struct ipalloc_state *ipalloc_state, struct public_ip_list *ip);