diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-06-04 00:30:34 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-06-04 00:30:34 +0300 |
commit | 83937e9592832408670da38bfe6e96c90ad63521 (patch) | |
tree | 20c6895015e2c281780eba0fead78aef3862ed8e /object-file.c | |
parent | 377d347eb3b1a23ece080dc5e5b8df6958c56e96 (diff) | |
parent | 112a9fe60d7c5f02ee1a805d8730d54a458b7ad1 (diff) |
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
Diffstat (limited to 'object-file.c')
-rw-r--r-- | object-file.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/object-file.c b/object-file.c index d35c1820e7..2a1f3386f6 100644 --- a/object-file.c +++ b/object-file.c @@ -1893,7 +1893,9 @@ static void close_loose_object(int fd, const char *filename) 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, filename); + else if (fsync_object_files > 0) fsync_or_die(fd, filename); else fsync_component_or_die(FSYNC_COMPONENT_LOOSE_OBJECT, fd, @@ -1961,6 +1963,9 @@ static int write_loose_object(const struct object_id *oid, char *hdr, static struct strbuf tmp_file = STRBUF_INIT; static struct strbuf filename = STRBUF_INIT; + if (batch_fsync_enabled(FSYNC_COMPONENT_LOOSE_OBJECT)) + prepare_loose_object_bulk_checkin(); + loose_object_path(the_repository, &filename, oid); fd = create_tmpfile(&tmp_file, filename.buf); |