io_uring: allow empty slots for reg buffers
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 28 Apr 2021 12:11:29 +0000 (13:11 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Apr 2021 19:26:19 +0000 (13:26 -0600)
commit6224843d56e0c29c0357e86b02b95801897c2caf
tree606736878ba8922977703f743bd22c5eb3f3d97b
parentb0d658ec88a695861c3fd78ef783c1181f81a6e2
io_uring: allow empty slots for reg buffers

Allow empty reg buffer slots any request using which should fail. This
allows users to not register all buffers in advance, but do it lazily
and/or on demand via updates. That is achieved by setting iov_base and
iov_len to zero for registration and/or buffer updates. Empty buffer
can't have a non-zero tag.

Implementation details: to not add extra overhead to io_import_fixed(),
create a dummy buffer crafted to fail any request using it, and set it
to all empty buffer slots.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7e95e4d700082baaf010c648c72ac764c9cc8826.1619611868.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c