diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-03-04 07:09:39 +0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-05-07 01:32:43 +0400 |
commit | 0ae5e4d370599592eab845527b31708a4f3411be (patch) | |
tree | e4116194315802a5911b3cfcb5a9af82896c5e22 /fs | |
parent | f8579f8673b7ecdb7a81d5d5bb1d981093d9aa94 (diff) | |
download | linux-0ae5e4d370599592eab845527b31708a4f3411be.tar.xz |
__btrfs_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.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 9fe20c2052af..1dafe0701daf 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1658,25 +1658,23 @@ again: } static ssize_t __btrfs_direct_write(struct kiocb *iocb, - const struct iovec *iov, - unsigned long nr_segs, loff_t pos, + struct iov_iter *from, + loff_t pos, size_t count, size_t ocount) { struct file *file = iocb->ki_filp; - struct iov_iter i; ssize_t written; ssize_t written_buffered; loff_t endbyte; int err; - iov_iter_init(&i, iov, nr_segs, count, 0); - written = generic_file_direct_write(iocb, &i, pos, count, ocount); + written = generic_file_direct_write(iocb, from, pos, count, ocount); if (written < 0 || written == count) return written; pos += written; - written_buffered = __btrfs_buffered_write(file, &i, pos); + written_buffered = __btrfs_buffered_write(file, from, pos); if (written_buffered < 0) { err = written_buffered; goto out; @@ -1724,6 +1722,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, ssize_t err = 0; size_t count, ocount; bool sync = (file->f_flags & O_DSYNC) || IS_SYNC(file->f_mapping->host); + struct iov_iter i; mutex_lock(&inode->i_mutex); @@ -1746,6 +1745,8 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, goto out; } + iov_iter_init(&i, iov, nr_segs, count, 0); + err = file_remove_suid(file); if (err) { mutex_unlock(&inode->i_mutex); @@ -1787,13 +1788,9 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, atomic_inc(&BTRFS_I(inode)->sync_writers); if (unlikely(file->f_flags & O_DIRECT)) { - num_written = __btrfs_direct_write(iocb, iov, nr_segs, + num_written = __btrfs_direct_write(iocb, &i, pos, count, ocount); } else { - struct iov_iter i; - - iov_iter_init(&i, iov, nr_segs, count, num_written); - num_written = __btrfs_buffered_write(file, &i, pos); if (num_written > 0) iocb->ki_pos = pos + num_written; |