On Sat, Apr 26, 2025 at 08:34:40PM -0600, Keith Busch wrote: > On Sat, Apr 26, 2025 at 03:42:59PM -0700, Caleb Sander Mateos wrote: > > On Sat, Apr 26, 2025 at 2:41 AM Ming Lei <ming.lei@xxxxxxxxxx> wrote: > > > > > > UBLK_F_SUPPORT_ZERO_COPY requires ublk server to issue explicit buffer > > > register/unregister uring_cmd for each IO, this way is not only inefficient, > > > but also introduce dependency between buffer consumer and buffer register/ > > > unregister uring_cmd, please see tools/testing/selftests/ublk/stripe.c > > > in which backing file IO has to be issued one by one by IOSQE_IO_LINK. > > > > This is a great idea! > > This is very similiar to something I proposed off-list, and the feedback Looks we both think of it, :-) > back then was this won't work because the back-end ring that wants to > use the zero-copy buffer isn't the same as the ublk server ring > recieving notification of a new command; the ublk driver has no idea > which uring to register the bvec with. Also, this is using the request > "tag" as the io_uring buf index, which wouldn't work when the ublk > server ring handles multiple ublk devices due to the tag collisions. > > If you're can make those trade-offs, then this is a great simplification > to the whole thing. The io_uring fd & buffer index can be provided from 'ublksrv_io_cmd'. https://lore.kernel.org/linux-block/aA2RNG3-WzuQqEN6@fedora/ If we only support IORING_ENTER_REGISTERED_RING, 32bit is enough for io_uring fd & buffer index, and there is still 64bits available if not taking UBLK_F_ZONED into account. Thanks, Ming