Add CowMergeOperations as a hint for snapshot write
As proposed in http://go/vabc, we want to reduce the cow size
for VAB. One nature apporach is to skip writing the idential
blocks to snapshot; instead we can read from the souce blocks.
Similiar to the non-A/B update schema, we need to compute a
sequence for snapshot merge to avoid the read after write problem.
If there is a circular dependency, we will omit some blocks in the
result sequence to break the cycles. So libsnapshot will write
the raw data of these blocks to cow.
All extents in the CowMergeOperations are subsets of a particular
OTA SOURCE_COPY InstallOperation. Also, these src & ext extents
will be contiguous to improve the libsnapshot read performance
before merge completes, as well as to simplify the sequence
generation.
Bug: 162274240
Test: unittest pass, genertes an OTA
Change-Id: I12c952593d83a8e34a0a6cff5a2066c9103a0d30
diff --git a/update_metadata.proto b/update_metadata.proto
index f79e38b..373ee5e 100644
--- a/update_metadata.proto
+++ b/update_metadata.proto
@@ -225,6 +225,22 @@
optional bytes src_sha256_hash = 9;
}
+// Hints to VAB snapshot to skip writing some blocks if these blocks are
+// identical to the ones on the source image. The src & dst extents for each
+// CowMergeOperation should be contiguous, and they're a subset of an OTA
+// InstallOperation.
+// During merge time, we need to follow the pre-computed sequence to avoid
+// read after write, similar to the inplace update schema.
+message CowMergeOperation {
+ enum Type {
+ COW_COPY = 0; // identical blocks
+ }
+ optional Type type = 1;
+
+ optional Extent src_extent = 2;
+ optional Extent dst_extent = 3;
+}
+
// Describes the update to apply to a single partition.
message PartitionUpdate {
// A platform-specific name to identify the partition set being updated. For
@@ -293,6 +309,11 @@
// as an effort to support partial updates. For most partitions,
// this is the build timestamp.
optional string version = 17;
+
+ // A sorted list of CowMergeOperation. When writing cow, we can choose to
+ // skip writing the raw bytes for these extents. During snapshot merge, the
+ // bytes will read from the source partitions instead.
+ repeated CowMergeOperation merge_operations = 18;
}
message DynamicPartitionGroup {