tw handlers cleanups
cover tw handlers cleanups
Two simple patches cleaning task_work handlers.
Pavel Begunkov (2):
io_uring: remove mutex in io_req_task_cancel()
io_uring: dedup tw-based request failing
fs/io_uring.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
Signature · 1 line
2.32.0
PATCH 1/2 io_uring: remove mutex in io_req_task_cancel()
io_req_complete_failed() only does io_req_complete_post(), which we don't need to protect by ->uring_lock, so remove mutex_lock / unlock from there.
Signed-off-by Pavel Begunkov <[email protected]>
--- fs/io_uring.c | 5 ----- 1 file changed, 5 deletions(-)
fs/io_uring.c +0 -5
@@ -2111,12 +2111,7 @@ static void io_req_task_work_add(struct io_kiocb *req)static void io_req_task_cancel (struct io_kiocb *req) { -struct io_ring_ctx *ctx = req->ctx; - -/* ctx is guaranteed to stay alive while we hold uring_lock */ -mutex_lock (&ctx->uring_lock);io_req_complete_failed (req, req->result); -mutex_unlock (&ctx->uring_lock); }static void io_req_task_submit (struct io_kiocb *req)
Signature · 1 line
2.32.0
PATCH 2/2 io_uring: dedup tw-based request failing
In reply to Pavel Begunkovio_req_task_timeout() closely follows io_req_task_cancel(), so remove it and replace with io_req_task_queue_fail().
Signed-off-by Pavel Begunkov <[email protected]>
--- fs/io_uring.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
fs/io_uring.c +1 -8
@@ -5529,12 +5529,6 @@ static int io_poll_update(struct io_kiocb *req, unsigned int issue_flags)return 0 ; } -static void io_req_task_timeout (struct io_kiocb *req) -{ -req_set_fail (req); -io_req_complete_post (req, -ETIME ,0 ); -} -static enum hrtimer_restart io_timeout_fn (struct hrtimer *timer) { struct io_timeout_data *data = container_of(timer,
@@ -5549,8 +5543,7 @@ static enum hrtimer_restart io_timeout_fn(struct hrtimer *timer) atomic_read(&req->ctx->cq_timeouts) + 1);spin_unlock_irqrestore (&ctx->timeout_lock, flags); - req->io_task_work.func = io_req_task_timeout; -io_req_task_work_add (req); +io_req_task_queue_fail (req, -ETIME );return HRTIMER_NORESTART ; }
Signature · 1 line
2.32.0
Quoted 8 lines · Pavel Begunkov
Two simple patches cleaning
task_workhandlers.Pavel Begunkov (2):
io_uring: remove mutex inio_req_task_cancel()
io_uring: dedup tw-based request failingfs/io_uring.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
Applied, thanks.
Signature · 1 line
Jens Axboe