ublk-org / ublksrv

ublk: userspace block device driver
MIT License
147 stars 50 forks source link

Aio #13

Closed ming1 closed 2 years ago

ming1 commented 2 years ago

Add interfaces for offloading io handling into non-io_uring context, and it is ublksrv's aio.

For the following reasons:

1) in io_uring implementation, fallocate() and fsync() is actually sync
interface, sometimes fsync() is required to order IO, which may slow
down the whole io uring

2) sometimes sqe may be run out of space

3) the single io_uring context may be saturated, such as compression,
decompression, encrypt/decrypt, ...

4) some implementation chooses non-io_uring io handling, such as
ublk-nbd.

The added interfaces will simplify io offloading implementation a lot. With these interface, demo_event now supports both null and loop target, meantime supports both sync io and io_uring handling.

ming1 commented 2 years ago

This ways is a bit heavy since request allocation is required in case of offloading the ublksrv IO direclty.

But it does help to offload non-ublksrv IO, such as qcow2's meta, fallocate on new cluster, or flush l2/refcount table.

Will work on V2 for cover both.

ming1 commented 2 years ago

merged already