projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
[yaffs2.git]
/
yaffs_guts.c
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index 389a57ca79f25efb475ef3e1311f3e6e4ab3c8b5..75eeb84cf3d5d23459d9897fa2b1fbc9e5b9c88c 100644
(file)
--- 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 {
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)
@@
-2537,10
+2546,8
@@
static int yaffs_CheckGarbageCollection(yaffs_Device *dev, int background)
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 &&
@@
-2568,6
+2575,9
@@
static int yaffs_CheckGarbageCollection(yaffs_Device *dev, int background)
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 ||