summaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorNeeraj Singh <neerajsi@microsoft.com>2022-03-10 22:43:20 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-10 23:10:22 (GMT)
commitabf38abec201cded6094801766d69e11a6c112b6 (patch)
treef1258b40f52f600be015a365ae5e57ed3b977a33 /environment.c
parent19d3f228c8df7e946278c96fb52acf1cea0f6a7a (diff)
downloadgit-abf38abec201cded6094801766d69e11a6c112b6.zip
git-abf38abec201cded6094801766d69e11a6c112b6.tar.gz
git-abf38abec201cded6094801766d69e11a6c112b6.tar.bz2
core.fsyncmethod: add writeout-only mode
This commit introduces the `core.fsyncMethod` configuration knob, which can currently be set to `fsync` or `writeout-only`. The new writeout-only mode attempts to tell the operating system to flush its in-memory page cache to the storage hardware without issuing a CACHE_FLUSH command to the storage controller. Writeout-only fsync is significantly faster than a vanilla fsync on common hardware, since data is written to a disk-side cache rather than all the way to a durable medium. Later changes in this patch series will take advantage of this primitive to implement batching of hardware flushes. When git_fsync is called with FSYNC_WRITEOUT_ONLY, it may fail and the caller is expected to do an ordinary fsync as needed. On Apple platforms, the fsync system call does not issue a CACHE_FLUSH directive to the storage controller. This change updates fsync to do fcntl(F_FULLFSYNC) to make fsync actually durable. We maintain parity with existing behavior on Apple platforms by setting the default value of the new core.fsyncMethod option. Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/environment.c b/environment.c
index fd0501e..3e3620d 100644
--- a/environment.c
+++ b/environment.c
@@ -44,6 +44,7 @@ int zlib_compression_level = Z_BEST_SPEED;
int pack_compression_level = Z_DEFAULT_COMPRESSION;
int fsync_object_files;
int use_fsync = -1;
+enum fsync_method fsync_method = FSYNC_METHOD_DEFAULT;
size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
size_t delta_base_cache_limit = 96 * 1024 * 1024;