Merge changes from topic "change_period" am: c0de6d8184 am: 3d81e0ba06 am: aa259e7ee0

Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2043104

Change-Id: I93577a23c99808054e77e41948f5c0fb704c6dce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Daeho Jeong 2022-03-29 14:19:24 +00:00 committed by Automerger Merge Worker
commit 5891d7e486

View file

@ -547,7 +547,9 @@ void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float
std::string dirtySegmentsPath = f2fsSysfsPath + "/dirty_segments";
std::string gcSleepTimePath = f2fsSysfsPath + "/gc_urgent_sleep_time";
std::string gcUrgentModePath = f2fsSysfsPath + "/gc_urgent";
std::string freeSegmentsStr, dirtySegmentsStr;
std::string ovpSegmentsPath = f2fsSysfsPath + "/ovp_segments";
std::string reservedBlocksPath = f2fsSysfsPath + "/reserved_blocks";
std::string freeSegmentsStr, dirtySegmentsStr, ovpSegmentsStr, reservedBlocksStr;
if (!ReadFileToString(freeSegmentsPath, &freeSegmentsStr)) {
PLOG(WARNING) << "Reading failed in " << freeSegmentsPath;
@ -559,9 +561,21 @@ void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float
return;
}
if (!ReadFileToString(ovpSegmentsPath, &ovpSegmentsStr)) {
PLOG(WARNING) << "Reading failed in " << ovpSegmentsPath;
return;
}
if (!ReadFileToString(reservedBlocksPath, &reservedBlocksStr)) {
PLOG(WARNING) << "Reading failed in " << reservedBlocksPath;
return;
}
int32_t freeSegments = std::stoi(freeSegmentsStr);
int32_t dirtySegments = std::stoi(dirtySegmentsStr);
int32_t reservedBlocks = std::stoi(ovpSegmentsStr) + std::stoi(reservedBlocksStr);
freeSegments = freeSegments > reservedBlocks ? freeSegments - reservedBlocks : 0;
neededSegments *= reclaimWeight;
if (freeSegments >= neededSegments) {
LOG(INFO) << "Enough free segments: " << freeSegments