19 Advanced Operating Systems The LINUX file system
20 Linux VFS
21 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
22 Super Block
23 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
24 Super Block Operations
25 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
26 The Inode
27 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
28 Inode functions Inode functions are –Iget() –Iput() –Namei() –Grow_inodes
29 Inode Operations
30 Inode Operations Provides the following –Creation –Lookup –Link/unlink –Special file operations –ie directory ops –Rename –Sym link following –Permissions
31 The File
32 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
33 File operations
34 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
35 Ext2 Layout Boot block Block group 0Block group n Super block Group descriptors Data block bitmap Inode Bitmap Inode table Data blocks 1 block N blocks1 block N blocks