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

Commit 492e972c authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I4fba1982,Ia0812a11 am: 7e8a9d9f

Original change: https://android-review.googlesource.com/c/platform/system/core/+/1818255

Change-Id: I0efbd258ca7b331fc56026773e3686a948c16835
parents 343cb321 7e8a9d9f
Loading
Loading
Loading
Loading
+5 −2
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,11 +218,12 @@ 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)) {
            if (next_offset + nr_consecutive * BLOCK_SZ != *source_offset) {
                break;
            }
            nr_consecutive += 1;