aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-04-07 11:52:01 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-01 19:58:39 -0400
commite259221763a40403d5bb232209998e8c45804ab8 (patch)
tree6f940ba17f38b693e495ad5267b1988dd66c9c0f /mm/filemap.c
parentdde0c2e79848298cc25621ad080d47f94dbd7cce (diff)
fs: simplify the generic_write_sync prototype
The kiocb already has the new position, so use that. The only interesting case is AIO, where we currently don't bother updating ki_pos. We're about to free the kiocb after we're done, so we might as well update it to make everyone's life simpler. While we're at it also return the bytes written argument passed in if we were successful so that the boilerplate error switch code in the callers can go away. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 8345d6d3436a..182b21825255 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2791,13 +2791,8 @@ ssize_t generic_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
2791 ret = __generic_file_write_iter(iocb, from); 2791 ret = __generic_file_write_iter(iocb, from);
2792 inode_unlock(inode); 2792 inode_unlock(inode);
2793 2793
2794 if (ret > 0) { 2794 if (ret > 0)
2795 ssize_t err; 2795 ret = generic_write_sync(iocb, ret);
2796
2797 err = generic_write_sync(iocb, iocb->ki_pos - ret, ret);
2798 if (err < 0)
2799 ret = err;
2800 }
2801 return ret; 2796 return ret;
2802} 2797}
2803EXPORT_SYMBOL(generic_file_write_iter); 2798EXPORT_SYMBOL(generic_file_write_iter);