• Pavel Begunkov's avatar
    io_uring: split sqe-prep and async setup · 93642ef8
    Pavel Begunkov authored
    There are two kinds of opcode-specific preparations we do. The first is
    just initialising req with what is always needed for an opcode and
    reading all non-generic SQE fields. And the second is copying some of
    the stuff like iovec preparing to punt a request to somewhere async,
    e.g. to io-wq or for draining. For requests that have tried an inline
    execution but still needing to be punted, the second prep type is done
    by the opcode handler itself.
    
    Currently, we don't explicitly split those preparation steps, but
    combining both of them into io_*_prep(), altering the behaviour by
    allocating ->async_data. That's pretty messy and hard to follow and also
    gets in the way of some optimisations.
    
    Split the steps, leave the first type as where it is now, and put the
    second into a new io_req_prep_async() helper. It may make us to do opcode
    switch twice, but it's worth it.
    Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    93642ef8
io_uring.c 248 KB