每个VFS对象都存放在一个恰当的数据结构中,其中包括对象的属性和指向对象方法表的指针。内核可以动态地修改对象的方法,因此可以为对象建立专用的行为。
超级块对象
struct super_block {
struct list_head s_list; /* 所有的super_block都通过s_list链接在一起 */
dev_t s_dev; /*用设备编号标识文件系统所在的块设备 */
unsigned char s_blocksize_bits; //用字节数取2的对数标识文件系统的块尺寸
unsigned long s_blocksize; //用字节数标识文件系统的块尺寸
loff_t s_maxbytes; /* Max file size */
struct file_system_type *s_type; //文件系统类型
const struct super_operations *s_op; /* 超级块方法 */
const struct dquot_operations *dq_op; /* 磁盘限额处理方法 */
const struct quotactl_ops *s_qcop; /* 磁盘限额管理方法 */
const struct export_operations *s_export_op; /* 网络文件系统使用的输出操作 */
unsigned long s_flags; /* 安装标志 */
unsigned long s_magic; /* 文件系统的魔数 */
struct dentry *s_root; /* 文件系统根目录的目录项对象 */
struct rw_semaphore s_umount; /* 卸载所用的信号量 */
int s_count; /* 超级快引用计数器 */
atomic_t s_active; /* 超级快次级引用计数器 */
#ifdef CONFIG_SECURITY
void *s_security;/* 指向超级块安全数据结构的指针 */
#endif
const struct xattr_handler **s_xattr; /* 指向超级块扩展属性结构的指针 */
struct list_head s_inodes; /* 该文件系统实例内的所有inode,都通过它们的i_sb_list成员挂接到s_inodes起始的双向链表中 */
struct hlist_bl_head s_anon; /* /* 用于处理远程网络文件系统的匿名目录项的链表 */*/
struct list_head s_mounts; /* list of mounts; _not_ for fs use */
struct block_device *s_bdev; /*指向块设备在内存中的block_device结构*/
struct backing_dev_info *s_bdi;
struct mtd_info *s_mtd;
struct hlist_node s_instances; /* 用于给定文件系统类型的超级块对象链表的指针 */
struct quota_info s_dquot; /* 磁盘限额的描述符 */
struct sb_writers s_writers;
char s_id[32]; /* 包含超级块的块设备名称 */
u8 s_uuid[16]; /* UUID */
void *s_fs_info; /* 指向特定文件系统的超级块信息的指针 */
unsigned int s_max_links;
fmode_t s_mode;
/* Granularity of c/m/atime in ns.
Cannot be worse than a second */
u32 s_time_gran;
/*
* The next field is for VFS *only*. No filesystems have any business
* even looking at it. You had been warned.
*/
struct mutex s_vfs_rename_mutex; /* 当VFS通过目录重命名文件时使用的信号量 */
/*
* Filesystem subtype. If non-empty the filesystem type field
* in /proc/mounts will be "type.subtype"
*/
char *s_subtype;
/*
* Saved mount options for lazy filesystems using
* generic_show_options()
*/
char __rcu *s_options;
const struct dentry_operations *s_d_op; /* default d_op for dentries */
/*
* Saved pool identifier for cleancache (-1 means none)
*/
int cleancache_poolid;
struct shrinker s_shrink; /* per-sb shrinker handle */
/* Number of inodes with nlink == 0 but still