]> www.infradead.org Git - nvme.git/commit
ublk: add segment parameter
authorMing Lei <ming.lei@redhat.com>
Thu, 27 Mar 2025 09:51:15 +0000 (17:51 +0800)
committerKeith Busch <kbusch@kernel.org>
Mon, 31 Mar 2025 15:48:24 +0000 (08:48 -0700)
commit34de1e06d4c94cba9090eb791232c0a213f247a9
tree08553f5d6fae00970879ca116e12f6fd8f00e4bb
parent874b1e598f73701afa39394f7c5bdabe6efef4c0
ublk: add segment parameter

IO split is usually bad in io_uring world, since -EAGAIN is caused and
IO handling may have to fallback to io-wq, this way does hurt performance.

ublk starts to support zero copy recently, for avoiding unnecessary IO
split, ublk driver's segment limit should be aligned with backend
device's segment limit.

Another reason is that io_buffer_register_bvec() needs to allocate bvecs,
which number is aligned with ublk request segment number, so that big
memory allocation can be avoided by setting reasonable max_segments limit.

So add segment parameter for providing ublk server chance to align
segment limit with backend, and keep it reasonable from implementation
viewpoint.

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