Move some SOURCE_COPY op processing out of Init() function
Currently, all COPY ops are processed upfront in
VABCPartitionWriter::Init() call. While update_engine is processing copy
ops, it can't respond to user actions such as pausing the OTA. To
improve UX, move some of the processing logic out of Init() function,
and spread the work through out the OTA install ops.
Before:
1. Write all COPY blocks through cow_writer
2. For blocks that gets converted to COW_REPLACE, compress them and
write to userspace snapshots using cow_writer
Item #2 take the most time, as compression + writing large blocks of
data to disk take a lot of time. This CL moves #2 to
VABCPartitionWriter::PerformSourceCopyOperation, so that the work is
done in chunks as we install the OTA.
Result:
Tested on O6, time spent on VABCPartitionWriter::Init() reduced from
177.6s to 2.3s
Test: Install oriole-UP1A.220930.002-to-UP1A.221007.001.zip
Bug: 248404111
Change-Id: I44737b7115e0ad7616ec49b8934fd6d70dc07447
diff --git a/payload_consumer/vabc_partition_writer.h b/payload_consumer/vabc_partition_writer.h
index 4df5151..8393fe5 100644
--- a/payload_consumer/vabc_partition_writer.h
+++ b/payload_consumer/vabc_partition_writer.h
@@ -24,11 +24,11 @@
#include <libsnapshot/snapshot_writer.h>
-#include "update_engine/common/cow_operation_convert.h"
#include "update_engine/payload_consumer/extent_map.h"
#include "update_engine/payload_consumer/install_operation_executor.h"
#include "update_engine/payload_consumer/install_plan.h"
-#include "update_engine/payload_consumer/partition_writer.h"
+#include "update_engine/payload_consumer/partition_writer_interface.h"
+#include "update_engine/payload_consumer/verified_source_fd.h"
#include "update_engine/payload_generator/extent_ranges.h"
namespace chromeos_update_engine {
@@ -62,12 +62,6 @@
void CheckpointUpdateProgress(size_t next_op_index) override;
- [[nodiscard]] static bool WriteSourceCopyCowOps(
- size_t block_size,
- const std::vector<CowOperation>& converted,
- android::snapshot::ICowWriter* cow_writer,
- FileDescriptorPtr source_fd);
-
[[nodiscard]] bool FinishedInstallOps() override;
int Close() override;
// Send merge sequence data to cow writer
@@ -91,6 +85,7 @@
InstallOperationExecutor executor_;
VerifiedSourceFd verified_source_fd_;
ExtentMap<const CowMergeOperation*, ExtentLess> xor_map_;
+ ExtentRanges copy_blocks_;
};
} // namespace chromeos_update_engine