Skip to content

IoUringFile based on universal I/O interface - #8292

Merged
ffuugoo merged 8 commits into
devfrom
io-uring-file
Mar 5, 2026
Merged

ffuugoo merged 8 commits into
devfrom
io-uring-file

Conversation

@ffuugoo

@ffuugoo ffuugoo commented Mar 4, 2026 •

Copy link
Copy Markdown
Contributor

Initial implementation of IoUringFile for universal I/O.

Few caveats:

  • implements UniversalRead<u8>/UniversalWrite<u8> instead of UR<T>/UW<T>
    • internally, it's always u8, so I started with this for simplicity, I'll tweak it into T in a follow-up PR
  • also no read_multi/write_multi, yet
    • follow-up PR, it's a small refactoring

TODO:

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --workspace --all-features command?

Changes to Core Features:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your core changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@ffuugoo
ffuugoo requested review from coszio, generall and xzfc March 4, 2026 17:13
@ffuugoo ffuugoo changed the title WIP: IoUringFile based on universal I/O interface IoUringFile based on universal I/O interface Mar 5, 2026
@ffuugoo
ffuugoo marked this pull request as ready for review March 5, 2026 10:33
`impl UniversalReadFileOps for IoUringFile`
Fix `completed` for write ops
@qdrant qdrant deleted a comment from coderabbitai Bot Mar 5, 2026
@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Comment on lines +242 to +258
impl<'a> Drop for IoUringRuntime<'a> {
fn drop(&mut self) {
while self.in_progress > 0 {
// TODO: Cancel operations with `io_uring::Submitter::register_sync_cancel`

self.submit_and_wait(self.in_progress)
.expect("operations submitted");

for result in self.completed() {
match result {
Ok(_) => (),
Err(err) => log::debug!("{err}"),
}
}
}
}
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the interesting part, that is different from our existing IoUringReader, is this.

We want to ensure, that if we, e.g., throw an error in the middle of IoUringFile::read_multi, we complete or cancel all pending operations. Because if we don't, and we just propagate the error and return from read_multi, then we would deallocate our BufferStore, but kernel will still hold pointers into these buffers and write into deallocated memory.

And it does not matter that much, if we put BufferStore inside TLS next to IoUring, because we would have the same problem: if we exit the thread, TLS would be dropped, but kernel might still have pointers into deallocated BufferStore. 🤷‍♀️

}

impl UniversalRead<u8> for IoUringFile {
fn open(path: impl AsRef<Path>, _options: OpenOptions) -> Result<Self>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal for handling of unsupported IO_URING:

  • on open, check that io_uring is either already created or actually create it.
  • if creation errors out, return error in the open result

Assume user will choose different storage backend if this happens

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a custom error for this as well

@generall generall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For follow-up PR:

  • use Hashmap -> Vec
  • handle errors without panic
  • multi-file
  • handle unsupported on open
  • Implement for T
  • implement clear_ram_cache
  • (*) implement populate (how?)

coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as resolved.

@ffuugoo ffuugoo mentioned this pull request Mar 5, 2026
10 of 16 tasks
@ffuugoo
ffuugoo merged commit d53c712 into dev Mar 5, 2026
13 of 16 checks passed
@ffuugoo
ffuugoo deleted the io-uring-file branch March 5, 2026 17:19
coszio pushed a commit to coszio/qdrant that referenced this pull request Mar 5, 2026
Introduce a universal I/O abstraction layer (following upstream qdrant/qdrant
PRs qdrant#8196, qdrant#8251, qdrant#8292) that decouples data access from storage backends.

Key components:
- UniversalRead<T> / UniversalWrite<T> traits for backend-agnostic I/O
- MmapUniversal<T>: mmap-based implementation with optional sequential read mmap
- BitSliceReader<S>: storage-agnostic bitslice reader that works over any
  UniversalRead<u8> backend, supporting:
  - read_bitslice(): read entire storage as a BitSlice (zero-copy for mmap)
  - get_bit(): single-bit access translating bit offset to a 1-byte read
  - read_bit_range(): partial bit range reads with byte-aligned backend access

https://claude.ai/code/session_01X9Bnj9Gooxh5bxkhbFmnGx
@generall generall added this to the Universal IO milestone Mar 26, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants