Skip to content

Commit 9f500e7

Browse files
committed
Merge pull request #2198 from dscho/avoid-commit-graph-lock-contention
Avoid commit-graph lock contention
2 parents c358654 + 1f8e29c commit 9f500e7

File tree

14 files changed

+21
-18
lines changed

14 files changed

+21
-18
lines changed

builtin/am.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ static void am_run(struct am_state *state, int resume)
18001800
*/
18011801
if (!state->rebasing) {
18021802
am_destroy(state);
1803-
close_all_packs(the_repository->objects);
1803+
close_object_store(the_repository->objects);
18041804
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
18051805
}
18061806
}

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
12431243
transport_disconnect(transport);
12441244

12451245
if (option_dissociate) {
1246-
close_all_packs(the_repository->objects);
1246+
close_object_store(the_repository->objects);
12471247
dissociate_from_references();
12481248
}
12491249

builtin/fetch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
16721672

16731673
string_list_clear(&list, 0);
16741674

1675-
close_all_packs(the_repository->objects);
1675+
close_object_store(the_repository->objects);
16761676

16771677
argv_array_pushl(&argv_gc_auto, "gc", "--auto", NULL);
16781678
if (verbosity < 0)

builtin/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
632632
gc_before_repack();
633633

634634
if (!repository_format_precious_objects) {
635-
close_all_packs(the_repository->objects);
635+
close_object_store(the_repository->objects);
636636
if (run_command_v_opt(repack.argv, RUN_GIT_CMD))
637637
die(FAILED_RUN, repack.argv[0]);
638638

@@ -660,7 +660,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
660660
report_garbage = report_pack_garbage;
661661
reprepare_packed_git(the_repository);
662662
if (pack_garbage.nr > 0) {
663-
close_all_packs(the_repository->objects);
663+
close_object_store(the_repository->objects);
664664
clean_pack_garbage();
665665
}
666666

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static void finish(struct commit *head_commit,
449449
* We ignore errors in 'gc --auto', since the
450450
* user should see them.
451451
*/
452-
close_all_packs(the_repository->objects);
452+
close_object_store(the_repository->objects);
453453
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
454454
}
455455
}

builtin/rebase.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ static int finish_rebase(struct rebase_options *opts)
328328

329329
delete_ref(NULL, "REBASE_HEAD", NULL, REF_NO_DEREF);
330330
apply_autostash(opts);
331-
close_all_packs(the_repository->objects);
331+
close_object_store(the_repository->objects);
332332
/*
333333
* We ignore errors in 'gc --auto', since the
334334
* user should see them.

builtin/receive-pack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
20322032
proc.git_cmd = 1;
20332033
proc.argv = argv_gc_auto;
20342034

2035-
close_all_packs(the_repository->objects);
2035+
close_object_store(the_repository->objects);
20362036
if (!start_command(&proc)) {
20372037
if (use_sideband)
20382038
copy_to_sideband(proc.err, -1, NULL);

builtin/repack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
419419
if (!names.nr && !po_args.quiet)
420420
printf_ln(_("Nothing new to pack."));
421421

422-
close_all_packs(the_repository->objects);
422+
close_object_store(the_repository->objects);
423423

424424
/*
425425
* Ok we have prepared all new packfiles.

commit-graph.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,10 +305,10 @@ int generation_numbers_enabled(struct repository *r)
305305
return !!first_generation;
306306
}
307307

308-
void close_commit_graph(struct repository *r)
308+
void close_commit_graph(struct raw_object_store *o)
309309
{
310-
free_commit_graph(r->objects->commit_graph);
311-
r->objects->commit_graph = NULL;
310+
free_commit_graph(o->commit_graph);
311+
o->commit_graph = NULL;
312312
}
313313

314314
static int bsearch_graph(struct commit_graph *g, struct object_id *oid, uint32_t *pos)
@@ -1049,7 +1049,7 @@ void write_commit_graph(const char *obj_dir,
10491049
stop_progress(&progress);
10501050
strbuf_release(&progress_title);
10511051

1052-
close_commit_graph(the_repository);
1052+
close_commit_graph(the_repository->objects);
10531053
finalize_hashfile(f, NULL, CSUM_HASH_IN_STREAM | CSUM_FSYNC);
10541054
commit_lock_file(&lk);
10551055

commit-graph.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void write_commit_graph(const char *obj_dir,
7272

7373
int verify_commit_graph(struct repository *r, struct commit_graph *g);
7474

75-
void close_commit_graph(struct repository *);
75+
void close_commit_graph(struct raw_object_store *);
7676
void free_commit_graph(struct commit_graph *);
7777

7878
#endif

0 commit comments

Comments
 (0)