diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-01 22:32:23 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2015-04-11 22:28:26 -0400 |
commit | 9565a5445240cd441f2c670aa7260ee8eb5dff79 (patch) | |
tree | 4449d982f9476fae8bff8ee9f78c673508b42a4e /fs/9p/vfs_addr.c | |
parent | c711a6b111322941a41bb024dbcc22b9858d5dd6 (diff) | |
download | linux-9565a5445240cd441f2c670aa7260ee8eb5dff79.tar.gz linux-9565a5445240cd441f2c670aa7260ee8eb5dff79.tar.bz2 linux-9565a5445240cd441f2c670aa7260ee8eb5dff79.zip |
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.c | 24 |
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; } |