summaryrefslogtreecommitdiffstats
path: root/fstrim.c
diff options
context:
space:
mode:
authorYoung-ho Cha <ganadist@gmail.com>2014-06-20 19:48:36 +0900
committerJP Abgrall <jpa@google.com>2015-02-26 18:45:52 +0000
commite72cd592b372d658f43baadf95330562aff30322 (patch)
tree1649d3b04f960635164d5fdf7b3f921e273dcedc /fstrim.c
parentd55d8dac45dc60cb2cc9e599d3e89532db0cfc39 (diff)
downloadandroid_system_vold-e72cd592b372d658f43baadf95330562aff30322.tar.gz
android_system_vold-e72cd592b372d658f43baadf95330562aff30322.tar.bz2
android_system_vold-e72cd592b372d658f43baadf95330562aff30322.zip
vold: acquire wakelock on fstrim thread
If fstrim thread creation or detachment is failed, wakelock can be leaked. So move wakelock acquire to do_fstrim_filesystems function Change-Id: I4da3164343af83fae3e5b01700f43d1752661276 Signed-off-by: Young-ho Cha <ganadist@gmail.com>
Diffstat (limited to 'fstrim.c')
-rw-r--r--fstrim.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fstrim.c b/fstrim.c
index 8a02c77..2769643 100644
--- a/fstrim.c
+++ b/fstrim.c
@@ -68,6 +68,11 @@ static void *do_fstrim_filesystems(void *thread_arg)
SLOGI("Starting fstrim work...\n");
+ /* Get a wakelock as this may take a while, and we don't want the
+ * device to sleep on us.
+ */
+ acquire_wake_lock(PARTIAL_WAKE_LOCK, FSTRIM_WAKELOCK);
+
/* Log the start time in the event log */
LOG_EVENT_LONG(LOG_FSTRIM_START, get_boot_time_ms());
@@ -133,11 +138,6 @@ int fstrim_filesystems(int deep_trim)
pthread_t t;
int ret;
- /* Get a wakelock as this may take a while, and we don't want the
- * device to sleep on us.
- */
- acquire_wake_lock(PARTIAL_WAKE_LOCK, FSTRIM_WAKELOCK);
-
/* Depending on the emmc chip and size, this can take upwards
* of a few minutes. If done in the same thread as the caller
* of this function, that would block vold from accepting any