260 likes | 293 Views
Learn about the transition from the old UNIX file system to a new, optimized file system for improved storage allocation and processing speed. Discover the layout, structure, and performance enhancements in the new system.
E N D
A Fast File System For UNIX By Marshall Kirk McKusick, William N.Joy Samuel J.Leffler Robert S. Fabry Presented by Zhifei Wang
Outline • Introduction • Old file system overview • New file system • New organization • Functional Enhancement • Performance • Conclusion
Introduction • UNIX File Abstraction • Everything as sequential byte stream • Old File System • Developed at Bell Labs • Each disk drive is divided into one or more partitions • Each disk partition may contain one file system • File system never spans multiple partitions
Old File System • File System Layout • I-Nodes • Problems
INodes • INodes: • File ownership information • Time Stamps for last modification/access • Array of pointers to data blocks of the underlying file
Old File System • Problem • Low Throughput • Long seek time • Why? • Transfer only 512 bytes once, at most • No read-ahead • Almost every access needs seek
New File System • Each disk drive contains one or more file systems. • A file system is described by its super-block • located at the beginning of the file system’s disk partition • contains critical data • Divides a disk partition into one or more cylinder groups
New File System – Cylinder Group • Cylinder Group • Redundant copy of super-block kept at varying offset so it spirals through the disk • i-nodes • Bit map describing available blocks Summary info describing usage of data blocks
New File System – Optimization at storage utilization • Larger blocks can be transferred in a single disk transaction • By increasing block size, disk access in NFS can transfer 4 times information than OFS per disk transaction. • eg: File in NFS – 4096 byte blocks • Problem: Huge Waste • Most UNIX file systems are composed of small files • Large block size wastes internal space
New File System –Waste due to large-size block Solution: Use Fragment!
New File System –Fragments in a block • Divide single block into one or more fragments • 2, 4 or 8 fragments for each block specified at file system creation • Lower bound disk sector size (512 bytes)
New File System –Space Allocation • New space to be allocated upon write system call • Each time the system checks to see if the size of the file has increased Strategies: • If enough space, just do it. • No fragmented blocks and no space in last block • Write in already-allocated / new full block • File contains one or more fragments with no space • If (size of new data + size of data already in fragments) > size of a full block, then a new block allocated and contents of the fragment are copied. Then continue to do as situation2 • But, this would cause problem! • Don’t make completely full, 90% is optimal
New File System –Parameterization • Goal • To parameterize the processor capabilities & mass storage characteristics so that blocks can be allocated in an optimum configuration-dependent way • Parameters used • Speed of the processor • Hardware support for mass storage transfers • Characteristics of the mass storage devices
New File System –Parameterization (cont’d) • How to achieve optimum configuration • Allocate new blocks on same cylinder as previous block • Cylinder group summary info keeps count of available blocks in cylinder group at different rotational positions • 8 rotational positions • Super-block contains vector of lists called rotational layout tables • Parameter that defines the number of milliseconds between completion of a data transfer and the initiation of another data transfer on same cylinder can be changed at any time
New File System – Layout Policy • Goal: • Increase locality of reference to minimize seek latency • Improve layout of data to make larger transfers possible • Global Policies • Make placement decisions for new i-nodes and data blocks • Calculate rotationally optimal block layouts • Decide when to force long seek because insufficient blocks • Local Policies • Use locally optimal scheme to lay out data blocks • Must strike a balance to avoid too much locality
New File System – Layout Policy (cont’d) • Tries to place all i-nodes of files in a directory in the same cylinder group • Allocation of i-nodes is done randomly/using a next free strategy within a cylinder group • Small & constant upper bound on the number of disk transfers (to access the i-nodes for all files in a directory) • When data blocks are used, file spilling is handled by redirecting block allocation to a different cylinder group • Advantage over OFS • All i-nodes for a particular cylinder group can be read with 8-16 disk transfers (OFS require a disk transfer to fetch i-node)
New File System – Layout Policy (cont’d) • Global policy routines call local allocation routines • If requested block not available • Use next available, rotationally closest block • If no blocks open on same cylinder, use block in same cylinder group • If cylinder group full, quadratically hash to choose another cylinder group • Exhaustive search
New File System – Functional Enhancements • Long file names • File names can be of arbitrary length. (255 chars) • File Locking • Old File System • No provision for locking files • Processes consumed CPU time by looping over attempts to create locks • Locks left lying around because of system crashes had to be manually removed • Process running as administrator were forced to use a different mechanism. • New File System • Provides file locking. [ 2 Schemes : Hard locks , Advisory locks ]
Symbolic Links Implemented as a file that contains a pathname When system encounters a symbolic link while interpreting a component of a pathname, the contents of the symbolic link is pre-pended to the rest of the pathname, and this name is interpreted to yield the resulting pathname Allows references across physical file systems and supports inter-machine linkage. Rename Old system required 3 system calls New implementation to avoid losing file with only temporary name if system crashes New File System – Functional Enhancements (cont’d)
New File System – Functional Enhancements (cont’d) • Quotas • Old system - Any single user can allocate all available space in the file system • New system - Quota mechanism sets limit on both number of inodes and the number of disk blocks that a user may allocate.
Performance • Both reads and writes are faster • Effective i-nodes layout • Larger block size
Inode layout policy is effective Large directory having many directories within. # disk accesses for inodes cut by a factor of 2. Large directory containing only files. # disk accesses for inodes cut by a factor of 8. Bandwidth Old file system uses only 3-5% of disk bandwidth New file system uses up to 47% Reads and writes faster Due to larger block size in new file system Writes same speed as reads in contrast to old system Performance
Conclusion • NFS is the basis for Unix File System • Nearly all UNIX machines use a variant of NFS including • Solaris • Unix BSD, Free Unix • Mac OS offers UFS as an alternative to its HFS • Linux offers partial support for UFS
Reference • Andrew S. Tanenbaum, Modern Operating Systems • Wikipedia.org