mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-01 10:42:11 +00:00
io_uring: reuse io_req_task_queue_fail()
Use io_req_task_queue_fail() on the fail path of io_req_task_queue(). It's unlikely to happen, so don't care about additional overhead, but allows to keep all the req->result invariant in a single function. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
e83acd7d37
commit
2c4b8eb643
@ -2011,18 +2011,6 @@ static void io_req_task_submit(struct callback_head *cb)
|
||||
__io_req_task_submit(req);
|
||||
}
|
||||
|
||||
static void io_req_task_queue(struct io_kiocb *req)
|
||||
{
|
||||
int ret;
|
||||
|
||||
req->task_work.func = io_req_task_submit;
|
||||
ret = io_req_task_work_add(req);
|
||||
if (unlikely(ret)) {
|
||||
req->result = -ECANCELED;
|
||||
io_req_task_work_add_fallback(req, io_req_task_cancel);
|
||||
}
|
||||
}
|
||||
|
||||
static void io_req_task_queue_fail(struct io_kiocb *req, int ret)
|
||||
{
|
||||
req->result = ret;
|
||||
@ -2032,6 +2020,14 @@ static void io_req_task_queue_fail(struct io_kiocb *req, int ret)
|
||||
io_req_task_work_add_fallback(req, io_req_task_cancel);
|
||||
}
|
||||
|
||||
static void io_req_task_queue(struct io_kiocb *req)
|
||||
{
|
||||
req->task_work.func = io_req_task_submit;
|
||||
|
||||
if (unlikely(io_req_task_work_add(req)))
|
||||
io_req_task_queue_fail(req, -ECANCELED);
|
||||
}
|
||||
|
||||
static inline void io_queue_next(struct io_kiocb *req)
|
||||
{
|
||||
struct io_kiocb *nxt = io_req_find_next(req);
|
||||
|
Loading…
Reference in New Issue
Block a user