============
-
126주차 진도를 복습하였습니다.
-
vfs_caches_init()
- start_kernel 1 ~/kernel/iamroot/linux-stable/init/main.c
- vfs_caches_init 925 ~/kernel/iamroot/linux-stable/init/main.c
- mnt_init 3503 ~/kernel/iamroot/linux-stable/fs/dcache.c
- sysfs_init 3139 ~/kernel/iamroot/linux-stable/fs/namespace.c
- kern_mount 319 ~/kernel/iamroot/linux-stable/fs/sysfs/mount.c
- kern_mount_data 1924 ~/kernel/iamroot/linux-stable/include/linux/fs.h
- vfs_kern_mount 3165 ~/kernel/iamroot/linux-stable/fs/namespace.c
- mount_fs 1111 ~/kernel/iamroot/linux-stable/fs/namespace.c
- sysfs_mount 1631 // sysfs_mount(&sysfs_fs_type, 0x400000, "sysfs", NULL):
- sysfs_fill_super 369 ~/kernel/iamroot/linux-stable/fs/sysfs/mount.c
- sysfs_get_inode 82 ~/kernel/iamroot/linux-stable/fs/sysfs/mount.c
- sysfs_mount 1631 // sysfs_mount(&sysfs_fs_type, 0x400000, "sysfs", NULL):
- mount_fs 1111 ~/kernel/iamroot/linux-stable/fs/namespace.c
- vfs_kern_mount 3165 ~/kernel/iamroot/linux-stable/fs/namespace.c
- kern_mount_data 1924 ~/kernel/iamroot/linux-stable/include/linux/fs.h
- kern_mount 319 ~/kernel/iamroot/linux-stable/fs/sysfs/mount.c
- sysfs_init 3139 ~/kernel/iamroot/linux-stable/fs/namespace.c
- mnt_init 3503 ~/kernel/iamroot/linux-stable/fs/dcache.c
- vfs_caches_init 925 ~/kernel/iamroot/linux-stable/init/main.c
asmlinkage void __init start_kernel(void)
{
char * command_line;
extern const struct kernel_param __start___param[], __stop___param[];
// ATAG,DTB 정보로 사용
...
buffer_init();
// buffer_head 를 사용하기 위한 kmem_cache 할당자 및 max_buffer_heads 값 초기화 수행
key_init(); // null funtion
security_init(); // null funtion
dbg_late_init(); // null funtion
// totalram_pages: 총 free된 page 수
vfs_caches_init(totalram_pages);
- call: start_kernel() -> vfs_caches_init()
// ARM10C 20151003
// totalram_pages: 총 free된 page 수
void __init vfs_caches_init(unsigned long mempages)
{
unsigned long reserve;
/* Base hash sizes on available memory, with a reserve equal to
150% of current kernel size */
// NOTE:
// mempages 값과 nr_free_pages() 의 값을 정확히 알 수 없음
// 계산된 reserve의 값을 XXX 로 함
// mempages: 총 free된 page 수, nr_free_pages(): 현재의 free pages 수
reserve = min((mempages - nr_free_pages()) * 3/2, mempages - 1);
// reserve: XXX
// mempages: 총 free된 page 수, reserve: XXX
mempages -= reserve;
// mempages: 총 free된 page 수 - XXX
// PATH_MAX: 4096
// SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL
// kmem_cache_create("names_cache", 4096, 0, 0x42000, NULL): kmem_cache#6
names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
// names_cachep: kmem_cache#6
dcache_init();
// dcache_init에서 한일:
//
// struct dentry를 위한 kmem_cache 생성
// dentry_cache: kmem_cache#5
inode_init();
// inode_init에서 한일:
//
// struct inode를 위한 kmem_cache 생성
// inode_cachep: kmem_cache#4
// mempages: 총 free된 page 수 - XXX
files_init(mempages);
mnt_init();
// ARM10C 20151114
static struct file_system_type sysfs_fs_type = {
.name = "sysfs",
.mount = sysfs_mount,
.kill_sb = sysfs_kill_sb,
.fs_flags = FS_USERNS_MOUNT,
};
- start_kernel()->vfs_caches_init()
- vfs_caches_init()
- mnt_init() : mnt_cahce를 할당받는다.
// ARM10C 20151024
void __init mnt_init(void)
{
unsigned u;
int err;
// sizeof(struct mount): 152 bytes, SLAB_HWCACHE_ALIGN: 0x00002000UL, SLAB_PANIC: 0x00040000UL
// kmem_cache_create("mnt_cache", 152, 0, 0x42000, NULL): kmem_cache#2
mnt_cache = kmem_cache_create("mnt_cache", sizeof(struct mount),
0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
// mnt_cache: kmem_cache#2
// sizeof(struct hlist_head): 4 bytes, mhash_entries: 0
// alloc_large_system_hash("Mount-cache", 4, 0, 19, 0, &m_hash_shift, &m_hash_mask, 0, 0): 16kB만큼 할당받은 메모리 주소
mount_hashtable = alloc_large_system_hash("Mount-cache",
sizeof(struct hlist_head),
mhash_entries, 19,
0,
&m_hash_shift, &m_hash_mask, 0, 0);
// mount_hashtable: 16kB만큼 할당받은 메모리 주소
// sizeof(struct hlist_head): 4 bytes, mphash_entries: 0
// alloc_large_system_hash("Mountpoint-cache", 4, 0, 19, 0, &m_hash_shift, &m_hash_mask, 0, 0): 16kB만큼 할당받은 메모리 주소
mountpoint_hashtable = alloc_large_system_hash("Mountpoint-cache",
sizeof(struct hlist_head),
mphash_entries, 19,
0,
&mp_hash_shift, &mp_hash_mask, 0, 0);
// mountpoint_hashtable: 16kB만큼 할당받은 메모리 주소
// mount_hashtable: 16kB만큼 할당받은 메모리 주소, mountpoint_hashtable: 16kB만큼 할당받은 메모리 주소
if (!mount_hashtable || !mountpoint_hashtable)
panic("Failed to allocate mount hash table\n");
// m_hash_mask: 0xFFF
for (u = 0; u <= m_hash_mask; u++)
// u: 0
INIT_HLIST_HEAD(&mount_hashtable[u]);
// INIT_HLIST_HEAD 에서 한일:
// ((&mount_hashtable[0])->first = NULL)
// u: 1...4095 까지 loop 수행
// mp_hash_mask: 0xFFF
for (u = 0; u <= mp_hash_mask; u++)
// u: 0
INIT_HLIST_HEAD(&mountpoint_hashtable[u]);
// INIT_HLIST_HEAD 에서 한일:
// ((&mountpoint_hashtable[0])->first = NULL)
// u: 1...4095 까지 loop 수행
err = sysfs_init();
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- mnt_init()
// ARM10C 20151031
int __init sysfs_init(void)
{
// ENOMEM: 12
int err = -ENOMEM;
// err: -12
// sizeof(struct sysfs_dirent): 64 bytes
// kmem_cache_create("sysfs_dir_cache", 64, 0, 0, NULL): kmem_cache#1
sysfs_dir_cachep = kmem_cache_create("sysfs_dir_cache",
sizeof(struct sysfs_dirent),
0, 0, NULL);
// sysfs_dir_cachep: kmem_cache#1
// sysfs_dir_cachep: kmem_cache#1
if (!sysfs_dir_cachep)
goto out;
// sysfs_inode_init(): 0
err = sysfs_inode_init();
// err: 0
// err: 0
if (err)
goto out_err;
// register_filesystem(&sysfs_fs_type): 0
err = register_filesystem(&sysfs_fs_type);
// err: 0
// register_filesystem에서 한일:
// file_systems: &sysfs_fs_type
// err: 0
if (!err) {
sysfs_mnt = kern_mount(&sysfs_fs_type);
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- sysfs_init()
- mnt_init()
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount(): kern_mount_data()
- sysfs_init()
- mnt_init()
// ARM10C 20151031
// &sysfs_fs_type
#define kern_mount(type) kern_mount_data(type, NULL)
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount(): kern_mount_data()
- sysfs_init()
- mnt_init()
// ARM10C 20151031
// &sysfs_fs_type, NULL
struct vfsmount *kern_mount_data(struct file_system_type *type, void *data)
{
struct vfsmount *mnt;
// type: &sysfs_fs_type, MS_KERNMOUNT: 0x400000, type->name: (&sysfs_fs_type)->name: "sysfs", data: NULL
mnt = vfs_kern_mount(type, MS_KERNMOUNT, type->name, data);
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount(): kern_mount_data()
- vfs_kern_mount()
- sysfs_init()
- mnt_init()
// ARM10C 20151031
// type: &sysfs_fs_type, MS_KERNMOUNT: 0x400000, type->name: (&sysfs_fs_type)->name: "sysfs", data: NULL
struct vfsmount *
vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
{
struct mount *mnt;
struct dentry *root;
// type: &sysfs_fs_type
if (!type)
return ERR_PTR(-ENODEV);
// name: "sysfs", alloc_vfsmnt("sysfs"): kmem_cache#2-oX (struct mount)
mnt = alloc_vfsmnt(name);
// mnt: kmem_cache#2-oX (struct mount)
// mnt: kmem_cache#2-oX (struct mount)
if (!mnt)
return ERR_PTR(-ENOMEM);
// flags: 0x400000, MS_KERNMOUNT: 0x400000
if (flags & MS_KERNMOUNT)
// mnt->mnt.mnt_flags: (kmem_cache#2-oX (struct mount))->mnt.mnt_flags, MNT_INTERNAL: 0x4000
mnt->mnt.mnt_flags = MNT_INTERNAL;
// mnt->mnt.mnt_flags: (kmem_cache#2-oX (struct mount))->mnt.mnt_flags: 0x4000
// type: &sysfs_fs_type, flags: 0x400000, name: "sysfs", data: NULL
root = mount_fs(type, flags, name, data);
struct mount의 메모리를 할당 받음 kmem_cache#2-oX (struct mount)
idr_layer_cache를 사용하여 struct idr_layer 의 메모리 kmem_cache#21-o0...7를 8 개를 할당 받음 (kmem_cache#21-o0...7)->ary[0]: NULL (&(&mnt_id_ida)->idr)->id_free: kmem_cache#21-o7 (&(&mnt_id_ida)->idr)->id_free_cnt: 7
struct ida_bitmap 의 메모리 kmem_cache#27-oX 할당 받음 (&mnt_id_ida)->free_bitmap: kmem_cache#27-oX
(&(&mnt_id_ida)->idr)->id_free: NULL (&(&mnt_id_ida)->idr)->id_free_cnt: 6 (&(&mnt_id_ida)->idr)->top: kmem_cache#21-o7 (struct idr_layer) (&(&mnt_id_ida)->idr)->layers: 1 (&mnt_id_ida)->free_bitmap: NULL
(kmem_cache#21-o7 (struct idr_layer))->ary[0]: NULL (kmem_cache#21-o7 (struct idr_layer))->layer: 0 (kmem_cache#21-o7 (struct idr_layer))->ary[0]: kmem_cache#27-oX (struct ida_bitmap) (kmem_cache#21-o7 (struct idr_layer))->count: 1
(kmem_cache#27-oX (struct ida_bitmap))->bitmap 의 0 bit를 1로 set 수행
(kmem_cache#2-oX (struct mount))->mnt_id: 0
mnt_id_start: 1
(kmem_cache#2-oX (struct mount))->mnt_devname: kmem_cache#30-oX: "sysfs" (kmem_cache#2-oX (struct mount))->mnt_pcp: kmem_cache#26-o0 에서 할당된 8 bytes 메모리 주소 [pcp0] (kmem_cache#2-oX (struct mount))->mnt_pcp->mnt_count: 1
((kmem_cache#2-oX (struct mount))->mnt_hash)->next: NULL ((kmem_cache#2-oX (struct mount))->mnt_hash)->pprev: NULL ((kmem_cache#2-oX (struct mount))->mnt_child)->next: (kmem_cache#2-oX (struct mount))->mnt_child ((kmem_cache#2-oX (struct mount))->mnt_child)->prev: (kmem_cache#2-oX (struct mount))->mnt_child ((kmem_cache#2-oX (struct mount))->mnt_mounts)->next: (kmem_cache#2-oX (struct mount))->mnt_mounts ((kmem_cache#2-oX (struct mount))->mnt_mounts)->prev: (kmem_cache#2-oX (struct mount))->mnt_mounts ((kmem_cache#2-oX (struct mount))->mnt_list)->next: (kmem_cache#2-oX (struct mount))->mnt_list ((kmem_cache#2-oX (struct mount))->mnt_list)->prev: (kmem_cache#2-oX (struct mount))->mnt_list ((kmem_cache#2-oX (struct mount))->mnt_expire)->next: (kmem_cache#2-oX (struct mount))->mnt_expire ((kmem_cache#2-oX (struct mount))->mnt_expire)->prev: (kmem_cache#2-oX (struct mount))->mnt_expire ((kmem_cache#2-oX (struct mount))->mnt_share)->next: (kmem_cache#2-oX (struct mount))->mnt_share ((kmem_cache#2-oX (struct mount))->mnt_share)->prev: (kmem_cache#2-oX (struct mount))->mnt_share ((kmem_cache#2-oX (struct mount))->mnt_slave_list)->next: (kmem_cache#2-oX (struct mount))->mnt_slave_list ((kmem_cache#2-oX (struct mount))->mnt_slave_list)->prev: (kmem_cache#2-oX (struct mount))->mnt_slave_list ((kmem_cache#2-oX (struct mount))->mnt_slave)->next: (kmem_cache#2-oX (struct mount))->mnt_slave ((kmem_cache#2-oX (struct mount))->mnt_slave)->prev: (kmem_cache#2-oX (struct mount))->mnt_slave ((kmem_cache#2-oX (struct mount))->mnt_fsnotify_marks)->first: NULL
- start_kernel()
- vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount(): kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- vfs_kern_mount()
- sysfs_init()
- mnt_init()
// ARM10C 20151114
// type: &sysfs_fs_type, flags: 0x400000, name: "sysfs", data: NULL
struct dentry *
mount_fs(struct file_system_type *type, int flags, const char *name, void *data)
{
struct dentry *root;
struct super_block *sb;
char *secdata = NULL;
// secdata: NULL
// ENOMEM: 12
int error = -ENOMEM;
// error: -12
// data: NULL, type->fs_flags: (&sysfs_fs_type)->fs_flags: 8, FS_BINARY_MOUNTDATA: 2
if (data && !(type->fs_flags & FS_BINARY_MOUNTDATA)) {
secdata = alloc_secdata();
if (!secdata)
goto out;
error = security_sb_copy_data(data, secdata);
if (error)
goto out_free_secdata;
}
// type->mount: (&sysfs_fs_type)->mount: sysfs_mount
// type: &sysfs_fs_type, flags: 0x400000, name: "sysfs", data: NULL
// sysfs_mount(&sysfs_fs_type, 0x400000, "sysfs", NULL):
root = type->mount(type, flags, name, data);
struct super_block 만큼의 메모리를 할당 받음 kmem_cache#25-oX (struct super_block)
//
// (&(&(&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->lock)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(&(&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->lock)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(&(&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->lock)->wait_lock)->rlock)->owner: 0xffffffff
// (&(&(&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->lock)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->list
// (&(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->list
// (&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->count: 0
// (&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->counters: kmem_cache#26-o0 에서 할당된 4 bytes 메모리 주소
// list head 인 &percpu_counters에 &(&(kmem_cache#25-oX (struct super_block))->s_writers.counter[0...2])->list를 연결함
//
// &(&(kmem_cache#25-oX (struct super_block))->s_writers.wait)->lock을 사용한 spinlock 초기화
// &(&(kmem_cache#25-oX (struct super_block))->s_writers.wait)->task_list를 사용한 list 초기화
// &(&(kmem_cache#25-oX (struct super_block))->s_writers.wait_unfrozen)->lock을 사용한 spinlock 초기화
// &(&(kmem_cache#25-oX (struct super_block))->s_writers.wait_unfrozen)->task_list를 사용한 list 초기화
//
// (&(kmem_cache#25-oX (struct super_block))->s_instances)->next: NULL
// (&(kmem_cache#25-oX (struct super_block))->s_instances)->pprev: NULL
// (&(kmem_cache#25-oX (struct super_block))->s_anon)->first: NULL
//
// (&(kmem_cache#25-oX (struct super_block))->s_inodes)->next: &(kmem_cache#25-oX (struct super_block))->s_inodes
// (&(kmem_cache#25-oX (struct super_block))->s_inodes)->prev: &(kmem_cache#25-oX (struct super_block))->s_inodes
//
// (&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node: kmem_cache#30-oX
// (&(&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->active_nodes)->bits[0]: 0
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].lock)->raw_lock: { { 0 } }
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].lock)->magic: 0xdead4ead
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].lock)->owner: 0xffffffff
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].lock)->owner_cpu: 0xffffffff
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].list)->next: (&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].list
// ((&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].list)->prev: (&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].list
// (&(kmem_cache#25-oX (struct super_block))->s_dentry_lru)->node[0].nr_items: 0
// (&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node: kmem_cache#30-oX
// (&(&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->active_nodes)->bits[0]: 0
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].lock)->raw_lock: { { 0 } }
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].lock)->magic: 0xdead4ead
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].lock)->owner: 0xffffffff
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].lock)->owner_cpu: 0xffffffff
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].list)->next: (&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].list
// ((&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].list)->prev: (&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].list
// (&(kmem_cache#25-oX (struct super_block))->s_inode_lru)->node[0].nr_items: 0
//
// (&(kmem_cache#25-oX (struct super_block))->s_mounts)->next: &(kmem_cache#25-oX (struct super_block))->s_mounts
// (&(kmem_cache#25-oX (struct super_block))->s_mounts)->prev: &(kmem_cache#25-oX (struct super_block))->s_mounts
//
// (&(kmem_cache#25-oX (struct super_block))->s_umount)->activity: 0
// &(&(kmem_cache#25-oX (struct super_block))->s_umount)->wait_lock을 사용한 spinlock 초기화
// (&(&(kmem_cache#25-oX (struct super_block))->s_umount)->wait_list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_umount)->wait_list
// (&(&(kmem_cache#25-oX (struct super_block))->s_umount)->wait_list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_umount)->wait_list
//
// (&(kmem_cache#25-oX (struct super_block))->s_umount)->activity: -1
//
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->count: 1
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_lock)->rlock)->owner: 0xffffffff
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_list
// (&(&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->wait_list
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->onwer: NULL
// (&(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex)->magic: &(kmem_cache#25-oX (struct super_block))->s_vfs_rename_mutex
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->count: 1
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_lock)->rlock)->owner: 0xffffffff
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_list
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->wait_list
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->onwer: NULL
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex)->magic: &(kmem_cache#25-oX (struct super_block))->s_dquot.dqio_mutex
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->count: 1
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_lock)->rlock)->owner: 0xffffffff
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_list
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->wait_list
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->onwer: NULL
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex)->magic: &(kmem_cache#25-oX (struct super_block))->s_dquot.dqonoff_mutex
// (&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->activity: 0
// &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->wait_lock을 사용한 spinlock 초기화
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->wait_list)->next: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->wait_list
// (&(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->wait_list)->prev: &(&(kmem_cache#25-oX (struct super_block))->s_dquot.dqptr_sem)->wait_list
//
// (kmem_cache#25-oX (struct super_block))->s_flags: 0x400000
// (kmem_cache#25-oX (struct super_block))->s_bdi: &default_backing_dev_info
// (kmem_cache#25-oX (struct super_block))->s_count: 1
// ((kmem_cache#25-oX (struct super_block))->s_active)->counter: 1
// (kmem_cache#25-oX (struct super_block))->s_maxbytes: 0x7fffffff
// (kmem_cache#25-oX (struct super_block))->s_op: &default_op
// (kmem_cache#25-oX (struct super_block))->s_time_gran: 1000000000
// (kmem_cache#25-oX (struct super_block))->cleancache_poolid: -1
// (kmem_cache#25-oX (struct super_block))->s_shrink.seeks: 2
// (kmem_cache#25-oX (struct super_block))->s_shrink.scan_objects: super_cache_scan
// (kmem_cache#25-oX (struct super_block))->s_shrink.count_objects: super_cache_count
// (kmem_cache#25-oX (struct super_block))->s_shrink.batch: 1024
// (kmem_cache#25-oX (struct super_block))->s_shrink.flags: 1
//
// idr_layer_cache를 사용하여 struct idr_layer 의 메모리 kmem_cache#21-o0...7를 8 개를 할당 받음
// (kmem_cache#21-o0...7)->ary[0]: NULL
// (&(&unnamed_dev_ida)->idr)->id_free: kmem_cache#21-o7
// (&(&unnamed_dev_ida)->idr)->id_free_cnt: 7
//
// struct ida_bitmap 의 메모리 kmem_cache#27-oX 할당 받음
// (&unnamed_dev_ida)->free_bitmap: kmem_cache#27-oX
//
// (&(&unnamed_dev_ida)->idr)->id_free: NULL
// (&(&unnamed_dev_ida)->idr)->id_free_cnt: 6
// (&(&unnamed_dev_ida)->idr)->top: kmem_cache#21-o7 (struct idr_layer)
// (&(&unnamed_dev_ida)->idr)->layers: 1
// (&unnamed_dev_ida)->free_bitmap: NULL
//
// (kmem_cache#21-o7 (struct idr_layer))->ary[0]: NULL
// (kmem_cache#21-o7 (struct idr_layer))->layer: 0
// (kmem_cache#21-o7 (struct idr_layer))->ary[0]: kmem_cache#27-oX (struct ida_bitmap)
// (kmem_cache#21-o7 (struct idr_layer))->count: 1
//
// (kmem_cache#27-oX (struct ida_bitmap))->bitmap 의 0 bit를 1로 set 수행
//
// unnamed_dev_start: 1
//
// (kmem_cache#25-oX (struct super_block))->s_dev: 0
// (kmem_cache#25-oX (struct super_block))->s_bdi: &noop_backing_dev_info
// (kmem_cache#25-oX (struct super_block))->s_fs_info: kmem_cache#30-oX (struct sysfs_super_info)
//
// (kmem_cache#25-oX (struct super_block))->s_type: &sysfs_fs_type
// (kmem_cache#25-oX (struct super_block))->s_id: "sysfs"
//
// list head인 &super_blocks 에 (kmem_cache#25-oX (struct super_block))->s_list을 tail에 추가
// (&(kmem_cache#25-oX (struct super_block))->s_instances)->next: NULL
// (&(&sysfs_fs_type)->fs_supers)->first: &(kmem_cache#25-oX (struct super_block))->s_instances
// (&(kmem_cache#25-oX (struct super_block))->s_instances)->pprev: &(&(&sysfs_fs_type)->fs_supers)->first
//
// (&(kmem_cache#25-oX (struct super_block))->s_shrink)->flags: 0
// (&(kmem_cache#25-oX (struct super_block))->s_shrink)->nr_deferred: kmem_cache#30-oX
// head list인 &shrinker_list에 &(&(kmem_cache#25-oX (struct super_block))->s_shrink)->list를 tail로 추가함
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- vfs_kern_mount()
- kern_mount_data()
// ARM10C 20151114
// type: &sysfs_fs_type, flags: 0x400000, name: "sysfs", data: NULL
static struct dentry *sysfs_mount(struct file_system_type *fs_type,
int flags, const char *dev_name, void *data)
{
struct sysfs_super_info *info;
enum kobj_ns_type type;
struct super_block *sb;
int error;
// flags: 0x400000, MS_KERNMOUNT: 0x400000
if (!(flags & MS_KERNMOUNT)) {
if (!capable(CAP_SYS_ADMIN) && !fs_fully_visible(fs_type))
return ERR_PTR(-EPERM);
for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++) {
if (!kobj_ns_current_may_mount(type))
return ERR_PTR(-EPERM);
}
}
// sizeof(struct sysfs_super_info): 8 bytes, GFP_KERNEL: 0xD0
// kzalloc(8, GFP_KERNEL: 0xD0): kmem_cache#30-oX
info = kzalloc(sizeof(*info), GFP_KERNEL);
// info: kmem_cache#30-oX (struct sysfs_super_info)
// info: kmem_cache#30-oX (struct sysfs_super_info)
if (!info)
return ERR_PTR(-ENOMEM);
// KOBJ_NS_TYPE_NONE: 0, KOBJ_NS_TYPES: 2
for (type = KOBJ_NS_TYPE_NONE; type < KOBJ_NS_TYPES; type++)
// type: 0, info->ns[0]: (kmem_cache#30-oX (struct sysfs_super_info))->ns[0],
// kobj_ns_grab_current(0): NULL
info->ns[type] = kobj_ns_grab_current(type);
// info->ns[0]: (kmem_cache#30-oX (struct sysfs_super_info))->ns[0]: NULL
// fs_type: &sysfs_fs_type, flags: 0x400000, info: kmem_cache#30-oX (struct sysfs_super_info)
// sget(&sysfs_fs_type, sysfs_test_super, sysfs_set_super, 0x400000, kmem_cache#30-oX (struct sysfs_super_info)): kmem_cache#25-oX (struct super_block)
sb = sget(fs_type, sysfs_test_super, sysfs_set_super, flags, info);
// sb: kmem_cache#25-oX (struct super_block)
// sb: kmem_cache#25-oX (struct super_block)
// IS_ERR(kmem_cache#25-oX (struct super_block)): 0,
// sb->s_fs_info: (kmem_cache#25-oX (struct super_block))->s_fs_info: kmem_cache#30-oX (struct sysfs_super_info),
// info: kmem_cache#30-oX (struct sysfs_super_info)
if (IS_ERR(sb) || sb->s_fs_info != info)
free_sysfs_super_info(info);
// sb: kmem_cache#25-oX (struct super_block)
// IS_ERR(kmem_cache#25-oX (struct super_block)): 0,
if (IS_ERR(sb))
return ERR_CAST(sb);
// sb->s_root: (kmem_cache#25-oX (struct super_block))->s_root: NULL
if (!sb->s_root) {
// sb: kmem_cache#25-oX (struct super_block), data: NULL, flags: 0x400000, MS_SILENT: 0x8000
error = sysfs_fill_super(sb, data, flags & MS_SILENT ? 1 : 0);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- kern_mount_data()
// ARM10C 20151121
// sb: kmem_cache#25-oX (struct super_block), data: NULL, 0
static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *inode;
struct dentry *root;
// sb->s_blocksize: (kmem_cache#25-oX (struct super_block))->s_blocksize, PAGE_CACHE_SIZE: 0x1000
sb->s_blocksize = PAGE_CACHE_SIZE;
// sb->s_blocksize: (kmem_cache#25-oX (struct super_block))->s_blocksize: 0x1000
// sb->s_blocksize_bits: (kmem_cache#25-oX (struct super_block))->s_blocksize_bits, PAGE_CACHE_SHIFT: 12
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
// sb->s_blocksize_bits: (kmem_cache#25-oX (struct super_block))->s_blocksize_bits: 12
// sb->s_magic: (kmem_cache#25-oX (struct super_block))->s_magic, SYSFS_MAGIC: 0x62656572
sb->s_magic = SYSFS_MAGIC;
// sb->s_magic: (kmem_cache#25-oX (struct super_block))->s_magic: 0x62656572
// sb->s_op: (kmem_cache#25-oX (struct super_block))->s_op
sb->s_op = &sysfs_ops;
// sb->s_op: (kmem_cache#25-oX (struct super_block))->s_op: &sysfs_ops
// sb->s_time_gran: (kmem_cache#25-oX (struct super_block))->s_time_gran
sb->s_time_gran = 1;
// sb->s_time_gran: (kmem_cache#25-oX (struct super_block))->s_time_gran: 1
/* get root inode, initialize and unlock it */
mutex_lock(&sysfs_mutex);
// mutex_lock에서 한일:
// &sysfs_mutex을 사용하여 mutex lock을 수행함
// sb: kmem_cache#25-oX (struct super_block),
inode = sysfs_get_inode(sb, &sysfs_root);
// ARM10C 20151121 // sb: kmem_cache#25-oX (struct super_block), &sysfs_root struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd) { struct inode *inode;
// 2015/11/21 종료 // 2015/11/28 시작
// sb: kmem_cache#25-oX (struct super_block), sd->s_ino: (&sysfs_root)->s_ino: 1
// iget_locked(kmem_cache#25-oX (struct super_block), 1): kmem_cache#4-oX
inode = iget_locked(sb, sd->s_ino);
// inode: kmem_cache#4-oX
// iget_locked에서 한일:
// inode용 kmem_cache인 inode_cachep: kmem_cache#4 를 사용하여 inode를 위한 메모리 kmem_cache#4-oX 할당 받음
//
// (kmem_cache#4-oX)->i_sb: kmem_cache#25-oX (struct super_block)
// (kmem_cache#4-oX)->i_blkbits: 12
// (kmem_cache#4-oX)->i_flags: 0
// (kmem_cache#4-oX)->i_count: 1
// (kmem_cache#4-oX)->i_op: &empty_iops
// (kmem_cache#4-oX)->__i_nlink: 1
// (kmem_cache#4-oX)->i_opflags: 0
// (kmem_cache#4-oX)->i_uid: 0
// (kmem_cache#4-oX)->i_gid: 0
// (kmem_cache#4-oX)->i_count: 0
// (kmem_cache#4-oX)->i_size: 0
// (kmem_cache#4-oX)->i_blocks: 0
// (kmem_cache#4-oX)->i_bytes: 0
// (kmem_cache#4-oX)->i_generation: 0
// (kmem_cache#4-oX)->i_pipe: NULL
// (kmem_cache#4-oX)->i_bdev: NULL
// (kmem_cache#4-oX)->i_cdev: NULL
// (kmem_cache#4-oX)->i_rdev: 0
// (kmem_cache#4-oX)->dirtied_when: 0
//
// &(kmem_cache#4-oX)->i_lock을 이용한 spin lock 초기화 수행
//
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->raw_lock: { { 0 } }
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->magic: 0xdead4ead
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->owner: 0xffffffff
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->owner_cpu: 0xffffffff
//
// (&(kmem_cache#4-oX)->i_mutex)->count: 1
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner: 0xffffffff
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->next: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
// (&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->prev: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
// (&(kmem_cache#4-oX)->i_mutex)->onwer: NULL
// (&(kmem_cache#4-oX)->i_mutex)->magic: &(kmem_cache#4-oX)->i_mutex
//
// (kmem_cache#4-oX)->i_dio_count: 0
//
// (&(kmem_cache#4-oX)->i_data)->a_ops: &empty_aops
// (&(kmem_cache#4-oX)->i_data)->host: kmem_cache#4-oX
// (&(kmem_cache#4-oX)->i_data)->flags: 0
// (&(kmem_cache#4-oX)->i_data)->flags: 0x200DA
// (&(kmem_cache#4-oX)->i_data)->private_data: NULL
// (&(kmem_cache#4-oX)->i_data)->backing_dev_info: &default_backing_dev_info
// (&(kmem_cache#4-oX)->i_data)->writeback_index: 0
//
// (kmem_cache#4-oX)->i_private: NULL
// (kmem_cache#4-oX)->i_mapping: &(kmem_cache#4-oX)->i_data
// (&(kmem_cache#4-oX)->i_dentry)->first: NULL
// (kmem_cache#4-oX)->i_acl: (void *)(0xFFFFFFFF),
// (kmem_cache#4-oX)->i_default_acl: (void *)(0xFFFFFFFF)
// (kmem_cache#4-oX)->i_fsnotify_mask: 0
//
// [pcp0] nr_inodes: 1
//
// (kmem_cache#4-oX)->i_ino: 1
// (kmem_cache#4-oX)->i_state: 0x8
//
// (&(kmem_cache#4-oX)->i_hash)->next: NULL
// (256KB의 메모리 공간 + 계산된 hash index 값)->first: &(kmem_cache#4-oX)->i_hash
// (&(kmem_cache#4-oX)->i_hash)->pprev: &(&(kmem_cache#4-oX)->i_hash)
//
// head list인 &(kmem_cache#4-oX)->i_sb->s_inodes에 &(kmem_cache#4-oX)->i_sb_list를 추가함
// inode: kmem_cache#4-oX, inode->i_state: (kmem_cache#4-oX)->i_state: 0x8, I_NEW: 0x8
if (inode && (inode->i_state & I_NEW))
// sd: &sysfs_root, inode: kmem_cache#4-oX
sysfs_init_inode(sd, inode);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- kern_mount_data()
/**
* sysfs_get_inode - get inode for sysfs_dirent
* @sb: super block
* @sd: sysfs_dirent to allocate inode for
*
* Get inode for @sd. If such inode doesn't exist, a new inode
* is allocated and basics are initialized. New inode is
* returned locked.
*
* LOCKING:
* Kernel thread context (may sleep).
*
* RETURNS:
* Pointer to allocated inode on success, NULL on failure.
*/
// ARM10C 20151121
// sb: kmem_cache#25-oX (struct super_block), &sysfs_root
struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd)
{
struct inode *inode;
// 2015/11/21 종료
// 2015/11/28 시작
// sb: kmem_cache#25-oX (struct super_block), sd->s_ino: (&sysfs_root)->s_ino: 1
// iget_locked(kmem_cache#25-oX (struct super_block), 1): kmem_cache#4-oX
inode = iget_locked(sb, sd->s_ino);
// inode: kmem_cache#4-oX
// inode: kmem_cache#4-oX, inode->i_state: (kmem_cache#4-oX)->i_state: 0x8, I_NEW: 0x8
if (inode && (inode->i_state & I_NEW))
// sd: &sysfs_root, inode: kmem_cache#4-oX
sysfs_init_inode(sd, inode);
-
inode용 kmem_cache인 inode_cachep: kmem_cache#4 를 사용하여 inode를 위한 메모리 kmem_cache#4-oX 할당 받음
-
(kmem_cache#4-oX)->i_sb: kmem_cache#25-oX (struct super_block)
-
(kmem_cache#4-oX)->i_blkbits: 12
-
(kmem_cache#4-oX)->i_flags: 0
-
(kmem_cache#4-oX)->i_count: 1
-
(kmem_cache#4-oX)->i_op: &empty_iops
-
(kmem_cache#4-oX)->__i_nlink: 1
-
(kmem_cache#4-oX)->i_opflags: 0
-
(kmem_cache#4-oX)->i_uid: 0
-
(kmem_cache#4-oX)->i_gid: 0
-
(kmem_cache#4-oX)->i_count: 0
-
(kmem_cache#4-oX)->i_size: 0
-
(kmem_cache#4-oX)->i_blocks: 0
-
(kmem_cache#4-oX)->i_bytes: 0
-
(kmem_cache#4-oX)->i_generation: 0
-
(kmem_cache#4-oX)->i_pipe: NULL
-
(kmem_cache#4-oX)->i_bdev: NULL
-
(kmem_cache#4-oX)->i_cdev: NULL
-
(kmem_cache#4-oX)->i_rdev: 0
-
(kmem_cache#4-oX)->dirtied_when: 0
-
&(kmem_cache#4-oX)->i_lock을 이용한 spin lock 초기화 수행
-
((&(kmem_cache#4-oX)->i_lock)->rlock)->raw_lock: { { 0 } }
-
((&(kmem_cache#4-oX)->i_lock)->rlock)->magic: 0xdead4ead
-
((&(kmem_cache#4-oX)->i_lock)->rlock)->owner: 0xffffffff
-
((&(kmem_cache#4-oX)->i_lock)->rlock)->owner_cpu: 0xffffffff
-
(&(kmem_cache#4-oX)->i_mutex)->count: 1
-
(&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
-
(&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
-
(&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner: 0xffffffff
-
(&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
-
(&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->next: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
-
(&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->prev: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
-
(&(kmem_cache#4-oX)->i_mutex)->onwer: NULL
-
(&(kmem_cache#4-oX)->i_mutex)->magic: &(kmem_cache#4-oX)->i_mutex
-
(kmem_cache#4-oX)->i_dio_count: 0
-
(&(kmem_cache#4-oX)->i_data)->a_ops: &empty_aops
-
(&(kmem_cache#4-oX)->i_data)->host: kmem_cache#4-oX
-
(&(kmem_cache#4-oX)->i_data)->flags: 0
-
(&(kmem_cache#4-oX)->i_data)->flags: 0x200DA
-
(&(kmem_cache#4-oX)->i_data)->private_data: NULL
-
(&(kmem_cache#4-oX)->i_data)->backing_dev_info: &default_backing_dev_info
-
(&(kmem_cache#4-oX)->i_data)->writeback_index: 0 // // (kmem_cache#4-oX)->i_private: NULL // (kmem_cache#4-oX)->i_mapping: &(kmem_cache#4-oX)->i_data // (&(kmem_cache#4-oX)->i_dentry)->first: NULL // (kmem_cache#4-oX)->i_acl: (void *)(0xFFFFFFFF), // (kmem_cache#4-oX)->i_default_acl: (void *)(0xFFFFFFFF) // (kmem_cache#4-oX)->i_fsnotify_mask: 0 // // [pcp0] nr_inodes: 1 // // (kmem_cache#4-oX)->i_ino: 1 // (kmem_cache#4-oX)->i_state: 0x8 // // (&(kmem_cache#4-oX)->i_hash)->next: NULL // (256KB의 메모리 공간 + 계산된 hash index 값)->first: &(kmem_cache#4-oX)->i_hash // (&(kmem_cache#4-oX)->i_hash)->pprev: &(&(kmem_cache#4-oX)->i_hash) // // head list인 &(kmem_cache#4-oX)->i_sb->s_inodes에 &(kmem_cache#4-oX)->i_sb_list를 추가함
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- kern_mount_data()
static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
{
struct bin_attribute *bin_attr;
// inode->i_private: (kmem_cache#4-oX)->i_private,
// sd: &sysfs_root, sysfs_get(&sysfs_root): 2
inode->i_private = sysfs_get(sd);
// inode->i_private: (kmem_cache#4-oX)->i_private: 2
// sysfs_get에서 한일:
// (&sysfs_root)->s_count: 2
// inode->i_mapping: (kmem_cache#4-oX)->i_mapping: &(kmem_cache#4-oX)->i_data
// inode->i_mapping->a_ops: (kmem_cache#4-oX)->i_mapping->a_ops: &empty_aops
inode->i_mapping->a_ops = &sysfs_aops;
// inode->i_mapping->a_ops: (kmem_cache#4-oX)->i_mapping->a_ops: &sysfs_aops
// inode->i_mapping->backing_dev_info: (kmem_cache#4-oX)->i_mapping->backing_dev_info: &default_backing_dev_info
inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
// inode->i_mapping->backing_dev_info: (kmem_cache#4-oX)->i_mapping->backing_dev_info: &sysfs_backing_dev_info
// inode->i_op: (kmem_cache#4-oX)->i_op: &empty_iops
inode->i_op = &sysfs_inode_operations;
// inode->i_op: (kmem_cache#4-oX)->i_op: &sysfs_inode_operations
// inode: kmem_cache#4-oX, sd->s_mode: (&sysfs_root)->s_mode
set_default_inode_attr(inode, sd->s_mode);
// set_default_inode_attr에서 한일:
// (kmem_cache#4-oX)->i_mode: 40447
// (kmem_cache#4-oX)->i_atime: 현재시간값,
// (kmem_cache#4-oX)->i_mtime: 현재시간값,
// (kmem_cache#4-oX)->i_ctime: 현재시간값
// sd: &sysfs_root, inode: kmem_cache#4-oX
sysf_refresh_inode(sd, inode);
### super.c::alloc_super()
* start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
```mount.c
// ARM10C 20151121
// sb: kmem_cache#25-oX (struct super_block), data: NULL, 0
static int sysfs_fill_super(struct super_block *sb, void *data, int silent)
{
struct inode *inode;
struct dentry *root;
// sb->s_blocksize: (kmem_cache#25-oX (struct super_block))->s_blocksize, PAGE_CACHE_SIZE: 0x1000
sb->s_blocksize = PAGE_CACHE_SIZE;
// sb->s_blocksize: (kmem_cache#25-oX (struct super_block))->s_blocksize: 0x1000
// sb->s_blocksize_bits: (kmem_cache#25-oX (struct super_block))->s_blocksize_bits, PAGE_CACHE_SHIFT: 12
sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
// sb->s_blocksize_bits: (kmem_cache#25-oX (struct super_block))->s_blocksize_bits: 12
// sb->s_magic: (kmem_cache#25-oX (struct super_block))->s_magic, SYSFS_MAGIC: 0x62656572
sb->s_magic = SYSFS_MAGIC;
// sb->s_magic: (kmem_cache#25-oX (struct super_block))->s_magic: 0x62656572
// sb->s_op: (kmem_cache#25-oX (struct super_block))->s_op
sb->s_op = &sysfs_ops;
// sb->s_op: (kmem_cache#25-oX (struct super_block))->s_op: &sysfs_ops
// sb->s_time_gran: (kmem_cache#25-oX (struct super_block))->s_time_gran
sb->s_time_gran = 1;
// sb->s_time_gran: (kmem_cache#25-oX (struct super_block))->s_time_gran: 1
/* get root inode, initialize and unlock it */
mutex_lock(&sysfs_mutex);
// mutex_lock에서 한일:
// &sysfs_mutex을 사용하여 mutex lock을 수행함
// sb: kmem_cache#25-oX (struct super_block),
inode = sysfs_get_inode(sb, &sysfs_root);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- kern_mount_data()
// ARM10C 20151121
// sb: kmem_cache#25-oX (struct super_block), &sysfs_root
struct inode *sysfs_get_inode(struct super_block *sb, struct sysfs_dirent *sd)
{
struct inode *inode;
// 2015/11/21 종료
// 2015/11/28 시작
// sb: kmem_cache#25-oX (struct super_block), sd->s_ino: (&sysfs_root)->s_ino: 1
// iget_locked(kmem_cache#25-oX (struct super_block), 1): kmem_cache#4-oX
inode = iget_locked(sb, sd->s_ino);
// inode: kmem_cache#4-oX
// iget_locked에서 한일:
// inode용 kmem_cache인 inode_cachep: kmem_cache#4 를 사용하여 inode를 위한 메모리 kmem_cache#4-oX 할당 받음
//
// (kmem_cache#4-oX)->i_sb: kmem_cache#25-oX (struct super_block)
// (kmem_cache#4-oX)->i_blkbits: 12
// (kmem_cache#4-oX)->i_flags: 0
// (kmem_cache#4-oX)->i_count: 1
// (kmem_cache#4-oX)->i_op: &empty_iops
// (kmem_cache#4-oX)->__i_nlink: 1
// (kmem_cache#4-oX)->i_opflags: 0
// (kmem_cache#4-oX)->i_uid: 0
// (kmem_cache#4-oX)->i_gid: 0
// (kmem_cache#4-oX)->i_count: 0
// (kmem_cache#4-oX)->i_size: 0
// (kmem_cache#4-oX)->i_blocks: 0
// (kmem_cache#4-oX)->i_bytes: 0
// (kmem_cache#4-oX)->i_generation: 0
// (kmem_cache#4-oX)->i_pipe: NULL
// (kmem_cache#4-oX)->i_bdev: NULL
// (kmem_cache#4-oX)->i_cdev: NULL
// (kmem_cache#4-oX)->i_rdev: 0
// (kmem_cache#4-oX)->dirtied_when: 0
//
// &(kmem_cache#4-oX)->i_lock을 이용한 spin lock 초기화 수행
//
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->raw_lock: { { 0 } }
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->magic: 0xdead4ead
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->owner: 0xffffffff
// ((&(kmem_cache#4-oX)->i_lock)->rlock)->owner_cpu: 0xffffffff
//
// (&(kmem_cache#4-oX)->i_mutex)->count: 1
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->raw_lock: { { 0 } }
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->magic: 0xdead4ead
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner: 0xffffffff
// (&(&(&(kmem_cache#4-oX)->i_mutex)->wait_lock)->rlock)->owner_cpu: 0xffffffff
// (&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->next: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
// (&(&(kmem_cache#4-oX)->i_mutex)->wait_list)->prev: &(&(kmem_cache#4-oX)->i_mutex)->wait_list
// (&(kmem_cache#4-oX)->i_mutex)->onwer: NULL
// (&(kmem_cache#4-oX)->i_mutex)->magic: &(kmem_cache#4-oX)->i_mutex
//
// (kmem_cache#4-oX)->i_dio_count: 0
//
// (&(kmem_cache#4-oX)->i_data)->a_ops: &empty_aops
// (&(kmem_cache#4-oX)->i_data)->host: kmem_cache#4-oX
// (&(kmem_cache#4-oX)->i_data)->flags: 0
// (&(kmem_cache#4-oX)->i_data)->flags: 0x200DA
// (&(kmem_cache#4-oX)->i_data)->private_data: NULL
// (&(kmem_cache#4-oX)->i_data)->backing_dev_info: &default_backing_dev_info
// (&(kmem_cache#4-oX)->i_data)->writeback_index: 0
//
// (kmem_cache#4-oX)->i_private: NULL
// (kmem_cache#4-oX)->i_mapping: &(kmem_cache#4-oX)->i_data
// (&(kmem_cache#4-oX)->i_dentry)->first: NULL
// (kmem_cache#4-oX)->i_acl: (void *)(0xFFFFFFFF),
// (kmem_cache#4-oX)->i_default_acl: (void *)(0xFFFFFFFF)
// (kmem_cache#4-oX)->i_fsnotify_mask: 0
//
// [pcp0] nr_inodes: 1
//
// (kmem_cache#4-oX)->i_ino: 1
// (kmem_cache#4-oX)->i_state: 0x8
//
// (&(kmem_cache#4-oX)->i_hash)->next: NULL
// (256KB의 메모리 공간 + 계산된 hash index 값)->first: &(kmem_cache#4-oX)->i_hash
// (&(kmem_cache#4-oX)->i_hash)->pprev: &(&(kmem_cache#4-oX)->i_hash)
//
// head list인 &(kmem_cache#4-oX)->i_sb->s_inodes에 &(kmem_cache#4-oX)->i_sb_list를 추가함
// inode: kmem_cache#4-oX, inode->i_state: (kmem_cache#4-oX)->i_state: 0x8, I_NEW: 0x8
if (inode && (inode->i_state & I_NEW))
// sd: &sysfs_root, inode: kmem_cache#4-oX
sysfs_init_inode(sd, inode);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- kern_mount_data()
// ARM10C 20151205
// sd: &sysfs_root, inode: kmem_cache#4-oX
static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
{
struct bin_attribute *bin_attr;
// inode->i_private: (kmem_cache#4-oX)->i_private,
// sd: &sysfs_root, sysfs_get(&sysfs_root): 2
inode->i_private = sysfs_get(sd);
// inode->i_private: (kmem_cache#4-oX)->i_private: 2
// sysfs_get에서 한일:
// (&sysfs_root)->s_count: 2
// inode->i_mapping: (kmem_cache#4-oX)->i_mapping: &(kmem_cache#4-oX)->i_data
// inode->i_mapping->a_ops: (kmem_cache#4-oX)->i_mapping->a_ops: &empty_aops
inode->i_mapping->a_ops = &sysfs_aops;
// inode->i_mapping->a_ops: (kmem_cache#4-oX)->i_mapping->a_ops: &sysfs_aops
// inode->i_mapping->backing_dev_info: (kmem_cache#4-oX)->i_mapping->backing_dev_info: &default_backing_dev_info
inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
// inode->i_mapping->backing_dev_info: (kmem_cache#4-oX)->i_mapping->backing_dev_info: &sysfs_backing_dev_info
// inode->i_op: (kmem_cache#4-oX)->i_op: &empty_iops
inode->i_op = &sysfs_inode_operations;
// inode->i_op: (kmem_cache#4-oX)->i_op: &sysfs_inode_operations
// inode: kmem_cache#4-oX, sd->s_mode: (&sysfs_root)->s_mode
set_default_inode_attr(inode, sd->s_mode);
// set_default_inode_attr에서 한일:
// (kmem_cache#4-oX)->i_mode: 40447
// (kmem_cache#4-oX)->i_atime: 현재시간값,
// (kmem_cache#4-oX)->i_mtime: 현재시간값,
// (kmem_cache#4-oX)->i_ctime: 현재시간값
// sd: &sysfs_root, inode: kmem_cache#4-oX
sysfs_refresh_inode(sd, inode);
/* initialize inode according to type */
switch (sysfs_type(sd)) {
case SYSFS_DIR:
inode->i_op = &sysfs_dir_inode_operations;
inode->i_fop = &sysfs_dir_operations;
break;
case SYSFS_KOBJ_ATTR:
inode->i_size = PAGE_SIZE;
inode->i_fop = &sysfs_file_operations;
break;
case SYSFS_KOBJ_BIN_ATTR:
bin_attr = sd->s_attr.bin_attr;
inode->i_size = bin_attr->size;
inode->i_fop = &sysfs_bin_operations;
break;
case SYSFS_KOBJ_LINK:
inode->i_op = &sysfs_symlink_inode_operations;
break;
default:
BUG();
}
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- kern_mount_data()
// ARM10C 20151205
// sd: &sysfs_root, inode: kmem_cache#4-oX
static void sysfs_refresh_inode(struct sysfs_dirent *sd, struct inode *inode)
{
// sd->s_iattr: (&sysfs_root)->s_iattr
struct sysfs_inode_attrs *iattrs = sd->s_iattr;
// iattrs: (&sysfs_root)->s_iattr
// inode->i_mode: (kmem_cache#4-oX)->i_mode: 40447,
// sd->s_mode: (&sysfs_root)->s_mode: 40447
inode->i_mode = sd->s_mode;
// inode->i_mode: (kmem_cache#4-oX)->i_mode: 40447
// iattrs: (&sysfs_root)->s_iattr: NULL
if (iattrs) {
/* sysfs_dirent has non-default attributes
* get them from persistent copy in sysfs_dirent
*/
set_inode_attr(inode, &iattrs->ia_iattr);
security_inode_notifysecctx(inode,
iattrs->ia_secdata,
iattrs->ia_secdata_len);
}
// 2015/12/05 종료
// sd: &sysfs_root, sysfs_type(&sysfs_root): 0x1, SYSFS_DIR: 0x0001
if (sysfs_type(sd) == SYSFS_DIR)
set_nlink(inode, sd->s_dir.subdirs + 2);
}
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- kern_mount_data()
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- kern_mount_data()
void unlock_new_inode(struct inode *inode)
{
lockdep_annotate_inode_mutex_key(inode);
spin_lock(&inode->i_lock);
WARN_ON(!(inode->i_state & I_NEW));
inode->i_state &= ~I_NEW;
smp_mb();
wake_up_bit(&inode->i_state, __I_NEW);
spin_unlock(&inode->i_lock);
}
EXPORT_SYMBOL(unlock_new_inode);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- lockdep_annotate_inode_mutex_key()
- spin_lock()
- WARN_ON()
- smp_mb()
- wake_up_bit()
- spin_unlock()
- mutex_unlock()
- d_make_root()
- sysfs_init_inode()
- kern_mount_data()
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- lockdep_annotate_inode_mutex_key()
- spin_lock()
- WARN_ON()
- smp_mb()
- wake_up_bit()
- spin_unlock()
- mutex_unlock()
- d_make_root()
- sysfs_init_inode()
- kern_mount_data()
struct dentry *d_make_root(struct inode *root_inode)
{
struct dentry *res = NULL;
if (root_inode) {
static const struct qstr name = QSTR_INIT("/", 1);
res = __d_alloc(root_inode->i_sb, &name);
if (res)
d_instantiate(res, root_inode);
else
iput(root_inode);
}
return res;
}
EXPORT_SYMBOL(d_make_root);
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- lockdep_annotate_inode_mutex_key()
- spin_lock()
- WARN_ON()
- smp_mb()
- wake_up_bit()
- spin_unlock()
- mutex_unlock()
- d_make_root()
- __d_alloc()
- sysfs_init_inode()
- kern_mount_data()
- start_kernel()->vfs_caches_init()
- mnt_init()
- sysfs_init()
- kmem_cache_create()
- sysfs_inode_init()
- register_filesystem()
- kern_mount()
- kern_mount_data()
- vfs_kern_mount()
- alloc_vfsmnt()
- mount_fs()
- mount(): sysfs_mount()
- sget()
- spin_lock()
- hlist_for_eash_entry()
- spin_unlock()
- alloc_super()
- set()
- strlcpy()
- list_add_tail()
- hlist_add_head()
- spin_unlock(&sb_lock)
- get_filesystem(type)
- register_shrinker()
- sget()
- mount(): sysfs_mount()
- vfs_kern_mount()
- free_sysfs_super_info()
- IS_ERR()
- sysfs_fill_super()
- sysfs_init_inode()
- sysfs_get()
- set_default_inode_attr()
- sysfs_refresh_inode()
- sys_nlink()
- unlock_new_inode()
- lockdep_annotate_inode_mutex_key()
- spin_lock()
- WARN_ON()
- smp_mb()
- wake_up_bit()
- spin_unlock()
- mutex_unlock()
- d_make_root()
- __d_alloc()
- sysfs_init_inode()
- kern_mount_data()
``dcache.c struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) { struct dentry *dentry; char *dname;
dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
if (!dentry)
return NULL;
/*
* We guarantee that the inline name is always NUL-terminated.
* This way the memcpy() done by the name switching in rename
* will still always have a NUL at the end, even if we might
* be overwriting an internal NUL character
*/
dentry->d_iname[DNAME_INLINE_LEN-1] = 0;
if (name->len > DNAME_INLINE_LEN-1) {
dname = kmalloc(name->len + 1, GFP_KERNEL);
if (!dname) {
kmem_cache_free(dentry_cache, dentry);
return NULL;
}
} else {
dname = dentry->d_iname;
}
dentry->d_name.len = name->len;
dentry->d_name.hash = name->hash;
memcpy(dname, name->name, name->len);
dname[name->len] = 0;
```dcache.h
// ARM10C 20151003
// DNAME_INLINE_LEN: 36
# define DNAME_INLINE_LEN 36 /* 128 bytes */
pdating 5188f0f..99cb0c4
Fast-forward
Reference/Breakdown/001_linux-kernel_20130428.md | 43 ++++++++++-
Reference/Breakdown/002_linux-kernel_20130504.md | 18 +++++
arch/arm/include/asm/barrier.h | 1 +
arch/arm/include/asm/memory.h | 2 +
fs/dcache.c | 40 +++++++++-
fs/inode.c | 34 ++++++++-
fs/sysfs/dir.c | 2 +
fs/sysfs/inode.c | 48 +++++++++++-
fs/sysfs/mount.c | 95 ++++++++++++++++++++++++
fs/sysfs/sysfs.h | 9 +++
include/asm-generic/bitsperlong.h | 1 +
include/asm-generic/bug.h | 1 +
include/linux/dcache.h | 6 ++
include/linux/fs.h | 7 +-
include/linux/gfp.h | 1 +
include/linux/hash.h | 12 +++
include/linux/list.h | 2 +
include/linux/mm.h | 2 +
include/linux/mmzone.h | 1 +
include/linux/spinlock.h | 4 +
include/linux/wait.h | 12 +++
kernel/locking/mutex.c | 2 +
kernel/sched/wait.c | 35 +++++++++
mm/page_alloc.c | 2 +-
mm/slub.c | 2 +
25 files changed, 371 insertions(+), 11 deletions(-)
create mode 100644 Reference/Breakdown/002_linux-kernel_20130504.mdUpdating 5188f0f..99cb0c4
Fast-forward
Reference/Breakdown/001_linux-kernel_20130428.md | 43 ++++++++++-
Reference/Breakdown/002_linux-kernel_20130504.md | 18 +++++
arch/arm/include/asm/barrier.h | 1 +
arch/arm/include/asm/memory.h | 2 +
fs/dcache.c | 40 +++++++++-
fs/inode.c | 34 ++++++++-
fs/sysfs/dir.c | 2 +
fs/sysfs/inode.c | 48 +++++++++++-
fs/sysfs/mount.c | 95 ++++++++++++++++++++++++
fs/sysfs/sysfs.h | 9 +++
include/asm-generic/bitsperlong.h | 1 +
include/asm-generic/bug.h | 1 +
include/linux/dcache.h | 6 ++
include/linux/fs.h | 7 +-
include/linux/gfp.h | 1 +
include/linux/hash.h | 12 +++
include/linux/list.h | 2 +
include/linux/mm.h | 2 +
include/linux/mmzone.h | 1 +
include/linux/spinlock.h | 4 +
include/linux/wait.h | 12 +++
kernel/locking/mutex.c | 2 +
kernel/sched/wait.c | 35 +++++++++
mm/page_alloc.c | 2 +-
mm/slub.c | 2 +
25 files changed, 371 insertions(+), 11 deletions(-)
create mode 100644 Reference/Breakdown/002_linux-kernel_20130504.md