summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-03 22:03:20 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:42 -0400
commitf8579f8673b7ecdb7a81d5d5bb1d981093d9aa94 (patch)
treed4287d0dffbf3758e709238302fb8865cdd66651 /fs
parente7c24607b5d68a4cdc56e09d70a3c8bae5f0519f (diff)
generic_file_direct_write(): switch to iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c6
-rw-r--r--fs/fuse/file.c6
-rw-r--r--fs/ocfs2/file.c6
-rw-r--r--fs/xfs/xfs_file.c5
4 files changed, 10 insertions, 13 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index ae6af072b635..9fe20c2052af 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1669,15 +1669,13 @@ static ssize_t __btrfs_direct_write(struct kiocb *iocb,
loff_t endbyte;
int err;
- written = generic_file_direct_write(iocb, iov, &nr_segs, pos,
- count, ocount);
+ iov_iter_init(&i, iov, nr_segs, count, 0);
+ written = generic_file_direct_write(iocb, &i, pos, count, ocount);
if (written < 0 || written == count)
return written;
pos += written;
- count -= written;
- iov_iter_init(&i, iov, nr_segs, count, written);
written_buffered = __btrfs_buffered_write(file, &i, pos);
if (written_buffered < 0) {
err = written_buffered;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 96d513e01a5d..126deb5d0a9c 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1235,15 +1235,13 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
goto out;
if (file->f_flags & O_DIRECT) {
- written = generic_file_direct_write(iocb, iov, &nr_segs, pos,
- count, ocount);
+ iov_iter_init(&i, iov, nr_segs, count, 0);
+ written = generic_file_direct_write(iocb, &i, pos, count, ocount);
if (written < 0 || written == count)
goto out;
pos += written;
- count -= written;
- iov_iter_init(&i, iov, nr_segs, count, written);
written_buffered = fuse_perform_write(file, mapping, &i, pos);
if (written_buffered < 0) {
err = written_buffered;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 8970dcf74de5..d6d78c2aa96e 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2251,6 +2251,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
int full_coherency = !(osb->s_mount_opt &
OCFS2_MOUNT_COHERENCY_BUFFERED);
int unaligned_dio = 0;
+ struct iov_iter from;
trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry,
(unsigned long long)OCFS2_I(inode)->ip_blkno,
@@ -2365,16 +2366,15 @@ relock:
if (ret)
goto out_dio;
+ iov_iter_init(&from, iov, nr_segs, count, 0);
if (direct_io) {
- written = generic_file_direct_write(iocb, iov, &nr_segs, *ppos,
+ written = generic_file_direct_write(iocb, &from, *ppos,
count, ocount);
if (written < 0) {
ret = written;
goto out_dio;
}
} else {
- struct iov_iter from;
- iov_iter_init(&from, iov, nr_segs, count, 0);
current->backing_dev_info = file->f_mapping->backing_dev_info;
written = generic_perform_write(file, &from, *ppos);
if (likely(written >= 0))
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 951a2321ee01..8617497867c7 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -641,6 +641,7 @@ xfs_file_dio_aio_write(
int iolock;
struct xfs_buftarg *target = XFS_IS_REALTIME_INODE(ip) ?
mp->m_rtdev_targp : mp->m_ddev_targp;
+ struct iov_iter from;
/* DIO must be aligned to device logical sector size */
if ((pos | count) & target->bt_logical_sectormask)
@@ -698,8 +699,8 @@ xfs_file_dio_aio_write(
}
trace_xfs_file_direct_write(ip, count, iocb->ki_pos, 0);
- ret = generic_file_direct_write(iocb, iovp,
- &nr_segs, pos, count, ocount);
+ iov_iter_init(&from, iovp, nr_segs, count, 0);
+ ret = generic_file_direct_write(iocb, &from, pos, count, ocount);
out:
xfs_rw_iunlock(ip, iolock);