Filter out duplicate blocks in new image
I generated 4 OTA packages on coral, and found that after
filtering out duplicate blocks from new_file_extents, OTA
packages are 0.2-0.3% smaller. Tiny improvement bust still
reduces OTA size by a bit.
There was a previous experiment that showed an increase in
OTA size is when we filter out duplicate blocks from BOTH
old_file_extents and new_file_extents.
Test: th
Bug: 177104308
Change-Id: Iff8d5948fbe5a028e356f47637e5b5a803e00334
diff --git a/payload_generator/extent_utils.h b/payload_generator/extent_utils.h
index f5bb39c..712cc92 100644
--- a/payload_generator/extent_utils.h
+++ b/payload_generator/extent_utils.h
@@ -145,6 +145,11 @@
return std::numeric_limits<size_t>::max();
}
+constexpr bool ExtentContains(const Extent& extent, size_t block) {
+ return extent.start_block() <= block &&
+ block < extent.start_block() + extent.num_blocks();
+}
+
} // namespace chromeos_update_engine
#endif // UPDATE_ENGINE_PAYLOAD_GENERATOR_EXTENT_UTILS_H_