changeset 189:b7314bfa91aa

When configured with CONFIG_YAFFS_9BYTE_TAGS, set chunkDeleted state using the delete status read before we set shouldBeFF to all-ones.
author imcd
date Mon, 23 Jul 2007 20:14:04 +0100
parents e8d248451214
children 31b2ee96d3a0
files yaffs_mtdif1.c
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_mtdif1.c
+++ b/yaffs_mtdif1.c
@@ -102,6 +102,8 @@ int nandmtd1_WriteChunkWithTagsToNAND(ya
 	compile_time_assertion(sizeof(yaffs_PackedTags1) == 12);
 	compile_time_assertion(sizeof(yaffs_Tags) == 8);
 
+	dev->nPageWrites++;
+
 	yaffs_PackTags1(&pt1, etags);
 	yaffs_CalcTagsECC((yaffs_Tags *)&pt1);
 
@@ -178,6 +180,8 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
 	int retval;
 	int deleted;
 
+	dev->nPageReads++;
+
 	memset(&ops, 0, sizeof(ops));
 	ops.mode = MTD_OOB_AUTO;
 	ops.len = (data) ? chunkBytes : 0;
@@ -237,7 +241,7 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
 	deleted = !pt1.deleted;
 	pt1.deleted = 1;
 #else
-	(void) deleted; /* not used */
+	deleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7);
 #endif
 
 	/* Check the packed tags mini-ECC and correct if necessary/possible.
@@ -250,7 +254,8 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
 	case 1:
 		/* recovered tags-ECC error */
 		dev->tagsEccFixed++;
-		eccres = YAFFS_ECC_RESULT_FIXED;
+		if (eccres == YAFFS_ECC_RESULT_NO_ERROR)
+			eccres = YAFFS_ECC_RESULT_FIXED;
 		break;
 	default:
 		/* unrecovered tags-ECC error */
@@ -265,13 +270,8 @@ int nandmtd1_ReadChunkWithTagsFromNAND(y
 	yaffs_UnpackTags1(etags, &pt1);
 	etags->eccResult = eccres;
 
-	/* Set deleted state.
-	 */
-#ifndef CONFIG_YAFFS_9BYTE_TAGS
+	/* Set deleted state */
 	etags->chunkDeleted = deleted;
-#else
-	etags->chunkDeleted = (yaffs_CountBits(((__u8 *)&pt1)[8]) < 7);
-#endif
 	return YAFFS_OK;
 }
 
@@ -306,7 +306,7 @@ static int nandmtd1_TestPrerequists(stru
 
 	if (oobavail < YTAG1_SIZE) {
 		yaffs_trace(YAFFS_TRACE_ERROR,
-			"mtd device has only %d bytes for tags, need %d",
+			"mtd device has only %d bytes for tags, need %d\n",
 			oobavail, YTAG1_SIZE);
 		return YAFFS_FAIL;
 	}