yaffs New background garbage collector and related tweaks
[yaffs2.git] / yaffs_guts.c
index 65e33a6..42e234a 100644 (file)
@@ -3428,8 +3428,10 @@ static unsigned yaffs_FindBlockForGarbageCollection(yaffs_Device *dev,
                        int maxThreshold = dev->param.nChunksPerBlock/2;
                        threshold = background ?
                                (dev->gcNotDone + 2) * 2 : 0;
-                       threshold = max(threshold, YAFFS_GC_PASSIVE_THRESHOLD);
-                       threshold = min(threshold, maxThreshold);
+                       if(threshold <YAFFS_GC_PASSIVE_THRESHOLD)
+                               threshold = YAFFS_GC_PASSIVE_THRESHOLD;
+                       if(threshold > maxThreshold)
+                               threshold = maxThreshold;
 
                        iterations = nBlocks / 16 + 1;
                        if (iterations > 100)