Skip to content

Commit

Permalink
io_uring/rw: split io_read() into a helper
Browse files Browse the repository at this point in the history
Commit a08d195 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 a08d195)
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
axboe authored and gregkh committed Dec 27, 2024
1 parent 400a2ae commit 7206043
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions io_uring/rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,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;
Expand Down Expand Up @@ -836,7 +836,18 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
/* 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;
}

static bool io_kiocb_start_write(struct io_kiocb *req, struct kiocb *kiocb)
Expand Down

0 comments on commit 7206043

Please sign in to comment.