-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add support for io_uring's direct descriptors #102
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So we have a place to add stuff for fixed/direct fds.
Direct descriptors are file descriptors that are private with io_uring allowing it to avoid some of the avoid by avoiding syncing with the shared fd tables. This changes AsyncFd to accept a new generic parameter, D, which requires to implement the Descriptor trait. This Descriptor traits defines some behaviour on what to do when making submissions, mainly it sets the IOSQE_FIXED_FILE flag for direct descriptors. We still default to a regular file descriptor, AsyncFd (without setting the generic parameter) still refer to a regular file descriptor (not direct).
Not fixed by rustfmt because it's a macro.
Now the op_future! macro can support both regular file descriptors and direct descriptors.
Now the op_async_iter! macro can support both regular file descriptors and direct descriptors. Similar to the change made to op_future!
So it can be used to update the submission.
Creates a new direct file descriptor.
Returns a regular file descriptor for a direct descriptor.
I expected regular file descriptors to be more commonly used in the near future, so this looks better in the docs.
To match AsyncFd::from_raw_fd.
So it doesn't conflict with new tests that use direct descriptor (for which I want to use the _direct suffix).
Enables the setup required for direct descriptors.
Converts a regular file descriptor into a direct descriptor.
It requires Linux 6.8, which is unreleased at the time of writing.
Moves the creation methods to be the first impl blocks in the docs for easier discoverability.
Currently untested as it will be need to added to the other modules to effectively test.
Still have to do the OpenOptions::open(_temp_file) functions as changing them would be a breaking change currently as rustc is not able to default to using File.
Still have to add tests to make sure this all works properly. Also have to add the generic parameter to socket, but that would be a breaking change.
Still have to test it.
Near ReceiveSignals.
Thomasdezeeuw
force-pushed
the
fixed-fds
branch
from
April 20, 2024 15:43
192d488
to
2cfcc3e
Compare
Instead of make raw io_uring_register system calls.
Some breaking changes incoming.
To allow opening of direct descriptions.
Sets the submission flags needed to create a direct descriptor (or does nothing). Also renames the set_flags to use_flags to not confuse the two methods.
So that we can open files using direct descriptors.
Some of the creation methods are quite far away from the AsyncFd docs, so link to them to bring them a little closer.
At this point I think all API can use direct descriptors except for |
For the operations that use file_index, i.e. the creation of direct descriptors.
They already have the equivalant flag set.
Matches the name we're using for direct descriptors.
This way it happens at compile time.
Returns the underlying Signals.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Direct descriptors are file descriptors that are private with io_uring
allowing it to avoid some of the avoid by avoiding syncing with the
shared fd tables.
This changes AsyncFd to accept a new generic parameter, D, which
requires to implement the Descriptor trait. This Descriptor traits
defines some behaviour on what to do when making submissions, mainly it
sets the IOSQE_FIXED_FILE flag for direct descriptors.
We still default to a regular file descriptor, AsyncFd (without setting
the generic parameter) still refer to a regular file descriptor (not
direct).
Closes #39
Closes #101