summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-05-27 11:16:51 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2017-06-29 17:49:23 -0400
commit18e9710ee59ce3bd2a2512ddcd3f7ceebe8b8d17 (patch)
treea09b5ebcb9460ad374b798258b8f46dd370cad88 /fs/read_write.c
parentedab5fe38c2c17a7d7ea5f82e1d9503bfc79a8ac (diff)
downloadlinux-18e9710ee59ce3bd2a2512ddcd3f7ceebe8b8d17.tar.bz2
fs: implement vfs_iter_read using do_iter_read
De-dupliate some code and allow for passing the flags argument to vfs_iter_read. Additional it properly updates atime now. 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.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 64b61a032a56..4dab30b62f0e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -356,26 +356,6 @@ out_putf:
}
#endif
-ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos)
-{
- struct kiocb kiocb;
- ssize_t ret;
-
- if (!file->f_op->read_iter)
- return -EINVAL;
-
- init_sync_kiocb(&kiocb, file);
- kiocb.ki_pos = *ppos;
-
- iter->type |= READ;
- ret = call_read_iter(file, &kiocb, iter);
- BUG_ON(ret == -EIOCBQUEUED);
- if (ret > 0)
- *ppos = kiocb.ki_pos;
- return ret;
-}
-EXPORT_SYMBOL(vfs_iter_read);
-
ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos)
{
struct kiocb kiocb;
@@ -944,6 +924,15 @@ out:
return ret;
}
+ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos,
+ int flags)
+{
+ if (!file->f_op->read_iter)
+ return -EINVAL;
+ return do_iter_read(file, iter, ppos, flags);
+}
+EXPORT_SYMBOL(vfs_iter_read);
+
static ssize_t do_iter_write(struct file *file, struct iov_iter *iter,
loff_t *pos, int flags)
{