projects
/
yaffs2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0a3e900
)
Faster block iteration where all blocks are being checked
author
charles
<charles>
Fri, 12 Mar 2010 02:48:34 +0000
(
02:48
+0000)
committer
charles
<charles>
Fri, 12 Mar 2010 02:48:34 +0000
(
02:48
+0000)
yaffs_guts.c
patch
|
blob
|
history
diff --git
a/yaffs_guts.c
b/yaffs_guts.c
index 99d6e97ab7b4990b94c6661a486289ba48a87acf..df66ec89860585636ffbfdaf0c80e7b90186493c 100644
(file)
--- a/
yaffs_guts.c
+++ b/
yaffs_guts.c
@@
-12,7
+12,7
@@
*/
const char *yaffs_guts_c_version =
*/
const char *yaffs_guts_c_version =
- "$Id: yaffs_guts.c,v 1.11
8 2010-03-12 01:22:48
charles Exp $";
+ "$Id: yaffs_guts.c,v 1.11
9 2010-03-12 02:48:34
charles Exp $";
#include "yportenv.h"
#include "yaffs_trace.h"
#include "yportenv.h"
#include "yaffs_trace.h"
@@
-1062,19
+1062,20
@@
static int yaffs_CalcOldestDirtySequence(yaffs_Device *dev)
{
int i;
__u32 seq;
{
int i;
__u32 seq;
- yaffs_BlockInfo *b
= 0
;
+ yaffs_BlockInfo *b;
if(!dev->param.isYaffs2)
return 0;
/* Find the oldest dirty sequence number. */
seq = dev->sequenceNumber;
if(!dev->param.isYaffs2)
return 0;
/* Find the oldest dirty sequence number. */
seq = dev->sequenceNumber;
+ b = dev->blockInfo;
for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
for (i = dev->internalStartBlock; i <= dev->internalEndBlock; i++) {
- b = yaffs_GetBlockInfo(dev, i);
if (b->blockState == YAFFS_BLOCK_STATE_FULL &&
(b->pagesInUse - b->softDeletions) < dev->param.nChunksPerBlock &&
b->sequenceNumber < seq)
seq = b->sequenceNumber;
if (b->blockState == YAFFS_BLOCK_STATE_FULL &&
(b->pagesInUse - b->softDeletions) < dev->param.nChunksPerBlock &&
b->sequenceNumber < seq)
seq = b->sequenceNumber;
+ b++;
}
return seq;
}
}
return seq;
}
@@
-2800,12
+2801,9
@@
static __u32 yaffs_FindRefreshBlock(yaffs_Device *dev)
*/
dev->refreshSkip = dev->param.refreshPeriod;
dev->refreshCount++;
*/
dev->refreshSkip = dev->param.refreshPeriod;
dev->refreshCount++;
-
+ bi = dev->blockInfo;
for (b = dev->internalStartBlock; b <=dev->internalEndBlock; b++){
for (b = dev->internalStartBlock; b <=dev->internalEndBlock; b++){
- bi = yaffs_GetBlockInfo(dev, b);
-
-
if (bi->blockState == YAFFS_BLOCK_STATE_FULL){
if(oldest < 1 ||
if (bi->blockState == YAFFS_BLOCK_STATE_FULL){
if(oldest < 1 ||
@@
-2814,6
+2812,7
@@
static __u32 yaffs_FindRefreshBlock(yaffs_Device *dev)
oldestSequence = bi->sequenceNumber;
}
}
oldestSequence = bi->sequenceNumber;
}
}
+ bi++;
}
if (oldest > 0) {
}
if (oldest > 0) {
@@
-2845,11
+2844,9
@@
static int yaffs_FindBlockForGarbageCollection(yaffs_Device *dev,
/* First let's see if we need to grab a prioritised block */
if (dev->hasPendingPrioritisedGCs) {
/* First let's see if we need to grab a prioritised block */
if (dev->hasPendingPrioritisedGCs) {
+ bi = dev->blockInfo;
for (i = dev->internalStartBlock; i < dev->internalEndBlock && !prioritised; i++) {
for (i = dev->internalStartBlock; i < dev->internalEndBlock && !prioritised; i++) {
- bi = yaffs_GetBlockInfo(dev, i);
- /* yaffs_VerifyBlock(dev,bi,i); */
-
if (bi->gcPrioritise) {
pendingPrioritisedExist = 1;
if (bi->blockState == YAFFS_BLOCK_STATE_FULL &&
if (bi->gcPrioritise) {
pendingPrioritisedExist = 1;
if (bi->blockState == YAFFS_BLOCK_STATE_FULL &&
@@
-2860,6
+2857,7
@@
static int yaffs_FindBlockForGarbageCollection(yaffs_Device *dev,
aggressive = 1; /* Fool the non-aggressive skip logiv below */
}
}
aggressive = 1; /* Fool the non-aggressive skip logiv below */
}
}
+ bi++;
}
if (!pendingPrioritisedExist) /* None found, so we can clear this */
}
if (!pendingPrioritisedExist) /* None found, so we can clear this */
@@
-5970,8
+5968,8
@@
static int yaffs_Scan(yaffs_Device *dev)
dev->sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER;
/* Scan all the blocks to determine their state */
dev->sequenceNumber = YAFFS_LOWEST_SEQUENCE_NUMBER;
/* Scan all the blocks to determine their state */
+ bi = dev->blockInfo;
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
- bi = yaffs_GetBlockInfo(dev, blk);
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
@@
-5997,6
+5995,7
@@
static int yaffs_Scan(yaffs_Device *dev)
dev->nErasedBlocks++;
dev->nFreeChunks += dev->param.nChunksPerBlock;
}
dev->nErasedBlocks++;
dev->nFreeChunks += dev->param.nChunksPerBlock;
}
+ bi++;
}
startIterator = dev->internalStartBlock;
}
startIterator = dev->internalStartBlock;
@@
-6494,8
+6493,8
@@
static int yaffs_ScanBackwards(yaffs_Device *dev)
chunkData = yaffs_GetTempBuffer(dev, __LINE__);
/* Scan all the blocks to determine their state */
chunkData = yaffs_GetTempBuffer(dev, __LINE__);
/* Scan all the blocks to determine their state */
+ bi = dev->blockInfo;
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
for (blk = dev->internalStartBlock; blk <= dev->internalEndBlock; blk++) {
- bi = yaffs_GetBlockInfo(dev, blk);
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
yaffs_ClearChunkBits(dev, blk);
bi->pagesInUse = 0;
bi->softDeletions = 0;
@@
-6548,6
+6547,7
@@
static int yaffs_ScanBackwards(yaffs_Device *dev)
}
}
}
}
+ bi++;
}
T(YAFFS_TRACE_SCAN,
}
T(YAFFS_TRACE_SCAN,
@@
-7994,15
+7994,13
@@
void yaffs_Deinitialise(yaffs_Device *dev)
static int yaffs_CountFreeChunks(yaffs_Device *dev)
{
static int yaffs_CountFreeChunks(yaffs_Device *dev)
{
- int nFree;
+ int nFree
=0
;
int b;
yaffs_BlockInfo *blk;
int b;
yaffs_BlockInfo *blk;
- for (nFree = 0, b = dev->internalStartBlock; b <= dev->internalEndBlock;
- b++) {
- blk = yaffs_GetBlockInfo(dev, b);
-
+ blk = dev->blockInfo;
+ for (b = dev->internalStartBlock; b <= dev->internalEndBlock; b++) {
switch (blk->blockState) {
case YAFFS_BLOCK_STATE_EMPTY:
case YAFFS_BLOCK_STATE_ALLOCATING:
switch (blk->blockState) {
case YAFFS_BLOCK_STATE_EMPTY:
case YAFFS_BLOCK_STATE_ALLOCATING:
@@
-8015,6
+8013,7
@@
static int yaffs_CountFreeChunks(yaffs_Device *dev)
default:
break;
}
default:
break;
}
+ blk++;
}
return nFree;
}
return nFree;