Skip to content

Latest commit

 

History

History
31 lines (17 loc) · 1.57 KB

File metadata and controls

31 lines (17 loc) · 1.57 KB

Init of the File System

Part 1: On the Kernel Boot CPU

The boot CPU inits in main.c:

  • init buffer cache
  • init virtual file system
  • init file table
  • pick the / device (ROOT_DEVICE_NUMBER) - to be mounted in part 2

Part 2: In a Kernel Process

The actual file system gets initialized from the first spawned process in forkret() (calling mount_root(ROOT_DEVICE_NUMBER, "vimixfs");). This is triggered via init_userspace and mounts the root file system.

While belonging to the first process (init), this still runs in S-mode.

The reason the init is placed here is that mounting the file system requires reads from disk (at least the file system super block to check some meta data). Reads will try to set the current processes sleeping until the data is ready. This would not work until a process is set up.

Part 3: In init

Lastly init will mount /dev and /sys as well as optionally additional file systems like /home.


Overview: kernel | file_system

File System: init_filesystem | vfs | vimixfs | devfs | sysfs | block_io | dentry_cache | inode | file | directory