diff mbox series

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

Message ID a830d177d4cd6cebde24e2c51c2185801b6d57dc.1639011434.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) Dec. 9, 2021, 12:57 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 4dc26d7b2c9..cc1c084242e 100644
--- a/cache.h
+++ b/cache.h
@@ -1004,9 +1004,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 b3e7006c68e..d9ef3ef0060 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 },
 };