Skip to content

cleanup(fs): stricter check for buffer chunks count and minor improvements#10117

Merged
kskalski merged 1 commit into
anza-xyz:masterfrom
kskalski:ks/file_read_buf_uring
Jan 21, 2026
Merged

cleanup(fs): stricter check for buffer chunks count and minor improvements#10117
kskalski merged 1 commit into
anza-xyz:masterfrom
kskalski:ks/file_read_buf_uring

Conversation

@kskalski
Copy link
Copy Markdown

Problem

u16 is used for index of buffer chunks (IoBufferChunk), e.g. in FileState there is start_buf_index: Option<u16>,
However we don't validate that dividing original buffer into chunks won't exceed limit of u16.

Summary of Changes

  • assert that dividing buffer.len() by chunk_size doesn't exceed u16::MAX (also add check that chunk_size is not larger than FIXED_BUFFER_LEN)
  • switch some u32 types in function signatures to proper type alias IoSize
  • add some safety comments
  • minor cleanups

@kskalski kskalski changed the title cleanup(fs): stricter check for count of buffer chunks and minor improvements cleanup(fs): stricter check for buffer chunks count and minor improvements Jan 20, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.6%. Comparing base (1e0f899) to head (c119ed2).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10117   +/-   ##
=======================================
  Coverage    82.6%    82.6%           
=======================================
  Files         845      845           
  Lines      317132   317134    +2     
=======================================
+ Hits       261967   261982   +15     
+ Misses      55165    55152   -13     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread fs/src/io_uring/memory.rs
buffer
.chunks_exact_mut(chunk_size as usize)
.map(move |buf| {
let io_buf_index = (buf.as_ptr() as usize - buf_start) / FIXED_BUFFER_LEN as usize;
let io_buf_index = (buf.as_ptr().addr() - buf_start) / FIXED_BUFFER_LEN as usize;
Copy link
Copy Markdown
Author

@kskalski kskalski Jan 20, 2026

Choose a reason for hiding this comment

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

this is now compatible with the way buf_start is calculated in line 211

@kskalski kskalski force-pushed the ks/file_read_buf_uring branch from eecdebc to c119ed2 Compare January 20, 2026 02:38
@kskalski kskalski marked this pull request as ready for review January 20, 2026 03:59
@kskalski kskalski requested a review from brooksprumo January 20, 2026 03:59
@kskalski
Copy link
Copy Markdown
Author

this was supposed to be part of #9701, missed pushing changes from my local repo.. :/

Copy link
Copy Markdown

@brooksprumo brooksprumo left a comment

Choose a reason for hiding this comment

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

:shipit:

@kskalski kskalski added this pull request to the merge queue Jan 21, 2026
Merged via the queue into anza-xyz:master with commit 63012b7 Jan 21, 2026
47 checks passed
@kskalski kskalski deleted the ks/file_read_buf_uring branch January 21, 2026 00:26
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