summaryrefslogtreecommitdiff
path: root/name-hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'name-hash.c')
-rw-r--r--name-hash.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/name-hash.c b/name-hash.c
index bd8dc7a6a7..45c98db0a0 100644
--- a/name-hash.c
+++ b/name-hash.c
@@ -584,9 +584,15 @@ static void lazy_init_name_hash(struct index_state *istate)
hashmap_init(&istate->dir_hash, dir_entry_cmp, NULL, istate->cache_nr);
if (lookup_lazy_params(istate)) {
- hashmap_disallow_rehash(&istate->dir_hash, 1);
+ /*
+ * Disable item counting and automatic rehashing because
+ * we do per-chain (mod n) locking rather than whole hashmap
+ * locking and we need to prevent the table-size from changing
+ * and bucket items from being redistributed.
+ */
+ hashmap_disable_item_counting(&istate->dir_hash);
threaded_lazy_init_name_hash(istate);
- hashmap_disallow_rehash(&istate->dir_hash, 0);
+ hashmap_enable_item_counting(&istate->dir_hash);
} else {
int nr;
for (nr = 0; nr < istate->cache_nr; nr++)