diff options
author | Jens Axboe <axboe@kernel.dk> | 2023-09-11 22:31:56 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-09-21 21:00:41 +0300 |
commit | a08d195b586a217d76b42062f88f375a3eedda4d (patch) | |
tree | 430dba2c7f2b6948b7080d67ce41c8d19ff9dbc5 /io_uring | |
parent | ce9ecca0238b140b88f43859b211c9fdfd8e5b70 (diff) | |
download | linux-a08d195b586a217d76b42062f88f375a3eedda4d.tar.xz |
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: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
-rw-r--r-- | io_uring/rw.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/io_uring/rw.c b/io_uring/rw.c index c8c822fa7980..5c58962d73da 100644 --- a/io_uring/rw.c +++ b/io_uring/rw.c @@ -708,7 +708,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode) 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_state __s, *s = &__s; @@ -853,7 +853,18 @@ done: /* it's faster to check here then delegate to kfree */ if (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) |