yaffs New background garbage collector and related tweaks
[yaffs2.git] / yaffs_guts.c
index 65e33a644b958c09b946f8a14c80d3bcbf933a05..42e234a73f56852b4d5760733c3f9ec59e3ae076 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)