Commit c0f45be5 authored by Jens Axboe's avatar Jens Axboe Committed by Wen Zhiwei
Browse files

io_uring/rw: split io_read() into a helper

stable inclusion
from stable-v6.6.68
commit 6c27fc6a783c8a77c756dd5461b15e465020d075
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBMDV1

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6c27fc6a783c8a77c756dd5461b15e465020d075



--------------------------------

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: default avatarGabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
(cherry picked from commit a08d195b586a217d76b42062f88f375a3eedda4d)
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent a96a9965
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -712,7 +712,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;
@@ -857,7 +857,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 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)