Only skip CowCopy ops with same src/dst block
When installing an VABC package, update_engine will omit COPY operations
whose src and dst blocks are the same. As any untouched block during
update is assumed to hold same content as the one in source slot.
There's an additional complication: When applying a VABC update,
update_engine might selectively convert some COPY operation to REPLACE
operation to avoid merge conflicts. Current code skips these converted
REPLACE operation if src/dst block are the same. But this optimization
should be handled on the merge sequence generation side instead of apply
side. Therefore, we are changing this to only skip COPY operations. This
might slightly increase COW size, but once we implement proper
optimization on merge sequence generation side COW size should be the
same as before.
Test: th
Change-Id: I07f86c9fbcae48ba0dca6a4482fdbaea4a967fc3
diff --git a/payload_consumer/vabc_partition_writer.cc b/payload_consumer/vabc_partition_writer.cc
index aa8c3ce..0843fff 100644
--- a/payload_consumer/vabc_partition_writer.cc
+++ b/payload_consumer/vabc_partition_writer.cc
@@ -102,11 +102,11 @@
std::vector<uint8_t> buffer(block_size);
for (const auto& cow_op : converted) {
- if (cow_op.src_block == cow_op.dst_block) {
- continue;
- }
switch (cow_op.op) {
case CowOperation::CowCopy:
+ if (cow_op.src_block == cow_op.dst_block) {
+ continue;
+ }
TEST_AND_RETURN_FALSE(
cow_writer->AddCopy(cow_op.dst_block, cow_op.src_block));
break;