diff options
author | Daeho Jeong <daehojeong@google.com> | 2022-03-25 22:47:17 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2022-03-25 22:47:17 +0000 |
commit | 81ba5bcf1ca31e7e8c19451c4c0d6f477fa44e5c (patch) | |
tree | 595356f225058251dc21a5d6c8402014bfa58b32 | |
parent | 3b35b2fcc57b81d7298acecdc3f71869c8448df8 (diff) | |
parent | 7c788fc3e9b7350f48b96aa68fca71f1a2518c02 (diff) | |
download | vold-81ba5bcf1ca31e7e8c19451c4c0d6f477fa44e5c.tar.gz |
vold: add gc period in setGCUrgentPace am: 7c788fc3e9
Original change: https://android-review.googlesource.com/c/platform/system/vold/+/2032446
Change-Id: I691c355f6eb91f83af0b4bbdade10bd67ceb62a3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | IdleMaint.cpp | 6 | ||||
-rw-r--r-- | IdleMaint.h | 2 | ||||
-rw-r--r-- | VoldNativeService.cpp | 5 | ||||
-rw-r--r-- | VoldNativeService.h | 2 | ||||
-rw-r--r-- | binder/android/os/IVold.aidl | 3 |
5 files changed, 10 insertions, 8 deletions
diff --git a/IdleMaint.cpp b/IdleMaint.cpp index 2fc0d4b8..597d6099 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<std::string> 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 ae70b634..9a2af4a6 100644 --- a/IdleMaint.h +++ b/IdleMaint.h @@ -27,7 +27,7 @@ int RunIdleMaint(bool needGC, const android::sp<android::os::IVoldTaskListener>& int AbortIdleMaint(const android::sp<android::os::IVoldTaskListener>& 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 ce6e6fc5..8ba3aafd 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 cb429730..423e8f9f 100644 --- a/VoldNativeService.h +++ b/VoldNativeService.h @@ -90,7 +90,7 @@ class VoldNativeService : public BinderService<VoldNativeService>, public os::Bn binder::Status abortIdleMaint(const android::sp<android::os::IVoldTaskListener>& 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 05da7b07..d77c7da0 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(); |