Skip to content

Commit 4b4d770

Browse files
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 a277204 + d46f02d commit 4b4d770

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
@@ -491,7 +491,7 @@ int cmd_add(int argc,
491491
die_in_unpopulated_submodule(repo->index, prefix);
492492
die_path_inside_submodule(repo->index, &pathspec);
493493

494-
enable_fscache(1);
494+
enable_fscache(0);
495495
/* We do not really re-read the index but update the up-to-date flags */
496496
preload_index(repo->index, &pathspec, 0);
497497

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
@@ -1618,7 +1618,7 @@ struct repository *repo UNUSED)
16181618
PATHSPEC_PREFER_FULL,
16191619
prefix, argv);
16201620

1621-
enable_fscache(1);
1621+
enable_fscache(0);
16221622
if (status_format != STATUS_FORMAT_PORCELAIN &&
16231623
status_format != STATUS_FORMAT_PORCELAIN_V2)
16241624
progress_flag = REFRESH_PROGRESS;
@@ -1659,7 +1659,7 @@ struct repository *repo UNUSED)
16591659
wt_status_print(&s);
16601660
wt_status_collect_free_buffers(&s);
16611661

1662-
enable_fscache(0);
1662+
disable_fscache();
16631663
return 0;
16641664
}
16651665

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"
@@ -3735,6 +3736,9 @@ int wmain(int argc, const wchar_t **wargv)
37353736
/* initialize critical section for waitpid pinfo_t list */
37363737
InitializeCriticalSection(&pinfo_cs);
37373738

3739+
/* initialize critical section for fscache */
3740+
InitializeCriticalSection(&fscache_cs);
3741+
37383742
/* set up default file mode and file modes for stdin/out/err */
37393743
_fmode = _O_BINARY;
37403744
_setmode(_fileno(stdin), _O_BINARY);

0 commit comments

Comments
 (0)