add an option to specify direct_io
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 16 Dec 2008 01:57:03 +0000 (12:57 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 16 Dec 2008 01:57:03 +0000 (12:57 +1100)
migrate/remote-cache.c
web/bar1.jpg [new file with mode: 0644]

index c5a33943441d9461dcd1e13eee335a7f46af2314..0e29825330b582666fa1afb4d3ca9e2cac3b9979 100644 (file)
@@ -111,6 +111,11 @@ static int file_min_mtime_age = 120;
 /* Should we allow read/write semantics ? */
 static int read_write = 0;
 
+/* should we use direct_io or not? Direct i/o can not be reexported by kNFSd
+   on linux !
+*/
+static int direct_io = 0;
+
 static int sigchild_initialized = 0;
 static int debug_initialized = 0;
 static int log_fd = -1;
@@ -2072,7 +2077,8 @@ static void usage(void)
 int main(int argc, const char *argv[])
 {
        int ret;
-       const char *fuse_argv[] = {
+       int num_args;
+       const char *fuse_argv[16] = {
                "remote_cache",
                "<export>",
                "-oallow_other",
@@ -2098,6 +2104,7 @@ int main(int argc, const char *argv[])
                { "debug", 'd', POPT_ARG_INT, &debug_level, 0, "debug level", "integer" },
                { "file-check-parent-mtime", 0, POPT_ARG_NONE, &file_check_parent_mtime, 0, "check mtime of remote file instead of parent directory mtime", NULL },
                { "read-write", 0, POPT_ARG_NONE, &read_write, 0, "read/write cache", NULL },
+               { "direct_io", 0, POPT_ARG_NONE, &direct_io, 0, "Use direct_io for better write performance (not kNFSd compatible)", NULL },
 
                POPT_TABLEEND
        };
@@ -2225,13 +2232,19 @@ int main(int argc, const char *argv[])
 
        printf("Remote caching of %s to temp storage %s exporting through %s\n", remote, cache, export);
 
-       printf("here we go ...\n");
-
        log_fd = creat("/var/log/log.remote-cache", 0777);
        if (log_fd == -1) {
                fprintf(stderr, "Could not open logfile. Aborting\n");
                exit(10);
        }
 
-       return fuse_main(8, discard_const(fuse_argv), &remote_cache_ops, NULL);
+       num_args = 8;
+       if (direct_io) {
+               fuse_argv[num_args] = "-odirect_io";
+               num_args++;
+               printf("Using DIRECT_IO\n");
+       }
+
+       printf("here we go ...\n");
+       return fuse_main(num_args, discard_const(fuse_argv), &remote_cache_ops, NULL);
 }
diff --git a/web/bar1.jpg b/web/bar1.jpg
new file mode 100644 (file)
index 0000000..7c6acf3
Binary files /dev/null and b/web/bar1.jpg differ