Offload prefetch to mount process for warm auth#2002
Draft
tyrielv wants to merge 1 commit into
Draft
Conversation
a5fb655 to
256710f
Compare
When a GVFS mount is running, all prefetch operations now offload to the mount process via named pipe IPC, using its already-warm authentication to skip the slow cold-auth path (anonymous HTTP probe + git credential helper invocation). Commits prefetch (--commits): PrefetchCommits IPC message tells the mount to run PrefetchStep with its warm GitObjectsHttpRequestor. A post-fetch callback is injected to avoid re-entrant named pipe IPC when SchedulePostFetchJob would otherwise call back into the same mount. Blob prefetch (--files/--folders): PrefetchBlobs IPC message carries file/folder lists, HEAD commit ID, and hydrate flag. The mount creates a fresh GitObjectsHttpRequestor with warm auth, runs BlobPrefetcher with capped thread counts (ProcessorCount/2), validates inputs, and properly disposes HTTP resources. LastBlobPrefetch.dat is passed through for noop state. Hydration (--hydrate): Two-phase approach: mount downloads blobs (no hydrate), then the verb process hydrates files locally using Parallel.ForEach with ProcessorCount/2 parallelism. This avoids the mount writing to ProjFS-virtualized files (self-callback risk) while ensuring all blobs are cached before hydration starts, minimizing the ProjFS expansion race window. Fallback: If the mount is not running, not ready, or is an older version that does not recognize the new IPC messages, the verb falls back to the existing direct-auth path transparently. Mount-side failures are surfaced directly (no fallback on real errors). Benchmarks on os.2020 (144 files in tools/nmakejs+Razzle+signing): Mounted offload: 158s (warm auth) Unmounted direct: 171s (cold auth) Mounted offload+hydrate: 153s (two-phase) Auth savings: ~13s per prefetch call Assisted-by: Claude Opus 4.6 Signed-off-by: Tyrie Vella <tyrielv@gmail.com>
4cccafb to
df48af7
Compare
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
When a GVFS mount is running,
gvfs prefetch --commitsnow sends aPrefetchCommitsrequest to the mount process via named pipe IPC. The mount process executes the prefetch using its already-warm authentication, avoiding the slow cold-auth path (anonymous HTTP probe +git credentialhelper invocation).If the mount is not running, not ready, or is an older version that does not recognize the
PrefetchCommitsmessage, the verb falls back to the existing direct-auth path transparently.Motivation
Authentication for prefetch is always slow — the anonymous probe + credential helper invocation adds multiple seconds. The mount process already has warm auth from startup. By offloading to the mount, we skip this cold-auth cost entirely for the common case where the repo is mounted.
Changes
PrefetchCommitsrequest/response message typesHandlePrefetchCommitsRequesthandler that runsPrefetchStepsynchronously on the connection thread using the mount's warmGVFSGitObjectsMountNotReady, orUnknownRequestfrom old mount). Mount-side failures are surfaced directly — no fallback on real errors.Design Decisions
PrefetchStep.SchedulePostFetchJob()opening a named pipe back to the same mount (re-entrant IPC). The mount handler directly enqueuesPostFetchStepon its maintenance scheduler.Testing