VFS: an empty overlay answers "no copy" without asking the file system #1097
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from ivall/xcl. Originally posted by DTsordas on 2026-11-24T11:40:11Z.
Part 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
Imported from ivall/xcl. Originally posted by sds-228 on 2026-11-24T14:06:27Z.
Review: COMMENTED
Reviewed head
3efb59f.cargo test -p xcl --lib vfs→ 24 passed, 0 failed here. Paired smoke blocks are present. Theoverlay_usedgating looks sound: the writers set the flag before creating anything in the overlay, and the earlier-run/whiteout-only cases have tests.Question: the PR's 60 s smoke block reports 1223 frames against main's 1434 (about 15% fewer), although both end at 60 presents per 2 s. For a change meant to cut per-open cost, is that difference expected run-to-run noise? Otherwise no issue found.
AI-assisted (OpenCode).
upstream-sync referenced this pull request2026-11-24 16:05:46 +00:00
upstream-sync referenced this pull request2026-11-24 16:05:47 +00:00
upstream-sync referenced this pull request2026-11-24 16:05:48 +00:00
upstream-sync referenced this pull request2026-11-24 21:07:56 +00:00
upstream-sync referenced this pull request2026-11-25 00:07:29 +00:00
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T08:21:49Z.
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!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T20:44:10Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:50:05Z.
Triage (#1607) – head
3efb59f#1092 (same author, same issue #999) also cuts file-system probes from opens, but at a different point: it skips the two
visible_in_*probes for plain reads inopen_decision. This PR skips the overlay probes invisible_in_overlay,is_dirandneeds_mergewhile the overlay holds nothing. They are complementary and neither contains the other.All writers I found inside vfs.rs set the flag before creating anything (
prepare_write, the copy/move staging,create_dir). The branch conflicts with main's newer vfs.rs changes (MAXIMUM_ALLOWED routing,..handling). No problems found in the diff.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
Pull request closed