Remove now unnecessary 'sync()' calls
Since the pack-files are now always created stably on disk, there is no need to sync() before pruning lose objects or old stale pack-files. [jc: with Nico's clean-up] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4c81b03e30
commit
54352bb274
@ -514,9 +514,10 @@ static void write_pack_file(void)
|
|||||||
* Did we write the wrong # entries in the header?
|
* Did we write the wrong # entries in the header?
|
||||||
* If so, rewrite it like in fast-import
|
* If so, rewrite it like in fast-import
|
||||||
*/
|
*/
|
||||||
if (pack_to_stdout || nr_written == nr_remaining) {
|
if (pack_to_stdout) {
|
||||||
unsigned flags = pack_to_stdout ? CSUM_CLOSE : CSUM_FSYNC;
|
sha1close(f, sha1, CSUM_CLOSE);
|
||||||
sha1close(f, sha1, flags);
|
} else if (nr_written == nr_remaining) {
|
||||||
|
sha1close(f, sha1, CSUM_FSYNC);
|
||||||
} else {
|
} else {
|
||||||
int fd = sha1close(f, NULL, 0);
|
int fd = sha1close(f, NULL, 0);
|
||||||
fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
|
fixup_pack_header_footer(fd, sha1, pack_tmp_name, nr_written);
|
||||||
|
@ -85,7 +85,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
|
|||||||
/* Handle arguments here .. */
|
/* Handle arguments here .. */
|
||||||
usage(prune_packed_usage);
|
usage(prune_packed_usage);
|
||||||
}
|
}
|
||||||
sync();
|
|
||||||
prune_packed_objects(opts);
|
prune_packed_objects(opts);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
|
|||||||
mark_reachable_objects(&revs, 1);
|
mark_reachable_objects(&revs, 1);
|
||||||
prune_object_dir(get_object_directory());
|
prune_object_dir(get_object_directory());
|
||||||
|
|
||||||
sync();
|
|
||||||
prune_packed_objects(show_only);
|
prune_packed_objects(show_only);
|
||||||
remove_temporary_files();
|
remove_temporary_files();
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -125,7 +125,6 @@ then
|
|||||||
# We know $existing are all redundant.
|
# We know $existing are all redundant.
|
||||||
if [ -n "$existing" ]
|
if [ -n "$existing" ]
|
||||||
then
|
then
|
||||||
sync
|
|
||||||
( cd "$PACKDIR" &&
|
( cd "$PACKDIR" &&
|
||||||
for e in $existing
|
for e in $existing
|
||||||
do
|
do
|
||||||
|
Loading…
Reference in New Issue
Block a user