Add functions to handle idle maintenance
runIdleMaint is equivalent with:
1. echo 1 > /sys/fs/f2fs/sdX/gc_urgent
2. wait until /sys/fs/f2fs/sdX/dirty_segments
<= threshold or timeout
3. echo 0 > /sys/fs/f2fs/sdX/gc_urgent
4. fstrim
abortIdleMaint forces the wait loop above to exit and
skips fstrim. However, if fstrim is already running,
abortIdleMaint will just leave it run to completion.
Test: adb shell sm idle-maint [run|abort]
Bug: 67776637
Change-Id: I4adff8d9b6bbd63bce41368cea55dc9e9b117eb6
diff --git a/IdleMaint.h b/IdleMaint.h
index 38dadfb..e043db4 100644
--- a/IdleMaint.h
+++ b/IdleMaint.h
@@ -23,6 +23,8 @@
namespace vold {
void Trim(const android::sp<android::os::IVoldTaskListener>& listener);
+int RunIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
+int AbortIdleMaint(const android::sp<android::os::IVoldTaskListener>& listener);
} // namespace vold
} // namespace android