diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-05 13:44:40 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-05 13:44:40 +0000 |
commit | 3ef3ae4609c939ed07679ab6e3f586ad6e54a035 (patch) | |
tree | 79e44978aa7138f78769321d55457f17dd7e5fb5 | |
parent | 9fd52f03cf60095ce63a28a405b42f252242e227 (diff) | |
parent | 7bb75de623695cad15ec2fac759a1e881379552d (diff) | |
download | extras-3ef3ae4609c939ed07679ab6e3f586ad6e54a035.tar.gz |
Snap for 5533315 from 7bb75de623695cad15ec2fac759a1e881379552d to qt-aml-release
Change-Id: I690ed303d6c087a5114ee6e1ca402ef04db7f1e6
-rw-r--r-- | checkpoint_gc/checkpoint_gc.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/checkpoint_gc/checkpoint_gc.sh b/checkpoint_gc/checkpoint_gc.sh index 93785804..d653ee56 100644 --- a/checkpoint_gc/checkpoint_gc.sh +++ b/checkpoint_gc/checkpoint_gc.sh @@ -26,6 +26,8 @@ STATUS_FD="${2}" DIRTY_SEGMENTS_THRESHOLD=100 SLEEP=5 +TIME=0 +MAX_TIME=3600 NAME=`while read dev dir type opt; do if [ /data = ${dir} -a f2fs = ${type} ]; then @@ -42,8 +44,8 @@ echo 1 > /sys/fs/f2fs/${NAME}/gc_urgent || exit 1 read DIRTY_SEGMENTS_START < /sys/fs/f2fs/${NAME}/dirty_segments DIRTY_SEGMENTS=${DIRTY_SEGMENTS_START} TODO_SEGMENTS=$((${DIRTY_SEGMENTS_START}-${DIRTY_SEGMENTS_THRESHOLD})) -echo $DIRTY_SEGMENTS_START while [ ${DIRTY_SEGMENTS} -gt ${DIRTY_SEGMENTS_THRESHOLD} ]; do + log -pi -t checkpoint_gc dirty segments:${DIRTY_SEGMENTS} \(threshold:${DIRTY_SEGMENTS_THRESHOLD}\) PROGRESS=`echo "(${DIRTY_SEGMENTS_START}-${DIRTY_SEGMENTS})/${TODO_SEGMENTS}"|bc -l` if [[ $PROGRESS == -* ]]; then PROGRESS=0 @@ -51,6 +53,10 @@ while [ ${DIRTY_SEGMENTS} -gt ${DIRTY_SEGMENTS_THRESHOLD} ]; do print -u${STATUS_FD} "global_progress ${PROGRESS}" read DIRTY_SEGMENTS < /sys/fs/f2fs/${NAME}/dirty_segments sleep ${SLEEP} + TIME=$((${TIME}+${SLEEP})) + if [ ${TIME} -gt ${MAX_TIME} ]; then + break + fi # In case someone turns it off behind our back echo 1 > /sys/fs/f2fs/${NAME}/gc_urgent done |