节点文献
无线路由器防掉电文件系统设计与实现
【作者】 寇含军;
【导师】 毛玉明;
【作者基本信息】 电子科技大学 , 通信与信息系统, 2004, 硕士
【摘要】 在嵌入式系统中,由于闪存具有容量大、速度快、功耗低等优点,越来越广泛地用作系统的外部存储设备。闪存是EEPROM的一种,主要分为NOR或非和NAND与非两种。大部分闪存文件存储应用都需要把闪存设备模拟成每扇区512字节的块设备,再在模拟的设备上使用标准的文件系统。这种实现无法避免在向扇区擦除和之后的写入过程中掉电对文件系统造成的损害。JFFS/JFFS2是新出现的专门针对闪存设计的文件系统,直接在闪存之上实现损耗平衡和防掉电。但是JFFS/JFFS2支持的闪存设备类型有限。在我们课题所涉及的无线路由器上,硬件只支持Disk On Chip与Compact Flash两种设备。DOC是一种与非闪存,在Linux中通过NFTL对系统表现为普通的块设备,在其上可使用普通的文件系统。实验表明,在DOC上使用普通的文件系统,系统几乎不具备防掉电性。CF是一种或非闪存,芯片内部使用了FTL的技术,无法直接被JFFS/JFFS2支持,只能在其上使用普通的文件系统或通过一种技术将其模拟成JFFS/JFFS2支持的MTD设备。实验表明,这种模拟技术虽然可以提高系统的防掉电能力,但会对CF的使用寿命造成一定的影响。考虑到大多数嵌入式Linux系统的特点,即系统运行时虽然会向文件系统写入很多文件、但大多数情况下不用对这些数据进行持久保存,本文从实验系统的实际情况出发,设计了一种新的文件系统技术。该技术将Linux系统正常运行时的文件写操作均放在内存中,只有在需要对文件进行持久保存的时候才会在很短的时间内将修改过的文件保存到闪存中。该文件系统中还设计了一些容错技术,即使在向闪存写入的过程中意外掉电,系统在下次启动时也能够检测并自动修复。另外根据Linux根文件系统自身的一些特点,该技术将只读的文件以支持压缩的文件系统格式存放在闪存中,以提高闪存的利用率;而对于可写文件在保存时则采用普通的文件系统格式,由闪存内部的FTL/NFTL来实现损耗平衡。该技术充分利用了Linux内核支持的各种文件系统格式,对其进行优化组合,特别适合于一般嵌入式Linux系统。
【Abstract】 Flash memory is evolving in the embedded systems due to its attractive features such as large capacity, fast access speed and low power consumption. Flash is a form of EEPROM, available mainly in two types, the traditional NOR flash and the newer NAND flash. The majority applications of flash for file storage have involved using the flash to emulate a block device with 512 bytes sectors, on top of which using standard file systems. This approach provides no wear leveling, and is extremely unsafe with the potential power loss between the erase and subsequent rewrite of the data. JFFS/JFFS2 are the newly emerging file systems specifically designed for flash memory, which provide wear leveling directly on the chip and are crash-proof because they are log-structured. However, JFFS/JFFS2 only supports limited number of types of flashes.The mainboard of the Wireless Router in our project only supports the Disk On Chip and the Compact Flash as the on-board external storage device. DOC is a type of NAND flash device and emulated by the NFTL as a normal block device, on top of which you may put the normal file systems. Experiments on the WR show that using the normal file systems on DOC is not crash-proof. CF is a type of NOR flash and it cannot be directly supported by JFFS/JFFS2. It supports the normal file systems by introducing the FTL, or with MTD emulation using block device, it is feasible to put the JFFS/JFFS2 file systems on CF. Experiments show that such emulation improves the crash-proof performance of the system, but it also greatly reduces the life cycle of flash chip.Considering the characteristics of most embedded Linux systems, that though the system writes miscellaneous files at runtime, most of them need not be persistent across reboots, this paper proposed a new file system technology, which moves all the write operations on the files into RAM at runtime and only saves the modified files back to the flash within a short time when the persistent storage is needed. It also has adopted some fault-tolerance mechanisms to detect and recovery from accidental power losses even when the seldom saving process is right in progress. To make the most efficient use of the flash chip, the read-only files are crammed into a compressed file system; as for the rewritable files, it uses the normal file systems with the chip builtin FTL/NFTL to provide wear leveling. The technology presented in the paper makes the best combination of the file system formats that the Linux kernel supports and it is especially suitable for embedded Linux systems.
- 【网络出版投稿人】 电子科技大学 【网络出版年期】2005年 01期
- 【分类号】TP311.52
- 【下载频次】168