Skip to content

Commit 7206043

Browse files
axboegregkh
authored andcommitted
io_uring/rw: split io_read() into a helper
Commit a08d195b586a217d76b42062f88f375a3eedda4d upstream. 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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]> (cherry picked from commit a08d195b586a217d76b42062f88f375a3eedda4d) Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 400a2ae commit 7206043

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

io_uring/rw.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
691691
return 0;
692692
}
693693

694-
int io_read(struct io_kiocb *req, unsigned int issue_flags)
694+
static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
695695
{
696696
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
697697
struct io_rw_state __s, *s = &__s;
@@ -836,7 +836,18 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
836836
/* it's faster to check here then delegate to kfree */
837837
if (iovec)
838838
kfree(iovec);
839-
return kiocb_done(req, ret, issue_flags);
839+
return ret;
840+
}
841+
842+
int io_read(struct io_kiocb *req, unsigned int issue_flags)
843+
{
844+
int ret;
845+
846+
ret = __io_read(req, issue_flags);
847+
if (ret >= 0)
848+
return kiocb_done(req, ret, issue_flags);
849+
850+
return ret;
840851
}
841852

842853
static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb)

0 commit comments

Comments
 (0)