问题2数据丢失?
此问题已经有网友写了,这里就不在重复,先感谢了。直接转载过来。。。。。
When write operation to the FAT file system is interrupted due to any accidental failure, such as sudden blackout, incorrect disk removal and unrecoverable disk error, the FAT structure can be collapted. Following images shows the critical section on the FatFs module. 当对FAT文件系统的写操作由于默写意外而中断,如突然断电,不正确的磁盘移除或不可恢复的磁盘错误,FAT结构可以被毁坏。下面的图片显示了FatFs的临界段。
1.jpg
(49.81 KB, 下载次数: 81)
An interruption in the red section can cause a cross link; as a result, the file/directory being changed may be lost. There is one or more possibility listed below when an interruption in the yellow section is occured.
红色区域的中断会导致一个交叉链接,结果,正在修改的文件/目录可能会丢失。而黄色区域中断可能导致的效果在下面列出:
File data being rewrited is collapted. 正在重写的文件数据被毁坏 A file being appended returns initial state. 正在添加内容的文件回到初始状态 A file created as new is gone. 丢失新建的文件 A file created as new or in overwritten remains with length of zero. 一个新建或覆盖的文件保持长度为0 - Efficiency of disk use gets worse due to lost chain. 因为丢失关联,磁盘的使用效率变坏。
Each case does not affect the files that not in write mode open. To minimize risk of data loss, the critical section can be minimized like shown in Figure 5 by minimizing the time that file is opened in write mode or using f_sync function properly. 在文件不是用写模式打开时,这些情况不会发生。为了最小化磁盘数据的丢失,临界段可以像图表5显示的那样最小化,通过最小化文件处于写模式打开的时间或者适当的使用f_sync函数。
[ 本帖最后由 zhaojun_xf 于 2012-10-17 16:32 编辑 ] |