changeset 288:b20bce8ec7a2

Rationalise stats gathering for nand access. Does not instrument mounting.
author charles <charles>
date Wed, 09 Sep 2009 03:03:01 +0000
parents 612d743759ab
children 850410979014
files yaffs_checkptrw.c yaffs_mtdif1.c yaffs_nand.c yaffs_tagscompat.c
diffstat 4 files changed, 17 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_checkptrw.c
+++ b/yaffs_checkptrw.c
@@ -12,7 +12,7 @@
  */
 
 const char *yaffs_checkptrw_c_version =
-	"$Id: yaffs_checkptrw.c,v 1.19 2009-06-19 01:35:46 charles Exp $";
+	"$Id: yaffs_checkptrw.c,v 1.20 2009-09-09 03:03:01 charles Exp $";
 
 
 #include "yaffs_checkptrw.h"
@@ -43,6 +43,9 @@ static int yaffs_CheckpointErase(yaffs_D
 		yaffs_BlockInfo *bi = yaffs_GetBlockInfo(dev, i);
 		if (bi->blockState == YAFFS_BLOCK_STATE_CHECKPOINT) {
 			T(YAFFS_TRACE_CHECKPOINT, (TSTR("erasing checkpt block %d"TENDSTR), i));
+
+			dev->nBlockErasures++;
+
 			if (dev->eraseBlockInNAND(dev, i - dev->blockOffset /* realign */)) {
 				bi->blockState = YAFFS_BLOCK_STATE_EMPTY;
 				dev->nErasedBlocks++;
@@ -222,6 +225,8 @@ static int yaffs_CheckpointFlushBuffer(y
 
 	realignedChunk = chunk - dev->chunkOffset;
 
+	dev->nPageWrites++;
+
 	dev->writeChunkWithTagsToNAND(dev, realignedChunk,
 			dev->checkpointBuffer, &tags);
 	dev->checkpointByteOffset = 0;
@@ -309,6 +314,8 @@ int yaffs_CheckpointRead(yaffs_Device *d
 					dev->checkpointCurrentChunk;
 
 				realignedChunk = chunk - dev->chunkOffset;
+				
+				dev->nPageReads++;
 
 				/* read in the next chunk */
 				/* printf("read checkpoint page %d\n",dev->checkpointPage); */
--- a/yaffs_mtdif1.c
+++ b/yaffs_mtdif1.c
@@ -36,7 +36,7 @@
 /* Don't compile this module if we don't have MTD's mtd_oob_ops interface */
 #if (MTD_VERSION_CODE > MTD_VERSION(2, 6, 17))
 
-const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.10 2009-03-09 07:41:10 charles Exp $";
+const char *yaffs_mtdif1_c_version = "$Id: yaffs_mtdif1.c,v 1.11 2009-09-09 03:03:01 charles Exp $";
 
 #ifndef CONFIG_YAFFS_9BYTE_TAGS
 # define YTAG1_SIZE 8
@@ -102,8 +102,6 @@ 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);
 
@@ -180,8 +178,6 @@ 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;
--- a/yaffs_nand.c
+++ b/yaffs_nand.c
@@ -12,7 +12,7 @@
  */
 
 const char *yaffs_nand_c_version =
-	"$Id: yaffs_nand.c,v 1.10 2009-03-06 17:20:54 wookey Exp $";
+	"$Id: yaffs_nand.c,v 1.11 2009-09-09 03:03:01 charles Exp $";
 
 #include "yaffs_nand.h"
 #include "yaffs_tagscompat.h"
@@ -29,6 +29,8 @@ int yaffs_ReadChunkWithTagsFromNAND(yaff
 
 	int realignedChunkInNAND = chunkInNAND - dev->chunkOffset;
 
+	dev->nPageReads++;
+
 	/* If there are no tags provided, use local tags to get prioritised gc working */
 	if (!tags)
 		tags = &localTags;
@@ -56,6 +58,9 @@ int yaffs_WriteChunkWithTagsToNAND(yaffs
 						   const __u8 *buffer,
 						   yaffs_ExtendedTags *tags)
 {
+
+	dev->nPageWrites++;
+
 	chunkInNAND -= dev->chunkOffset;
 
 
@@ -89,7 +94,7 @@ int yaffs_MarkBlockBad(yaffs_Device *dev
 {
 	blockNo -= dev->blockOffset;
 
-;
+
 	if (dev->markNANDBlockBad)
 		return dev->markNANDBlockBad(dev, blockNo);
 	else
@@ -119,8 +124,8 @@ int yaffs_EraseBlockInNAND(struct yaffs_
 
 	blockInNAND -= dev->blockOffset;
 
+	dev->nBlockErasures++;
 
-	dev->nBlockErasures++;
 	result = dev->eraseBlockInNAND(dev, blockInNAND);
 
 	return result;
--- a/yaffs_tagscompat.c
+++ b/yaffs_tagscompat.c
@@ -170,7 +170,6 @@ static int yaffs_WriteChunkToNAND(struct
 		return YAFFS_FAIL;
 	}
 
-	dev->nPageWrites++;
 	return dev->writeChunkToNAND(dev, chunkInNAND, data, spare);
 }
 
@@ -184,8 +183,6 @@ static int yaffs_ReadChunkFromNAND(struc
 	int retVal;
 	yaffs_Spare localSpare;
 
-	dev->nPageReads++;
-
 	if (!spare && data) {
 		/* If we don't have a real spare, then we use a local one. */
 		/* Need this for the calculation of the ecc */