Chap 4: Distributed File Systems 2019/2/16
4.1 Review of conventional FS Directory File service Block service 2019/2/16
Moving-Head Disk Mechanism 2019/2/16
Block service interface Obtain new block: b=AllocateBlock( ); Release block: FreeBlock(b); Read/Write block: &buf = GetBlock(b); PutBlock(b, &data); Must manage: Free block list Caching Block service 2019/2/16
File service interface Realizes flat file system fid = CreateFile( ); DeleteFile(fid); &buf = Read(fid, position, #bytes); Write(fid, position, &buf); Need to maintain File Control Block (FCB), e.g., Unix inode, containing index, owner, creation time, last modify time, etc. File Service Block Service 2019/2/16
Directory service Directory service File service Block service 2019/2/16
4.2 Unix (s5fs) example Boot area Sup- block inode blocks Data blocks (a) Disk layout Free inodes cache Free data blocks cache empty empty Link to next pointers block (next slide) (b) Superblock structure 2019/2/16
Linked free blocks list In Super- block a b c Data blocks are used to store addresses of free blocks. Sep 26 2019/2/16
Block buffer cache 2019/2/16
Inode u g s r w x r w x r w x Set uid owner group other Type (4 bits) sticky bit 2019/2/16
Inode and 3-level index Inode 4 KB 1 1K pointers 4 KB 12 13 14 15 1K pointers 2019/2/16
Managing open files in File Service layer Swappable per process Kernel-resident Disk-resident 1 inode 2 3 Parent’s OFT data 1 System OFT (stores position pointers) 2 In-core inode table Child’s OFT OFT: Open File Table (one entry per open) 2019/2/16
Digression 2019/2/16
Digression 2019/2/16
Logical structure of directory hierarchy foo usr bin / vmunix Root directory etc 2019/2/16
Implementing directories . Lnk_cnt=1 Lnk_cnt=2 .. 4 foo 6 6 Hello world! . bin .. usr 2 4 5 VMUNIX vmunix 5 . local 3 .. 3 foo 6 bin2 /usr/bin 8 8 2019/2/16
Unix links %ln file hlink /*file is in current directory*/ %ln –s file slink %ls –li * 10606 - rw-r- - r- - 2 tiko May 23 00:05 file 10606 - rw-r- - r- - 2 tiko May 23 00:05 hlink 10607 lrwxrwxrwx 1 tiko May 23 00:59 slink file %ln –s nonesuch devoid /*nonsuch non-existent %ls –l devoid …………..devoid nonesuch 2019/2/16
Mapping file systems to physical devices 2019/2/16
Mounting / Root file system bin etc usr cc date sh passwd getty / Mount point cc date sh passwd getty / /dev/sd0g bin src include yacc ban awk uts stdio.h 2019/2/16