ctdb-recoverd: Make num_lmasters a local variable
authorMartin Schwenke <martin@meltin.net>
Sun, 29 Mar 2015 06:49:02 +0000 (17:49 +1100)
committerAmitay Isaacs <amitay@samba.org>
Sun, 10 May 2015 01:22:13 +0000 (03:22 +0200)
It isn't used anywhere else and is always re-initialised to 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index 49d69f09c7457daababd7641e8998c46712089ad..391890677bc7ae15c1a79c88de927ee3030bc8fc 100644 (file)
@@ -225,7 +225,6 @@ struct ctdb_banning_state {
 struct ctdb_recoverd {
        struct ctdb_context *ctdb;
        uint32_t recmaster;
-       uint32_t num_lmasters;
        uint32_t last_culprit_node;
        struct ctdb_node_map *nodemap;
        struct timeval priority_time;
@@ -3407,6 +3406,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        struct ctdb_node_map **remote_nodemaps=NULL;
        struct ctdb_vnn_map *vnnmap=NULL;
        struct ctdb_vnn_map *remote_vnnmap=NULL;
+       uint32_t num_lmasters;
        int32_t debug_level;
        int i, j, ret;
        bool self_ban;
@@ -3589,13 +3589,13 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        }
 
        /* count how many active nodes there are */
-       rec->num_lmasters  = 0;
+       num_lmasters  = 0;
        for (i=0; i<nodemap->num; i++) {
                if (!(nodemap->nodes[i].flags & NODE_FLAGS_INACTIVE)) {
                        if (ctdb_node_has_capabilities(rec->caps,
                                                       ctdb->nodes[i]->pnn,
                                                       CTDB_CAP_LMASTER)) {
-                               rec->num_lmasters++;
+                               num_lmasters++;
                        }
                }
        }
@@ -3852,9 +3852,9 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
         * there are active nodes with the lmaster capability...  or
         * do a recovery.
         */
-       if (vnnmap->size != rec->num_lmasters) {
+       if (vnnmap->size != num_lmasters) {
                DEBUG(DEBUG_ERR, (__location__ " The vnnmap count is different from the number of active lmaster nodes: %u vs %u\n",
-                         vnnmap->size, rec->num_lmasters));
+                         vnnmap->size, num_lmasters));
                ctdb_set_culprit(rec, ctdb->pnn);
                do_recovery(rec, mem_ctx, pnn, nodemap, vnnmap);
                return;