diff options
author | Christoph Hellwig <hch@lst.de> | 2017-05-27 11:16:52 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-29 17:49:23 -0400 |
commit | abbb65899aecfc97bda64b6816d1e501754cfe1f (patch) | |
tree | 58b223fcbd886f93b75b98f3ac2807aa82e1c9e7 /fs/read_write.c | |
parent | 18e9710ee59ce3bd2a2512ddcd3f7ceebe8b8d17 (diff) | |
download | linux-abbb65899aecfc97bda64b6816d1e501754cfe1f.tar.gz linux-abbb65899aecfc97bda64b6816d1e501754cfe1f.tar.bz2 linux-abbb65899aecfc97bda64b6816d1e501754cfe1f.zip |
fs: implement vfs_iter_write using do_iter_write
De-dupliate some code and allow for passing the flags argument to
vfs_iter_write. Additionally it now properly updates timestamps.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 4dab30b62f0e..acfd3dc63d57 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -356,26 +356,6 @@ out_putf: } #endif -ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos) -{ - struct kiocb kiocb; - ssize_t ret; - - if (!file->f_op->write_iter) - return -EINVAL; - - init_sync_kiocb(&kiocb, file); - kiocb.ki_pos = *ppos; - - iter->type |= WRITE; - ret = call_write_iter(file, &kiocb, iter); - BUG_ON(ret == -EIOCBQUEUED); - if (ret > 0) - *ppos = kiocb.ki_pos; - return ret; -} -EXPORT_SYMBOL(vfs_iter_write); - int rw_verify_area(int read_write, struct file *file, const loff_t *ppos, size_t count) { struct inode *inode; @@ -962,6 +942,15 @@ static ssize_t do_iter_write(struct file *file, struct iov_iter *iter, return ret; } +ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos, + int flags) +{ + if (!file->f_op->write_iter) + return -EINVAL; + return do_iter_write(file, iter, ppos, flags); +} +EXPORT_SYMBOL(vfs_iter_write); + ssize_t vfs_readv(struct file *file, const struct iovec __user *vec, unsigned long vlen, loff_t *pos, int flags) { |