Skip to content

drvfs: add per-mount transport= option for cross-OS filesystem benchmarking#40608

Draft
benhillis wants to merge 1 commit into
masterfrom
user/benhill/drvfs-transport-option
Draft

drvfs: add per-mount transport= option for cross-OS filesystem benchmarking#40608
benhillis wants to merge 1 commit into
masterfrom
user/benhill/drvfs-transport-option

Conversation

@benhillis
Copy link
Copy Markdown
Member

@benhillis benhillis commented May 20, 2026

Summary

Adds a per-mount transport= option to mount.drvfs so all three cross-OS filesystem architectures can be benchmarked side-by-side in a single VM without reconfiguring .wslconfig between runs.

What this enables

With [wsl2] experimental.drvFsTransports=true in .wslconfig, the WSL service starts all three filesystem backends concurrently. You can then mount the same drive using different transports simultaneously:

mount -t drvfs C: /mnt/plan9    -o transport=plan9
mount -t drvfs C: /mnt/virtio   -o transport=virtio9p
mount -t drvfs C: /mnt/virtiofs -o transport=virtiofs

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

  • Invalid transport values fail the mount with a clear error message
  • Requesting a transport whose backend is not running fails with an actionable message
  • Standard Linux "last wins" semantics for duplicate transport= options
  • No silent fallback: explicit transport requests never degrade to a different transport

Changes

  • Guest (src/linux/init/drvfs.cpp): Parse transport= from mount options, dispatch to the requested backend, fail with clear stderr messages on error
  • Host (WslCoreConfig, WslCoreVm): New experimental.drvFsTransports setting; start all three backends when enabled
  • Tests: 4 TAEF tests covering all transports, option parsing, invalid values, and unavailable backends
  • Docs: Updated drvfs.md with usage and configuration

PR Checklist

  • Builds clean
  • Tests pass (4/4)
  • Documentation updated

Copilot AI review requested due to automatic review settings May 20, 2026 19:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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/strip transport= from mount options and route the mount to plan9 / virtio9p / virtiofs accordingly.
  • Host: add experimental.drvFsTransports config 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.

Comment thread src/windows/service/exe/WslCoreVm.cpp Outdated
@@ -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 thread src/linux/init/drvfs.cpp
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 thread src/linux/init/drvfs.cpp Outdated
Comment on lines +508 to +509
"mount: transport 'virtiofs' is not available; ensure [wsl2] experimental.drvFsTransports=true is set in "
".wslconfig\n");
Comment thread src/linux/init/drvfs.cpp Outdated
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.
@benhillis benhillis force-pushed the user/benhill/drvfs-transport-option branch from c8745c6 to 9374704 Compare May 20, 2026 20:10
Copilot AI review requested due to automatic review settings May 20, 2026 20:27
…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>
@benhillis benhillis force-pushed the user/benhill/drvfs-transport-option branch from c70b446 to 5452032 Compare May 20, 2026 20:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment thread src/linux/init/drvfs.cpp
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 thread src/linux/init/drvfs.cpp
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");
}

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.

2 participants