Skip to content

Commit 51e2f67

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 cf524c4 + c60f2c0 commit 51e2f67

12 files changed

+493
-174
lines changed

builtin/add.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ int cmd_add(int argc,
477477
die_in_unpopulated_submodule(repo->index, prefix);
478478
die_path_inside_submodule(repo->index, &pathspec);
479479

480-
enable_fscache(1);
480+
enable_fscache(0);
481481
/* We do not really re-read the index but update the up-to-date flags */
482482
preload_index(repo->index, &pathspec, 0);
483483

builtin/checkout.c

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

411-
enable_fscache(1);
411+
enable_fscache(the_repository->index->cache_nr);
412412
for (pos = 0; pos < the_repository->index->cache_nr; pos++) {
413413
struct cache_entry *ce = the_repository->index->cache[pos];
414414
if (ce->ce_flags & CE_MATCHED) {
@@ -434,7 +434,7 @@ static int checkout_worktree(const struct checkout_opts *opts,
434434
errs |= run_parallel_checkout(&state, pc_workers, pc_threshold,
435435
NULL, NULL);
436436
mem_pool_discard(&ce_mem_pool, should_validate_cache_entries());
437-
enable_fscache(0);
437+
disable_fscache();
438438
remove_marked_cache_entries(the_repository->index, 1);
439439
remove_scheduled_dirs();
440440
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
@@ -1602,7 +1602,7 @@ struct repository *repo UNUSED)
16021602
PATHSPEC_PREFER_FULL,
16031603
prefix, argv);
16041604

1605-
enable_fscache(1);
1605+
enable_fscache(0);
16061606
if (status_format != STATUS_FORMAT_PORCELAIN &&
16071607
status_format != STATUS_FORMAT_PORCELAIN_V2)
16081608
progress_flag = REFRESH_PROGRESS;
@@ -1643,7 +1643,7 @@ struct repository *repo UNUSED)
16431643
wt_status_print(&s);
16441644
wt_status_collect_free_buffers(&s);
16451645

1646-
enable_fscache(0);
1646+
disable_fscache();
16471647
return 0;
16481648
}
16491649

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)