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—结构体图解  (这篇写的不错)

linux vfs四大对象之一 superblock

vfs的super block的更多相关文章

  1. block(data block,directory block)、inode、块位图、inode位图和super block概念详解【转】

    本文转载自:https://blog.csdn.net/jhndiuowehu/article/details/50788287 一.基本概念:      1.block:文件系统中存储数据的最小单元 ...

  2. VFS

    VFS的作用:为文件系统提供通用的接口. 通用文件模型:common file model.特殊文件系统需要将它的物理结构转换成通用文件模型. common file model包括以下几个重要对象: ...

  3. VFS对象总结

    关键术语: 超级快(super block)对象: 一个超级块对应一个具体的文件系统(已经安装的文件系统类型如 ext2,此处是实际的文件系统,不是 VFS). iNode 对象: inode是内核文 ...

  4. Ext2文件系统布局,文件数据块寻址,VFS虚拟文件系统

    注:本分类下文章大多整理自<深入分析linux内核源代码>一书,另有参考其他一些资料如<linux内核完全剖析>.<linux c 编程一站式学习>等,只是为了更好 ...

  5. VFS四大对象之一 struct super_block

    linux虚拟文件系统四大对象: 1)超级块(super block) 2)索引节点(inode) 3)目录项(dentry) 4)文件对象(file) 现在先介绍第一个 一.super_block的 ...

  6. 解析Linux中的VFS文件系统之文件系统的注册(二)

    继上一篇文章:http://www.cnblogs.com/linhaostudy/p/7397024.html 3. 文件系统的注册 这里的文件系统是指可能会被挂载到目录树中的各个实际文件系统,所谓 ...

  7. 解析Linux中的VFS文件系统机制

    转载:原文地址https://www.ibm.com/developerworks/cn/linux/l-vfs/ 1. 摘要 本文阐述 Linux 中的文件系统部分,源代码来自基于 IA32 的 2 ...

  8. VFS文件系统结构分析

    VFS是Linux非常核心的一个概念,linux下的大部分操作都要用到VFS的相关功能.这里从使用者的角度,对VFS进行了简单说明.使用者不但需要知道Linux下有哪些文件操作的函数,还需要对VFS的 ...

  9. VFS,super_block,inode,dentry—结构体图解

    总结: VFS只存在于内存中,它在系统启动时被创建,系统关闭时注销. VFS的作用就是屏蔽各类文件系统的差异,给用户.应用程序.甚至Linux其他管理模块提供统一的接口集合. 管理VFS数据结构的组成 ...

随机推荐

  1. HTTP请求时候总是设置的两个参数ConnectionTimeOut和SocketTimeOut

    在HTTP请求时候总是设置两个参数,就是连接超时和Socket超时 public static final String SO_TIMEOUT = "http.socket.timeout& ...

  2. Java 设计模式之 Command 设计模式

    首先我们先来看 UML 图: 参考资料: java设计模式-Command(命令)模式 - - ITeye技术网站http://men4661273.iteye.com/blog/1633775 JA ...

  3. String 与StringBuffer习题

    1: 画出如下几行代码的结构 // 画出如下几行代码的结构 String s1 = "hello"; // value存储在常量池内 String s2 = "hello ...

  4. Socket错误详解及处理方法

    例如错误代码10061, 说明服务器已经找到,但连接被服务器拒绝, 连接失败原因可能是: 端口号设置错误: 2.服务器没有处于监听状态 (即ServerSocket –>Active=true) ...

  5. Wildfly安装以及集成idea(mac)

    文章目录 Linux发布运行 下载 集成idea Linux发布运行 首先说一下在linux环境,只需要将war包上传到wildfly-8.2.0.Final/standalone/deploymen ...

  6. 有趣的linux指令

    1.cmatrix sudo apt-get update sudo apt-get install cmatrix 2.asciiquarium wget http://search.cpan.or ...

  7. lib.tcl

    #********************************************************************# 功能描述:定义公共的函数# 依赖关系:依赖于全局aitoo ...

  8. 跨域(SpringBoot)

    概念: 在 HTML 中,<a>, <form>, <img>, <script>, <iframe>, <link>等标签以及 ...

  9. ApplicationContextAware 快速获取bean

    在Web应用中,Spring容器通常采用声明式方式配置产生:开发者只要在web.xml中配置一个Listener,该Listener将会负责初始化Spring容器,MVC框架可以直接调用Spring容 ...

  10. 解决Ubuntu12.04下rpcbind: cannot open '/var/run/rpcbind/rpcbind.xdr' file for reading

    不知道怎么回事,实验室的电脑在同学搞过之后,每次启动都报错 rpcbind: cannot open '/run/rpcbind/rpcbind.xdr' file for reading, errn ...