1.几个重要的数据结构:
<超级块>: 一个已安装的文件系统对应一个超级块
1318struct super_block {
1319 struct list_head s_list; /* Keep this first */
1320 dev_t s_dev; /* search index; _not_ kdev_t */
1321 unsigned char s_dirt;
1322 unsigned char s_blocksize_bits;
1323 unsigned long s_blocksize;
1324 loff_t s_maxbytes; /* Max file size */
1325 struct file_system_type *s_type;
1326 const struct super_operations *s_op;
…… ……
1330 unsigned long s_flags;
1332 struct dentry *s_root;
1335 int s_count;
1342 struct list_head s_inodes; /* all inodes */
1347 struct list_head s_files;
1353 struct block_device *s_bdev;
1357 struct quota_info s_dquot; /* Diskquota specific options */
1362 char s_id[32]; /* Informational name */
…… ……
1388};
字段解释:
s_list: 系统中所有的超级块组成的双向链表
s_dev: 超级块所描述的系统所在的设备号
s_type: 超级块所描述的文件系统的系统类型
s_op: 操作函数指针
s_root: 超级块所描述的系统的根目录目录项
s_count:超级块的引用计数
s_inodes: 该文件系统的所有索引结点组成的链表的链表头
s_files: 该文件系统所有打开文件的文件描述符链表, 3.13版本中没有看见
s_id: 超级块的名称
<索引结点>:磁盘中的一个文件对应一个索引结点
725struct inode {
726 struct hlist_node i_hash;
727 struct list_head i_list; /* backing dev IO list */
729 struct list_head i_dentry;
730 unsigned long i_ino;
731 atomic_t i_count;
732 unsigned int i_nlink;
733 uid_t i_uid;
734 gid_t i_gid;
735 dev_t i_rdev;
736 unsigned int i_blkbits;
737 u64 i_version;
738 loff_t i_size;
…… ……
742 struct timespec i_atime;