[PATCH v2 3/9] io_uring: optimise initial ltimeout refcounting

Pavel Begunkov
2021-08-15T09:41:08Z

Linked timeouts are never refcounted when it comes to the first call to
__io_prep_linked_timeout(), so save an io_ref_get() and set the desired
value directly.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
fs/io_uring.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index fde76d502fff..d2b968c8111f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1310,8 +1310,7 @@ static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req)

/* linked timeouts should have two refs once prep'ed */
io_req_set_refcount(req);
- io_req_set_refcount(nxt);
- req_ref_get(nxt);
+ __io_req_set_refcount(nxt, 2);

nxt->timeout.head = req;
nxt->flags |= REQ_F_LTIMEOUT_ACTIVE;
--
2.32.0