Thread (1 message) 1 message, 1 author, 2022-03-09

Re: [PATCH v5 2/5] core.fsyncmethod: add writeout-only mode

From: Junio C Hamano <hidden>
Date: 2022-03-09 23:48:12

"Neeraj Singh via GitGitGadget" [off-list ref] writes:
From: Neeraj Singh <redacted>

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 <redacted>
---
OK.  This seems to be quite reasonable in that the pieces of code
that use fsync_or_die() do not have to change at all, and all of
them will keep behaving the same way.  In other words, the "how" of
fsync is very much well isolated.

Nice.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help