diff mbox series

[v4,4/4] core.fsync: add a `derived-metadata` aggregate option

Message ID 5c22a41c1f3b6edc941e8bcd0d77df87f1087f85.1643686425.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series A design for future-proofing fsync() configuration | expand

Commit Message

Neeraj Singh (WINDOWS-SFS) Feb. 1, 2022, 3:33 a.m. UTC
From: Neeraj Singh <neerajsi@microsoft.com>

This commit adds an aggregate option that currently includes the
commit-graph file and pack metadata (indexes and bitmaps).

The user may want to exclude this set from durability since they can be
recomputed from other data if they wind up corrupt or missing.

This is split out from the other patches in the series since it is
an optional nice-to-have that might be controversial.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
---
 Documentation/config/core.txt | 6 +++---
 cache.h                       | 7 ++++---
 config.c                      | 1 +
 3 files changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/config/core.txt b/Documentation/config/core.txt
index 8e5b7a795ab..21092f3a4d1 100644
--- a/Documentation/config/core.txt
+++ b/Documentation/config/core.txt
@@ -562,9 +562,9 @@  core.fsync::
 * `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 includes `loose-objects`, `pack`,
-  `pack-metadata`, and `commit-graph`.
-* `default` is an aggregate option that is equivalent to `objects,-loose-object`
+* `objects` is an aggregate option that includes `loose-objects` and `pack`.
+* `derived-metadata` is an aggregate option that includes `pack-metadata` and `commit-graph`.
+* `default` is an aggregate option that is equivalent to `objects,derived-metadata,-loose-object`
 * `all` is an aggregate option that syncs all individual components above.
 
 core.fsyncMethod::
diff --git a/cache.h b/cache.h
index 9f3c1ec4c42..3327cf6af0b 100644
--- a/cache.h
+++ b/cache.h
@@ -1012,9 +1012,10 @@  enum fsync_component {
 				  FSYNC_COMPONENT_COMMIT_GRAPH)
 
 #define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
-				  FSYNC_COMPONENT_PACK | \
-				  FSYNC_COMPONENT_PACK_METADATA | \
-				  FSYNC_COMPONENT_COMMIT_GRAPH)
+				  FSYNC_COMPONENT_PACK)
+
+#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
+					   FSYNC_COMPONENT_COMMIT_GRAPH)
 
 #define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \
 			      FSYNC_COMPONENT_PACK | \
diff --git a/config.c b/config.c
index 325644e3c2c..64a8a4d7c2a 100644
--- a/config.c
+++ b/config.c
@@ -1223,6 +1223,7 @@  static const struct fsync_component_entry {
 	{ "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
 	{ "index", FSYNC_COMPONENT_INDEX },
 	{ "objects", FSYNC_COMPONENTS_OBJECTS },
+	{ "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
 	{ "default", FSYNC_COMPONENTS_DEFAULT },
 	{ "all", FSYNC_COMPONENTS_ALL },
 };