Skip to content

Improvements for IoUringFile - #8300

Merged
generall merged 14 commits into
devfrom
io-uring-file-improvements
Mar 12, 2026
Merged

generall merged 14 commits into
devfrom
io-uring-file-improvements

Conversation

@ffuugoo

@ffuugoo ffuugoo commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #8292.

  • handle read and write requests more explicitly
  • assert against partial reads/writes

TODO:

  • implement read_multi and write_multi
    • unify/deduplicate *_batch and *_multi (and maybe read_* and write_*) impls?
  • implement populate and clear_ram_cache
  • implement UniversalRead/UniversalWrite for T
  • handle errors without panic
  • check if io_uring available/supported during IoUringFile::open
  • use Vec/VecDeque in IoUringState instead of HashMap

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 5, 2026 16:22
@ffuugoo ffuugoo mentioned this pull request Mar 5, 2026
7 of 12 tasks
Base automatically changed from io-uring-file to dev March 5, 2026 17:19
@ffuugoo
ffuugoo force-pushed the io-uring-file-improvements branch 2 times, most recently from 240bcb8 to 964fc85 Compare March 9, 2026 10:56
@ffuugoo
ffuugoo marked this pull request as ready for review March 9, 2026 18:24
@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as duplicate.

coderabbitai[bot]

This comment was marked as duplicate.

@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.

test fails with alignment error

coderabbitai[bot]

This comment was marked as duplicate.

ffuugoo and others added 12 commits March 12, 2026 20:32
- handle read and write requests more explicitly
- assert against partial reads/writes
…t for T (#8353)

* fix(io_uring): allocate Vec<MaybeUninit<T>> for reads to fix alignment for T

Refactor IoUringState::read to take generic T and item_offset/items_length
instead of byte_offset/byte_length. Allocate Vec<MaybeUninit<T>> so the
kernel writes into correctly aligned memory, then convert to Vec<T> in
finalize. Fixes bytemuck::cast_vec alignment panic for types like u64.

Made-with: Cursor

* refactor(io_uring): only make read/write methods generic, not state or runtime

- IoUringState and IoUringRuntime no longer generic over T
- read<T>() allocates Vec<MaybeUninit<T>>, transmutes to Vec<MaybeUninit<u8>> for storage
- finalize returns ReadBuffer; callers use .into_vec::<T>() to get Vec<T>
- Write path unchanged (callers pass bytes via bytemuck::cast_slice)

Made-with: Cursor

* Cleanup

* review n1

* review n2

* fmt

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Roman Titov <[email protected]>
Co-authored-by: Andrey Vasnetsov <[email protected]>
coderabbitai[bot]

This comment was marked as duplicate.

@generall
generall force-pushed the io-uring-file-improvements branch from 1dcb8bf to 5e6d087 Compare March 12, 2026 19:36
@generall
generall merged commit a3786cf into dev Mar 12, 2026
15 checks passed
@generall
generall deleted the io-uring-file-improvements branch March 12, 2026 21:41
@generall generall added this to the Universal IO milestone Mar 26, 2026
generall added a commit that referenced this pull request Mar 26, 2026
* Improvements for `IoUringFile`

- handle read and write requests more explicitly
- assert against partial reads/writes

* Implement `read_multi`/`write_multi`

* Implement `populate` and `clear_ram_cache`

* Rename internal structures as `IoUringSomething`

* [ai] Make `UniversalRead`/`UniversalWrite` impl generic over `T`

* Handle `io_uring` initialization error

* Check that `io_uring` is initialized and supported, when opening `IoUringFile`

* fixup! Check that `io_uring` is initialized and supported, when opening `IoUringFile`

Fix typo

* test for reading u64 from file with uring

* fmt

* clippy

* fix(io_uring): allocate Vec<MaybeUninit<T>> for reads to fix alignment for T (#8353)

* fix(io_uring): allocate Vec<MaybeUninit<T>> for reads to fix alignment for T

Refactor IoUringState::read to take generic T and item_offset/items_length
instead of byte_offset/byte_length. Allocate Vec<MaybeUninit<T>> so the
kernel writes into correctly aligned memory, then convert to Vec<T> in
finalize. Fixes bytemuck::cast_vec alignment panic for types like u64.

Made-with: Cursor

* refactor(io_uring): only make read/write methods generic, not state or runtime

- IoUringState and IoUringRuntime no longer generic over T
- read<T>() allocates Vec<MaybeUninit<T>>, transmutes to Vec<MaybeUninit<u8>> for storage
- finalize returns ReadBuffer; callers use .into_vec::<T>() to get Vec<T>
- Write path unchanged (callers pass bytes via bytemuck::cast_slice)

Made-with: Cursor

* Cleanup

* review n1

* review n2

* fmt

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Roman Titov <[email protected]>
Co-authored-by: Andrey Vasnetsov <[email protected]>

* use AHash instead of just hash

* add ahash to deps

---------

Co-authored-by: Andrey Vasnetsov <[email protected]>
Co-authored-by: qdrant-cloud-bot <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Mar 29, 2026
KShivendu pushed a commit that referenced this pull request Mar 30, 2026
* Improvements for `IoUringFile`

- handle read and write requests more explicitly
- assert against partial reads/writes

* Implement `read_multi`/`write_multi`

* Implement `populate` and `clear_ram_cache`

* Rename internal structures as `IoUringSomething`

* [ai] Make `UniversalRead`/`UniversalWrite` impl generic over `T`

* Handle `io_uring` initialization error

* Check that `io_uring` is initialized and supported, when opening `IoUringFile`

* fixup! Check that `io_uring` is initialized and supported, when opening `IoUringFile`

Fix typo

* test for reading u64 from file with uring

* fmt

* clippy

* fix(io_uring): allocate Vec<MaybeUninit<T>> for reads to fix alignment for T (#8353)

* fix(io_uring): allocate Vec<MaybeUninit<T>> for reads to fix alignment for T

Refactor IoUringState::read to take generic T and item_offset/items_length
instead of byte_offset/byte_length. Allocate Vec<MaybeUninit<T>> so the
kernel writes into correctly aligned memory, then convert to Vec<T> in
finalize. Fixes bytemuck::cast_vec alignment panic for types like u64.

Made-with: Cursor

* refactor(io_uring): only make read/write methods generic, not state or runtime

- IoUringState and IoUringRuntime no longer generic over T
- read<T>() allocates Vec<MaybeUninit<T>>, transmutes to Vec<MaybeUninit<u8>> for storage
- finalize returns ReadBuffer; callers use .into_vec::<T>() to get Vec<T>
- Write path unchanged (callers pass bytes via bytemuck::cast_slice)

Made-with: Cursor

* Cleanup

* review n1

* review n2

* fmt

---------

Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: Roman Titov <[email protected]>
Co-authored-by: Andrey Vasnetsov <[email protected]>

* use AHash instead of just hash

* add ahash to deps

---------

Co-authored-by: Andrey Vasnetsov <[email protected]>
Co-authored-by: qdrant-cloud-bot <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
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.

4 participants