|
发表于 2003-4-10 09:58:32
|
显示全部楼层
[quote:48777d2510="cheungming"]
there are two modes of write operations
1) write back - write data and then back. data may still in cache, not on disk. so when system crash, power off, or reboot, data will lost. especially when u metadata are lost, u file system will be corrupted and u lose all data.
2) write through - write data, wait data to be written to disk, then back. by this way, u can make sure that u data are in disk, and u will not lose data when system crashes. but this is very slow.
(in these two modes, back means report upper appplication, "u write operation is end").
so now people use log file system, like ext3, xfs, or reiserfs. it uses write cache, and log. log is a way to record data and its write speed is much faster than write data to file directly. by the log, the data can be restored after system crash.[/quote]
有两种写入执行的方式:
1) 写入缓存 - 写入数据然后返回,数据仍然储存在缓存里而非磁盘上。当系统在崩溃,停电,或者重起的情况下,你的文件系统将会丢失,特别是在位数据丢失的情况下,你的文件系统将会被损坏而你将丢失所有的数据。
2) 直接写入 - 写入数据,当数据存储到磁盘后返回。这种情况,你可以确定你的数据已经被写入磁盘,你的数据在系统崩溃的时候不会丢失。但这种方式将会降低运行速度。(在这两种方式中,返回表示向上级应用程序报告,“你的写入执行已经结束了。”)
所以现在人们用日志系统,例如ext3, xfs, 或者reiserfs. 日志系统使用写入缓存和日志。日志是一种记录数据的方式,而且的速度远远比直接将数据写入磁盘的要快。通过日志文件,数据在系统崩溃后可以被重新恢复。 |
|