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

Commit 15f94436 authored by Yi-Yo Chiang's avatar Yi-Yo Chiang
Browse files

fs_mgr_overlayfs: Add scratch size override system property

Bug: 253207748
Test: Treehugger
Change-Id: I7140044d127e7db99d86decbe818be3680d26995
parent 9b123de8
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ using android::fiemap::IImageManager;

namespace {

constexpr char kDataScratchSizeMbProp[] = "fs_mgr.overlayfs.data_scratch_size_mb";

bool fs_mgr_access(const std::string& path) {
    return access(path.c_str(), F_OK) == 0;
}
@@ -1070,7 +1072,10 @@ static bool CreateScratchOnData(std::string* scratch_device, bool* partition_exi
        return false;
    }
    if (!images->BackingImageExists(partition_name)) {
        uint64_t size = GetIdealDataScratchSize();
        auto size = android::base::GetUintProperty<uint64_t>(kDataScratchSizeMbProp, 0) * 1_MiB;
        if (!size) {
            size = GetIdealDataScratchSize();
        }
        if (!size) {
            size = 2_GiB;
        }