summaryrefslogtreecommitdiff
path: root/yaffs_guts.c
diff options
context:
space:
mode:
authorCharles Manning <cdhmanning@gmail.com>2010-08-19 16:00:15 +1200
committerCharles Manning <cdhmanning@gmail.com>2010-08-19 16:00:15 +1200
commitaa8454786457b8b3144e8859da15ac3719cc0602 (patch)
treea46417c81f9ed04cc022394ceb8b09d7bbdfeb68 /yaffs_guts.c
parentb76bff5557ccc92df456fd7b1cd13c8b061cda07 (diff)
yaffs Tweak gc parameters
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>
Diffstat (limited to 'yaffs_guts.c')
-rw-r--r--yaffs_guts.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/yaffs_guts.c b/yaffs_guts.c
index 389a57c..75eeb84 100644
--- a/yaffs_guts.c
+++ b/yaffs_guts.c
@@ -2435,7 +2435,16 @@ static unsigned yaffs_FindBlockForGarbageCollection(yaffs_Device *dev,
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)
@@ -2537,10 +2546,8 @@ static int yaffs_CheckGarbageCollection(yaffs_Device *dev, int background)
int aggressive = 0;
int gcOk = YAFFS_OK;
int maxTries = 0;
-
int minErased;
int erasedChunks;
-
int checkpointBlockAdjust;
if(dev->param.gcControl &&
@@ -2568,6 +2575,9 @@ static int yaffs_CheckGarbageCollection(yaffs_Device *dev, int background)
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 ||