vfs的super block
super block这个数据结构,乃至super block在磁盘上的位置,是哪里的规定?
没规定,1k偏移只是ext文件系统.但是像fat,它们第0扇区后就是保留扇区,但linux一样要识别它们.
知道这个现象就能搞清楚了:双系统的ntf分区,在linux下一样是可以识别并正常操作的,但那些文件系统可能连superblock的概念都没有.
vfs层不干预"文件系统格式",所以super block自然也不能干涉.
再说内存里的super block,它跟inode, dentry, file并列vfs的四大数据结构.(看到网上有谁这么一说)
super block总是觉得不知道它是干嘛的,抽象出来这么一个东西.
其实大概3个作用:
1,文件系统总览,这个文件系统的大致信息.像block size等等.
2,作为一个文件系统的root数据结构,像dentry里是直接存着到sb的指针的.它上面还有一些字段,估计vfs层做统一处理时,用得着.要维护某些状态.
3,文件系统提供的一大批函数操作是由这个结构里的指针指向的,叫做super_operation.
结构:
struct super_block
{
struct list_head s_list;/* Keep this first */// 连接super_block的链表
dev_t s_dev;/* search index; _not_ kdev_t */
unsignedlong s_blocksize;
unsignedlong s_old_blocksize;
unsignedchar s_blocksize_bits;
unsignedchar s_dirt;
unsignedlonglong s_maxbytes;/* Max file size */
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;//
unsignedlong s_flags;//
unsignedlong s_magic;//
struct dentry *s_root;// Linux文件系统中某个索引节点(inode)的链接
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 xattr_handler **s_xattr;//
struct list_head s_inodes;/* all inodes */// 链接文件系统的inode
struct list_head s_dirty;/* dirty inodes */
struct list_head s_io;/* parked for writeback */
struct hlist_head s_anon;/* anonymous dentries for (nfs) exporting */
struct list_head s_files;// 对于每一个打开的文件,由file对象来表示。链接文件系统中file
struct block_device *s_bdev;//
struct list_head s_instances;//
struct quota_info s_dquot;/* Diskquota specific options */
int s_frozen;//
wait_queue_head_t s_wait_unfrozen;//
char s_id[];/* Informational name */
void*s_fs_info;/* Filesystem private info */
/**
* The next field is for VFS *only*. No filesystems have any business
* even looking at it. You had been warned.
*/
struct semaphore s_vfs_rename_sem;/* Kludge */
/* Granuality of c/m/atime in ns.
Cannot be worse than a second */
u32 s_time_gran;
};

ext2,3的blocksize可以是1,2,4,8kb.
ext4的blocksize可以是1~64kb.
blocksize的大小会影响:
1,最大文件体积.
2,文件系统最大体积.(Maxiumn File System Size,应该是容量)
3,性能
VFS,super_block,inode,dentry—结构体图解 (这篇写的不错)
vfs的super block的更多相关文章
- block(data block,directory block)、inode、块位图、inode位图和super block概念详解【转】
本文转载自:https://blog.csdn.net/jhndiuowehu/article/details/50788287 一.基本概念: 1.block:文件系统中存储数据的最小单元 ...
- VFS
VFS的作用:为文件系统提供通用的接口. 通用文件模型:common file model.特殊文件系统需要将它的物理结构转换成通用文件模型. common file model包括以下几个重要对象: ...
- VFS对象总结
关键术语: 超级快(super block)对象: 一个超级块对应一个具体的文件系统(已经安装的文件系统类型如 ext2,此处是实际的文件系统,不是 VFS). iNode 对象: inode是内核文 ...
- Ext2文件系统布局,文件数据块寻址,VFS虚拟文件系统
注:本分类下文章大多整理自<深入分析linux内核源代码>一书,另有参考其他一些资料如<linux内核完全剖析>.<linux c 编程一站式学习>等,只是为了更好 ...
- VFS四大对象之一 struct super_block
linux虚拟文件系统四大对象: 1)超级块(super block) 2)索引节点(inode) 3)目录项(dentry) 4)文件对象(file) 现在先介绍第一个 一.super_block的 ...
- 解析Linux中的VFS文件系统之文件系统的注册(二)
继上一篇文章:http://www.cnblogs.com/linhaostudy/p/7397024.html 3. 文件系统的注册 这里的文件系统是指可能会被挂载到目录树中的各个实际文件系统,所谓 ...
- 解析Linux中的VFS文件系统机制
转载:原文地址https://www.ibm.com/developerworks/cn/linux/l-vfs/ 1. 摘要 本文阐述 Linux 中的文件系统部分,源代码来自基于 IA32 的 2 ...
- VFS文件系统结构分析
VFS是Linux非常核心的一个概念,linux下的大部分操作都要用到VFS的相关功能.这里从使用者的角度,对VFS进行了简单说明.使用者不但需要知道Linux下有哪些文件操作的函数,还需要对VFS的 ...
- VFS,super_block,inode,dentry—结构体图解
总结: VFS只存在于内存中,它在系统启动时被创建,系统关闭时注销. VFS的作用就是屏蔽各类文件系统的差异,给用户.应用程序.甚至Linux其他管理模块提供统一的接口集合. 管理VFS数据结构的组成 ...
随机推荐
- python测试redis是否可以使用
前提打开redis服务,windows打开方式到redis的安装目录命令行输入redis-server from redis import StrictRedis redis = StrictRedi ...
- java 中异常类
算术异常类:ArithmeticExecption 空指针异常类:NullPointerException 类型强制转换异常:ClassCastException 数组负下标异常:NegativeAr ...
- MySQL体系结构概览
MySQL体系结构 InnoDB体系结构 MySQL实例有一组后台线程.一些内存块和若干服务线程组成 在默认情况下,MySQL有7组后台线程,分别为1个主线程,4组IO线程,1个锁线程,1个错误监控线 ...
- SqlServer 高级查询
高级查询在数据库中用得是最频繁的,也是应用最广泛的. Ø 基本常用查询 --select select * from student; --all 查询所有 select all sex from ...
- 编程语言-Java-问题整理
jar文件运行报错 - Exception in thread "main" java.lang.UnsupportedClassVersionError 低版本运行高版本文件 ...
- Self-Attention 和 Transformer
1.Self-Attention 之前的RNN输入是难以并行化的,我们下一个输入可能依赖前一个输出,只有知道了前面的输出才能计算后面的输出. 于是提出了 self-attention ,但是这时候 $ ...
- C#=> 栈模仿堆的操作
//原理,利用两个栈,互相作用,来模仿堆的效果,先进先出.. using System; using System.Collections.Generic; using System.Linq; us ...
- Struts2之下载
下载页面 <%@ page language="java" contentType="text/html; charset=UTF-8" pageEnco ...
- BZOJ 1683.City skyline 城市地平线
传送门 从左到右扫一遍,考虑什么时候会和之前形成同一幢房子从而不用统计 显然是当前的高度和之前某个点高度相同,并且它们之间没有更矮的建筑 考虑用一个单调栈维护一个单调上升的房子轮廓,然后对于扫到的每一 ...
- 重置zend studio 默认设置的方法[转]
这个方法类似于手机的“恢复出厂设置”的功能,就是将所有的使用记录全部清除,用于解决zend studio使用过程中遇到的各种莫名其妙的问题,可以说是zend studio各种问题的终极解决方法~能够解 ...