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

Commit be85b80f authored by Jacky Jian's avatar Jacky Jian Committed by Gerrit Code Review
Browse files

Merge "isBlockAligned to use uint64_t" into main

parents 8067bd81 15e98464
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ class CowWriterV3 : public CowWriterBase {
                                                 CowOperationType type);
    size_t GetCompressionFactor(const size_t blocks_to_compress, CowOperationType type) const;

    constexpr bool IsBlockAligned(const size_t size) {
    constexpr bool IsBlockAligned(const uint64_t size) {
        // These are the only block size supported. Block size beyond 256k
        // may impact random read performance post OTA boot.
        const size_t values[] = {4_KiB, 8_KiB, 16_KiB, 32_KiB, 64_KiB, 128_KiB, 256_KiB};
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ class ReadWorker : public Worker, public IBlockServer::Delegate {
    bool ReadFromSourceDevice(const CowOperation* cow_op, void* buffer);
    bool ReadDataFromBaseDevice(sector_t sector, void* buffer, size_t read_size);

    constexpr bool IsBlockAligned(size_t size) { return ((size & (BLOCK_SZ - 1)) == 0); }
    constexpr bool IsBlockAligned(uint64_t size) { return ((size & (BLOCK_SZ - 1)) == 0); }
    constexpr sector_t ChunkToSector(chunk_t chunk) { return chunk << CHUNK_SHIFT; }
    constexpr chunk_t SectorToChunk(sector_t sector) { return sector >> CHUNK_SHIFT; }