ublk: avoid to pass `struct ublksrv_io_cmd *` to ublk_commit_and_fetch()
authorMing Lei <ming.lei@redhat.com>
Sun, 13 Jul 2025 14:34:00 +0000 (22:34 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 15 Jul 2025 14:04:16 +0000 (08:04 -0600)
commit7ebdba87cf2a248aad10aff6b5fb1ca7c6b0add7
tree2768a81c920941b6b43d3dab14631fa50b898610
parent07bc706431799e7cf5209e8afdd8071d400266e7
ublk: avoid to pass `struct ublksrv_io_cmd *` to ublk_commit_and_fetch()

Refactor ublk_commit_and_fetch() in the following way for removing
parameter of `struct ublksrv_io_cmd *`:

- return `struct request *` from ublk_fill_io_cmd(), so that we can
use request reference reliably in this way cause both request and
io_uring_cmd reference share same storage

- move ublk_fill_io_cmd() before calling into ublk_commit_and_fetch(),
so that ublk_fill_io_cmd() could be run with per-io lock held for
supporting command batch.

- pass ->zone_append_lba to ublk_commit_and_fetch() directly

The main motivation is to reproduce ublk_commit_and_fetch() for fetching
io command batch with multishot uring_cmd.

Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20250713143415.2857561-6-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/ublk_drv.c