diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-02 05:49:24 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-12 04:28:27 +0200 |
commit | 42b1ab979d92d21ae2ea376e77f33f18973b9581 (patch) | |
tree | 89d3d43076a89e2140d025683bae4c058df5eb10 /fs/9p/vfs_addr.c | |
parent | 9p: switch p9_client_read() to passing struct iov_iter * (diff) | |
download | linux-42b1ab979d92d21ae2ea376e77f33f18973b9581.tar.xz linux-42b1ab979d92d21ae2ea376e77f33f18973b9581.zip |
9p: get rid of v9fs_direct_file_read()
do it in ->direct_IO()...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/9p/vfs_addr.c')
-rw-r--r-- | fs/9p/vfs_addr.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index afe3225aaf36..2e38f9a5b472 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -251,21 +251,20 @@ static ssize_t v9fs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t pos) { struct file *file = iocb->ki_filp; - if (rw == WRITE) { - ssize_t written; - int err = 0; - - written = p9_client_write(file->private_data, pos, iter, &err); - if (written) { + ssize_t n; + int err = 0; + if (rw & WRITE) { + n = p9_client_write(file->private_data, pos, iter, &err); + if (n) { struct inode *inode = file_inode(file); loff_t i_size = i_size_read(inode); - if (pos + written > i_size) - inode_add_bytes(inode, pos + written - i_size); - return written; + if (pos + n > i_size) + inode_add_bytes(inode, pos + n - i_size); } - return err; + } else { + n = p9_client_read(file->private_data, pos, iter, &err); } - return -EINVAL; + return n ? n : err; } static int v9fs_write_begin(struct file *filp, struct address_space *mapping, |