summaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2016-04-07 08:52:01 -0700
committerAl Viro <viro@zeniv.linux.org.uk>2016-05-01 19:58:39 -0400
commite259221763a40403d5bb232209998e8c45804ab8 (patch)
tree6f940ba17f38b693e495ad5267b1988dd66c9c0f /fs/block_dev.c
parentdde0c2e79848298cc25621ad080d47f94dbd7cce (diff)
downloadlwn-e259221763a40403d5bb232209998e8c45804ab8.tar.gz
lwn-e259221763a40403d5bb232209998e8c45804ab8.zip
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 'fs/block_dev.c')
-rw-r--r--fs/block_dev.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index d8dc3512e927..a063d4d8ac39 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1660,12 +1660,8 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
blk_start_plug(&plug);
ret = __generic_file_write_iter(iocb, from);
- if (ret > 0) {
- ssize_t err;
- err = generic_write_sync(iocb, iocb->ki_pos - ret, ret);
- if (err < 0)
- ret = err;
- }
+ if (ret > 0)
+ ret = generic_write_sync(iocb, ret);
blk_finish_plug(&plug);
return ret;
}