projects
/
yaffs2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
772130e
)
Fix checkpoint to handle out of space conditions better
author
charles
<charles>
Thu, 29 Oct 2009 03:05:55 +0000
(
03:05
+0000)
committer
charles
<charles>
Thu, 29 Oct 2009 03:05:55 +0000
(
03:05
+0000)
yaffs_checkptrw.c
patch
|
blob
|
history
diff --git
a/yaffs_checkptrw.c
b/yaffs_checkptrw.c
index 4481bbcd210550a6b300541fd426bde29469ea69..481b0327f46180302335039eb8012153e146cc24 100644
(file)
--- a/
yaffs_checkptrw.c
+++ b/
yaffs_checkptrw.c
@@
-12,7
+12,7
@@
*/
const char *yaffs_checkptrw_c_version =
*/
const char *yaffs_checkptrw_c_version =
- "$Id: yaffs_checkptrw.c,v 1.2
0 2009-09-09 03:03:01
charles Exp $";
+ "$Id: yaffs_checkptrw.c,v 1.2
1 2009-10-29 03:05:55
charles Exp $";
#include "yaffs_checkptrw.h"
#include "yaffs_checkptrw.h"
@@
-130,6
+130,9
@@
static void yaffs_CheckpointFindNextCheckpointBlock(yaffs_Device *dev)
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
{
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
{
+
+ dev->checkpointOpenForWrite = forWriting;
+
/* Got the functions we need? */
if (!dev->writeChunkWithTagsToNAND ||
!dev->readChunkWithTagsFromNAND ||
/* Got the functions we need? */
if (!dev->writeChunkWithTagsToNAND ||
!dev->readChunkWithTagsFromNAND ||
@@
-147,9
+150,6
@@
int yaffs_CheckpointOpen(yaffs_Device *dev, int forWriting)
dev->checkpointPageSequence = 0;
dev->checkpointPageSequence = 0;
-
- dev->checkpointOpenForWrite = forWriting;
-
dev->checkpointByteCount = 0;
dev->checkpointSum = 0;
dev->checkpointXor = 0;
dev->checkpointByteCount = 0;
dev->checkpointSum = 0;
dev->checkpointXor = 0;
@@
-358,11
+358,14
@@
int yaffs_CheckpointClose(yaffs_Device *dev)
if (dev->checkpointOpenForWrite) {
if (dev->checkpointByteOffset != 0)
yaffs_CheckpointFlushBuffer(dev);
if (dev->checkpointOpenForWrite) {
if (dev->checkpointByteOffset != 0)
yaffs_CheckpointFlushBuffer(dev);
- } else {
+ } else
if(dev->checkpointBlockList)
{
int i;
for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) {
int i;
for (i = 0; i < dev->blocksInCheckpoint && dev->checkpointBlockList[i] >= 0; i++) {
- yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, dev->checkpointBlockList[i]);
- if (bi->blockState == YAFFS_BLOCK_STATE_EMPTY)
+ int blk = dev->checkpointBlockList[i];
+ yaffs_BlockInfo *bi = NULL;
+ if( dev->internalStartBlock <= blk && blk <= dev->internalEndBlock)
+ bi = yaffs_GetBlockInfo(dev, blk);
+ if (bi && bi->blockState == YAFFS_BLOCK_STATE_EMPTY)
bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
else {
/* Todo this looks odd... */
bi->blockState = YAFFS_BLOCK_STATE_CHECKPOINT;
else {
/* Todo this looks odd... */
@@
-390,13
+393,10
@@
int yaffs_CheckpointClose(yaffs_Device *dev)
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev)
{
int yaffs_CheckpointInvalidateStream(yaffs_Device *dev)
{
- /* Erase the
first checksum block
*/
+ /* Erase the
checkpoint data
*/
T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate"TENDSTR)));
T(YAFFS_TRACE_CHECKPOINT, (TSTR("checkpoint invalidate"TENDSTR)));
- if (!yaffs_CheckpointSpaceOk(dev))
- return 0;
-
return yaffs_CheckpointErase(dev);
}
return yaffs_CheckpointErase(dev);
}