io_uring/rsrc: allow cloning with node replacements
authorJens Axboe <axboe@kernel.dk>
Tue, 29 Oct 2024 13:50:56 +0000 (07:50 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 31 Oct 2024 00:54:40 +0000 (18:54 -0600)
commit0ecda46309065d9d6a255f21d16756f0ef39c684
tree0e5bd8b12d667b4ffdbed35b6bb9c2dadc500b12
parent05ed1fe7ae5ce50f84145c47925eea42c561f59d
io_uring/rsrc: allow cloning with node replacements

Currently cloning a buffer table will fail if the destination already has
a table. But it should be possible to use it to replace existing elements.
Add a IORING_REGISTER_DST_REPLACE cloning flag, which if set, will allow
the destination to already having a buffer table. If that is the case,
then entries designated by offset + nr buffers will be replaced if they
already exist.

Note that it's allowed to use IORING_REGISTER_DST_REPLACE and not have
an existing table, in which case it'll work just like not having the
flag set and an empty table - it'll just assign the newly created table
for that case.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/uapi/linux/io_uring.h
io_uring/rsrc.c