# HG changeset patch # User charles # Date 1252465381 -3600 # Node ID 1e8f7df58d5e393327f164b617cfb19c0515c3ec # Parent 003f31df02fcd2aa7a107703346b244855019521 Rationalise stats gathering for nand access. Does not instrument mounting. diff --git a/yaffs_checkptrw.c b/yaffs_checkptrw.c --- 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); */ diff --git a/yaffs_mtdif1.c b/yaffs_mtdif1.c --- 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; diff --git a/yaffs_nand.c b/yaffs_nand.c --- 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; diff --git a/yaffs_tagscompat.c b/yaffs_tagscompat.c --- 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 */