From 5101bff53a59d4cd54da0b4cde0cc32208b22d64 Mon Sep 17 00:00:00 2001 From: Charles Manning Date: Wed, 2 Jun 2021 11:28:43 +1200 Subject: [PATCH] Fix sleep logic in background gc thread example The logic to sleep longer was the wrong way around. Signed-off-by: Charles Manning --- direct/test-framework/yaffs_osglue.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/direct/test-framework/yaffs_osglue.c b/direct/test-framework/yaffs_osglue.c index 2cc18bb..94ca24d 100644 --- a/direct/test-framework/yaffs_osglue.c +++ b/direct/test-framework/yaffs_osglue.c @@ -106,7 +106,13 @@ static void *bg_gc_func(void *dummy) while ((dev = yaffs_next_dev()) != NULL) { result = yaffs_do_background_gc_reldev(dev, urgent); - if (result > 0) + + /* result is 1 if more than half the free space is + * erased. + * If less than half the free space is erased then it is + * worth doing another background_gc operation sooner. + */ + if (result == 0) next_urgent = 1; } -- 2.30.2