File System Implementation: Tran, Van Hoai
File System Implementation: Tran, Van Hoai
E-mail: [email protected]
(partly based on slides of Le Thanh Van)
1 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
2 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
3 / 30
Design principles
4 / 30
Design principles
5 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
6 / 30
On-disk and in-memory structures
On-disk
Boot control block (per volume): first block of volume, contain boot
information of an OS
Volume control block (per volume): partition details (#blocks, block size,
free-blocks, free-FCBs)
Directory structre: file organization
per-file FCB
7 / 30
File open/read
File open
File read
8 / 30
Virtual file system (VFS)
9 / 30
Virtual file system (VFS)
API
API (open, close, read, write, mmap) defined on objects
(inode object, file object, superblock object, dentry object)
10 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
11 / 30
Directory implementation
12 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
13 / 30
Types of allocation
14 / 30
Contiguous allocation (1)
15 / 30
Contiguous allocation (2)
Extent-based systems
16 / 30
Linked allocation
17 / 30
Linked allocation
FAT
18 / 30
Indexed allocation
19 / 30
Indexed allocation
UNIX inode
20 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
21 / 30
Bit vector
Free-space management
Free-space management is done by free-space list which keeps
track disk space
Bit vector (or bit map):
0 block i occupied
biti =
1 block i free
Block number calculation
(Number of bits per word)×
(Number of 0-valued words)+
offset of first 1 bit
23 / 30
Linked list
24 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
25 / 30
Improving performance by cache
Disk controllers has its own on-board cache
OS maintains a separate section of main memory for
buffer cache to store blocks used again shortly
Page cache: using virtual memory techniques to cache file
data (in pages, not in file-system oriented blocks)
⇒ Unified virtual memory (in Solaris, linux, Windows)
26 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
27 / 30
Improving performance by cache
28 / 30
Outline
3 Directory implemention
4 Allocation methods
5 Free-space management
7 Recovery
29 / 30
NFS architecture
30 / 30