diff options
author | Daniel Rosenberg <drosen@google.com> | 2019-04-01 17:55:58 -0700 |
---|---|---|
committer | Daniel Rosenberg <drosen@google.com> | 2019-04-01 18:18:51 -0700 |
commit | 96731d84db05b7b67613e70eff789c113bd5ad2a (patch) | |
tree | 9b5bcba0b8a55c5b85a0c05275065eb47cafd7a0 | |
parent | 654a37cd657593c9a01ff586f55b0b308f9c3474 (diff) | |
download | extras-96731d84db05b7b67613e70eff789c113bd5ad2a.tar.gz |
Make checkpoint_gc.sh robust against interference
If some other process decides to run a brief period of GC and then turn
it off, checkpoint_gc.sh will keep running and hold up the OTA. To
combat that, we set gc_urgent again each cycle.
Test: set gc_urgent to 0 after the script sets it to 1. Verify script
still runs
Change-Id: If361a7e6aace2b20d976d94210fc5a72c3630c72
-rw-r--r-- | checkpoint_gc/checkpoint_gc.sh | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/checkpoint_gc/checkpoint_gc.sh b/checkpoint_gc/checkpoint_gc.sh index d5f7ab40..93785804 100644 --- a/checkpoint_gc/checkpoint_gc.sh +++ b/checkpoint_gc/checkpoint_gc.sh @@ -44,7 +44,6 @@ 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 - echo $DIRTY_SEGMENTS PROGRESS=`echo "(${DIRTY_SEGMENTS_START}-${DIRTY_SEGMENTS})/${TODO_SEGMENTS}"|bc -l` if [[ $PROGRESS == -* ]]; then PROGRESS=0 @@ -52,6 +51,8 @@ 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} + # In case someone turns it off behind our back + echo 1 > /sys/fs/f2fs/${NAME}/gc_urgent done log -pi -t checkpoint_gc Turning off GC for ${NAME} |