Open songzhi opened 2 years ago
So you mean:
RuntimeBuilder
to register buffers.registered_buffer_id(&self) -> Option<u16>
to IoBuf
and IoBufMut
(The function sign is just for demo).I don't know if there are some limitations of io-uring, like if it is allowd to register the same buffers to multiple rings. Also, this will bring the limitation that we cannot have multiple rings(like glommio) in a single Runtime instance.
The buffer manager is another thing I think. We can let users do it by themselves or provide an impl for them.
Just checked glommio's source code, they registered the same buffer to all rings. But the buffer index in different rings maybe different, so this is a problem when exposing the register buffers function to users.
Provides fixed buffers from a pre-registered buffer pool, to support ReadFixed and WriteFixed ops. The APIs monoio should provide are important and should be discussed.
There are several related works. glommio uses a per-reactor buddy-system allocator to allocate buffers for writes to their
DmaFile
. TheDmaFile
needs the buffer and the position be properly aligned for Direct I/O. But monoio doesn't suppor Direct I/O now. In the tokio-uring's pending PR, the APIs are as follows:Should monoio provide extra
read_fixed_at
andwrite_fixed_at
methods which only accept FixedBuf as parameter, or extendIoBuf
/IoBufMut
to provide ais_registered
/is_fixed
hint to allow callingOp<ReadFixed/WriteFixed>
internally inread_at
/write_at
?How the fixed buffer allocator/registry should be like? I prefer to provide a allocator like glommio, and provide a register buffers method, but let users manage these fixed buffers, monoio only take and return their ownerships.
I'm glad to implement this feature as long as the discussion ends up with a result.