Skip to content

Commit a800be0

Browse files
dschoGit for Windows Build Agent
authored and
Git for Windows Build Agent
committed
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 d35ccc2 + 0445b81 commit a800be0

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
@@ -20,6 +20,7 @@
2020
#include "../write-or-die.h"
2121
#include "../repository.h"
2222
#include "../repository.h"
23+
#include "win32/fscache.h"
2324
#include "dir.h"
2425
#include "gettext.h"
2526
#define SECURITY_WIN32
@@ -3724,6 +3725,9 @@ int wmain(int argc, const wchar_t **wargv)
37243725
/* initialize critical section for waitpid pinfo_t list */
37253726
InitializeCriticalSection(&pinfo_cs);
37263727

3728+
/* initialize critical section for fscache */
3729+
InitializeCriticalSection(&fscache_cs);
3730+
37273731
/* set up default file mode and file modes for stdin/out/err */
37283732
_fmode = _O_BINARY;
37293733
_setmode(_fileno(stdin), _O_BINARY);

0 commit comments

Comments
 (0)