From b868a88c1ad8c96559f2caeebf742b0b437d72e2 Mon Sep 17 00:00:00 2001 From: Daeho Jeong Date: Thu, 31 Aug 2023 12:50:09 -0700 Subject: [PATCH] Correct reserved blocks to segments Align units to a segment unit when adjusting free segment number. Test: run the smart idle maint service. Change-Id: I4fd74ac92adc4ae1a0ded4a7df75a690d829eb20 Signed-off-by: Daeho Jeong --- IdleMaint.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IdleMaint.cpp b/IdleMaint.cpp index 1a6c0a6..7d3eaf4 100644 --- a/IdleMaint.cpp +++ b/IdleMaint.cpp @@ -551,9 +551,9 @@ void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float int32_t freeSegments = std::stoi(freeSegmentsStr); int32_t dirtySegments = std::stoi(dirtySegmentsStr); - int32_t reservedBlocks = std::stoi(ovpSegmentsStr) + std::stoi(reservedBlocksStr); + int32_t reservedSegments = std::stoi(ovpSegmentsStr) + std::stoi(reservedBlocksStr) / 512; - freeSegments = freeSegments > reservedBlocks ? freeSegments - reservedBlocks : 0; + freeSegments = freeSegments > reservedSegments ? freeSegments - reservedSegments : 0; int32_t totalSegments = freeSegments + dirtySegments; int32_t finalTargetSegments = 0;