block/file-posix: set up Linux AIO and io_uring in the current thread
authorStefan Hajnoczi <stefanha@redhat.com>
Thu, 14 Sep 2023 14:00:58 +0000 (10:00 -0400)
committerKevin Wolf <kwolf@redhat.com>
Thu, 21 Dec 2023 21:49:27 +0000 (22:49 +0100)
commitcd0c0db0aa905af9b72735d5ea40cb41206c7ca8
tree62c3cfd84c94aef0a291a5be76217b27b7483b82
parent7075d235114b40b30524cf1c5b61906c0bbf5f4d
block/file-posix: set up Linux AIO and io_uring in the current thread

The file-posix block driver currently only sets up Linux AIO and
io_uring in the BDS's AioContext. In the multi-queue block layer we must
be able to submit I/O requests in AioContexts that do not have Linux AIO
and io_uring set up yet since any thread can call into the block driver.

Set up Linux AIO and io_uring for the current AioContext during request
submission. We lose the ability to return an error from
.bdrv_file_open() when Linux AIO and io_uring setup fails (e.g. due to
resource limits). Instead the user only gets warnings and we fall back
to aio=threads. This is still better than a fatal error after startup.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20230914140101.1065008-2-stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/file-posix.c