Ffs
Ffs
Don Porter
1
COMP 530: Operating Systems
• Thoughts?
2
COMP 530: Operating Systems
Strawman
Super-
Inodes Data
block
0 DISKSZ
• Problems?
3
COMP 530: Operating Systems
0 DISKSZ
Head
• cat a
• cat b
• cat c
Lots of seeking – no locality for head across files 4
COMP 530: Operating Systems
Metadata locality
• File data and metadata (inode) are frequently
accessed together
• Simple design fails to capture this pattern
• Any ideas?
5
COMP 530: Operating Systems
0 DISKSZ
6
COMP 530: Operating Systems
0 DISKSZ
• Directories:
– New directories placed in least-utilized cylinder group
• Low number of total directories + plenty of free inodes
• Why?
• Files:
– Blocks of files should be allocated in same group as inode
– Place files in same directory in same group
Edge cases? 8
COMP 530: Operating Systems
9
COMP 530: Operating Systems
Amortizing seeks
• Seeks have a fixed cost
– Let’s say 10 ms on a current HDD
• Transfer time is proportional to amount of
contiguous data moved
– Let’s say 125 MB/s on a current HDD
10
COMP 530: Operating Systems
Amortizing seeks
• Suppose we want to spend half of our time seeking:
– I.e., we want to spend 10 ms in transfer time
125MB 1s
* *10ms = 1.25MB
1s 1000ms
• Suppose we want to spend 10% of our time seeking
125MB 1s
* * 90ms = 11.25MB
1s 1000ms
Caveat: You need to actually use this much data 11
COMP 530: Operating Systems
Fragmentation
• Not fragmenting free space becomes very important
to performance
• Internal: Lots of files smaller than 1.25 MB
– Idea: pack multiple small files into one 1.25 MB chunk
• Called sub-blocking
• External: Need to keep enough free space in a block
group for a directory
– Approach: load balance across block groups
– No good solution when disk is nearly full
12
COMP 530: Operating Systems
13
COMP 530: Operating Systems
14
COMP 530: Operating Systems
FFS Summary
• First file system designed for good performance
• Design principles still in use today
– Ext* family on Linux
– FFS still used in BSD
• Key ideas:
– Block/cylinder groups
– Data placement heuristics
– Amortizing seeks
15