This will reduce unnecessary garbace collection by limiting in-thread garbage
collection to when the garbage > 3/4 of the free space.
This should push more gc into background and make the write path faster.
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
threshold = dev->param.nChunksPerBlock;
iterations = nBlocks;
} else {
threshold = dev->param.nChunksPerBlock;
iterations = nBlocks;
} else {
- int maxThreshold = dev->param.nChunksPerBlock/2;
+ int maxThreshold;
+
+ if(background)
+ maxThreshold = dev->param.nChunksPerBlock/2;
+ else
+ maxThreshold = dev->param.nChunksPerBlock/8;
+
+ if(maxThreshold < YAFFS_GC_PASSIVE_THRESHOLD)
+ maxThreshold = YAFFS_GC_PASSIVE_THRESHOLD;
+
threshold = background ?
(dev->gcNotDone + 2) * 2 : 0;
if(threshold <YAFFS_GC_PASSIVE_THRESHOLD)
threshold = background ?
(dev->gcNotDone + 2) * 2 : 0;
if(threshold <YAFFS_GC_PASSIVE_THRESHOLD)
int aggressive = 0;
int gcOk = YAFFS_OK;
int maxTries = 0;
int aggressive = 0;
int gcOk = YAFFS_OK;
int maxTries = 0;
int minErased;
int erasedChunks;
int minErased;
int erasedChunks;
int checkpointBlockAdjust;
if(dev->param.gcControl &&
int checkpointBlockAdjust;
if(dev->param.gcControl &&
if (dev->nErasedBlocks < minErased)
aggressive = 1;
else {
if (dev->nErasedBlocks < minErased)
aggressive = 1;
else {
+ if(!background && erasedChunks > (dev->nFreeChunks / 4))
+ break;
+
if(dev->gcSkip > 20)
dev->gcSkip = 20;
if(erasedChunks < dev->nFreeChunks/2 ||
if(dev->gcSkip > 20)
dev->gcSkip = 20;
if(erasedChunks < dev->nFreeChunks/2 ||