Add opt-in per-disk sync= and cache= attachment modes#42
Open
amr-mesbah wants to merge 1 commit into
Open
Conversation
Expose VZDiskImageStorageDeviceAttachment's cachingMode and synchronizationMode (macOS 12+) via two new, optional storage options settable from both the JSON config and the --disk CLI: sync=<full|fsync|none> (default: full, unchanged) cache=<auto|cached|uncached> (default: auto, unchanged) When neither is set the behaviour is byte-for-byte identical to before (legacy initWithURL:readOnly:error: path), so existing configs are unaffected. The new initializer is taken only when an option is supplied and only under `if (@available(macOS 12.0, *))`, with a >=120000 SDK compile guard, preserving the macOS 11 build. Invalid values raise a clear VMConfigDiskStorageError. Motivation: ephemeral CI VMs pay a large per-fsync stall under the default full synchronization (every guest fsync blocks on a host-stable commit). Allowing sync=none,cache=cached removes that stall. Measured on a macOS 26.2 guest: 5000 fsync'd small-file writes dropped from 32.2s to 5.0s (6.4x), sequential write 984 -> 1593 MB/s. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Exposes
VZDiskImageStorageDeviceAttachmentcachingMode/synchronizationMode(macOS 12+) as two optional, opt-in storage options, settable from both the JSON config and the--diskCLI:Why
Ephemeral VMs pay a large per-
fsyncstall under the default full synchronization: every guestfsyncblocks on a host-stable commit. Allowingsync=none,cache=cachedremoves that stall.Measured (macOS 26.2 guest, same disk, only the sync mode changed)
Safety / compatibility
initWithURL:readOnly:error:path) — existing configs unaffected.if (@available(macOS 12.0, *))plus a__MAC_OS_X_VERSION_MAX_ALLOWED >= 120000compile guard, so the macOS 11 build is preserved.VMConfigDiskStorageError.Note:
sync=noneis intended for ephemeral VMs (no host-crash durability); not for golden/base images or during--restore.