Presentation is loading. Please wait.

Presentation is loading. Please wait.

File System Examples Unix Fast File System (FFS)

Similar presentations


Presentation on theme: "File System Examples Unix Fast File System (FFS)"— Presentation transcript:

0 Instructor: Junfeng Yang
W4118 Operating Systems Instructor: Junfeng Yang

1 File System Examples Unix Fast File System (FFS)
What were the problems with Unix FS? How did FFS solve these problems? Linux Second Extended File System (EXT2) What is the EXT2 on-disk layout? What is the EXT2 directory structure? Virtual File System (VFS) What is VFS? What are the key data structures of Linux VFS?

2 Original Unix FS From Bell Labs Simple and elegant Problem: slow
20KB/s, 2% of maximum even for sequential disk transfer inodes data blocks (512 bytes) super block

3 Why so slow? Blocks too small Unorganized freelist No data locality
Fixed costs per transfer (seek and rotational delays) Need more indirect blocks Unorganized freelist Consecutive file blocks are not close together Pay seek cost even for sequential access No data locality inodes far from data blocks inodes of files in directory not close together

4 Larger Blocks BSD: increase block to 4096 or more bytes Faster
However, internal fragmentation FFS provided a solution Not a problem now: disks are big and cheap

5 Initial performance good
Unorganized freelist Leads to random allocation of sequential file blocks overtime Solution: bitmap for free blocks E.g., Initial performance good Get worse over time

6 Data Locality Store related data together
Always find free block nearby Keep free space on disks (10%) Spread unrelated data apart Make room for related data

7 How to Achieve Locality
Each cylinder group contains Superblock Inodes Bitmap of free blocks Additional info for block allocation Data blocks File: store data blocks within a cylinder group Dir: store files in same dir in a cylinder group Make room Spread out directories to cylinder groups Switch to a different cylinder group for large files

8 File System Examples Unix Fast File System (FFS)
What were the problems with Unix FS? How did FFS solve these problems? Linux Second Extended File System (EXT2) What is the EXT2 on-disk layout? What is the EXT2 directory structure? Virtual File System (VFS) What is VFS? What are the key data structures of Linux VFS? 8

9 Ext2 “Standard” Linux File System
Previously it was the most commonly used Serves as a basis for Ext3 which adds journaling Uses FFS like layout Each file system is composed of identical block groups Allocation is designed to improve locality inodes contain pointers (32 bits) to blocks Direct, Indirect, Double Indirect, Triple Indirect Maximum file size: 4.1TB (4K Blocks) Maximum file system size: 16TB (4K Blocks) On-disk structures defined in include/linux/ext2_fs.h

10 Ext2 Disk Layout Files in the same directory are stored in the same block group Files in different directories are spread among the block groups Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

11 Block Addressing in Ext2
Twelve “direct” blocks Data Block Inode Data Block Data Block BLKSIZE/4 Indirect Blocks Data Block Data Block Data Block Data Block Indirect Blocks (BLKSIZE/4)2 Data Block Data Block Double Indirect Indirect Blocks Data Block Data Block Data Block Data Block (BLKSIZE/4)3 Data Block Indirect Blocks Data Block Triple Indirect Double Indirect Data Block Indirect Blocks Data Block Data Block Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

12 Ext2 Directory Structure
(a) A Linux directory with three files. (b) The same directory after the file voluminous has been removed. Picture from Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

13 File System Examples Unix Fast File System (FFS)
What were the problems with Unix FS? How did FFS solve these problems? Linux Second Extended File System (EXT2) What is the EXT2 on-disk layout? What is the EXT2 directory structure? Virtual File System (VFS) What is VFS? What are the key data structures of Linux VFS? 13

14 VFS Old days: “the” file system
Nowadays: many file system types and instances co-exist VFS: an FS abstraction layer that transparently and uniformly supports multiple file systems A VFS specifies an interface A specific FS implements this interface Often a struct of function pointers VFS dispatches FS operations through this interface E.g., dir->inode_op->mkdir();

15 Schematic View of Virtual File System

16 Key Linux VFS Data Structures
struct file information about an open file includes current position (file pointer) struct dentry information about a directory entry includes name + inode# struct inode unique descriptor of a file or directory contains permissions, timestamps, block map (data) inode#: integer (unique per mounted filesystem) Pointer to FS-specific inode structure e.g. ext2_inode_info struct superblock descriptor of a mounted filesystem


Download ppt "File System Examples Unix Fast File System (FFS)"

Similar presentations


Ads by Google