fs_mgr_overlayfs: Add scratch size override system property

Bug: 253207748
Test: Treehugger
Change-Id: I7140044d127e7db99d86decbe818be3680d26995
This commit is contained in:
Yi-Yo Chiang 2022-10-11 18:49:48 +08:00
parent 9b123de886
commit 15f94436b3

View file

@ -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;
}