vfs的数据结构

每个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
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值