Skip to content

add: enable FSCache around repo_read_index_preload()#6216

Merged
dscho merged 2 commits into
git-for-windows:mainfrom
tonybaloney:wsl-fscache-add
Jun 5, 2026
Merged

add: enable FSCache around repo_read_index_preload()#6216
dscho merged 2 commits into
git-for-windows:mainfrom
tonybaloney:wsl-fscache-add

Conversation

@dscho

@dscho dscho commented Apr 28, 2026

Copy link
Copy Markdown
Member

This is a companion of microsoft#899.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git add happens inside repo_read_index_preload(), which currently runs before enable_fscache() is called. Moving the enable up so the preload phase is wrapped lets the existing batched NtQueryDirectoryFile cache cover the bulk of the lstat traffic. This patch gave me a ~30% performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0) again instead of disable_fscache(), leaking the refcount.

Anthony Shaw added 2 commits April 28, 2026 09:40
Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest `lstat()`-bound work in
`git add` happens inside `repo_read_index_preload()`, which currently
runs *before* `enable_fscache()` is called. Moving the enable up so the
preload phase is wrapped lets the existing batched
`NtQueryDirectoryFile()` cache cover the bulk of the lstat traffic.

Signed-off-by: Anthony Shaw <anthonyshaw@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Fix a copy-paste bug at the end of `cmd_add()`: the cleanup site called
`enable_fscache(0)` again instead of `disable_fscache()`, leaking the
refcount. Harmless in a one-shot process today, but it confuses the
matching enable/disable contract that callers and reviewers expect.

Signed-off-by: Anthony Shaw <anthonyshaw@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
@dscho dscho self-assigned this Apr 28, 2026
@dscho dscho marked this pull request as ready for review April 28, 2026 16:19
dscho added a commit to microsoft/git that referenced this pull request Apr 28, 2026
…`vfs-2.54.0` (#902)

This is a companion of #899 and
git-for-windows#6216.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git
add happens inside repo_read_index_preload(), which currently runs
before enable_fscache() is called. Moving the enable up so the preload
phase is wrapped lets the existing batched NtQueryDirectoryFile cache
cover the bulk of the lstat traffic. This patch gave me a ~30%
performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0)
again instead of disable_fscache(), leaking the refcount.
@dscho dscho merged commit c21f34a into git-for-windows:main Jun 5, 2026
60 checks passed
@dscho dscho added this to the Next release milestone Jun 5, 2026
@dscho

dscho commented Jun 5, 2026

Copy link
Copy Markdown
Member Author

/add relnote feature The FSCache now accelerates more git add scenarios.

The workflow run was started

github-actions Bot pushed a commit to git-for-windows/build-extra that referenced this pull request Jun 5, 2026
The FSCache now [accelerates more `git add`
scenarios](git-for-windows/git#6216).

Signed-off-by: gitforwindowshelper[bot] <gitforwindowshelper-bot@users.noreply.github.com>
gitforwindowshelper Bot pushed a commit that referenced this pull request Jun 10, 2026
This is a companion of microsoft#899.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git
add happens inside repo_read_index_preload(), which currently runs
before enable_fscache() is called. Moving the enable up so the preload
phase is wrapped lets the existing batched NtQueryDirectoryFile cache
cover the bulk of the lstat traffic. This patch gave me a ~30%
performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0)
again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot pushed a commit that referenced this pull request Jun 10, 2026
This is a companion of microsoft#899.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git
add happens inside repo_read_index_preload(), which currently runs
before enable_fscache() is called. Moving the enable up so the preload
phase is wrapped lets the existing batched NtQueryDirectoryFile cache
cover the bulk of the lstat traffic. This patch gave me a ~30%
performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0)
again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot pushed a commit that referenced this pull request Jun 10, 2026
This is a companion of microsoft#899.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git
add happens inside repo_read_index_preload(), which currently runs
before enable_fscache() is called. Moving the enable up so the preload
phase is wrapped lets the existing batched NtQueryDirectoryFile cache
cover the bulk of the lstat traffic. This patch gave me a ~30%
performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0)
again instead of disable_fscache(), leaking the refcount.
gitforwindowshelper Bot pushed a commit that referenced this pull request Jun 11, 2026
This is a companion of microsoft#899.

Trace2 + GIT_TRACE_FSCACHE evidence on Windows ARM64 (Snapdragon X
Elite, ReFS Dev Drive) shows that the heaviest lstat-bound work in git
add happens inside repo_read_index_preload(), which currently runs
before enable_fscache() is called. Moving the enable up so the preload
phase is wrapped lets the existing batched NtQueryDirectoryFile cache
cover the bulk of the lstat traffic. This patch gave me a ~30%
performance improvement on a large git repo with a batched add.

Also at the end of cmd_add(): the cleanup site called enable_fscache(0)
again instead of disable_fscache(), leaking the refcount.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant