Skip to content
  • Stefan Hajnoczi's avatar
    block/file-posix: set up Linux AIO and io_uring in the current thread · cd0c0db0
    Stefan Hajnoczi authored and Kevin Wolf's avatar Kevin Wolf committed
    
    
    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's avatarStefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230914140101.1065008-2-stefanha@redhat.com>
    Reviewed-by: default avatarKevin Wolf <kwolf@redhat.com>
    Reviewed-by: Eric Blake's avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    cd0c0db0