]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
moved the vnn_map initialisation out of the cmdline code
authorAndrew Tridgell <tridge@samba.org>
Wed, 9 May 2007 21:55:46 +0000 (07:55 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 9 May 2007 21:55:46 +0000 (07:55 +1000)
(This used to be ctdb commit 81492b840d608dc724d5a25ddef6eb0ce12b95fb)

ctdb/common/cmdline.c
ctdb/common/ctdb.c
ctdb/common/ctdb_daemon.c

index 3b95f7cc60ae2e2773fac5d1570b2ca8a24ea879..8a7dbbe7d59ebf6569ab798550d9cbb3885a3426 100644 (file)
@@ -89,7 +89,7 @@ struct poptOption popt_ctdb_cmdline[] = {
 struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
 {
        struct ctdb_context *ctdb;
-       int i, ret;
+       int ret;
 
        if (ctdb_cmdline.nlist == NULL) {
                printf("You must provide a node list with --nlist\n");
@@ -156,26 +156,6 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
                }
        }
 
-       /* initialize the vnn mapping table */
-/*
-XXX we currently initialize it to the maximum number of nodes to 
-XXX make it behave the same way as previously.  
-XXX Once we have recovery working we should initialize this always to 
-XXX generation==0 (==invalid) and let the recovery tool populate this 
-XXX table for the daemons. 
-*/
-       ctdb->vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb->num_nodes);
-       if (ctdb->vnn_map == NULL) {
-               DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n"));
-               exit(1);
-       }
-       ctdb->vnn_map->generation = 1;
-       ctdb->vnn_map->size = ctdb->num_nodes;
-       for(i=0;i<ctdb->vnn_map->size;i++){
-               ctdb->vnn_map->map[i] = i%ctdb->num_nodes;
-       }
-
-
        return ctdb;
 }
 
index f2eb42ff716fc93523dfb1838c9065d3ecb8096c..a7084d1a34cedc76c35dd4f367b976d6c82677dd 100644 (file)
@@ -152,6 +152,25 @@ int ctdb_set_nlist(struct ctdb_context *ctdb, const char *nlist)
                        return -1;
                }
        }
+
+       /* initialize the vnn mapping table now that we have num_nodes setup */
+/*
+XXX we currently initialize it to the maximum number of nodes to 
+XXX make it behave the same way as previously.  
+XXX Once we have recovery working we should initialize this always to 
+XXX generation==0 (==invalid) and let the recovery tool populate this 
+XXX table for the daemons. 
+*/
+       ctdb->vnn_map = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*ctdb->num_nodes);
+       if (ctdb->vnn_map == NULL) {
+               DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n"));
+               exit(1);
+       }
+       ctdb->vnn_map->generation = 1;
+       ctdb->vnn_map->size = ctdb->num_nodes;
+       for(i=0;i<ctdb->vnn_map->size;i++){
+               ctdb->vnn_map->map[i] = i%ctdb->num_nodes;
+       }
        
        talloc_free(lines);
        return 0;
index 704ad8f1d8960a73889440a9b475d30b75e4ae6f..7cce7ce471b3a5026ad1b0170f66f819a1c7e1e1 100644 (file)
@@ -721,7 +721,6 @@ int ctdb_start(struct ctdb_context *ctdb)
        
        close(fd[1]);
 
-
        ctdb->ev = event_context_init(NULL);
        fde = event_add_fd(ctdb->ev, ctdb, fd[0], EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_read_from_parent, &fd[0]);
        fde = event_add_fd(ctdb->ev, ctdb, ctdb->daemon.sd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE, ctdb_accept_client, ctdb);