From 3a263f2d5074abcd6129dff4f1bd1a0ab45a04da Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 9 Sep 2009 03:03:01 +0000 Subject: [PATCH] Rationalise stats gathering for nand access. Does not instrument mounting. --- yaffs_checkptrw.c | 9 ++++++++- yaffs_mtdif1.c | 6 +----- yaffs_nand.c | 11 ++++++++--- yaffs_tagscompat.c | 3 --- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c index ea03e3a..4481bbc 100644 --- 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_Device *dev) 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(yaffs_Device *dev) 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 *dev, void *data, int nBytes) dev->checkpointCurrentChunk; realignedChunk = chunk - dev->chunkOffset; + + dev->nPageReads++; /* read in the next chunk */ /* printf("read checkpoint page %d\n",dev->checkpointPage); */ diff --git a/yaffs_mtdif1.c b/yaffs_mtdif1.c index c069dfa..00fa4f2 100644 --- 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(yaffs_Device *dev, 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(yaffs_Device *dev, int retval; int deleted; - dev->nPageReads++; - memset(&ops, 0, sizeof(ops)); ops.mode = MTD_OOB_AUTO; ops.len = (data) ? chunkBytes : 0; diff --git a/yaffs_nand.c b/yaffs_nand.c index bd815cb..0a76ca0 100644 --- 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(yaffs_Device *dev, int chunkInNAND, 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_Device *dev, const __u8 *buffer, yaffs_ExtendedTags *tags) { + + dev->nPageWrites++; + chunkInNAND -= dev->chunkOffset; @@ -89,7 +94,7 @@ int yaffs_MarkBlockBad(yaffs_Device *dev, int blockNo) { blockNo -= dev->blockOffset; -; + if (dev->markNANDBlockBad) return dev->markNANDBlockBad(dev, blockNo); else @@ -119,8 +124,8 @@ int yaffs_EraseBlockInNAND(struct yaffs_DeviceStruct *dev, blockInNAND -= dev->blockOffset; - dev->nBlockErasures++; + result = dev->eraseBlockInNAND(dev, blockInNAND); return result; diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c index 402537f..e3173cc 100644 --- a/yaffs_tagscompat.c +++ b/yaffs_tagscompat.c @@ -170,7 +170,6 @@ static int yaffs_WriteChunkToNAND(struct yaffs_DeviceStruct *dev, return YAFFS_FAIL; } - dev->nPageWrites++; return dev->writeChunkToNAND(dev, chunkInNAND, data, spare); } @@ -184,8 +183,6 @@ static int yaffs_ReadChunkFromNAND(struct yaffs_DeviceStruct *dev, 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 */ -- 2.30.2