feat(driver): add register_files/unregister_files for fixed-file ops#718
Conversation
Berrysoft
left a comment
There was a problem hiding this comment.
- Maybe also
register_files_sparseandregister_files_update? - Could you add a test for this feature? Maybe it should open a file, register the fd, and read it. The
OpCodecould becfged forio_uringonly. - It's IO unsafe to expose APIs for
RawFd. I'm considering a structFileRegistry<'_>which could keep the lifetime of the registered fds and unregister them ondrop.
5076ef0 to
f65218f
Compare
There was a problem hiding this comment.
Pull request overview
Adds public APIs to register/unregister io_uring “fixed files” so callers can use Fixed(index) operations without forking, exposed consistently across the driver/proactor/runtime layers.
Changes:
- Add io_uring driver methods calling
submitter().register_files()/unregister_files(). - Expose
Proactor::{register_files, unregister_files}withUnsupportedfallback on non-io_uring drivers. - Expose
Runtime::{register_files, unregister_files}plus runtime free functionsregister_files()/unregister_files().
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| compio-driver/src/sys/iour/mod.rs | Adds the io_uring-driver-level wrappers around submitter fixed-file registration APIs. |
| compio-driver/src/lib.rs | Adds proactor-level, driver-gated public APIs with Unsupported fallback. |
| compio-runtime/src/runtime/mod.rs | Adds runtime-level methods and free functions delegating to the underlying proactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
P.S. It's OK to ignore my suggestion on a safer guard |
…file ops Add support for registering and unregistering file descriptors with io_uring for fixed-file operations, following the same pattern as the existing register_personality/unregister_personality API. This is needed for use cases like FUSE over io_uring where file descriptors must be registered with the ring before using Fixed(index) in submission queue entries.
f65218f to
6881ccf
Compare
|
Thanks for the quick responses! I will send a follow up cr to address those minor issues mentioned above. |
Summary
register_files/unregister_filessupport for io_uring fixed-file operationsregister_personality/unregister_personalityAPIMotivation
FUSE over io_uring requires registering file descriptors with the ring before using
Fixed(index)in submission queue entries. Currently there is no way to do this through compio's public API, requiring users to maintain a fork.Changes
compio-driver/src/sys/iour/mod.rs: Directsubmitter().register_files()/unregister_files()callscompio-driver/src/lib.rs(Proactor): Platform-gated public API withUnsupportedfallback on non-io_uring driverscompio-runtime/src/runtime/mod.rs(Runtime): Runtime-level methods + convenience free functionsregister_files()/unregister_files()