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>
This commit is contained in:
parent
efb9fa9e91
commit
60b9df7a54
|
@ -2371,14 +2371,14 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||||
loff_t offset, unsigned long nr_segs)
|
loff_t offset, unsigned long nr_segs)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
struct file *file = NULL;
|
struct file *file = iocb->ki_filp;
|
||||||
|
struct fuse_file *ff = file->private_data;
|
||||||
loff_t pos = 0;
|
loff_t pos = 0;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
loff_t i_size;
|
loff_t i_size;
|
||||||
size_t count = iov_length(iov, nr_segs);
|
size_t count = iov_length(iov, nr_segs);
|
||||||
struct fuse_io_priv *io;
|
struct fuse_io_priv *io;
|
||||||
|
|
||||||
file = iocb->ki_filp;
|
|
||||||
pos = offset;
|
pos = offset;
|
||||||
inode = file->f_mapping->host;
|
inode = file->f_mapping->host;
|
||||||
i_size = i_size_read(inode);
|
i_size = i_size_read(inode);
|
||||||
|
@ -2403,9 +2403,9 @@ fuse_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||||
io->file = file;
|
io->file = file;
|
||||||
/*
|
/*
|
||||||
* By default, we want to optimize all I/Os with async request
|
* By default, we want to optimize all I/Os with async request
|
||||||
* submission to the client filesystem.
|
* submission to the client filesystem if supported.
|
||||||
*/
|
*/
|
||||||
io->async = 1;
|
io->async = ff->fc->async_dio;
|
||||||
io->iocb = iocb;
|
io->iocb = iocb;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -541,6 +541,9 @@ struct fuse_conn {
|
||||||
/** Does the filesystem want adaptive readdirplus? */
|
/** Does the filesystem want adaptive readdirplus? */
|
||||||
unsigned readdirplus_auto:1;
|
unsigned readdirplus_auto:1;
|
||||||
|
|
||||||
|
/** Does the filesystem support asynchronous direct-IO submission? */
|
||||||
|
unsigned async_dio:1;
|
||||||
|
|
||||||
/** The number of requests waiting for completion */
|
/** The number of requests waiting for completion */
|
||||||
atomic_t num_waiting;
|
atomic_t num_waiting;
|
||||||
|
|
||||||
|
|
|
@ -871,6 +871,8 @@ static void process_init_reply(struct fuse_conn *fc, struct fuse_req *req)
|
||||||
fc->do_readdirplus = 1;
|
fc->do_readdirplus = 1;
|
||||||
if (arg->flags & FUSE_READDIRPLUS_AUTO)
|
if (arg->flags & FUSE_READDIRPLUS_AUTO)
|
||||||
fc->readdirplus_auto = 1;
|
fc->readdirplus_auto = 1;
|
||||||
|
if (arg->flags & FUSE_ASYNC_DIO)
|
||||||
|
fc->async_dio = 1;
|
||||||
} else {
|
} else {
|
||||||
ra_pages = fc->max_read / PAGE_CACHE_SIZE;
|
ra_pages = fc->max_read / PAGE_CACHE_SIZE;
|
||||||
fc->no_lock = 1;
|
fc->no_lock = 1;
|
||||||
|
@ -898,7 +900,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req)
|
||||||
FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK |
|
FUSE_EXPORT_SUPPORT | FUSE_BIG_WRITES | FUSE_DONT_MASK |
|
||||||
FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ |
|
FUSE_SPLICE_WRITE | FUSE_SPLICE_MOVE | FUSE_SPLICE_READ |
|
||||||
FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA |
|
FUSE_FLOCK_LOCKS | FUSE_IOCTL_DIR | FUSE_AUTO_INVAL_DATA |
|
||||||
FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO;
|
FUSE_DO_READDIRPLUS | FUSE_READDIRPLUS_AUTO | FUSE_ASYNC_DIO;
|
||||||
req->in.h.opcode = FUSE_INIT;
|
req->in.h.opcode = FUSE_INIT;
|
||||||
req->in.numargs = 1;
|
req->in.numargs = 1;
|
||||||
req->in.args[0].size = sizeof(*arg);
|
req->in.args[0].size = sizeof(*arg);
|
||||||
|
|
|
@ -90,6 +90,9 @@
|
||||||
* 7.21
|
* 7.21
|
||||||
* - add FUSE_READDIRPLUS
|
* - add FUSE_READDIRPLUS
|
||||||
* - send the requested events in POLL request
|
* - send the requested events in POLL request
|
||||||
|
*
|
||||||
|
* 7.22
|
||||||
|
* - add FUSE_ASYNC_DIO
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _LINUX_FUSE_H
|
#ifndef _LINUX_FUSE_H
|
||||||
|
@ -125,7 +128,7 @@
|
||||||
#define FUSE_KERNEL_VERSION 7
|
#define FUSE_KERNEL_VERSION 7
|
||||||
|
|
||||||
/** Minor version number of this interface */
|
/** Minor version number of this interface */
|
||||||
#define FUSE_KERNEL_MINOR_VERSION 21
|
#define FUSE_KERNEL_MINOR_VERSION 22
|
||||||
|
|
||||||
/** The node ID of the root inode */
|
/** The node ID of the root inode */
|
||||||
#define FUSE_ROOT_ID 1
|
#define FUSE_ROOT_ID 1
|
||||||
|
@ -215,6 +218,7 @@ struct fuse_file_lock {
|
||||||
* FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
|
* FUSE_AUTO_INVAL_DATA: automatically invalidate cached pages
|
||||||
* FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
|
* FUSE_DO_READDIRPLUS: do READDIRPLUS (READDIR+LOOKUP in one)
|
||||||
* FUSE_READDIRPLUS_AUTO: adaptive readdirplus
|
* FUSE_READDIRPLUS_AUTO: adaptive readdirplus
|
||||||
|
* FUSE_ASYNC_DIO: asynchronous direct I/O submission
|
||||||
*/
|
*/
|
||||||
#define FUSE_ASYNC_READ (1 << 0)
|
#define FUSE_ASYNC_READ (1 << 0)
|
||||||
#define FUSE_POSIX_LOCKS (1 << 1)
|
#define FUSE_POSIX_LOCKS (1 << 1)
|
||||||
|
@ -231,6 +235,7 @@ struct fuse_file_lock {
|
||||||
#define FUSE_AUTO_INVAL_DATA (1 << 12)
|
#define FUSE_AUTO_INVAL_DATA (1 << 12)
|
||||||
#define FUSE_DO_READDIRPLUS (1 << 13)
|
#define FUSE_DO_READDIRPLUS (1 << 13)
|
||||||
#define FUSE_READDIRPLUS_AUTO (1 << 14)
|
#define FUSE_READDIRPLUS_AUTO (1 << 14)
|
||||||
|
#define FUSE_ASYNC_DIO (1 << 15)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CUSE INIT request/reply flags
|
* CUSE INIT request/reply flags
|
||||||
|
|
Loading…
Reference in New Issue