Skip to content

Commit a08d195

Browse files
committed
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ce9ecca commit a08d195

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
@@ -708,7 +708,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
708708
return 0;
709709
}
710710

711-
int io_read(struct io_kiocb *req, unsigned int issue_flags)
711+
static int __io_read(struct io_kiocb *req, unsigned int issue_flags)
712712
{
713713
struct io_rw *rw = io_kiocb_to_cmd(req, struct io_rw);
714714
struct io_rw_state __s, *s = &__s;
@@ -853,7 +853,18 @@ int io_read(struct io_kiocb *req, unsigned int issue_flags)
853853
/* it's faster to check here then delegate to kfree */
854854
if (iovec)
855855
kfree(iovec);
856-
return kiocb_done(req, ret, issue_flags);
856+
return ret;
857+
}
858+
859+
int io_read(struct io_kiocb *req, unsigned int issue_flags)
860+
{
861+
int ret;
862+
863+
ret = __io_read(req, issue_flags);
864+
if (ret >= 0)
865+
return kiocb_done(req, ret, issue_flags);
866+
867+
return ret;
857868
}
858869

859870
int io_write(struct io_kiocb *req, unsigned int issue_flags)

0 commit comments

Comments
 (0)