diff options
author | Martin Schwenke <martin@meltin.net> | 2016-11-18 16:08:13 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2016-12-02 00:24:28 +0100 |
commit | 429377a2426fdfc8c3f7d8854fa2189ad36ff78c (patch) | |
tree | 4b7f0c2754529397df40eca7cc07b88c4170e465 /ctdb/server/ipalloc.h | |
parent | 24db43839f8a17c4498454d4bbd24411f647defa (diff) | |
download | samba-429377a2426fdfc8c3f7d8854fa2189ad36ff78c.tar.gz |
ctdb-ipalloc: Optimise check to see if IP is available on a node
Use a "bitmap" of available IPs for each IP address instead of walking
the list of available IP addresses.
For ctdb/tests/takeover/lcp2.030.sh, this improves the time taken on
my laptop from:
real 0m11.997s
user 0m11.960s
sys 0m0.000s
to
real 0m8.571s
user 0m8.544s
sys 0m0.000s
So, when assigning all 900 IP addresses the improvement is about 25%.
For the no-op case (where all IPs are already assigned to nodes), the
extra setup adds a small fraction of a second for 900 IPs.
Intermediate cases result in intermediate improvements.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb/server/ipalloc.h')
-rw-r--r-- | ctdb/server/ipalloc.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/ctdb/server/ipalloc.h b/ctdb/server/ipalloc.h index d116426c7be..4413b2a0d19 100644 --- a/ctdb/server/ipalloc.h +++ b/ctdb/server/ipalloc.h @@ -31,6 +31,7 @@ struct public_ip_list { struct public_ip_list *next; uint32_t pnn; ctdb_sock_addr addr; + bool *available_on; }; #define IP_KEYLEN 4 |