Skip to content

feat(fast_io): add IORING_OP_STATX batch chains for parallel directory stat (#1833)#4001

Merged
oferchen merged 8 commits into
masterfrom
feat/io-uring-statx-batch-1833
May 13, 2026
Merged

feat(fast_io): add IORING_OP_STATX batch chains for parallel directory stat (#1833)#4001
oferchen merged 8 commits into
masterfrom
feat/io-uring-statx-batch-1833

Conversation

@oferchen
Copy link
Copy Markdown
Owner

Summary

  • Add IORING_OP_STATX (opcode 21) wrapper in fast_io following the existing RENAMEAT2/LINKAT pattern, with OnceLock-cached kernel probe for Linux 5.11+
  • Implement submit_statx_batch() for multi-path batch submission with chunked SQ processing and automatic fallback to synchronous rustix::fs::statx on older kernels
  • Add non-Linux stub in io_uring_stub.rs and top-level try_statx_batch_via_io_uring() convenience dispatch in lib.rs

Test plan

  • CI passes on Linux (fmt, clippy, nextest)
  • CI passes on macOS and Windows (stub path compiles, statx_supported() returns false)
  • Verify opcode constant (21) matches io_uring::opcode::Statx::CODE
  • Verify kernel probe is idempotent and consistent with minimum kernel version
  • Verify batch results preserve input order across 16 concurrent paths
  • Verify per-path errors (ENOENT) do not affect other entries in the batch
  • Verify symlink follow vs nofollow semantics in batch path
  • Verify fallback path produces correct results when io_uring STATX is unavailable

…y stat (#1833)

Add io_uring IORING_OP_STATX opcode wrapper following the existing
RENAMEAT2/LINKAT pattern. Key additions:

- statx_supported(): OnceLock-cached kernel probe via IORING_REGISTER_PROBE
- build_statx_sqe() / build_statx_sqe_unchecked(): SQE construction
- submit_statx_blocking(): single-path synchronous wrapper
- submit_statx_batch(): multi-path batch submission with chunked SQ
  processing and automatic fallback to rustix::fs::statx on kernels < 5.11
- try_statx_batch_via_io_uring(): top-level convenience dispatch in lib.rs
- Non-Linux stub in io_uring_stub.rs returning Unsupported
- 18 tests covering opcode constants, probe idempotency, blocking/batch
  submission, error handling, order preservation, and symlink semantics
@github-actions github-actions Bot added the enhancement New feature or request label May 13, 2026
oferchen added 7 commits May 13, 2026 18:41
- Use iterator-based init for Vec<Option<io::Error>> (not Clone)
- Pass flags as i32 directly to Statx opcode (not u32 cast)
- Remove .bits() on rustix Statx fields that are plain u32
Replace field-by-field rustix_statx_to_libc conversion with a
ptr::read cast. The rustix crate exposes some statx fields as newtype
wrappers (StatxAttributes) or plain integers depending on backend
feature configuration, causing type mismatches under --all-features.
Both types are layout-identical repr(C) representations of the kernel
struct statx, verified by const size/alignment assertions.

Also fix .flags() i32 type mismatch in build_statx_sqe_unchecked.
libc::S_IFMT, S_IFREG, and S_IFLNK are u32 (mode_t) but
statx.stx_mode is u16. Use u32::from() for type-safe widening.
@oferchen oferchen merged commit a77a01d into master May 13, 2026
36 of 39 checks passed
@oferchen oferchen deleted the feat/io-uring-statx-batch-1833 branch May 14, 2026 14:57
oferchen added a commit that referenced this pull request May 18, 2026
…y stat (#1833) (#4001)

* feat(fast_io): add IORING_OP_STATX batch chains for parallel directory stat (#1833)

Add io_uring IORING_OP_STATX opcode wrapper following the existing
RENAMEAT2/LINKAT pattern. Key additions:

- statx_supported(): OnceLock-cached kernel probe via IORING_REGISTER_PROBE
- build_statx_sqe() / build_statx_sqe_unchecked(): SQE construction
- submit_statx_blocking(): single-path synchronous wrapper
- submit_statx_batch(): multi-path batch submission with chunked SQ
  processing and automatic fallback to rustix::fs::statx on kernels < 5.11
- try_statx_batch_via_io_uring(): top-level convenience dispatch in lib.rs
- Non-Linux stub in io_uring_stub.rs returning Unsupported
- 18 tests covering opcode constants, probe idempotency, blocking/batch
  submission, error handling, order preservation, and symlink semantics

* fix: correct io_uring STATX build errors on CI

- Use iterator-based init for Vec<Option<io::Error>> (not Clone)
- Pass flags as i32 directly to Statx opcode (not u32 cast)
- Remove .bits() on rustix Statx fields that are plain u32

* fix: use byte-level statx conversion to handle rustix type differences

Replace field-by-field rustix_statx_to_libc conversion with a
ptr::read cast. The rustix crate exposes some statx fields as newtype
wrappers (StatxAttributes) or plain integers depending on backend
feature configuration, causing type mismatches under --all-features.
Both types are layout-identical repr(C) representations of the kernel
struct statx, verified by const size/alignment assertions.

Also fix .flags() i32 type mismatch in build_statx_sqe_unchecked.

* style: fix cargo fmt formatting for const assertions

* fix: use &mut StatxArgs for mutable statx_buf access in SQE builders

* fix: scope StatxArgs block to avoid clippy drop_non_drop lint

* fix: cast stx_mode to u32 before bitwise AND with libc mode constants

libc::S_IFMT, S_IFREG, and S_IFLNK are u32 (mode_t) but
statx.stx_mode is u16. Use u32::from() for type-safe widening.

* fix: cast remaining stx_mode to u32 in submit_statx_batch test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant