New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
io_uring: implement automatic buffer selection #10197
Conversation
302d935
to
d50a044
Compare
d50a044
to
cd152ce
Compare
This PR had an Azure CI failure and the log was deleted since it is so old, so I rebased this against master. |
f074285
to
ee484dd
Compare
I changed the PR, now Both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it makes sense to do the breaking changes in one go? Would be really nice to get recv()
into this PR since it's so similar to read()
.
Ok, I can do that. |
e06dcc9
to
c8bb3a9
Compare
I've added support for buffer selection for This means that I have to handle the |
df8598a
to
260b836
Compare
Thanks for doing this!
Rather than using |
Ok makes sense, I'll change it |
260b836
to
b9033b6
Compare
I've pushed an update which uses the |
b9033b6
to
3f57d1a
Compare
These functions are needed to implement automatic buffer selection. This maps to the IORING_OP_PROVIDE_BUFFERS and IORING_OP_PROVIDE_BUFFERS ops.
Reads can be done in two ways with io_uring: * using a simple buffer * using a automatic buffer selection which requires the user to have provided a number of buffers before ReadBuffer let's the caller choose where the data should be read.
RecvBuffer is equivalent to ReadBuffer but tailored for recv only.
readv() is essentially identical to read() except for the buffer type, this simplifies the API for the caller at the cost of not clearly mapping to the liburing C API.
3f57d1a
to
3c58d3e
Compare
Thanks @vrischmann and reviewers! |
This implements automatic buffer selection for
io_uring
.The current api of
read
andrecv
is not great when using automatic buffer selection, we have to write relatively ugly code like this:because
read
takes a slice and gives itsptr
andlen
to the kernel via these fields.This is the reason why I added
read_raw
andrecv_raw
which take a?[*]u8
and a separate length, so we can write code like this instead:which is better imo.
I'm not 100% happy with this API either, because:
There are other solutions but they require breaking existing code using
read
andrecv
.read
the same asread_raw
and let the caller give the correct pointer/len.
Any input on this is appreciated, I might have missed something obvious.