From: Junio C Hamano Date: Fri, 3 Jun 2022 21:30:34 +0000 (-0700) Subject: Merge branch 'ns/batch-fsync' X-Git-Tag: v2.37.0-rc0~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=83937e9592832408670da38bfe6e96c90ad63521;p=thirdparty%2Fgit.git Merge branch 'ns/batch-fsync' Introduce a filesystem-dependent mechanism to optimize the way the bits for many loose object files are ensured to hit the disk platter. * ns/batch-fsync: core.fsyncmethod: performance tests for batch mode t/perf: add iteration setup mechanism to perf-lib core.fsyncmethod: tests for batch mode test-lib-functions: add parsing helpers for ls-files and ls-tree core.fsync: use batch mode and sync loose objects by default on Windows unpack-objects: use the bulk-checkin infrastructure update-index: use the bulk-checkin infrastructure builtin/add: add ODB transaction around add_files_to_cache cache-tree: use ODB transaction around writing a tree core.fsyncmethod: batched disk flushes for loose-objects bulk-checkin: rebrand plug/unplug APIs as 'odb transactions' bulk-checkin: rename 'state' variable and separate 'plugged' boolean --- 83937e9592832408670da38bfe6e96c90ad63521 diff --cc cache.h index 595582becc,2b5f614184..7b3825cf50 --- a/cache.h +++ b/cache.h @@@ -1028,9 -1026,12 +1028,13 @@@ enum fsync_component FSYNC_COMPONENT_PACK | \ FSYNC_COMPONENT_PACK_METADATA | \ FSYNC_COMPONENT_COMMIT_GRAPH | \ - FSYNC_COMPONENT_INDEX) + FSYNC_COMPONENT_INDEX | \ + FSYNC_COMPONENT_REFERENCE) + #ifndef FSYNC_COMPONENTS_PLATFORM_DEFAULT + #define FSYNC_COMPONENTS_PLATFORM_DEFAULT FSYNC_COMPONENTS_DEFAULT + #endif + /* * A bitmask indicating which components of the repo should be fsynced. */ diff --cc object-file.c index d35c1820e7,a696f5ec69..2a1f3386f6 --- a/object-file.c +++ b/object-file.c @@@ -1893,11 -1852,13 +1893,13 @@@ static void close_loose_object(int fd, if (the_repository->objects->odb->will_destroy) goto out; - if (fsync_object_files > 0) + if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT)) - fsync_loose_object_bulk_checkin(fd, "loose object file"); ++ fsync_loose_object_bulk_checkin(fd, filename); + else if (fsync_object_files > 0) - fsync_or_die(fd, "loose object file"); + fsync_or_die(fd, filename); else fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd, - "loose object file"); + filename); out: if (close(fd) != 0) diff --cc t/perf/p7519-fsmonitor.sh index 0b9129ca7b,5b489c968b..b1cb23880f --- a/t/perf/p7519-fsmonitor.sh +++ b/t/perf/p7519-fsmonitor.sh @@@ -60,19 -60,7 +60,7 @@@ the esac fi - if test -n "$GIT_PERF_7519_DROP_CACHE" - then - # When using GIT_PERF_7519_DROP_CACHE, GIT_PERF_REPEAT_COUNT must be 1 to - # generate valid results. Otherwise the caching that happens for the nth - # run will negate the validity of the comparisons. - if test "$GIT_PERF_REPEAT_COUNT" -ne 1 - then - echo "warning: Setting GIT_PERF_REPEAT_COUNT=1" >&2 - GIT_PERF_REPEAT_COUNT=1 - fi - fi - -trace_start() { +trace_start () { if test -n "$GIT_PERF_7519_TRACE" then name="$1" @@@ -175,18 -155,14 +163,18 @@@ setup_for_fsmonitor_hook () test_perf_w_drop_caches () { if test -n "$GIT_PERF_7519_DROP_CACHE"; then - test-tool drop-caches + test_perf "$1" --setup "test-tool drop-caches" "$2" + else + test_perf "$@" fi - - test_perf "$@" } -test_fsmonitor_suite() { - if test -n "$INTEGRATION_SCRIPT"; then +test_fsmonitor_suite () { + if test -n "$USE_FSMONITOR_DAEMON" + then + DESC="builtin fsmonitor--daemon" + elif test -n "$INTEGRATION_SCRIPT" + then DESC="fsmonitor=$(basename $INTEGRATION_SCRIPT)" else DESC="fsmonitor=disabled"