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

Commit f7001fad authored by Daniel Rosenberg's avatar Daniel Rosenberg
Browse files

libsnapshot: Add IsOrderedOp

Ordered Ops are Cow Ops with source block dependencies.
Currently this is only Copy Ops, but will extend to XOR
blocks when they're added.

Bug: 177104308
Test: Builds, does not impace cow_api_test/cow_snapuserd_test
Change-Id: I0a50dfe3316ec3a3b1d035335f094c62296649a5
parent f0d9beb1
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -90,5 +90,14 @@ bool IsMetadataOp(const CowOperation& op) {
    }
}

bool IsOrderedOp(const CowOperation& op) {
    switch (op.type) {
        case kCowCopyOp:
            return true;
        default:
            return false;
    }
}

}  // namespace snapshot
}  // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -185,7 +185,10 @@ std::ostream& operator<<(std::ostream& os, CowOperation const& arg);
int64_t GetNextOpOffset(const CowOperation& op, uint32_t cluster_size);
int64_t GetNextDataOffset(const CowOperation& op, uint32_t cluster_size);

// Ops that are internal to the Cow Format and not OTA data
bool IsMetadataOp(const CowOperation& op);
// Ops that have dependencies on old blocks, and must take care in their merge order
bool IsOrderedOp(const CowOperation& op);

}  // namespace snapshot
}  // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -395,7 +395,7 @@ bool Snapuserd::ReadMetadata() {
        // handling of assigning chunk-id's. Furthermore, we make
        // sure that replace/zero and copy ops are not batch merged; hence,
        // the bump in the chunk_id before break of this loop
        if (cow_op->type == kCowCopyOp) {
        if (IsOrderedOp(*cow_op)) {
            data_chunk_id = GetNextAllocatableChunkId(data_chunk_id);
            break;
        }