drvfs: add per-mount transport= option for cross-OS filesystem benchmarking#40608
Draft
benhillis wants to merge 1 commit into
Draft
drvfs: add per-mount transport= option for cross-OS filesystem benchmarking#40608benhillis wants to merge 1 commit into
benhillis wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for selecting DrvFs’ cross-OS filesystem transport on a per-mount basis (via -o transport=...) to enable side-by-side benchmarking of plan9-over-hvsocket, virtio-9p, and virtiofs within a single WSL2 VM. This includes a new experimental .wslconfig switch intended to stand up multiple backends concurrently, plus new Windows tests and updated documentation.
Changes:
- Guest (
mount.drvfs): parse/striptransport=from mount options and route the mount to plan9 / virtio9p / virtiofs accordingly. - Host: add
experimental.drvFsTransportsconfig and adjust VM/share setup logic to make additional transports available. - Tests/docs: add TAEF coverage for the override and document usage + experimental flag.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test/windows/DrvFsTests.cpp | Adds a new test class validating transport= behavior, stripping, invalid values, and backend availability. |
| test/windows/Common.h | Extends test config defaults with drvFsTransports. |
| test/windows/Common.cpp | Emits [experimental] drvFsTransports=... into generated .wslconfig test configs. |
| src/windows/service/exe/WslCoreVm.cpp | Updates share registration to optionally expose multiple Plan9 transports and tweaks virtiofs availability checks. |
| src/windows/common/WslCoreConfig.h | Adds experimental.drvFsTransports config key + helper predicates for transport availability. |
| src/windows/common/WslCoreConfig.cpp | Parses/validates the new experimental setting and enforces compatibility constraints. |
| src/linux/init/drvfs.h | Introduces DrvFsTransport enum and new function signatures for transport override plumbing. |
| src/linux/init/drvfs.cpp | Implements option parsing/dispatch and adds virtiofs no-fallback mode for explicit transport requests. |
| src/linux/init/config.cpp | Detects existing Plan9 transport during remount to preserve the actual transport in experimental multi-transport scenarios. |
| doc/docs/technical-documentation/drvfs.md | Documents transport= option and the experimental drvFsTransports switch. |
| @@ -871,47 +871,65 @@ _Requires_lock_held_(m_guestDeviceLock) | |||
| void WslCoreVm::AddPlan9Share( | |||
| _In_ PCWSTR AccessName, _In_ PCWSTR Path, [[maybe_unused]] _In_ UINT32 Port, _In_ hcs::Plan9ShareFlags Flags, _In_ HANDLE UserToken, _In_opt_ PCWSTR VirtIoTag) | |||
Comment on lines
+201
to
+206
| Scans an option string for one or more transport=<value> tokens, removes | ||
| each from Options, and returns the requested transport. If multiple | ||
| transport= tokens are present, the last one wins. If no transport= | ||
| token is found, the function returns DrvFsTransport::Default and Options | ||
| is left unchanged. If the value is empty or unrecognized, returns | ||
| DrvFsTransport::Invalid. |
Comment on lines
+508
to
+509
| "mount: transport 'virtiofs' is not available; ensure [wsl2] experimental.drvFsTransports=true is set in " | ||
| ".wslconfig\n"); |
Comment on lines
+523
to
+524
| "mount: transport 'virtio9p' is not available; ensure [wsl2] experimental.drvFsTransports=true is set in " | ||
| ".wslconfig\n"); |
Comment on lines
+47
to
+49
| Accepted values are `plan9`, `virtio9p`, and `virtiofs` — matching the corresponding `.wslconfig` setting names. Unknown or empty values cause the mount to fail with an error. | ||
|
|
||
| The requested transport must be available in the VM. By default the host only stands up the transport selected by `wsl2.virtio9p` / `wsl2.virtiofs`, so mounting with a `transport=` value whose backend is not running fails at mount time. To make all three transports available simultaneously in a single VM (useful for development and benchmarking), enable the experimental setting below. |
c8745c6 to
9374704
Compare
…arking Add the ability to explicitly select which DrvFs transport to use on a per-mount basis via the transport= mount option. This makes it easy to benchmark and compare all three cross-OS filesystem architectures (plan9-over-hvsocket, virtio-9p, and virtiofs) side-by-side in a single VM without reconfiguring .wslconfig between runs. New mount option: mount -t drvfs C: /mnt/c -o transport=plan9 mount -t drvfs C: /mnt/c -o transport=virtio9p mount -t drvfs C: /mnt/c -o transport=virtiofs New host setting: [wsl2] experimental.drvFsTransports=true When drvFsTransports is enabled, the WSL service starts all three filesystem backends concurrently, allowing any transport to be selected at mount time. Behavior: - Invalid transport values fail the mount with a clear error message - Requesting a transport whose backend isn't running fails with an actionable message pointing to the config setting - Standard Linux 'last wins' semantics for duplicate options - No fallback: explicit transport requests never silently degrade Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c70b446 to
5452032
Compare
Comment on lines
+509
to
+514
| auto result = MountVirtioFs(Source, Target, EffectiveOptions, Admin, Config, ExitCode, false); | ||
| if (result < 0) | ||
| { | ||
| fprintf(stderr, "mount: transport 'virtiofs' is not available\n"); | ||
| } | ||
|
|
Comment on lines
+521
to
+526
| auto result = MountPlan9(Source, Target, EffectiveOptions, Admin, Config, ExitCode, Transport); | ||
| if (result < 0 && Transport == DrvFsTransport::Virtio9p) | ||
| { | ||
| fprintf(stderr, "mount: transport 'virtio9p' is not available\n"); | ||
| } | ||
|
|
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
Adds a per-mount
transport=option tomount.drvfsso all three cross-OS filesystem architectures can be benchmarked side-by-side in a single VM without reconfiguring.wslconfigbetween runs.What this enables
With
[wsl2] experimental.drvFsTransports=truein.wslconfig, the WSL service starts all three filesystem backends concurrently. You can then mount the same drive using different transports simultaneously:This makes it trivial to run comparative filesystem benchmarks (fio, compilebench, git operations, etc.) across plan9-over-hvsocket, virtio-9p, and virtiofs without rebooting or restarting WSL.
Behavior
Changes
src/linux/init/drvfs.cpp): Parsetransport=from mount options, dispatch to the requested backend, fail with clear stderr messages on errorWslCoreConfig,WslCoreVm): Newexperimental.drvFsTransportssetting; start all three backends when enableddrvfs.mdwith usage and configurationPR Checklist