Commit 15316263 authored by Al Viro's avatar Al Viro

fuse: switch fuse_direct_io_file_operations to ->{read,write}_iter()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent cfa86a74
...@@ -1401,14 +1401,10 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io, ...@@ -1401,14 +1401,10 @@ static ssize_t __fuse_direct_read(struct fuse_io_priv *io,
return res; return res;
} }
static ssize_t fuse_direct_read(struct file *file, char __user *buf, static ssize_t fuse_direct_read_iter(struct kiocb *iocb, struct iov_iter *to)
size_t count, loff_t *ppos)
{ {
struct fuse_io_priv io = { .async = 0, .file = file }; struct fuse_io_priv io = { .async = 0, .file = iocb->ki_filp };
struct iovec iov = { .iov_base = buf, .iov_len = count }; return __fuse_direct_read(&io, to, &iocb->ki_pos);
struct iov_iter ii;
iov_iter_init(&ii, READ, &iov, 1, count);
return __fuse_direct_read(&io, &ii, ppos);
} }
static ssize_t __fuse_direct_write(struct fuse_io_priv *io, static ssize_t __fuse_direct_write(struct fuse_io_priv *io,
...@@ -1432,24 +1428,21 @@ static ssize_t __fuse_direct_write(struct fuse_io_priv *io, ...@@ -1432,24 +1428,21 @@ static ssize_t __fuse_direct_write(struct fuse_io_priv *io,
return res; return res;
} }
static ssize_t fuse_direct_write(struct file *file, const char __user *buf, static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
size_t count, loff_t *ppos)
{ {
struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; struct file *file = iocb->ki_filp;
struct inode *inode = file_inode(file); struct inode *inode = file_inode(file);
ssize_t res;
struct fuse_io_priv io = { .async = 0, .file = file }; struct fuse_io_priv io = { .async = 0, .file = file };
struct iov_iter ii; ssize_t res;
iov_iter_init(&ii, WRITE, &iov, 1, count);
if (is_bad_inode(inode)) if (is_bad_inode(inode))
return -EIO; return -EIO;
/* Don't allow parallel writes to the same file */ /* Don't allow parallel writes to the same file */
mutex_lock(&inode->i_mutex); mutex_lock(&inode->i_mutex);
res = __fuse_direct_write(&io, &ii, ppos); res = __fuse_direct_write(&io, from, &iocb->ki_pos);
if (res > 0) if (res > 0)
fuse_write_update_size(inode, *ppos); fuse_write_update_size(inode, iocb->ki_pos);
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
return res; return res;
...@@ -2988,8 +2981,10 @@ static const struct file_operations fuse_file_operations = { ...@@ -2988,8 +2981,10 @@ static const struct file_operations fuse_file_operations = {
static const struct file_operations fuse_direct_io_file_operations = { static const struct file_operations fuse_direct_io_file_operations = {
.llseek = fuse_file_llseek, .llseek = fuse_file_llseek,
.read = fuse_direct_read, .read = new_sync_read,
.write = fuse_direct_write, .read_iter = fuse_direct_read_iter,
.write = new_sync_write,
.write_iter = fuse_direct_write_iter,
.mmap = fuse_direct_mmap, .mmap = fuse_direct_mmap,
.open = fuse_open, .open = fuse_open,
.flush = fuse_flush, .flush = fuse_flush,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment