]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ns/batch-fsync'
authorJunio C Hamano <gitster@pobox.com>
Fri, 3 Jun 2022 21:30:34 +0000 (14:30 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 3 Jun 2022 21:30:34 +0000 (14:30 -0700)
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

16 files changed:
1  2 
Documentation/config/core.txt
builtin/add.c
builtin/unpack-objects.c
builtin/update-index.c
bulk-checkin.c
cache-tree.c
cache.h
compat/mingw.h
config.c
git-compat-util.h
object-file.c
t/perf/p7519-fsmonitor.sh
t/perf/perf-lib.sh
t/t3903-stash.sh
t/t5300-pack-object.sh
t/test-lib-functions.sh

Simple merge
diff --cc builtin/add.c
Simple merge
Simple merge
Simple merge
diff --cc bulk-checkin.c
Simple merge
diff --cc cache-tree.c
Simple merge
diff --cc cache.h
index 595582becc83a5ffc1dfcc19eb59123d772b44c4,2b5f61418480ace855d9cf9a7e7fe52b55cd91f5..7b3825cf50f008205f93d8b6e9eb34ca01dc672e
+++ 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 compat/mingw.h
Simple merge
diff --cc config.c
Simple merge
Simple merge
diff --cc object-file.c
index d35c1820e7af51691e500e9da8fdc0282157749c,a696f5ec69a8825f94a28ef475c75dd6d4428b54..2a1f3386f6a970d943fc306a870864db04039599
@@@ -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)
index 0b9129ca7bc55a61d3692834fe44940214669244,5b489c968b884d12a313c506c044e545cbdfcf36..b1cb23880fb2bf44faad8745d58f392ceff17a94
@@@ -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"
Simple merge
Simple merge
Simple merge
Simple merge