130 likes | 155 Views
Chapter 41. Locality and The Fast File System. Sangchul Kim(stdio@snu.ac.kr) School of Computer Science and Engineering Seoul National University. Contents. Background Problem Fast File System The Cylinder Group Policies A Few Other Things Summary. Background. S. i-nodes. Data.
E N D
Chapter 41.Locality and The Fast File System Sangchul Kim(stdio@snu.ac.kr) School of Computer Science and Engineering Seoul National University
Contents • Background • Problem • Fast File System • The Cylinder Group • Policies • A Few Other Things • Summary
Background S i-nodes Data • Unix file system • Super block (S) • Information about the entire file system • How big the volume is • How many i-nodes there are • A pointer to the head of a free list of blocks • The Advantage of this file system • Simple • Support the basic abstractions • Files and the directory hierarchy
Problem A A E B E B C C D E D E • The performance is terrible • Data blocks are allocated randomly • File system ends up getting fragmented • Transferring data from the disk is inefficient • Block size is too small (512 bytes) • i-nodes are allocated far from data blocks • All i-nodes at beginning of disk is far from the data • Going back and forth from i-nodes to data blocks
Fast File System (FFS) url: https://www.bitrix24.com/about/blogs/tips-n-trick/how-to-set-up-an-inspiration-system-and-never-run-out-of-ideas.php (retrieved on 2015/06/02) • The ideas • Design the file system structures • The cylinder group • Design allocation policies to be “disk aware” • File locality • Change the internal implementation • Keep the same interface to the file system
Fast File System (FFS) url: http://osr507doc.sco.com/en/HANDBOOK/hdi_dkinit.html (Retrived on 2015/06/02) • The cylinder group (block group) • Comprise of one or more consecutive cylinders • Disk partition is divided into one or more cylinder groups
Fast File System (FFS) Disk drive File system • The cylinder group (block group) • Super block copy(S) • For reliability reasons (e.g., corruption or scratch) • Inode bitmap (ib) and data bitmap (db) • Manage free space • i-node and data block • Unix file system
Fast File System (FFS) • Policies • The core idea of policies • “related” data are placed in the same cylinder group • The files that are in same directory • Place in the same cylinder group • How to allocate files and directories • Placement of files • Allocatethe data blocks of a file in the same group as its i-node • Prevent long seeks • Placement of directories • A low number of allocated directories for balance • A high number of free i-nodes to be able to allocate bunch of files
Fast File System (FFS) G0 G1 G2 G3 G4 G5 G6 G7 G8 G9 6 7 8 9 4 5 2 3 0 1 0 1 2 3 4 5 6 7 8 9 • Policies • The large-file exception • Without a different rule, a large file would entirely fill the block group • It prevents subsequent “related” files from being placed within this block group • Choose the chunk size carefully • Affect the performance
A Few Other Things 10 9 5 4 10 8 11 9 7 11 0 0 3 6 1 8 6 5 2 2 1 4 7 3 • Internal fragmentation • The block size is 4KB, but many files are under that size • Divide a single file system block into fragments (sub-blocks) • Continue allocating 512 byte blocks • After acquiring a 4KB of data, the sub-blocks copy in to 4KB block • Using buffers, the redundant I/O is avoided. • Parameterization
A Few Other Things • Long file names • File names can be of arbitrary length. • Symbolic link • Implemented as a file that contains a pathname. • Atomic rename() operation • Previous file system required three calls to the system • Target file could be left with only its temporary name.
Summary • The ideas to solve the Unix file system problem • The cylinder group and “disk aware” policy • To solve the allocation problem of data blocks • To solve the allocation of i-nodes far from data blocks • The expansion of the block size • To solve the bad performance of transferring data from the disk • The introduction of a few other things • Internal fragmentation • Parameterization • Long file names • Symbolic link • Atomic rename() operation