针对Yaffs2文件系统中块选择策略引起的NandFlash磨损均衡方面的缺陷,引入文件更新和块回收热度计算,将不同热度的文件分离到对应热度的物理块中,来改进空闲块选择策略.同时引入分散度和磨损度判断机制,通过在不同情况下选择最有效的回收块选择策略进行垃圾回收,以提高磨损均衡效果.实验使用QEMU搭建嵌入式Linux仿真环境,从垃圾回收页拷贝次数、块总擦除次数、块最大擦除次数、块擦除次数最大差值、块擦除次数标准差等方面进行性能比较.仿真实验结果表明,改进策略能大大提高Yaffs2垃圾回收效率,并能有效提升磨损均衡效果,延长NandFlash设备的使用寿命.
In view of the defects of the NAND Flash wear leveling caused by the block selection policy in Yaffs2 file system, the heat calculation method of file update and block recycling was introduced. The data with different heat was separated into the corresponding physical blocks, thus the free block selec- tion policy could be improved. And the degree of dispersion and wear leveling was adopted to improve the wear leveling by choosing the most effective garbage collection strategy in different situations. The QEMU and embedded Linux was used as the simulation platform. The performance metrics used was the number of copy operations, the number of erase operations, the maximum erase count for all blocks, the maximum erase count for all blocks, the maximum difference in the erase counts, and the standard deviation of the erase counts. The simulation results show that the improved method can greatly improve the efficiency of garbage collection, and can effectively improve the degree of wear leveling and prolong the service life of NAND Flash equipments.