linux的mount
Posted 相印
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux的mount相关的知识,希望对你有一定的参考价值。
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[32];/* 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,性能
以上是关于linux的mount的主要内容,如果未能解决你的问题,请参考以下文章