-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A design for future-proofing fsync() configuration #1093
Changes from all commits
825079b
a41bd4a
64e2bdc
6adc8dc
757f6d0
67d21ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -547,13 +547,63 @@ core.whitespace:: | |
is relevant for `indent-with-non-tab` and when Git fixes `tab-in-indent` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Patrick Steinhardt wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Patrick Steinhardt wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Jiang Xin wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
|
||
errors. The default tab width is 8. Allowed values are 1 to 63. | ||
|
||
core.fsync:: | ||
A comma-separated list of components of the repository that | ||
should be hardened via the core.fsyncMethod when created or | ||
modified. You can disable hardening of any component by | ||
prefixing it with a '-'. Items that are not hardened may be | ||
lost in the event of an unclean system shutdown. Unless you | ||
have special requirements, it is recommended that you leave | ||
this option empty or pick one of `committed`, `added`, | ||
or `all`. | ||
+ | ||
When this configuration is encountered, the set of components starts with | ||
the platform default value, disabled components are removed, and additional | ||
components are added. `none` resets the state so that the platform default | ||
is ignored. | ||
+ | ||
The empty string resets the fsync configuration to the platform | ||
default. The default on most platforms is equivalent to | ||
`core.fsync=committed,-loose-object`, which has good performance, | ||
but risks losing recent work in the event of an unclean system shutdown. | ||
+ | ||
* `none` clears the set of fsynced components. | ||
* `loose-object` hardens objects added to the repo in loose-object form. | ||
* `pack` hardens objects added to the repo in packfile form. | ||
* `pack-metadata` hardens packfile bitmaps and indexes. | ||
* `commit-graph` hardens the commit graph file. | ||
* `index` hardens the index when it is modified. | ||
* `objects` is an aggregate option that is equivalent to | ||
`loose-object,pack`. | ||
* `derived-metadata` is an aggregate option that is equivalent to | ||
`pack-metadata,commit-graph`. | ||
* `committed` is an aggregate option that is currently equivalent to | ||
`objects`. This mode sacrifices some performance to ensure that work | ||
that is committed to the repository with `git commit` or similar commands | ||
is hardened. | ||
* `added` is an aggregate option that is currently equivalent to | ||
`committed,index`. This mode sacrifices additional performance to | ||
ensure that the results of commands like `git add` and similar operations | ||
are hardened. | ||
* `all` is an aggregate option that syncs all individual components above. | ||
|
||
core.fsyncMethod:: | ||
A value indicating the strategy Git will use to harden repository data | ||
using fsync and related primitives. | ||
+ | ||
* `fsync` uses the fsync() system call or platform equivalents. | ||
* `writeout-only` issues pagecache writeback requests, but depending on the | ||
filesystem and storage hardware, data added to the repository may not be | ||
durable in the event of a system crash. This is the default mode on macOS. | ||
|
||
core.fsyncObjectFiles:: | ||
This boolean will enable 'fsync()' when writing object files. | ||
This setting is deprecated. Use core.fsync instead. | ||
+ | ||
This is a total waste of time and effort on a filesystem that orders | ||
data writes properly, but can be useful for filesystems that do not use | ||
journalling (traditional UNIX filesystems) or that only journal metadata | ||
and not file contents (OS X's HFS+, or Linux ext3 with "data=writeback"). | ||
This setting affects data added to the Git repository in loose-object | ||
form. When set to true, Git will issue an fsync or similar system call | ||
to flush caches so that loose-objects remain consistent in the face | ||
of a unclean system shutdown. | ||
|
||
core.preloadIndex:: | ||
Enable parallel index preload for operations like 'git diff' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "git-compat-util.h" | ||
#include <winternl.h> | ||
#include "lazyload.h" | ||
|
||
int win32_fsync_no_flush(int fd) | ||
{ | ||
IO_STATUS_BLOCK io_status; | ||
|
||
#define FLUSH_FLAGS_FILE_DATA_ONLY 1 | ||
|
||
DECLARE_PROC_ADDR(ntdll.dll, NTSTATUS, NTAPI, NtFlushBuffersFileEx, | ||
HANDLE FileHandle, ULONG Flags, PVOID Parameters, ULONG ParameterSize, | ||
PIO_STATUS_BLOCK IoStatusBlock); | ||
|
||
if (!INIT_PROC_ADDR(NtFlushBuffersFileEx)) { | ||
errno = ENOSYS; | ||
return -1; | ||
} | ||
|
||
memset(&io_status, 0, sizeof(io_status)); | ||
if (NtFlushBuffersFileEx((HANDLE)_get_osfhandle(fd), FLUSH_FLAGS_FILE_DATA_ONLY, | ||
NULL, 0, &io_status)) { | ||
errno = EINVAL; | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,11 +4,6 @@ | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Junio C Hamano wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, "brian m. carlson" wrote (reply to this):
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Neeraj Singh wrote (reply to this):
|
||
#undef NOGDI | ||
|
||
/* | ||
* Including the appropriate header file for RtlGenRandom causes MSVC to see a | ||
* redefinition of types in an incompatible way when including headers below. | ||
*/ | ||
#undef HAVE_RTLGENRANDOM | ||
#include "../git-compat-util.h" | ||
#include <wingdi.h> | ||
#include <winreg.h> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Patrick Steinhardt wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Ævar Arnfjörð Bjarmason wrote (reply to this):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Neeraj Singh wrote (reply to this):