my program infomation:
I write 1MB files use below:
#define KB 1024
filesize = 1;
static char wbuf[KB];
for (i = 0; i < (filesize * KB); i++) {
if ( write (fd, wbuf, KB) < 0) {
printf ("Error: cannot write %s\n", test_file);
return -1;
}
}
Yaffs will pop "!! Allocator out !!!! problem"
Another test: I write 1MB using 2KB, It is OK.
filesize = 1;
static char wbuf[2048];
for (i = 0; i < (filesize * 512); i++) {
if ( write (fd, wbuf, 2048) < 0) {
printf ("Error: cannot write %s\n", test_file);
return -1;
}
}
/ # cat /proc/yaffs
Device 0 "nand_nda"
startBlock......... 0
endBlock........... 255
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 247
Best Regards.
Ken
2009/8/20 Ken Yu <
gagayo@gmail.com>
> 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.
> >
> > /
>