Would like to share some knowledge about VFS on Linux 2.6.37.1.
Before start, let's get to know some terms in LINUX file system world. They are:
1. Super Block: we can think it as Partition;
2. Inode: like a directory structure;
3. Dentry: a file or folder.
And then, i'd like to introduce some key data structures in VFS. They are:
1. file_system_type
Certain fields are listed:
• name: the actual file system name, like "rootfs", "ext3", etc;
• next: points to the next file_system_type node in the list;
• fs_supers: links to the list of super blocks of this file system;
2. super_block
Certain fields are listed:
• s_type: points to its file_system_type;
• s_instances: links to fs_supers list of file_system_type;
• s_root: links to the list of dentrys, which will be introduced soon;
3. dentry
Certain fields are listed:
• d_name: a qstr structure which includes hash code and name string of the dentry. e.g. "/home";
• d_sb: points to the super block of this dentry;
• d_parent: points to the parents of this dentry;
• d_inodes: points to the inode, which will be introduced soon;
• d_mounted: to indicate if there's any block device be mounted to this dentry; this is a very important field which will be introduced more later on;
• d_hash: links to the hash list for quick searching a child under it's parent folder;
4. inode
Certain fields are listed:
• i_sb: points to the super block;
(To be continue)