vfs_caches_init函数初始化VFS,下面梳理函数调用流程

start_kernel()
-->vfs_caches_init_early();
-->dcache_init_early();
-->static struct hlist_head *dentry_hashtabl = alloc_large_system_hash("Dentry cache",
sizeof(struct hlist_head),
dhash_entries,
,
HASH_EARLY,
&d_hash_shift,
&d_hash_mask,
);
-->inode_init_early();
-->static struct hlist_head *inode_hashtable = alloc_large_system_hash("Inode-cache",
sizeof(struct hlist_head),
ihash_entries,
,
HASH_EARLY,
&i_hash_shift,
&i_hash_mask,
);
-->vfs_caches_init(num_physpages);
/*1.kmem_cache用于名字*/
-->struct kmem_cache *names_cachep = kmem_cache_create("names_cache", PATH_MAX, ,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
-->dcache_init();
/*2.kmem_cache用于缓存dentry目录项*/
-->struct kmem_cache *dentry_cache = KMEM_CACHE(dentry,
SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|SLAB_MEM_SPREAD);
-->inode_init();
/*3.kmem_cache用于缓存inode*/
-->struct kmem_cache *inode_cachep = kmem_cache_create("inode_cache",
sizeof(struct inode),
,
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
SLAB_MEM_SPREAD),
init_once);
-->files_init(mempages);
/*4.kmem_cache用于缓存file结构体*/
-->struct kmem_cache *filp_cachep = kmem_cache_create("filp", sizeof(struct file), ,
SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
-->mnt_init();
/*5.kmem_cache用于缓存vfsmount结构体*/
-->struct kmem_cache *mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct vfsmount),
, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
-->static struct list_head *mount_hashtable =(struct list_head *)__get_free_page(GFP_ATOMIC);
/*注册&挂载sysfs虚拟文件系统*/
-->sysfs_init()
/*6.kmem_cache用于缓存sysfs_dirent结构体*/
-->struct kmem_cache *sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
/*对应的应该就是"/fs/"跟目录*/ sizeof(struct sysfs_dirent),, , NULL);
-->fs_kobj = kobject_create_and_add("fs", NULL);
/*注册rootfs虚拟文件系统*/
-->init_rootfs();
/*挂载rootfs虚拟文件系统*/
-->init_mount_tree();
-->bdev_cache_init();
/*7.kmem_cache用于缓存bdev_inode结构体*/
-->struct kmem_cache *bdev_cachep = kmem_cache_create("bdev_cache", sizeof(struct bdev_inode),
, (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD|SLAB_PANIC),init_once);
/*注册的这是啥文件系统啊?*/
-->register_filesystem(&bd_type);
/*挂载*/
-->struct vfsmount *bd_mnt = kern_mount(&bd_type);
-->struct super_block *blockdev_superblock = bd_mnt->mnt_sb; /* For writeback */
/*字符设备相关的初始化*/
-->chrdev_init();

vfs_caches_init函数解析的更多相关文章

  1. [转]javascript eval函数解析json数据时为什加上圆括号eval("("+data+")")

    javascript eval函数解析json数据时为什么 加上圆括号?为什么要 eval这里要添加 “("("+data+")");//”呢?   原因在于: ...

  2. PHP json_decode 函数解析 json 结果为 NULL 的解决方法

    在做网站 CMS 模块时,对于模块内容 content 字段,保存的是 json 格式的字符串,所以在后台进行模块内容的编辑操作 ( 取出保存的数据 ) 时,需要用到 json_decode() 函数 ...

  3. Matlab中bsxfun和unique函数解析

    一.问题来源 来自于一份LSH代码,记录下来. 二.函数解析 2.1 bsxfun bsxfun是一个matlab自版本R2007a来就提供的一个函数,作用是”applies an element-b ...

  4. socket使用TCP协议时,send、recv函数解析以及TCP连接关闭的问题

    Tcp协议本身是可靠的,并不等于应用程序用tcp发送数据就一定是可靠的.不管是否阻塞,send发送的大小,并不代表对端recv到多少的数据. 在阻塞模式下, send函数的过程是将应用程序请求发送的数 ...

  5. sigaction函数解析

    http://blog.chinaunix.net/uid-1877180-id-3011232.html sigaction函数解析  sigaction函数的功能是检查或修改与指定信号相关联的处理 ...

  6. driver_register()函数解析

    driver_register()函数解析 /** * driver_register - register driver with bus * @drv: driver to register *  ...

  7. async函数解析

    转载请注明出处:async函数解析 async函数是基于Generator函数实现的,也就是说是Generator函数的语法糖.在之前的文章有介绍过Generator函数语法和异步应用,如果对其不了解 ...

  8. tf.train.shuffle_batch函数解析

    tf.train.shuffle_batch (tensor_list, batch_size, capacity, min_after_dequeue, num_threads=1, seed=No ...

  9. oracle中next_day()、last_day()函数解析

    oracle中next_day()函数解析 Sql代码 当前系统时间的下一星期一的时间select   next_day(sysdate,1) from dual NEXT_DAY(date,char ...

随机推荐

  1. __contains__, __len__,__reversed__

    __contains__():当使用in,not in 对象的时候 调用(not in 是在in完成后再取反,实际上还是in操作) class A(object): def __init__(self ...

  2. GYM 101673E(暴搜预处理)

    1.不会超过500个不同的串-- 2.样例没给has到has是怎么样的,实测是true. 3.记忆化别剪错枝就好,嘤嘤嘤-- const int maxn = 505 + 5; int n, m, t ...

  3. hdu3487Play with Chain(splay)

    链接 简单的两种操作,一种删除某段区间,加在第I个点的后面,另一个是翻转区间.都是splay的简单操作. 悲剧一:pushdown时候忘记让lz=0 悲剧二:删除区间,加在某点之后的时候忘记修改其父亲 ...

  4. # bug 查找 (一) 快速记录 IE8 下三个问题

    bug 查找 (一) 快速记录 IE8 下三个问题 昨天 pc 端网站上灰度,发现多个在 IE8 下的问题,描述和解决方案如下: 第一个问题是 css 文件过大 现象 把项目所有的 css 打包成单个 ...

  5. this/super/static/final/匿名对象/继承/抽象类/访问权限修饰符

    1.this关键字的作用     1)调用本类中的属性;     2)调用本类中的构造方法;且只能放首行,且必须留一个构造方法作为出口,即不能递归调用     3)表示当前对象; 2.匿名对象     ...

  6. C++数据文件存储与加载(利用opencv)

    首先请先确认已经安装好了opencv3及以上版本. #include <opencv2/opencv.hpp>#include <iostream>#include <s ...

  7. URL URI URN的区别

    下面这张图可以完美的解释他们三者之间的关系 URI包含URL和URN Uniform Resource Identifier :统一资源标志符,用于标识某一互联网资源 Uniform Resoutce ...

  8. 使用js将后台返回的数据转换成树形结构

    将类似如下数据转换成树形的数据: [ { id: 1, name: '1', }, { id: 2, name: '1-1', parentId: 1 }, { id: 3, name: '1-1-1 ...

  9. WPF使用附加属性绑定,解决data grid列绑定不上的问题

    背景 需要对datagrid的列header添加自定义属性,然后绑定,并根据不同的列header绑定不同的值,传统的加扩展类太麻烦,而附加属性的特点更适用于这种场景. 1.xaml 代码 <Da ...

  10. No-11.变量进阶

    变量进阶 目标 变量的引用 可变和不可变类型 局部变量和全局变量 01. 变量的引用 变量 和 数据 都是保存在 内存 中的 在 Python 中 函数 的 参数传递 以及 返回值 都是靠 引用 传递 ...