]> git.itanic.dy.fi Git - linux-stable/commit
io_uring/rw: cleanup io_rw_done()
authorJens Axboe <axboe@kernel.dk>
Wed, 10 Jan 2024 17:05:32 +0000 (10:05 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Jan 2024 18:46:48 +0000 (11:46 -0700)
commitfe80eb15dea5125ea64845c9de0dd7f8478dd267
tree6ab79b33a63360173c7eb14e7553a849963c6b24
parent6ff1407e24e6fdfa4a16ba9ba551e3d253a26391
io_uring/rw: cleanup io_rw_done()

This originally came from the aio side, and it's laid out rather oddly.
The common case here is that we either get -EIOCBQUEUED from submitting
an async request, or that we complete the request correctly with the
given number of bytes. Handling the odd internal restart error codes
is not a common operation.

Lay it out a bit more optimally that better explains the normal flow,
and switch to avoiding the indirect call completely as this is our
kiocb and we know the completion handler can only be one of two
possible variants. While at it, move it to where it belongs in the
file, with fellow end IO helpers.

Outside of being easier to read, this also reduces the text size of the
function by 24 bytes for me on arm64.

Reviewed-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/rw.c