mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
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 <[email protected]> Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
parent
dde0c2e798
commit
e259221763
12 changed files with 46 additions and 65 deletions
|
|
@ -256,6 +256,7 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, bool is_async)
|
|||
if (dio->end_io) {
|
||||
int err;
|
||||
|
||||
// XXX: ki_pos??
|
||||
err = dio->end_io(dio->iocb, offset, ret, dio->private);
|
||||
if (err)
|
||||
ret = err;
|
||||
|
|
@ -265,15 +266,15 @@ static ssize_t dio_complete(struct dio *dio, ssize_t ret, bool is_async)
|
|||
inode_dio_end(dio->inode);
|
||||
|
||||
if (is_async) {
|
||||
if (dio->rw & WRITE) {
|
||||
int err;
|
||||
|
||||
err = generic_write_sync(dio->iocb, offset,
|
||||
transferred);
|
||||
if (err < 0 && ret > 0)
|
||||
ret = err;
|
||||
}
|
||||
/*
|
||||
* generic_write_sync expects ki_pos to have been updated
|
||||
* already, but the submission path only does this for
|
||||
* synchronous I/O.
|
||||
*/
|
||||
dio->iocb->ki_pos += transferred;
|
||||
|
||||
if (dio->rw & WRITE)
|
||||
ret = generic_write_sync(dio->iocb, transferred);
|
||||
dio->iocb->ki_complete(dio->iocb, ret, 0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue