I add more information about dev->nErasedBlocks
 
initial /proc/yaffs:
/ # cat /proc/yaffs
Device 0 "nand_nda"
startBlock......... 0
endBlock........... 255
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 256
 
after I write one 1MB file by open() and write() function:
 
/ # cat /proc/yaffs
Device 0 "nand_nda"
startBlock......... 0
endBlock........... 255
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 239

This 1MB file eats 17 blocks ( 17*64*2048 Bytes = 2,228,224 Bytes).
 
It's queer.
 
 
I use "cp" command. nErasedBlocks is correct.
 
/ # cp file_1 /mnt/f0/

/ # cat /proc/yaffs
Device 0 "nand_nda"
startBlock......... 0
endBlock........... 255
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 247

 
Best Regards.
Ken
 
On 2009-08-20 02:41, Ken Yu wrote:
> Hi, all:
>
> My OS is linux 2.6.12 and I check out yaffs from cvs yesterday.
>
> I cut a mtd partition that is 32MB.
>
> /