changeset 103:154a27183762

Subject: [Yaffs] Avoid tagsEccUnfixed stats bump on mounting partially usedblock IIUC, yaffs1 compatibility mode checks tags ECCs and updates stats on tags ECC errors when scanning an unused chunk of a partially-allocated block at mount time. This causes a mildly alarming "tagsEccUnfixed..... 1" in /proc/yaffs. Suggested fix below. Signed-off-by: Todd Poynor <tpoynor@mvista.com>
author marty
date Tue, 29 Nov 2005 20:54:32 +0000
parents 0e8b8a695278
children f3540e75e879
files yaffs_tagscompat.c
diffstat 1 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_tagscompat.c
+++ b/yaffs_tagscompat.c
@@ -455,20 +455,22 @@ int yaffs_TagsCompatabilityReadChunkWith
 			int deleted =
 			    (yaffs_CountBits(spare.pageStatus) < 7) ? 1 : 0;
 
-			yaffs_GetTagsFromSpare(dev, &spare, &tags);
-
 			eTags->chunkDeleted = deleted;
-			eTags->objectId = tags.objectId;
-			eTags->chunkId = tags.chunkId;
-			eTags->byteCount = tags.byteCount;
-			eTags->serialNumber = tags.serialNumber;
 			eTags->eccResult = eccResult;
 			eTags->blockBad = 0;	/* We're reading it */
 			/* therefore it is not a bad block */
-
 			eTags->chunkUsed =
 			    (memcmp(&spareFF, &spare, sizeof(spareFF)) !=
 			     0) ? 1 : 0;
+
+			if (eTags->chunkUsed) {
+				yaffs_GetTagsFromSpare(dev, &spare, &tags);
+
+				eTags->objectId = tags.objectId;
+				eTags->chunkId = tags.chunkId;
+				eTags->byteCount = tags.byteCount;
+				eTags->serialNumber = tags.serialNumber;
+			}
 		}
 
 		return YAFFS_OK;