[Yaffs] Avoid tagsEccUnfixed stats bump on mounting partially used block

Todd Poynor tpoynor at mvista.com
Fri Nov 18 04:09:42 GMT 2005


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 at mvista.com>

Index: yaffs_tagscompat.c
===================================================================
RCS file: /home/aleph1/cvs/yaffs2/yaffs_tagscompat.c,v
retrieving revision 1.7
diff -u -r1.7 yaffs_tagscompat.c
--- yaffs_tagscompat.c	20 Sep 2005 23:12:38 -0000	1.7
+++ yaffs_tagscompat.c	18 Nov 2005 04:03:47 -0000
@@ -455,20 +455,22 @@
 			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;



More information about the yaffs mailing list