diff options
author | Martin Schwenke <martin@meltin.net> | 2017-02-03 12:28:44 +1100 |
---|---|---|
committer | Martin Schwenke <martins@samba.org> | 2017-02-24 07:47:11 +0100 |
commit | 5bb6ec6af2359a5b463349df54c168741cb1aca3 (patch) | |
tree | 860ea23ffd629dc850c3c2f5bc6d1065b259e601 | |
parent | 0b4e609194f1f45d80a7e6274f8de66863b8d6de (diff) | |
download | samba-5bb6ec6af2359a5b463349df54c168741cb1aca3.tar.gz |
ctdb-ipalloc: Switch noiphost to struct bitmap
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r-- | ctdb/server/ipalloc.c | 10 | ||||
-rw-r--r-- | ctdb/server/ipalloc_common.c | 2 | ||||
-rw-r--r-- | ctdb/server/ipalloc_private.h | 2 |
3 files changed, 6 insertions, 8 deletions
diff --git a/ctdb/server/ipalloc.c b/ctdb/server/ipalloc.c index df638f01daa..a0e497eaca8 100644 --- a/ctdb/server/ipalloc.c +++ b/ctdb/server/ipalloc.c @@ -52,10 +52,8 @@ ipalloc_state_init(TALLOC_CTX *mem_ctx, ipalloc_state->num = num_nodes; - ipalloc_state->noiphost = - talloc_zero_array(ipalloc_state, - bool, - ipalloc_state->num); + ipalloc_state->noiphost = bitmap_talloc(ipalloc_state, + ipalloc_state->num); if (ipalloc_state->noiphost == NULL) { DEBUG(DEBUG_ERR, (__location__ " Out of memory\n")); goto fail; @@ -220,7 +218,7 @@ void ipalloc_set_node_flags(struct ipalloc_state *ipalloc_state, for (i=0;i<nodemap->num;i++) { /* Can not host IPs on INACTIVE node */ if (nodemap->node[i].flags & NODE_FLAGS_INACTIVE) { - ipalloc_state->noiphost[i] = true; + bitmap_set(ipalloc_state->noiphost, i); } /* If node is disabled then it can only host IPs if @@ -231,7 +229,7 @@ void ipalloc_set_node_flags(struct ipalloc_state *ipalloc_state, if (!(all_disabled && ipalloc_state->no_ip_host_on_all_disabled == 0)) { - ipalloc_state->noiphost[i] = true; + bitmap_set(ipalloc_state->noiphost, i); } } } diff --git a/ctdb/server/ipalloc_common.c b/ctdb/server/ipalloc_common.c index d961b871739..50bb59a5937 100644 --- a/ctdb/server/ipalloc_common.c +++ b/ctdb/server/ipalloc_common.c @@ -61,7 +61,7 @@ static bool can_node_host_ip(struct ipalloc_state *ipalloc_state, int32_t pnn, struct public_ip_list *ip) { - if (ipalloc_state->noiphost[pnn]) { + if (bitmap_query(ipalloc_state->noiphost, pnn)) { return false; } diff --git a/ctdb/server/ipalloc_private.h b/ctdb/server/ipalloc_private.h index cd74d9cc3f6..1f7385e4c47 100644 --- a/ctdb/server/ipalloc_private.h +++ b/ctdb/server/ipalloc_private.h @@ -32,7 +32,7 @@ struct ipalloc_state { /* Arrays with data for each node */ struct ctdb_public_ip_list *available_public_ips; struct ctdb_public_ip_list *known_public_ips; - bool *noiphost; + struct bitmap *noiphost; struct public_ip_list *all_ips; enum ipalloc_algorithm algorithm; |