Skip to content

Release v1.0.1: fix sparse allocate, Windows statvfs, Fuchsia build - #49

Merged
al8n merged 2 commits into
mainfrom
1.0.1
Apr 22, 2026
Merged

al8n merged 2 commits into
mainfrom
1.0.1

Conversation

@al8n

@al8n al8n commented Apr 22, 2026 •

Copy link
Copy Markdown
Owner

Summary

Patch release against v1.0.0. No public API changes; four bug fixes plus docs.

  • Sparse-file allocate (Unix, sync + async) — the short-circuit on metadata().len() >= len silently turned allocate into a no-op on sparse files (logical length large, zero blocks reserved). Now gated on metadata().blocks() * 512 >= len, which asks the right question ("are the blocks already reserved?") and still skips the macOS F_PREALLOCATE re-allocate-ENOSPC path from Allocation on macOS is not working, while it does with fs2 #15.
  • Windows statvfs — GetDiskFreeSpaceExW returns three distinct numbers. The previous code passed NULL for the third pointer, reused lpFreeBytesAvailable as both free_space and available_space, and let total_space come from the caller-scoped quota total. Now routes lpTotalNumberOfFreeBytes → free_space (volume-wide, quota-independent), lpFreeBytesAvailable → available_space (caller quota), and computes total_space from cluster math (sectors_per_cluster * bytes_per_sector * total_number_of_clusters) so it reports volume capacity. Visibly changes values on quota-enabled volumes.
  • Fuchsia build — target_os = "fuchsia" added to the Unix fallocate branch (sync + async). Fuchsia is cfg(unix) under rustc and rustix exposes fallocate there, so the previous omission left Fuchsia builds without an allocate symbol once FileExt was enabled. With this fix, every fs4 feature builds on Fuchsia except fs-err3 / fs-err3-tokio; those remain blocked on upstream fs-err v3 referencing std::os::unix::fs::chroot, which rustc gates out on Fuchsia. Tracking: fs-err 3.x fails to compile on target_os = "fuchsia" (chroot gated out) andrewhickman/fs-err#90.
  • Docs — README gains a Minimum Supported Rust Version section (the declared rust-version = "1.75.0" covers the default sync feature; async-std / smol effectively require 1.85 via transitive async-lock / async-signal) and a Platform Notes → Fuchsia subsection documenting the upstream fs-err gap.

Testing

New Linux-gated regression test allocate_reserves_blocks_on_sparse_file (sync + async): creates a sparse file via set_len, asserts allocated_size == 0, calls allocate, asserts blocks are reserved.

Semver

Patch. No public API added, removed, or altered. The Windows statvfs fix changes observable numeric values on quota-enabled volumes, but the previous values were documented-incorrect.

Test plan

  • cargo test --all-features on ubuntu, macos, windows via CI
  • cargo hack clippy --each-feature green on all CI OSes
  • Cross-compile sanity for x86_64-unknown-fuchsia once CI is extended (new target worth adding)
  • Manual: verify new free_space / total_space values on a Windows volume with a user quota configured

@al8n al8n changed the title 1.0.1 Release v1.0.1: fix sparse allocate, Windows statvfs, Fuchsia build Apr 22, 2026
@codecov

codecov Bot commented Apr 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.55%. Comparing base (fb3e036) to head (c2f433e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   96.37%   96.55%   +0.18%     
==========================================
  Files          11       11              
  Lines         662      697      +35     
==========================================
+ Hits          638      673      +35     
  Misses         24       24              
Files with missing lines Coverage Δ
src/file_ext/async_impl.rs 98.80% <100.00%> (+0.13%) ⬆️
src/file_ext/sync_impl.rs 100.00% <100.00%> (ø)
src/lib.rs 40.00% <ø> (ø)
src/unix/async_impl.rs 96.77% <100.00%> (ø)
src/unix/sync_impl.rs 96.66% <100.00%> (ø)
src/windows.rs 90.90% <100.00%> (+0.24%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb3e036...c2f433e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@al8n
al8n merged commit ea097e2 into main Apr 22, 2026
30 checks passed
@al8n
al8n deleted the 1.0.1 branch April 22, 2026 23:42
al8n added a commit that referenced this pull request Apr 22, 2026
)

Patch release against v1.0.0. No public API changes; four bug fixes plus docs.

- **Sparse-file `allocate` (Unix, sync + async)** — the short-circuit on `metadata().len() >= len` silently turned `allocate` into a no-op on sparse files (logical length large, zero blocks reserved). Now gated on `metadata().blocks() * 512 >= len`, which asks the right question ("are the blocks already reserved?") and still skips the macOS `F_PREALLOCATE` re-allocate-ENOSPC path from #15.
- **Windows `statvfs`** — `GetDiskFreeSpaceExW` returns three distinct numbers. The previous code passed NULL for the third pointer, reused `lpFreeBytesAvailable` as both `free_space` and `available_space`, and let `total_space` come from the caller-scoped quota total. Now routes `lpTotalNumberOfFreeBytes` → `free_space` (volume-wide, quota-independent), `lpFreeBytesAvailable` → `available_space` (caller quota), and computes `total_space` from cluster math (`sectors_per_cluster * bytes_per_sector * total_number_of_clusters`) so it reports volume capacity. Visibly changes values on quota-enabled volumes.
- **Fuchsia build** — `target_os = "fuchsia"` added to the Unix fallocate branch (sync + async). Fuchsia is `cfg(unix)` under rustc and `rustix` exposes `fallocate` there, so the previous omission left Fuchsia builds without an `allocate` symbol once `FileExt` was enabled. With this fix, every fs4 feature builds on Fuchsia **except** `fs-err3` / `fs-err3-tokio`; those remain blocked on upstream `fs-err v3` referencing `std::os::unix::fs::chroot`, which rustc gates out on Fuchsia. Tracking: andrewhickman/fs-err#90.
- **Docs** — README gains a **Minimum Supported Rust Version** section (the declared `rust-version = "1.75.0"` covers the default `sync` feature; `async-std` / `smol` effectively require 1.85 via transitive `async-lock` / `async-signal`) and a **Platform Notes → Fuchsia** subsection documenting the upstream `fs-err` gap.

New Linux-gated regression test `allocate_reserves_blocks_on_sparse_file` (sync + async): creates a sparse file via `set_len`, asserts `allocated_size == 0`, calls `allocate`, asserts blocks are reserved.
al8n added a commit that referenced this pull request Apr 23, 2026
)

Patch release against v1.0.0. No public API changes; four bug fixes plus docs.

- **Sparse-file `allocate` (Unix, sync + async)** — the short-circuit on `metadata().len() >= len` silently turned `allocate` into a no-op on sparse files (logical length large, zero blocks reserved). Now gated on `metadata().blocks() * 512 >= len`, which asks the right question ("are the blocks already reserved?") and still skips the macOS `F_PREALLOCATE` re-allocate-ENOSPC path from #15.
- **Windows `statvfs`** — `GetDiskFreeSpaceExW` returns three distinct numbers. The previous code passed NULL for the third pointer, reused `lpFreeBytesAvailable` as both `free_space` and `available_space`, and let `total_space` come from the caller-scoped quota total. Now routes `lpTotalNumberOfFreeBytes` → `free_space` (volume-wide, quota-independent), `lpFreeBytesAvailable` → `available_space` (caller quota), and computes `total_space` from cluster math (`sectors_per_cluster * bytes_per_sector * total_number_of_clusters`) so it reports volume capacity. Visibly changes values on quota-enabled volumes.
- **Fuchsia build** — `target_os = "fuchsia"` added to the Unix fallocate branch (sync + async). Fuchsia is `cfg(unix)` under rustc and `rustix` exposes `fallocate` there, so the previous omission left Fuchsia builds without an `allocate` symbol once `FileExt` was enabled. With this fix, every fs4 feature builds on Fuchsia **except** `fs-err3` / `fs-err3-tokio`; those remain blocked on upstream `fs-err v3` referencing `std::os::unix::fs::chroot`, which rustc gates out on Fuchsia. Tracking: andrewhickman/fs-err#90.
- **Docs** — README gains a **Minimum Supported Rust Version** section (the declared `rust-version = "1.75.0"` covers the default `sync` feature; `async-std` / `smol` effectively require 1.85 via transitive `async-lock` / `async-signal`) and a **Platform Notes → Fuchsia** subsection documenting the upstream `fs-err` gap.

New Linux-gated regression test `allocate_reserves_blocks_on_sparse_file` (sync + async): creates a sparse file via `set_len`, asserts `allocated_size == 0`, calls `allocate`, asserts blocks are reserved.
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.

1 participant