ublk: register buffer to local io_uring with provided buf index via UBLK_F_AUTO_BUF_REG
authorMing Lei <ming.lei@redhat.com>
Tue, 20 May 2025 04:54:33 +0000 (12:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 20 May 2025 16:24:45 +0000 (10:24 -0600)
commit99c1e4eb6a3fbbec27c7c70e5fce15cdc1422893
tree5c3ffaf7b69fc529455e5bf97e3ebe0c19c2c4f6
parent9e6b4756b35426801cae84a5a1d7a3e0d480d197
ublk: register buffer to local io_uring with provided buf index via UBLK_F_AUTO_BUF_REG

Add UBLK_F_AUTO_BUF_REG for supporting to register buffer automatically
to local io_uring context with provided buffer index.

Add UAPI structure `struct ublk_auto_buf_reg` for holding user parameter
to register request buffer automatically, one 'flags' field is defined, and
there is still 32bit available for future extension, such as, adding one
io_ring FD field for registering buffer to external io_uring.

`struct ublk_auto_buf_reg` is populated from ublk uring_cmd's sqe->addr,
and all existing ublk commands are data-less, so it is just fine to reuse
sqe->addr for this purpose.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250520045455.515691-4-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c
include/uapi/linux/ublk_cmd.h