Test environment:
CPU: STM32F407, 168MHZ
NAND: Page size: 4096
Page num per block: 128
Operation: File is sequentially wroten to nand, with file size around 4M bytes.
Speed: less than 200k bytes/s
Cause: A block recover occurs every time data cross block boundary, slow down the write speed. In sequential writing, block recover is not necessary.
文件是顺序写的,每当跨block时,都会将block复制一份,导致写得很慢。其实在这种情况没必须执行recover。
code cause problem:
URET _BufFlush(struct uffs_DeviceSt *dev, UBOOL force_block_recover, int slot)
{
.....
n = uffs_GetFreePagesCount(dev, bc);
if (n >= dev->buf.dirtyGroup[slot].count && !force_block_recover) {
//The free pages are enough for the dirty pages
ret = uffs_BufFlush_Exist_With_Enough_FreePage(dev, slot, node, bc);
}
else {
ret = uffs_BufFlush_Exist_With_BlockRecover(dev, slot, node, bc, U_FALSE);
}
.....
}