aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Miklos Szeredi <mszeredi@suse.cz>2011-05-19 14:49:26 +0200
committerGravatar Miklos Szeredi <mszeredi@suse.cz>2011-05-19 14:49:26 +0200
commita785697e039fc6b3eb78dae24f39bb5fe40a27ed (patch)
treee025e30bb87de02189bd75935829f8f68e2f54c8 /lib
parentd84fc1f429e667b9ba11ddc808aa394d6cbadc41 (diff)
Disable splice by default
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/fuse_i.h3
-rw-r--r--lib/fuse_lowlevel.c22
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/fuse_i.h b/lib/fuse_i.h
index 9d0de58..d35d5f3 100644
--- a/lib/fuse_i.h
+++ b/lib/fuse_i.h
@@ -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;
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index a19d429..1715e2e1 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -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"
);
}