f2fs: “Fsync acceleration with roll-forward recovery” 具体步骤求详细~
F2FS performs roll-forward recovery as follows. If we denote the log position of the last stable checkpoint as N, (1) F2FS collects the direct node blocks having the special flag located in N+n, while constructing a list of their node information. n refers to the number of blocks updated since the last checkpoint. (2) By using the node information in the list, it loads the most recently written node blocks, named N-n, into the page cache. (3) Then, it compares the data indices in between N-n and N+n. (4) If it detects different data indices, then it refreshes the cached node blocks with the new indices stored in N+n, and finally marks them as dirty. Once completing the roll-forward recovery, F2FS performs checkpointing to store the whole in-memory changes to the disk
I don't quite understand what does this paragraph mean :)
个人理解是由于fsync操作经常要频繁写小文件,而flash是以block为单位写入,会有不想关的数据被重复写入,性能较差。因此F2FS提出只写入与更新有关的data block和direct node block,不写metadata,他在direct block里面设立了一个特殊flag用来标识这个操作。 在做recovery到时候,在checkpoint后面找到这个标识,比较一下checkpoint之前和之后的区别,就知道要新写入哪些文件,不用把不想关的数据重复写入,把这些新数据放到cache中标记为dirty 他们就会被刷到memory最后写入disk. F2FS github文章已经更新这块的解答,可以参考一下。
What does this mean?