VFS: an empty overlay answers "no copy" without asking the file system #1106
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1106
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1106"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@DTsordas on GitHub · 2026-11-24 11:40 UTC · original
DTsordas:vfs-skip-empty-overlay→main· +66 −4 · 1 files · 1 commits · openPart of #999, and independent of #1092 (either can merge first). Most titles never write their game folder, so the overlay holds nothing, yet every read open of a game file asked the file system whether an overlay copy exists (
visible_in_overlay, astd::fs::metadatathat costs about as much as the open). So did every directory search in a game folder (is_dirandneeds_mergebeforeFindFirstFile).The VFS now keeps
overlay_used. It's set at start when the overlay folder holds anything besides.xcl_whiteouts(an earlier run's copies), and bystage_write,prepare_writeandcreate_dirbefore they create anything there. Those are the only ways the VFS puts things into the overlay: a move within the overlay needs an existing entry, andReplaceFileWon game paths goes through theCopyFileW/MoveFileExWhooks. While the flag is clear,visible_in_overlay,is_dirandneeds_mergedon't ask the file system about the overlay. Something put into the overlay folder by hand during a run is seen from the next run on.Measured with scratch benchmarks (not part of the PR): 200 game files and 200 game folders under
G:, release build, median of 15 rounds of 200, three runs each. The table gives the median of the three runs, with the runs in brackets.47efa2eopen_decision, a read openopen_decision+File::openFile::open(reference)is_dir+needs_mergebefore aFindFirstFileread_dir+ first entry (reference)For the directory rows, the "main" column is an overlay holding an earlier run's copy, which asks the file system as main does. Together with #1092, a read open asks it nothing extra: on an earlier main (
077ce40),open_decisionwent from 65 µs to 2.0 µs with both changes. What's left of the directory checks isis_dirasking the original twice (exists, then is a folder), which is left for its own PR.What is in it
crates/xcl/src/vfs.rs:overlay_used(set inVfs::newfrom the overlay folder, and bymark_overlay_usedin the three writers), checked first invisible_in_overlay,is_dirandneeds_merge.an_overlay_from_an_earlier_run_is_seen_but_a_whiteout_list_alone_is_none(a newVfsover an overlay holding only the whiteout list keeps the flag clear and still hides the deleted file; over an earlier run's copy, it reads the copy). Alsoan_empty_overlay_is_not_asked_until_this_run_writes_to_it: a file and a folder put there behind the VFS's back are not looked for until the VFS writes there. Withvisible_in_overlayalways probing, as on main, the latter fails.remove_dir_checks_both_layers_before_removing_overlay(from47efa2e) creates its overlay folder directly on disk, so it now marks the overlay used after that, as a run that found the folder at start would. Its assertions are unchanged.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at3efb59f(on main47efa2e): 743 passed, 0 failed, 41 ignored, 0 SKIPPED, includinge2e'stest_title_runs_and_game_folder_is_untouched.cargo test -p xcl --lib vfs: 24 passed.Regression run
The title's 60 s smoke run (
scripts/smoke.ps1, release builds, same machine, back to back with a warm shader cache).main:
PR:
Not tested
AI use
🤖 Generated with Claude Code
github-bot referenced this pull request2026-11-26 04:59:09 +00:00
@DavidM1911 on GitHub · 2026-11-25 08:21 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.