分类: LINUX
2010-01-21 23:32:43
Many of the VFS methods described in have a corresponding Ext2 implementation. Because it would take a whole book to describe all of them, we limit ourselves to briefly reviewing the methods implemented in Ext2. Once the disk and the memory data structures are clearly understood, the reader should be able to follow the code of the Ext2 functions that implement them.
我觉得理解了disk上的data&info布局后,了解disk&memory之间的映射关系,再加上buffer/page-cache/vfs的一些处理,再看code就变得相当的容易了...这样比较便于最短的时间理解一个文件系统的设计理念...
突然有个更野的目标...打算看完ext3后,再看ext4/btrfs... 现在在看ext3_load_journal这部分.初始化的时候,如何处理disk上的journal区,是根据已知的(parse mount options)还是b-dev,有不同的routine.ext3_get_journal/dev_journal()... fill_super时,可能根据不同的option,决定是load journal or create a new one,,for "create" example, ext3 do the alloc/initialize work,then journal core need do future work. ex:ext3_create_journal-->get_journal-->jounal_create() note: journal本身也是root directory里的一个inode,在create的过程中,除了在内存中建立相应的journal_t的inode映象,也要通过journal core对它进行初始化,清0,在disk相应的block里写入相应journal的raw datas.journal_create()时会读入block到buffer经过处理后,写回.journal_reset完了会update_journal superblock,即先在内存中建立journal_superblock_t的disk数据,处理完成后写回disk. 后面会启动journal thread 主线程.