Disable splice by default
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 19 May 2011 12:49:26 +0000 (14:49 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Thu, 19 May 2011 12:49:26 +0000 (14:49 +0200)
Disable splice by default, add "splice_read", "splice_write" and
"splice_move" options.  Keep the "no_splice_*" variants, which can
disable splice even if the filesystem explicitly enables it.

ChangeLog
lib/fuse_i.h
lib/fuse_lowlevel.c

index 15fa22cd29ded9ec23be18d80821fd37283bb2e1..f836222e96df2a784dfd24b9eb2ec2445d99813f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-05-19  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Disable splice by default, add "splice_read", "splice_write" and
+       "splice_move" options.  Keep the "no_splice_*" variants, which can
+       disable splice even if the filesystem explicitly enables it.
+
 2011-04-15  Max Krasnyansky <maxk@kernel.org>
        * Added support for "auto_unmount" option which unmounts the
        filesystem automatically on process exit (or crash).
index 9d0de5804f225e6ed38dac61ca6a85afd58c3490..d35d5f3a9bf8533991734de68bfee4b38aaed7d8 100644 (file)
@@ -63,6 +63,9 @@ struct fuse_ll {
        int atomic_o_trunc;
        int no_remote_lock;
        int big_writes;
+       int splice_write;
+       int splice_move;
+       int splice_read;
        int no_splice_write;
        int no_splice_move;
        int no_splice_read;
index a19d429fc51417f4d55797f6c8f10b7db316b1de..1715e2e1190d361fd0a75a8921f0965ff90a5634 100644 (file)
@@ -1597,11 +1597,11 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
        if (req->f->conn.proto_minor >= 14) {
                f->conn.capable |= FUSE_CAP_SPLICE_WRITE | FUSE_CAP_SPLICE_MOVE;
                f->conn.capable |= FUSE_CAP_SPLICE_READ;
-               if (!f->no_splice_write)
+               if (f->splice_write)
                        f->conn.want |= FUSE_CAP_SPLICE_WRITE;
-               if (!f->no_splice_move)
+               if (f->splice_move)
                        f->conn.want |= FUSE_CAP_SPLICE_MOVE;
-               if (!f->no_splice_read &&
+               if (f->splice_read &&
                    (f->op.write_buf || f->op.retrieve_reply))
                        f->conn.want |= FUSE_CAP_SPLICE_READ;
        }
@@ -1627,6 +1627,13 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
        if (f->op.init)
                f->op.init(f->userdata, &f->conn);
 
+       if (f->no_splice_read)
+               f->conn.want &= ~FUSE_CAP_SPLICE_READ;
+       if (f->no_splice_write)
+               f->conn.want &= ~FUSE_CAP_SPLICE_WRITE;
+       if (f->no_splice_move)
+               f->conn.want &= ~FUSE_CAP_SPLICE_MOVE;
+
        if (f->conn.async_read || (f->conn.want & FUSE_CAP_ASYNC_READ))
                outarg.flags |= FUSE_ASYNC_READ;
        if (f->conn.want & FUSE_CAP_POSIX_LOCKS)
@@ -2220,8 +2227,11 @@ static struct fuse_opt fuse_ll_opts[] = {
        { "atomic_o_trunc", offsetof(struct fuse_ll, atomic_o_trunc), 1},
        { "no_remote_lock", offsetof(struct fuse_ll, no_remote_lock), 1},
        { "big_writes", offsetof(struct fuse_ll, big_writes), 1},
+       { "splice_write", offsetof(struct fuse_ll, splice_write), 1},
        { "no_splice_write", offsetof(struct fuse_ll, no_splice_write), 1},
+       { "splice_move", offsetof(struct fuse_ll, splice_move), 1},
        { "no_splice_move", offsetof(struct fuse_ll, no_splice_move), 1},
+       { "splice_read", offsetof(struct fuse_ll, splice_read), 1},
        { "no_splice_read", offsetof(struct fuse_ll, no_splice_read), 1},
        FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_DISCARD),
        FUSE_OPT_KEY("-h", KEY_HELP),
@@ -2249,9 +2259,9 @@ static void fuse_ll_help(void)
 "    -o atomic_o_trunc      enable atomic open+truncate support\n"
 "    -o big_writes          enable larger than 4kB writes\n"
 "    -o no_remote_lock      disable remote file locking\n"
-"    -o no_splice_write     don't use splice to write to the fuse device\n"
-"    -o no_splice_move      don't move data while splicing to the fuse device\n"
-"    -o no_splice_read      don't use splice to read from the fuse device\n"
+"    -o [no_]splice_write   use splice to write to the fuse device\n"
+"    -o [no_]splice_move    move data while splicing to the fuse device\n"
+"    -o [no_]splice_read    use splice to read from the fuse device\n"
 );
 }