changeset 305:1e8f7df58d5e

Rationalise stats gathering for nand access. Does not instrument mounting.
author charles
date Wed, 09 Sep 2009 04:03:01 +0100
parents 003f31df02fc
children 03e453bfb3f1
files yaffs_checkptrw.c yaffs_mtdif1.c yaffs_nand.c yaffs_tagscompat.c
diffstat 4 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_checkptrw.c
+++ b/yaffs_checkptrw.c
@@ -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
@@ -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
@@ -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 */