Windows: add gated direct I/O for mounted raw volumes - #1839
Open
0x1337F00D wants to merge 1 commit into
Open
Conversation
Keep the existing encrypted I/O queue as the compatibility path, while optional read and write gates use bounded queue-owned workers and ordered segmented host I/O for raw partitions and drives. File containers and the system/filter path remain on the legacy implementation, and the new path is disabled by default.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a second, opt-in I/O path for mounted raw partitions and drives on Windows. The existing encrypted I/O queue remains the compatibility path; eligible raw-volume reads and writes can independently use a bounded direct path when their respective gates are enabled.
The implementation was developed and measured only in a Windows 11 ARM64 Parallels VM with a locally test-signed driver. It has not yet been validated on bare-metal NVMe hardware or on x64 Windows.
Related performance issue: #136.
Design
VeraCryptEnableMountedVolumeFastReadIoVeraCryptEnableMountedVolumeFastWriteIoThe lifetime model intentionally does not abandon a timed-out child IRP. This addresses the ownership problem discussed in prior direct-I/O work such as #1808.
Performance-counter IOCTLs used to prove path selection during development are intentionally excluded from this product PR; they remain isolated for a possible separate diagnostics PR.
Performance evidence
DiskSpd was run against the same 4 GiB file on a mounted raw test partition (
W:), with the same profile order and arguments for legacy (gates off) and direct modes:-d8 -W0 -C0 -b1M -o4 -t2 -Sh -L-d8 -W0 -C0 -b4K -o32 -t4 -r -Sh -L-w0; writes used-w100These figures are VM/cache/hypervisor-sensitive and must not be read as bare-metal NVMe claims. They demonstrate the relative bottleneck reduction in this test environment.
Counters in an instrumented sibling build confirmed that eligible bytes traversed the direct path. The final PR tree removes that counter ABI but retains the same direct-I/O data path plus the final lifetime/ordering hardening.
Stability and correctness checks
The evidence run completed with:
chkdskexit code 0The final counter-free ARM64 Release driver also builds successfully (
veracrypt.sysSHA-256B1B625604BC8FDFF021F53260EEAC37C5D30E1F9D0FDC6D81C24BBE8915BCBB8).Scope and requested review
This PR does not change the system/filter path, file-container path, or Windows storage identity/PnP behavior. It is specifically the dual-path performance change for already mounted raw volumes.
Review and measurements on bare-metal Windows, especially x64 and fast NVMe devices, would be very valuable before enabling either gate by default.