diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-04 23:16:18 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-05-04 23:16:18 +0000 |
commit | 7bb75de623695cad15ec2fac759a1e881379552d (patch) | |
tree | 79e44978aa7138f78769321d55457f17dd7e5fb5 | |
parent | a10c5b24cb44a5e2434ec988ceb634f77dc76fd2 (diff) | |
parent | 06286985a3f511dc7cf0544c24ae9ea07fecc06a (diff) | |
download | extras-7bb75de623695cad15ec2fac759a1e881379552d.tar.gz |
Snap for 5533229 from 06286985a3f511dc7cf0544c24ae9ea07fecc06a to qt-release
Change-Id: If106a71fef2c38e09903de22ca42397f4f6d4d33
-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 |