Commit a08d195b authored by Jens Axboe's avatar Jens Axboe

io_uring/rw: split io_read() into a helper

Add __io_read() which does the grunt of the work, leaving the completion
side to the new io_read(). No functional changes in this patch.
Reviewed-by: default avatarGabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent ce9ecca0
...@@ -708,7 +708,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) ...@@ -708,7 +708,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
return 0; return 0;
} }
int io_read(struct io_kiocb *req, unsigned int issue_flags) static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
{ {
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw); struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
struct io_rw_state __s, *s = &__s; struct io_rw_state __s, *s = &__s;
...@@ -853,7 +853,18 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags) ...@@ -853,7 +853,18 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
/* it's faster to check here then delegate to kfree */ /* it's faster to check here then delegate to kfree */
if (iovec) if (iovec)
kfree(iovec); kfree(iovec);
return kiocb_done(req, ret, issue_flags); return ret;
}
int io_read(struct io_kiocb *req, unsigned int issue_flags)
{
int ret;
ret = __io_read(req, issue_flags);
if (ret >= 0)
return kiocb_done(req, ret, issue_flags);
return ret;
} }
int io_write(struct io_kiocb *req, unsigned int issue_flags) int io_write(struct io_kiocb *req, unsigned int issue_flags)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment