Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a2760fe authored by Kelvin Zhang's avatar Kelvin Zhang Committed by Gerrit Code Review
Browse files

Merge "Initialize COW options using update manifest"

parents 95465fe7 b5a96072
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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;
+14 −0
Original line number Diff line number Diff line
@@ -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;
+7 −0
Original line number Diff line number Diff line
@@ -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 {