diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-13 14:10:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-04-21 13:57:36 -0400 |
commit | 639a93a521c759ddb32cc875f3ea1965072b2cbc (patch) | |
tree | f56a54d0824b1c87e05646b592657a6c30193065 /mm/filemap.c | |
parent | c63ed807d1fca901d6b463deb3ceeced4969384e (diff) |
generic_file_direct_write(): make use of iov_iter_revert()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 1694623a6289..9f788eecd2c5 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2704,7 +2704,6 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from) ssize_t written; size_t write_len; pgoff_t end; - struct iov_iter data; write_len = iov_iter_count(from); end = (pos + write_len - 1) >> PAGE_SHIFT; @@ -2733,8 +2732,7 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from) } } - data = *from; - written = mapping->a_ops->direct_IO(iocb, &data); + written = mapping->a_ops->direct_IO(iocb, from); /* * Finally, try again to invalidate clean pages which might have been @@ -2751,13 +2749,14 @@ generic_file_direct_write(struct kiocb *iocb, struct iov_iter *from) if (written > 0) { pos += written; - iov_iter_advance(from, written); + write_len -= written; if (pos > i_size_read(inode) && !S_ISBLK(inode->i_mode)) { i_size_write(inode, pos); mark_inode_dirty(inode); } iocb->ki_pos = pos; } + iov_iter_revert(from, write_len - iov_iter_count(from)); out: return written; } |