diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-05-01 08:37:21 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-05-01 08:37:21 -0400 |
commit | 60b9df7a54804a965850db00beec4d3a2c002536 (patch) | |
tree | ce3519c0708d6dd4113707c36a4ebdc6501542ef | |
parent | efb9fa9e911b23c7ea5330215bda778a7c69dba8 (diff) |
fuse: add flag to turn on async direct IO
Without async DIO write requests to a single file were always serialized.
With async DIO that's no longer the case.
So don't turn on async DIO by default for fear of breaking backward
compatibility.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
-rw-r--r-- | fs/fuse/file.c | 8 | ||||
-rw-r--r-- | fs/fuse/fuse_i.h | 3 | ||||
-rw-r--r-- | fs/fuse/inode.c | 4 | ||||
-rw-r--r-- | include/uapi/linux/fuse.h | 7 |
4 files changed, 16 insertions, 6 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 1f8e3d60dc07..6ab7ca43f9e0 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -2371,14 +2371,14 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2371 | loff_t offset, unsigned long nr_segs) | 2371 | loff_t offset, unsigned long nr_segs) |
2372 | { | 2372 | { |
2373 | ssize_t ret = 0; | 2373 | ssize_t ret = 0; |
2374 | struct file *file = NULL; | 2374 | struct file *file = iocb->ki_filp; |
2375 | struct fuse_file *ff = file->private_data; | ||
2375 | loff_t pos = 0; | 2376 | loff_t pos = 0; |
2376 | struct inode *inode; | 2377 | struct inode *inode; |
2377 | loff_t i_size; | 2378 | loff_t i_size; |
2378 | size_t count = iov_length(iov, nr_segs); | 2379 | size_t count = iov_length(iov, nr_segs); |
2379 | struct fuse_io_priv *io; | 2380 | struct fuse_io_priv *io; |
2380 | 2381 | ||
2381 | file = iocb->ki_filp; | ||
2382 | pos = offset; | 2382 | pos = offset; |
2383 | inode = file->f_mapping->host; | 2383 | inode = file->f_mapping->host; |
2384 | i_size = i_size_read(inode); | 2384 | i_size = i_size_read(inode); |
@@ -2403,9 +2403,9 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov, | |||
2403 | io->file = file; | 2403 | io->file = file; |
2404 | /* | 2404 | /* |
2405 | * By default, we want to optimize all I/Os with async request | 2405 | * By default, we want to optimize all I/Os with async request |
2406 | * submission to the client filesystem. | 2406 | * submission to the client filesystem if supported. |
2407 | */ | 2407 | */ |
2408 | io->async = 1; | 2408 | io->async = ff->fc->async_dio; |
2409 | io->iocb = iocb; | 2409 | io->iocb = iocb; |
2410 | 2410 | ||
2411 | /* | 2411 | /* |
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h index 53b830e3b38f..fde7249a3a96 100644 --- a/fs/fuse/fuse_i.h +++ b/fs/fuse/fuse_i.h | |||
@@ -541,6 +541,9 @@ struct fuse_conn { | |||
541 | /** Does the filesystem want adaptive readdirplus? */ | 541 | /** Does the filesystem want adaptive readdirplus? */ |
542 | unsigned readdirplus_auto:1; | 542 | unsigned readdirplus_auto:1; |
543 | 543 | ||
544 | /** Does the filesystem support asynchronous direct-IO submission? */ | ||
545 | unsigned async_dio:1; | ||
546 | |||
544 | /** The number of requests waiting for completion */ | 547 | /** The number of requests waiting for completion */ |
545 | atomic_t num_waiting; | 548 | atomic_t num_waiting; |
546 | 549 | ||
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 17ec1f70524d..6201f81e4d3a 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -871,6 +871,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req) | |||
871 | fc->do_readdirplus = 1; | 871 | fc->do_readdirplus = 1; |
872 | if (arg->flags & FUSE_READDIRPLUS_AUTO) | 872 | if (arg->flags & FUSE_READDIRPLUS_AUTO) |
873 | fc->readdirplus_auto = 1; | 873 | fc->readdirplus_auto = 1; |
874 | if (arg->flags & FUSE_ASYNC_DIO) | ||
875 | fc->async_dio = 1; | ||
874 | } else { | 876 | } else { |
875 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; | 877 | ra_pages = fc->max_read / PAGE_CACHE_SIZE; |
876 | fc->no_lock = 1; | 878 | fc->no_lock = 1; |
@@ -898,7 +900,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) | |||
898 | FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | | 900 | FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK | |
899 | FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | | 901 | FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ | |
900 | FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | | 902 | FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA | |
901 | FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO; | 903 | FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO; |
902 | req->in.h.opcode = FUSE_INIT; | 904 | req->in.h.opcode = FUSE_INIT; |
903 | req->in.numargs = 1; | 905 | req->in.numargs = 1; |
904 | req->in.args[0].size = sizeof(*arg); | 906 | req->in.args[0].size = sizeof(*arg); |
diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h index 706d035fa748..60bb2f9f7b74 100644 --- a/include/uapi/linux/fuse.h +++ b/include/uapi/linux/fuse.h | |||
@@ -90,6 +90,9 @@ | |||
90 | * 7.21 | 90 | * 7.21 |
91 | * - add FUSE_READDIRPLUS | 91 | * - add FUSE_READDIRPLUS |
92 | * - send the requested events in POLL request | 92 | * - send the requested events in POLL request |
93 | * | ||
94 | * 7.22 | ||
95 | * - add FUSE_ASYNC_DIO | ||
93 | */ | 96 | */ |
94 | 97 | ||
95 | #ifndef _LINUX_FUSE_H | 98 | #ifndef _LINUX_FUSE_H |
@@ -125,7 +128,7 @@ | |||
125 | #define FUSE_KERNEL_VERSION 7 | 128 | #define FUSE_KERNEL_VERSION 7 |
126 | 129 | ||
127 | /** Minor version number of this interface */ | 130 | /** Minor version number of this interface */ |
128 | #define FUSE_KERNEL_MINOR_VERSION 21 | 131 | #define FUSE_KERNEL_MINOR_VERSION 22 |
129 | 132 | ||
130 | /** The node ID of the root inode */ | 133 | /** The node ID of the root inode */ |
131 | #define FUSE_ROOT_ID 1 | 134 | #define FUSE_ROOT_ID 1 |
@@ -215,6 +218,7 @@ struct fuse_file_lock { | |||
215 | * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages | 218 | * FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages |
216 | * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) | 219 | * FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one) |
217 | * FUSE_READDIRPLUS_AUTO: adaptive readdirplus | 220 | * FUSE_READDIRPLUS_AUTO: adaptive readdirplus |
221 | * FUSE_ASYNC_DIO: asynchronous direct I/O submission | ||
218 | */ | 222 | */ |
219 | #define FUSE_ASYNC_READ (1 << 0) | 223 | #define FUSE_ASYNC_READ (1 << 0) |
220 | #define FUSE_POSIX_LOCKS (1 << 1) | 224 | #define FUSE_POSIX_LOCKS (1 << 1) |
@@ -231,6 +235,7 @@ struct fuse_file_lock { | |||
231 | #define FUSE_AUTO_INVAL_DATA (1 << 12) | 235 | #define FUSE_AUTO_INVAL_DATA (1 << 12) |
232 | #define FUSE_DO_READDIRPLUS (1 << 13) | 236 | #define FUSE_DO_READDIRPLUS (1 << 13) |
233 | #define FUSE_READDIRPLUS_AUTO (1 << 14) | 237 | #define FUSE_READDIRPLUS_AUTO (1 << 14) |
238 | #define FUSE_ASYNC_DIO (1 << 15) | ||
234 | 239 | ||
235 | /** | 240 | /** |
236 | * CUSE INIT request/reply flags | 241 | * CUSE INIT request/reply flags |