mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-ipalloc: Switch noiphost to struct bitmap
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
0b4e609194
commit
5bb6ec6af2
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user