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

Commit bb0a7642 authored by Kelvin Zhang's avatar Kelvin Zhang Committed by Daniel Rosenberg
Browse files

Fix a typo

this check should be performed on newly returned `op` instead of
`cow_op`

Test: th
Change-Id: Ia0812a1126d3e0bdfaff82859eb4b4a066a73bff
parent 7b0ae4ba
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -194,10 +194,12 @@ void ReadAheadThread::PrepareReadAhead(uint64_t* source_offset, int* pending_ops
                                       std::vector<uint64_t>& blocks) {
    int num_ops = *pending_ops;
    int nr_consecutive = 0;
    CHECK_NE(source_offset, nullptr);

    if (!RAIterDone() && num_ops) {
        // Get the first block with offset
        const CowOperation* cow_op = GetRAOpIter();
        CHECK_NE(cow_op, nullptr);
        *source_offset = cow_op->source;
        if (cow_op->type == kCowCopyOp) {
            *source_offset *= BLOCK_SZ;
@@ -216,8 +218,9 @@ void ReadAheadThread::PrepareReadAhead(uint64_t* source_offset, int* pending_ops
         */
        while (!RAIterDone() && num_ops) {
            const CowOperation* op = GetRAOpIter();
            CHECK_NE(op, nullptr);
            uint64_t next_offset = op->source;
            if (cow_op->type == kCowCopyOp) {
            if (op->type == kCowCopyOp) {
                next_offset *= BLOCK_SZ;
            }
            if (next_offset != (*source_offset - nr_consecutive * BLOCK_SZ)) {