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/payload_generator/payload_file.h b/payload_generator/payload_file.h
index 3dce00f..8b17956 100644
--- a/payload_generator/payload_file.h
+++ b/payload_generator/payload_file.h
@@ -43,7 +43,8 @@
// reference a blob stored in the file provided to WritePayload().
bool AddPartition(const PartitionConfig& old_conf,
const PartitionConfig& new_conf,
- std::vector<AnnotatedOperation> aops);
+ std::vector<AnnotatedOperation> aops,
+ std::vector<CowMergeOperation> merge_sequence);
// Write the payload to the |payload_file| file. The operations reference
// blobs in the |data_blobs_path| file and the blobs will be reordered in the
@@ -90,6 +91,7 @@
// The operations to be performed to this partition.
std::vector<AnnotatedOperation> aops;
+ std::vector<CowMergeOperation> cow_merge_sequence;
PartitionInfo old_info;
PartitionInfo new_info;