/* *超级块对象有super_block结构体表示,定义在文件linux/fs.h中 * */ struct super_block { struct list_head s_list; /* 指向超级块链表的指针 */ dev_t s_dev; /* 设备标识符 */ unsigned long s_blocksize; /* 以字节为单位的块大小 */ unsigned long s_old_blocksize; /* 以位为单位的旧的块大小 */ unsigned char s_blocksize_bits; /* 以位为单位的块大小 */ unsigned char s_dirt; /* 修改脏标志 */ unsigned long long s_maxbytes; /* 文件大小上限 */ struct file_system_type s_type; /* 文件系统类型 */ struct super_operations s_op; /* 超级块方法 */ struct dquot_operations *dq_op; /* 磁盘限额方法 */ struct quotactl_ops *s_qcop; /* 限额控制方法 */ struct export_operations *s_export_op; /* 到处方法 */ unsigned long s_flags; /* 挂载标志 */ unsigned long s_magic; /* 文件系统魔数 */ struct dentry *s_root; /* 目录挂载点 */ struct rw_semaphore s_umount; /* 卸载信号量 */ struct semaphore s_lock; /* 超级块信号量 */ int s_count; /* 引用计数 */ int s_syncing; /* 文件系统同步标志 */ int s_need_sync_fs; /* 尚未同步标志 */ atomic_t s_active; /* 活动引用计数 */ void *s_security; /* 安全模块 */ struct list_head s_dirty; /* 脏节点链表 */ struct list_head s_io; /* 回写链表 */ struct hlist_head s_anon; /* 匿名目录项 */ struct list_head s_files; /* 被分配文件链表 */ struct block_device *s_bdev; /* 相关块设备 */ struct list_head s_instances; /* 该类型文件系统 */ struct quota_info s_dquot; /* 限额相关选项 */ char s_id[32]; /* 文本名字 */ void *s_fs_info; /* 文件系统特殊信号 */ struct semaphore s_vfs_rename_sem; /* 重命名信号量 */ }; /* *超级块对象中的s_op指向超级块的操作函数表。超级块操作函数表有struct super_operations定义,在linux/fs.h文件中定义 */ struct super_operations { struct inode *(*alloc_inode) (struct super_block *sb); /*在给定的超级块下创建并初始化一个新的索引节点对象*/ void (*destroy_inode) (struct inode *); /*释放跟定的索引节点*/ void (*read_inode) (struct inode *); /*以inode->i_ino为索引,从磁盘上读取索引节点,并填充内存中对应的索引节点结构的剩余部分*/ void (*dirty_inode) (struct inode *); /*VFS在索引节点脏时(被修改)会调用此函数,日志文件系统(ect3等)执行该函数进行日志更新*/ void (*write_inode) (struct inode *, int); /*将给定的索引节点写入磁盘,wait参数知名写操作是否需要同步*/ void (*put_inode) (struct inode *); /*释放给定索引节点*/ void (*drop_inode) (struct inode *); /*在最后一个索引节点被释放后,VFS调用此函数*/ void (*delete_inode) (struct inode *); /*从磁盘上删除给点的索引节点*/ void (*put_super) (struct super_block *); /*在卸载文件系统时由VFS调用,用来释放超级块*/ void (*write_super) (struct super_block *); /*使文件系统的数据元与磁盘上的文件系统同步*/ int (*sync_fs) (struct super_block *, int); /*是文件系统数据源与磁盘上的文件系统同步*/ void (*write_super_lockfs) (struct super_block *); /*此函数首先禁止对文件系统作改变,再使用给定的超级块更新磁盘上的超级块。LVM会调用此函数*/ void (*unlockfs) (struct super_block *); /*对文件系统解除锁定*/ int (*statfs) (struct super_block *, struct statfs *); /*VFS通过调用该函数获取文件系统状态,文件系统信息放置在statfs中*/ int (*remount_fs) (struct super_block *, int *, char *); /*当制定新的安装选项重新安装文件系统时,vfs会调用该函数*/ void (*clear_inode) (struct inode *); /*释放索引节点*/ void (*umount_begin) (struct super_block *); /*调用该函数释放索引节点,并清空包含相关数据的所有页面*/ int (*show_options) (struct seq_file *, struct vfsmount *); }; |
|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )
GMT+8, 2024-9-29 21:25 , Processed in 0.284231 second(s), 12 queries , Gzip On, MemCache On.
Powered by Discuz! X3.5
© 2001-2023 Discuz! Team.