Merge "Initialize COW options using update manifest" am: 2a2760fe0a

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2454005

Change-Id: I06dfe0e56d2449e0a320469779aef6f8c5d1cc4c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Kelvin Zhang 2023-02-24 05:47:30 +00:00 committed by Automerger Merge Worker
commit 599cc32d20
4 changed files with 33 additions and 0 deletions

View file

@ -108,6 +108,12 @@ message SnapshotStatus {
// Estimated COW size from OTA manifest.
uint64 estimated_cow_size = 12;
// Enable multi-threaded compression
bool enable_threading = 13;
// Enable batching for COW writes
bool batched_writes = 14;
}
// Next: 8

View file

@ -60,6 +60,12 @@ struct PartitionCowCreator {
bool using_snapuserd = false;
std::string compression_algorithm;
// True if multi-threaded compression should be enabled
bool enable_threading;
// True if COW writes should be batched in memory
bool batched_writes;
struct Return {
SnapshotStatus snapshot_status;
std::vector<Interval> cow_partition_usable_regions;

View file

@ -400,6 +400,12 @@ bool SnapshotManager::CreateSnapshot(LockedFile* lock, PartitionCowCreator* cow_
status->set_metadata_sectors(0);
status->set_using_snapuserd(cow_creator->using_snapuserd);
status->set_compression_algorithm(cow_creator->compression_algorithm);
if (cow_creator->enable_threading) {
status->set_enable_threading(cow_creator->enable_threading);
}
if (cow_creator->batched_writes) {
status->set_batched_writes(cow_creator->batched_writes);
}
if (!WriteSnapshotStatus(lock, *status)) {
PLOG(ERROR) << "Could not write snapshot status: " << status->name();
@ -3248,6 +3254,12 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
.using_snapuserd = using_snapuserd,
.compression_algorithm = compression_algorithm,
};
if (dap_metadata.vabc_feature_set().has_threaded()) {
cow_creator.enable_threading = dap_metadata.vabc_feature_set().threaded();
}
if (dap_metadata.vabc_feature_set().has_batch_writes()) {
cow_creator.batched_writes = dap_metadata.vabc_feature_set().batch_writes();
}
auto ret = CreateUpdateSnapshotsInternal(lock.get(), manifest, &cow_creator, &created_devices,
&all_snapshot_status);
@ -3635,6 +3647,8 @@ std::unique_ptr<ISnapshotWriter> SnapshotManager::OpenCompressedSnapshotWriter(
CowOptions cow_options;
cow_options.compression = status.compression_algorithm();
cow_options.max_blocks = {status.device_size() / cow_options.block_size};
cow_options.batch_write = status.batched_writes();
cow_options.num_compress_threads = status.enable_threading() ? 2 : 0;
// Disable scratch space for vts tests
if (device()->IsTestDevice()) {
cow_options.scratch_space = false;

View file

@ -71,11 +71,18 @@ message DynamicPartitionGroup {
repeated string partition_names = 3;
}
message VABCFeatureSet {
optional bool threaded = 1;
optional bool batch_writes = 2;
}
message DynamicPartitionMetadata {
repeated DynamicPartitionGroup groups = 1;
optional bool vabc_enabled = 3;
optional string vabc_compression_param = 4;
optional uint32 cow_version = 5;
// A collection of knobs to tune Virtual AB Compression
optional VABCFeatureSet vabc_feature_set = 6;
}
message DeltaArchiveManifest {