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

Commit 065377b2 authored by Daniel Zheng's avatar Daniel Zheng
Browse files

snapuserd: skip verification

verification can be disabled as a property configurable through
vabc_features.mk

Bug: 332255580
Test: th
Change-Id: I48a6e5d20fee40cf1a90a8c35d29a5ca5c367572
parent 6bbaccc4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -233,6 +233,9 @@ message SnapshotUpdateStatus {

    // Default value is 3, configures threads to do verification phase
    uint32 num_verification_threads = 16;

    // Skips verification of partitions
    bool skip_verification = 17;
}

message SnapshotMergeReport {
+3 −0
Original line number Diff line number Diff line
@@ -859,6 +859,9 @@ class SnapshotManager final : public ISnapshotManager {
    // Check if direct reads are enabled for the source image
    bool UpdateUsesODirect(LockedFile* lock);

    // Check if we skip the verification of the target image
    bool UpdateUsesSkipVerification(LockedFile* lock);

    // Get value of maximum cow op merge size
    uint32_t GetUpdateCowOpMergeSize(LockedFile* lock);

+11 −0
Original line number Diff line number Diff line
@@ -2234,6 +2234,11 @@ bool SnapshotManager::UpdateUsesODirect(LockedFile* lock) {
    return update_status.o_direct();
}

bool SnapshotManager::UpdateUsesSkipVerification(LockedFile* lock) {
    SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
    return update_status.skip_verification();
}

uint32_t SnapshotManager::GetUpdateCowOpMergeSize(LockedFile* lock) {
    SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
    return update_status.cow_op_merge_size();
@@ -3244,6 +3249,7 @@ bool SnapshotManager::WriteUpdateState(LockedFile* lock, UpdateState state,
        status.set_io_uring_enabled(old_status.io_uring_enabled());
        status.set_legacy_snapuserd(old_status.legacy_snapuserd());
        status.set_o_direct(old_status.o_direct());
        status.set_skip_verification(old_status.skip_verification());
        status.set_cow_op_merge_size(old_status.cow_op_merge_size());
        status.set_num_worker_threads(old_status.num_worker_threads());
        status.set_verify_block_size(old_status.verify_block_size());
@@ -3626,6 +3632,10 @@ Return SnapshotManager::CreateUpdateSnapshots(const DeltaArchiveManifest& manife
            status.set_o_direct(true);
            LOG(INFO) << "o_direct for source image enabled";
        }
        if (GetSkipVerificationProperty()) {
            status.set_skip_verification(true);
            LOG(INFO) << "skipping verification of images";
        }
        if (is_legacy_snapuserd) {
            status.set_legacy_snapuserd(true);
            LOG(INFO) << "Setting legacy_snapuserd to true";
@@ -4073,6 +4083,7 @@ bool SnapshotManager::Dump(std::ostream& os) {
    ss << "Using userspace snapshots: " << update_status.userspace_snapshots() << std::endl;
    ss << "Using io_uring: " << update_status.io_uring_enabled() << std::endl;
    ss << "Using o_direct: " << update_status.o_direct() << std::endl;
    ss << "Using skip_verification: " << update_status.skip_verification() << std::endl;
    ss << "Cow op merge size (0 for uncapped): " << update_status.cow_op_merge_size() << std::endl;
    ss << "Worker thread count: " << update_status.num_worker_threads() << std::endl;
    ss << "Num verification threads: " << update_status.num_verification_threads() << std::endl;
+2 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ DEFINE_bool(socket_handoff, false,
DEFINE_bool(user_snapshot, false, "If true, user-space snapshots are used");
DEFINE_bool(io_uring, false, "If true, io_uring feature is enabled");
DEFINE_bool(o_direct, false, "If true, enable direct reads on source device");
DEFINE_bool(skip_verification, false, "If true, skip verification of partitions");
DEFINE_int32(cow_op_merge_size, 0, "number of operations to be processed at once");
DEFINE_int32(worker_count, android::snapshot::kNumWorkerThreads,
             "number of worker threads used to serve I/O requests to dm-user");
@@ -123,6 +124,7 @@ bool Daemon::StartServerForUserspaceSnapshots(int arg_start, int argc, char** ar
                .num_worker_threads = FLAGS_worker_count,
                .use_iouring = FLAGS_io_uring,
                .o_direct = FLAGS_o_direct,
                .skip_verification = FLAGS_skip_verification,
                .cow_op_merge_size = static_cast<uint32_t>(FLAGS_cow_op_merge_size),
                .verify_block_size = static_cast<uint32_t>(FLAGS_verify_block_size),
                .num_verification_threads = static_cast<uint32_t>(FLAGS_num_verify_threads),
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ struct HandlerOptions {
    int num_worker_threads{};
    bool use_iouring{};
    bool o_direct{};
    bool skip_verification{};
    uint32_t cow_op_merge_size{};
    uint32_t verify_block_size{};
    uint32_t num_verification_threads{};
Loading