Skip to content

Commit 871da27

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 <[email protected]>
2 parents 6cb7d6c + 18cbed7 commit 871da27

File tree

12 files changed

+493
-174
lines changed

12 files changed

+493
-174
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ int cmd_add(int argc,
485485
die_in_unpopulated_submodule(repo->index, prefix);
486486
die_path_inside_submodule(repo->index, &pathspec);
487487

488-
enable_fscache(1);
488+
enable_fscache(0);
489489
/* We do not really re-read the index but update the up-to-date flags */
490490
preload_index(repo->index, &pathspec, 0);
491491

builtin/checkout.c

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

418-
enable_fscache(1);
418+
enable_fscache(the_repository->index->cache_nr);
419419
for (pos = 0; pos < the_repository->index->cache_nr; pos++) {
420420
struct cache_entry *ce = the_repository->index->cache[pos];
421421
if (ce->ce_flags & CE_MATCHED) {
@@ -441,7 +441,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
441441
errs |= run_parallel_checkout(&state, pc_workers, pc_threshold,
442442
NULL, NULL);
443443
mem_pool_discard(&ce_mem_pool, should_validate_cache_entries());
444-
enable_fscache(0);
444+
disable_fscache();
445445
remove_marked_cache_entries(the_repository->index, 1);
446446
remove_scheduled_dirs();
447447
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
@@ -1609,7 +1609,7 @@ struct repository *repo UNUSED)
16091609
PATHSPEC_PREFER_FULL,
16101610
prefix, argv);
16111611

1612-
enable_fscache(1);
1612+
enable_fscache(0);
16131613
if (status_format != STATUS_FORMAT_PORCELAIN &&
16141614
status_format != STATUS_FORMAT_PORCELAIN_V2)
16151615
progress_flag = REFRESH_PROGRESS;
@@ -1650,7 +1650,7 @@ struct repository *repo UNUSED)
16501650
wt_status_print(&s);
16511651
wt_status_collect_free_buffers(&s);
16521652

1653-
enable_fscache(0);
1653+
disable_fscache();
16541654
return 0;
16551655
}
16561656

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"
@@ -3731,6 +3732,9 @@ int wmain(int argc, const wchar_t **wargv)
37313732
/* initialize critical section for waitpid pinfo_t list */
37323733
InitializeCriticalSection(&pinfo_cs);
37333734

3735+
/* initialize critical section for fscache */
3736+
InitializeCriticalSection(&fscache_cs);
3737+
37343738
/* set up default file mode and file modes for stdin/out/err */
37353739
_fmode = _O_BINARY;
37363740
_setmode(_fileno(stdin), _O_BINARY);

0 commit comments

Comments
 (0)