]> git.baikalelectronics.ru Git - kernel.git/commit
io_uring: deduplicate freeing linked timeouts
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 29 Jun 2020 10:12:59 +0000 (13:12 +0300)
committerJens Axboe <axboe@kernel.dk>
Tue, 30 Jun 2020 14:38:58 +0000 (08:38 -0600)
commita3c08c730f9da638d019abfb45f3ddecd6b4387a
treed589944e8631359a8a3199073121c60ace69199f
parent1b0d3f3d845407aa950241d7fa63b38f001e0061
io_uring: deduplicate freeing linked timeouts

Linked timeout cancellation code is repeated in in io_req_link_next()
and io_fail_links(), and they differ in details even though shouldn't.
Basing on the fact that there is maximum one armed linked timeout in
a link, and it immediately follows the head, extract a function that
will check for it and defuse.

Justification:
- DRY and cleaner
- better inlining for io_req_link_next() (just 1 call site now)
- isolates linked_timeouts from common path
- reduces time under spinlock for failed links
- actually less code

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
[axboe: fold in locking fix for io_fail_links()]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c