add an init function to the nfs backend to test we can reach the server before we...
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Sat, 26 Sep 2009 00:11:03 +0000 (10:11 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sat, 26 Sep 2009 00:11:03 +0000 (10:11 +1000)
libnfs.c
nfsio.c

index 5819ed76ecb49a9e114646c60c6d116c39a7ed5d..a98b2cd722a558624f9a76f4678267ba4036e19a 100644 (file)
--- a/libnfs.c
+++ b/libnfs.c
@@ -238,7 +238,6 @@ static void insert_fhandle(struct nfsio *nfsio, const char *name, const char *fh
        tree_t *t;
        int i;
 
-printf("insert_fhandle:%s size:%d\n", name, size);
        while (name[0] == '.') name++;
 
        t = malloc(sizeof(tree_t));
diff --git a/nfsio.c b/nfsio.c
index 4155622dea24c283c98ebb191e7e7871e117dabe..af34c09eb09ac7a232cbd12105a42f0da17bbad8 100644 (file)
--- a/nfsio.c
+++ b/nfsio.c
@@ -392,6 +392,20 @@ static void nfs3_rename(struct dbench_op *op)
        }
 }
 
+static int nfs3_init(void)
+{
+       void *handle;
+
+       handle = nfsio_connect(options.server, options.export, options.protocol);
+       if (handle == NULL) {
+               printf("Failed to connect to NFS server\n");
+               return 1;
+       }
+
+       nfsio_disconnect(handle);
+       return 0;
+}
+
 static struct backend_op ops[] = {
        { "Deltree",  nfs3_deltree },
        { "GETATTR3", nfs3_getattr },
@@ -415,6 +429,7 @@ static struct backend_op ops[] = {
 
 struct nb_operations nfs_ops = {
        .backend_name = "nfsbench",
+       .init         = nfs3_init,
        .setup        = nfs3_setup,
        .cleanup      = nfs3_cleanup,
        .ops          = ops