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

Commit b78d0e28 authored by Akilesh Kailash's avatar Akilesh Kailash
Browse files

snapshotctl: fsync after writing every 1MB buffer



Sync writes after every 1MB instead of flushing at the end.

Bug: 299011882
Test: Boot device off snapshots
Change-Id: If91168ec92c2b2995bdf296ea1c7d4c261b12411
Signed-off-by: default avatarAkilesh Kailash <akailash@google.com>
parent 0ca4e8f4
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -227,8 +227,12 @@ bool MapSnapshots::WriteSnapshotPatch(std::string cow_device, std::string patch)
        if (file_offset >= dev_sz) {
            break;
        }

        if (fsync(cfd.get()) < 0) {
            PLOG(ERROR) << "Fsync failed at offset: " << file_offset << " size: " << to_read;
            return false;
        }
    }
    fsync(cfd.get());
    return true;
}