1 / 11

Chapter 40 File System Implementation

Chapter 40 File System Implementation. Chien -Chung Shen CIS, UD cshen@cis.udel.edu. Learning by Example. A simple file system implementation vsfs (Very S imple F ile S ystem) a simplified version of Unix file system

bazyli
Download Presentation

Chapter 40 File System Implementation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 40File System Implementation Chien-Chung Shen CIS, UD cshen@cis.udel.edu

  2. Learning by Example • A simple file system implementation • vsfs (Very Simple File System) • a simplified version of Unix file system • features include on-disk structures, access methods, and various policies • File system is pure software so that no special hardware are added for better performance; however, need to understand and take advantage of device characteristics to make sure file systems work well • e.g., AFS -> ZFS with different data structures and features (pros and cons): learning via case studies

  3. Mental Model of FS • Mental models are what you are really trying to develop when learning about systems • Mental model of file systems include answers to questions like • what on-disk structures store the file system’s data and metadata? • what happens when a process opens a file? • which on-disk structures are accessed during a read or write?

  4. The Way to Think • Two aspects: object-oriented view • data structures, e.g., what types of on-disk structures are utilized by file system to organize its data and metadata (e.g., array of blocks or tree-based structure) • access methods, e.g., how system calls are mapped onto the data structures (e.g., which structures are read during the execution of a particular system call)

  5. Overall Organization (1) • Overall on-disk organization of the data structures of the vsfs file system • disk is divided into a serious of equal-sized blocks • e.g.,a small disk is divided into 64 “4KB blocks” • 56-block “data region” for user data

  6. Overall Organization (2) • Metadata [stored in inode] tracks each file (its data blocks, owner, access rights, modify time, etc.) • inode table on disk (5*16 “256-byte inodes”) • Need to track whether inodesand data blocks are free or allocated (allocation structures) • freelist or bitmap(data bitmap and inode bitmap)

  7. Overall Organization (3) • Superblock: contains information about this file system, includinghow many inodes and data blocks are in the file system (80 and 56, respectively), where the inode table begins (block 3), etc. • When mounting file system, OS reads the superblock first to initialize various parameters

  8. File Organization: inode (1) • “Indexnode” holding a file’s metadata • Inode table of 5 “4KB blocks” • To read inode number 32, calculate offset into inode region (32*sizeof(inode) = 8192), add it to the start address of the inode table on disk (12KB) to get 20KB

  9. File Organization: inode (2) • Disks are not byte addressable, but rather consist of many addressable sectors, usually 512 bytes. • Thus, to fetch the block of inodes that contains inode 32, file system issues a read to sector 40 (20*1024/512) to fetch the desired inode block blk= (inumber * sizeof(inode_t)) / blockSize; sector = ((blk * blockSize) + inodeStartAddr) / sectorSize;

  10. Where Data Blocks Are • One option: have one or more direct pointers (disk addresses) inside the inode, each refers to one disk block • Limited file size • Multi-level index • indirect pointers: instead of pointing to a block that contains user data, it points to a block that contains more pointers, each of which point to user data • e.g., 4 KB block and 4-byte disk addresses (12+1024)*4K • double indirect pointers • triple indirect pointers

  11. Multi-Level Index

More Related