summaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_addr.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-04-01 23:49:24 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:28:27 -0400
commit42b1ab979d92d21ae2ea376e77f33f18973b9581 (patch)
tree89d3d43076a89e2140d025683bae4c058df5eb10 /fs/9p/vfs_addr.c
parente1200fe68f20759f359698f8a8dc81d06d1265f5 (diff)
downloadlinux-42b1ab979d92d21ae2ea376e77f33f18973b9581.tar.bz2
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.c21
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,