170 likes | 264 Vues
Learn about Linux VFS, mounting file systems, super block operations, inode functions, file operations, and Ext2 layout in OS development.
E N D
Advanced Operating Systems The LINUX file system
Mounting File Systems • register_filesystems call • Creates file_system_type struct • Linked into growable table • Once registered must be mounted • Each mount fs has super_block structure • Root is mounted at init • Some don’t have devices - pipefs
Super Block • Describes entire file system • Block size, access rights, change time • Union U at the end is for fs specifics • Generic_sdp is used for later mounted systems • s_lock & s_wait are used as semaphores for super block synchronisation
Super Block Operations • Hides actual implementation • Actually function may not exist ie MSDOS • Provides • Write function • Put for unmounting • Stat for information • Remount – change status • Read_inode fills inode structure
The Inode • Holds information on the file • The rest is • Memory management info • File system dependant • Doubly linked list of inodes • Contains all inodes – ie unused • ‘dirty’ inodes kept on hashed table
Inode functions • Inode functions are • Iget() • Iput() • Namei() • Grow_inodes
Inode Operations • Provides the following • Creation • Lookup • Link/unlink • Special file operations –ie directory ops • Rename • Sym link following • Permissions
The File • The file structure allows duplication of inode information for multitasking purposes • Ie more than one process will wish to read a file • The pos variable can differ for each process • Has to deal with writes to file – done at inode level through locks
File Operations • These change the file structure not only –or sometimes not at all, the inode structure • Deals with • Reading, writing, seeking • Device specifics • Media changes
Super block Group descriptors Data block bitmap Inode Bitmap Inode table Data blocks Ext2 Layout Boot block Block group 0 Block group n 1 block N blocks 1 block 1 block 1 block N blocks