Skip to content

Commit a82bf00

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Merge remote-tracking branch 'benpeart/fscache-per-thread-gfw'
This brings substantial wins in performance because the FSCache is now per-thread, being merged to the primary thread only at the end, so we do not have to lock (except while merging). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2 parents 1e32e97 + 5a52625 commit a82bf00

12 files changed

Lines changed: 493 additions & 173 deletions

File tree

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ int cmd_add(int argc,
497497
die_in_unpopulated_submodule(repo->index, prefix);
498498
die_path_inside_submodule(repo->index, &pathspec);
499499

500-
enable_fscache(1);
500+
enable_fscache(0);
501501
/* We do not really re-read the index but update the up-to-date flags */
502502
preload_index(repo->index, &pathspec, 0);
503503

builtin/checkout.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
401401
if (pc_workers > 1)
402402
init_parallel_checkout();
403403

404-
enable_fscache(1);
404+
enable_fscache(the_repository->index->cache_nr);
405405
for (pos = 0; pos < the_repository->index->cache_nr; pos++) {
406406
struct cache_entry *ce = the_repository->index->cache[pos];
407407
if (ce->ce_flags & CE_MATCHED) {
@@ -427,7 +427,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
427427
errs |= run_parallel_checkout(&state, pc_workers, pc_threshold,
428428
NULL, NULL);
429429
mem_pool_discard(&ce_mem_pool, should_validate_cache_entries());
430-
enable_fscache(0);
430+
disable_fscache();
431431
remove_marked_cache_entries(the_repository->index, 1);
432432
remove_scheduled_dirs();
433433
errs |= finish_delayed_checkout(&state, opts->show_progress);

builtin/commit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,7 @@ struct repository *repo UNUSED)
16231623
PATHSPEC_PREFER_FULL,
16241624
prefix, argv);
16251625

1626-
enable_fscache(1);
1626+
enable_fscache(0);
16271627
if (status_format != STATUS_FORMAT_PORCELAIN &&
16281628
status_format != STATUS_FORMAT_PORCELAIN_V2)
16291629
progress_flag = REFRESH_PROGRESS;
@@ -1664,7 +1664,7 @@ struct repository *repo UNUSED)
16641664
wt_status_print(&s);
16651665
wt_status_collect_free_buffers(&s);
16661666

1667-
enable_fscache(0);
1667+
disable_fscache();
16681668
return 0;
16691669
}
16701670

compat/mingw.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "symlinks.h"
1515
#include "trace2.h"
1616
#include "win32.h"
17+
#include "win32/fscache.h"
1718
#include "win32/lazyload.h"
1819
#include "wrapper.h"
1920
#include "write-or-die.h"
@@ -4061,6 +4062,9 @@ int wmain(int argc, const wchar_t **wargv)
40614062
InitializeCriticalSection(&pinfo_cs);
40624063
InitializeCriticalSection(&phantom_symlinks_cs);
40634064

4065+
/* initialize critical section for fscache */
4066+
InitializeCriticalSection(&fscache_cs);
4067+
40644068
/* set up default file mode and file modes for stdin/out/err */
40654069
_fmode = _O_BINARY;
40664070
_setmode(_fileno(stdin), _O_BINARY);

0 commit comments

Comments
 (0)