summaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_addr.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2015-04-01 22:32:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-11 22:28:26 -0400
commit9565a5445240cd441f2c670aa7260ee8eb5dff79 (patch)
tree4449d982f9476fae8bff8ee9f78c673508b42a4e /fs/9p/vfs_addr.c
parentc711a6b111322941a41bb024dbcc22b9858d5dd6 (diff)
downloadlinux-9565a5445240cd441f2c670aa7260ee8eb5dff79.tar.bz2
9p: get rid of v9fs_direct_file_write()
just handle 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.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c
index 0e153f07e0fc..402269c108cd 100644
--- a/fs/9p/vfs_addr.c
+++ b/fs/9p/vfs_addr.c
@@ -252,15 +252,21 @@ static int v9fs_launder_page(struct page *page)
static ssize_t
v9fs_direct_IO(int rw, struct kiocb *iocb, struct iov_iter *iter, loff_t pos)
{
- /*
- * FIXME
- * Now that we do caching with cache mode enabled, We need
- * to support direct IO
- */
- p9_debug(P9_DEBUG_VFS, "v9fs_direct_IO: v9fs_direct_IO (%pD) off/no(%lld/%lu) EINVAL\n",
- iocb->ki_filp,
- (long long)pos, iter->nr_segs);
-
+ 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) {
+ 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;
+ }
+ return err;
+ }
return -EINVAL;
}