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

Commit 209fda35 authored by Daniel Zheng's avatar Daniel Zheng
Browse files

libsnapshot: move header op count setup

Op count should be set before we sync the header. This way subsequence
writers can initialize with the correct op buffer size

Test: cow_api_test
Change-Id: I56a0d747b3f2a1d9d582d8f9d643b81cbdd9b8d7
parent 76377643
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ bool CowWriterV3::ParseOptions() {
        return false;
    }
    header_.compression_algorithm = *algorithm;
    header_.op_count_max = options_.op_count_max;

    if (parts.size() > 1) {
        if (!android::base::ParseUint(parts[1], &compression_.compression_level)) {
@@ -163,7 +164,7 @@ bool CowWriterV3::OpenForWrite() {
            return false;
        }
    }
    header_.op_count_max = options_.op_count_max;

    resume_points_ = std::make_shared<std::vector<ResumePoint>>();

    if (!Sync()) {