SOCap 12
SOCap 12
Main Points
File layout
Directory layout
Design Challenges
Index structure
How do we locate the blocks of a file?
Index granularity
What block size do we use?
Free space
How do we find unused blocks on disk?
Locality
How do we preserve spatial locality?
Reliability
What if machine crashes in middle of a file system op?
FFS
NTFS
Index
structure
Linked list
Tree
(fixed, assym)
Tree
(dynamic)
granularity
block
block
extent
free space
allocation
FAT array
Locality
Bitmap
(fixed
location)
defragmentation Block groups
+ reserve
space
Bitmap
(file)
Extents
Best fit
defrag
File table:
Linear map of all blocks on disk
Each file a linked list of blocks
FAT
FAT
Pros:
Easy to find free block
Easy to append to a file
Easy to delete a file
Cons:
FAT size
Should be uploaded in main memory
Limitation to file system size
--> Per realizzare file systems pi estesi: gli elementi della FAT indirizzano blocchi logici,
multipli del blocco fisico del disco.
Massima dimensione del File System per diverse ampiezze dei blocchi
inode
Metadata
File owner, access permissions, access times,
FFS inode
Metadata
File owner, access permissions, access times,
FFS inode
Metadata
File owner, access permissions, access times,
FFS inode
Metadata
File owner, access permissions, access times,
FFS Locality
Block group allocation
Block group is a set of nearby cylinders
Files in same directory located in same group
Subdirectories located in different block groups
FFS
Pros
Efficient storage for both small and large files
Locality for both small and large files
Locality for metadata and data
Cons
Inefficient for tiny files (a 1 byte file requires both an
inode and a data block)
Inefficient encoding when file is mostly contiguous on
disk (no equivalent to superpages)
Need to reserve 10-20% of free space to prevent
fragmentation
NTFS
Master File Table
Flexible 1KB storage for metadata and data
Extents
Block pointers cover runs of blocks
Similar approach in linux (ext4)
File create can provide hint as to size of file
Directories
Directories
Directories can be files
Map file name to file number (MFT #, inode num)