aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-10 14:53:57 -0700
committerGravatar Nikolaus Rath <Nikolaus@rath.org>2016-10-10 14:53:57 -0700
commit5ce00337208c3957f35009211ac8c72ccd3da3ad (patch)
tree151d118d28367f63617ec99b319e71631da9d901
parente1274ccc153a0168a1fc0f8138787452a56ad92c (diff)
Removed 'async_read' field in fuse_conn_info
This is redundant with the capability flags in `wants` and `capable`.
-rw-r--r--ChangeLog.rst6
-rw-r--r--include/fuse_common.h5
-rw-r--r--lib/fuse_i.h2
-rw-r--r--lib/fuse_lowlevel.c19
4 files changed, 19 insertions, 13 deletions
diff --git a/ChangeLog.rst b/ChangeLog.rst
index 2b2dba9..dc243f2 100644
--- a/ChangeLog.rst
+++ b/ChangeLog.rst
@@ -1,6 +1,12 @@
Unreleased Changes
==================
+* Removed the `async_read` field from `struct fuse_conn_info`. To
+ determine if the kernel supports asynchronous reads, file systems
+ should check the `FUSE_CAP_ASYNC_READ` bit of the `capable`
+ field. To enable/disable asynchronous reads, file systems should set
+ the flag in the `wanted` field.
+
* The `fuse_parse_cmdline` function no longer prints out help when the
``--verbose`` or ``--help`` flags are given. This needs to be done
by the file system (e.g. using the `fuse_cmdline_help()`,
diff --git a/include/fuse_common.h b/include/fuse_common.h
index 6eadc90..4a0e94b 100644
--- a/include/fuse_common.h
+++ b/include/fuse_common.h
@@ -157,11 +157,6 @@ struct fuse_conn_info {
unsigned proto_minor;
/**
- * Is asynchronous read supported (read-write)
- */
- unsigned async_read;
-
- /**
* Maximum size of the write buffer
*/
unsigned max_write;
diff --git a/lib/fuse_i.h b/lib/fuse_i.h
index 446842a..c8aa279 100644
--- a/lib/fuse_i.h
+++ b/lib/fuse_i.h
@@ -67,6 +67,8 @@ struct fuse_session {
int writeback_cache;
int no_writeback_cache;
int clone_fd;
+ int async_read;
+ int sync_read;
struct fuse_lowlevel_ops op;
int got_init;
struct cuse_data *cuse_data;
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 7648788..8bf457a 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1849,12 +1849,13 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
}
if (arg->minor >= 6) {
- if (f->conn.async_read)
- f->conn.async_read = arg->flags & FUSE_ASYNC_READ;
if (arg->max_readahead < f->conn.max_readahead)
f->conn.max_readahead = arg->max_readahead;
- if (arg->flags & FUSE_ASYNC_READ)
+ if (arg->flags & FUSE_ASYNC_READ) {
f->conn.capable |= FUSE_CAP_ASYNC_READ;
+ /* Enable by default */
+ f->conn.want |= FUSE_CAP_ASYNC_READ;
+ }
if (arg->flags & FUSE_POSIX_LOCKS)
f->conn.capable |= FUSE_CAP_POSIX_LOCKS;
if (arg->flags & FUSE_ATOMIC_O_TRUNC)
@@ -1878,7 +1879,6 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (arg->flags & FUSE_NO_OPEN_SUPPORT)
f->conn.capable |= FUSE_CAP_NO_OPEN_SUPPORT;
} else {
- f->conn.async_read = 0;
f->conn.max_readahead = 0;
}
@@ -1947,12 +1947,16 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
f->conn.want &= ~FUSE_CAP_ASYNC_DIO;
if (f->no_writeback_cache)
f->conn.want &= ~FUSE_CAP_WRITEBACK_CACHE;
+ if (f->async_read)
+ f->conn.want |= FUSE_CAP_ASYNC_READ;
+ if (f->sync_read)
+ f->conn.want &= ~FUSE_CAP_ASYNC_READ;
/* Always enable big writes, this is superseded
by the max_write option */
outarg.flags |= FUSE_BIG_WRITES;
- if (f->conn.async_read || (f->conn.want & FUSE_CAP_ASYNC_READ))
+ if (f->conn.want & FUSE_CAP_ASYNC_READ)
outarg.flags |= FUSE_ASYNC_READ;
if (f->conn.want & FUSE_CAP_POSIX_LOCKS)
outarg.flags |= FUSE_POSIX_LOCKS;
@@ -2558,8 +2562,8 @@ static const struct fuse_opt fuse_ll_opts[] = {
{ "max_background=%u", offsetof(struct fuse_session, conn.max_background), 0 },
{ "congestion_threshold=%u",
offsetof(struct fuse_session, conn.congestion_threshold), 0 },
- { "async_read", offsetof(struct fuse_session, conn.async_read), 1 },
- { "sync_read", offsetof(struct fuse_session, conn.async_read), 0 },
+ { "sync_read", offsetof(struct fuse_session, sync_read), 1 },
+ { "async_read", offsetof(struct fuse_session, async_read), 1 },
{ "atomic_o_trunc", offsetof(struct fuse_session, atomic_o_trunc), 1},
{ "no_remote_lock", offsetof(struct fuse_session, no_remote_posix_lock), 1},
{ "no_remote_lock", offsetof(struct fuse_session, no_remote_flock), 1},
@@ -2825,7 +2829,6 @@ struct fuse_session *fuse_session_new(struct fuse_args *args,
fprintf(stderr, "fuse: failed to allocate fuse object\n");
goto out1;
}
- se->conn.async_read = 1;
se->conn.max_write = UINT_MAX;
se->conn.max_readahead = UINT_MAX;
se->atomic_o_trunc = 0;