Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.
-
Upload
margaret-perry -
Category
Documents
-
view
215 -
download
0
Transcript of Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.
![Page 1: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/1.jpg)
Log-Structured File System(LFS)
6.033 Review SessionMay 19, 2014
![Page 2: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/2.jpg)
Background
• Problem:– Sequential HD access is cheap, random access is
expensive (true in 1991 and today)– Standard UNIX file system does lots of random
access for small file writes (small reads OK due to caching)
• Solution:– Design a new kind of file system that always writes
data sequentially at the “end” of the disk
![Page 3: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/3.jpg)
Data Structures in LFSSame as in UNIX File System• Superblock (fixed position on disk)• Inode• Blocks containing file data or directory listings• Indirect Block
Used to Maintain Log Structure• Inode map (replaces the “itable”/“inode table” in the UNIX FS; no longer in a fixed
position on disk)
Used to optimize cleaning• Segment summary• Segment usage table
Used to handle crash recovery• Checkpoint region (fixed position on disk, incl. pointers to inode map blocks)• Directory change log
![Page 4: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/4.jpg)
Data Structures in LFSSame as in UNIX File System• Superblock (fixed position on disk)• Inode• Blocks containing file data or directory listings• Indirect Block
Used to Maintain Log Structure• Inode map (replaces the “itable”/“inode table” in the UNIX FS; no longer in a fixed
position on disk)
Used to optimize cleaning• Segment summary• Segment usage table
Used to handle crash recovery• Checkpoint region (fixed position on disk, incl. pointers to inode map blocks)• Directory change log
![Page 5: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/5.jpg)
Create file1/file2 in dir1/dir2: Without LFS
![Page 6: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/6.jpg)
Create file1/file2 in dir1/dir2: Without LFS
= Disk Seek
![Page 7: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/7.jpg)
Create file1/file2 in dir1/dir2: With LFS
![Page 8: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/8.jpg)
Create file1/file2 in dir1/dir2: With LFS
= Disk Seek
Boom.
![Page 9: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/9.jpg)
Create file1/file2 in dir1/dir2: With LFS
= Disk Seek
![Page 10: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/10.jpg)
What’s the Catch?
• Eventually we’ll reach the end of the disk• As files are deleted, freed data blocks leave
“holes” in the previously contiguous log• If we simply fill in the holes, we’re be back to
standard UNIX FS performance (probably worse)
![Page 11: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/11.jpg)
Free Space Management Solutions
![Page 12: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/12.jpg)
Free Space Management Solutions
• LFS uses combination; copy-and-compact 512KB “segments” but thread compacted segments into open spaces in the log
• Why 512KB? Makes seek time neglibible.
![Page 13: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/13.jpg)
Data Structures in LFSSame as in UNIX File System• Superblock (fixed position on disk)• Inode• Blocks containing file data or directory listings• Indirect Block
Used to Maintain Log Structure• Inode map (replaces the “itable”/“inode table” in the UNIX FS; no longer in a fixed
position on disk)
Used to optimize cleaning• Segment summary• Segment usage table
Used to handle crash recovery• Checkpoint region (fixed position on disk, incl. pointers to inode map blocks)• Directory change log
![Page 14: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/14.jpg)
Data Structures in LFSSame as in UNIX File System• Superblock (fixed position on disk)• Inode• Blocks containing file data or directory listings• Indirect Block
Used to Maintain Log Structure• Inode map (replaces the “itable”/“inode table” in the UNIX FS; no longer in a fixed
position on disk)
Used to optimize cleaning• Segment summary: Information that allows block liveness to be determined• Segment usage table: Statistics used to rank which segments to clean first
Used to handle crash recovery• Checkpoint region (fixed position on disk, incl. pointers to inode map blocks)• Directory change log
![Page 15: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/15.jpg)
Data Structures in LFSSame as in UNIX File System• Superblock (fixed position on disk)• Inode• Blocks containing file data or directory listings• Indirect Block
Used to Maintain Log Structure• Inode map (replaces the “itable”/“inode table” in the UNIX FS; no longer in a fixed
position on disk)
Used to optimize cleaning• Segment summary: Information that allows block liveness to be determined• Segment usage table: Statistics used to rank which segments to clean first
Used to handle crash recovery• Checkpoint region (fixed position on disk, incl. pointers to inode map blocks)• Directory change log
![Page 16: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/16.jpg)
Performance Characteristics
![Page 17: Log-Structured File System (LFS) 6.033 Review Session May 19, 2014.](https://reader035.fdocuments.us/reader035/viewer/2022071806/56649d9c5503460f94a84ee1/html5/thumbnails/17.jpg)
Performance Characteristics