diff --git a/IdleMaint.cpp b/IdleMaint.cpp index 2fc0d4b..597d609 100644 --- a/IdleMaint.cpp +++ b/IdleMaint.cpp @@ -87,7 +87,7 @@ static const int GC_TIMEOUT_SEC = 420; static const int DEVGC_TIMEOUT_SEC = 120; static const int KBYTES_IN_SEGMENT = 2048; static const int MIN_GC_URGENT_SLEEP_TIME = 500; -static const int ONE_HOUR_IN_MS = 3600000; +static const int ONE_MINUTE_IN_MS = 60000; static const int GC_NORMAL_MODE = 0; static const int GC_URGENT_MID_MODE = 3; @@ -531,7 +531,7 @@ int32_t GetStorageLifeTime() { } void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float dirtyReclaimRate, - float reclaimWeight) { + float reclaimWeight, int32_t gcPeriod) { std::list paths; bool needGC = true; @@ -586,7 +586,7 @@ void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float if (neededSegments == 0) { sleepTime = MIN_GC_URGENT_SLEEP_TIME; } else { - sleepTime = ONE_HOUR_IN_MS / neededSegments; + sleepTime = gcPeriod * ONE_MINUTE_IN_MS / neededSegments; if (sleepTime < MIN_GC_URGENT_SLEEP_TIME) { sleepTime = MIN_GC_URGENT_SLEEP_TIME; } diff --git a/IdleMaint.h b/IdleMaint.h index ae70b63..9a2af4a 100644 --- a/IdleMaint.h +++ b/IdleMaint.h @@ -27,7 +27,7 @@ int RunIdleMaint(bool needGC, const android::sp& int AbortIdleMaint(const android::sp& listener); int32_t GetStorageLifeTime(); void SetGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, float dirtyReclaimRate, - float reclaimWeight); + float reclaimWeight, int32_t gcPeriod); void RefreshLatestWrite(); int32_t GetWriteAmount(); diff --git a/VoldNativeService.cpp b/VoldNativeService.cpp index ce6e6fc..8ba3aaf 100644 --- a/VoldNativeService.cpp +++ b/VoldNativeService.cpp @@ -494,11 +494,12 @@ binder::Status VoldNativeService::getStorageLifeTime(int32_t* _aidl_return) { binder::Status VoldNativeService::setGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, - float dirtyReclaimRate, float reclaimWeight) { + float dirtyReclaimRate, float reclaimWeight, + int32_t gcPeriod) { ENFORCE_SYSTEM_OR_ROOT; ACQUIRE_LOCK; - SetGCUrgentPace(neededSegments, minSegmentThreshold, dirtyReclaimRate, reclaimWeight); + SetGCUrgentPace(neededSegments, minSegmentThreshold, dirtyReclaimRate, reclaimWeight, gcPeriod); return Ok(); } diff --git a/VoldNativeService.h b/VoldNativeService.h index cb42973..423e8f9 100644 --- a/VoldNativeService.h +++ b/VoldNativeService.h @@ -90,7 +90,7 @@ class VoldNativeService : public BinderService, public os::Bn binder::Status abortIdleMaint(const android::sp& listener); binder::Status getStorageLifeTime(int32_t* _aidl_return); binder::Status setGCUrgentPace(int32_t neededSegments, int32_t minSegmentThreshold, - float dirtyReclaimRate, float reclaimWeight); + float dirtyReclaimRate, float reclaimWeight, int32_t gcPeriod); binder::Status refreshLatestWrite(); binder::Status getWriteAmount(int32_t* _aidl_return); diff --git a/binder/android/os/IVold.aidl b/binder/android/os/IVold.aidl index 05da7b0..d77c7da 100644 --- a/binder/android/os/IVold.aidl +++ b/binder/android/os/IVold.aidl @@ -68,7 +68,8 @@ interface IVold { void abortIdleMaint(IVoldTaskListener listener); int getStorageLifeTime(); void setGCUrgentPace(int neededSegments, int minSegmentThreshold, - float dirtyReclaimRate, float reclaimWeight); + float dirtyReclaimRate, float reclaimWeight, + int gcPeriod); void refreshLatestWrite(); int getWriteAmount();