File system internals - PowerPoint PPT Presentation

1 / 15
About This Presentation
Title:

File system internals

Description:

Has hooks, but not implementation for undelete. mmap idea ... Logical deletion (supports undelete) Reason is obvious. Structure of an ext2 cluster ... – PowerPoint PPT presentation

Number of Views:52
Avg rating:3.0/5.0
Slides: 16
Provided by: tomn8
Category:

less

Transcript and Presenter's Notes

Title: File system internals


1
File system internals
  • Traditional Unix (Bach)
  • Linux block cache
  • Linux memory-mapping (mmap)

2
Traditional Unix (Bach)
  • Lower Level File System Algorithms

Name-to-inode
Allocating inodes
Allocating buffers
Handling inodes
Buffer allocation algorithms
Buffer manipulation algorithms getblk brelse
bread breada bwrite
3
Interpreting theprevious picture
  • This shows the low level algorithms used to
    implement the system calls

4
Linux specialties
  • Virtual file system
  • Allows a common interface to a large variety of
    file systems
  • Implemented as an abstraction layer
  • File system implementations are in
    /usr/src/linux/fs
  • Uses the fops structure of pointers to methods

5
Linux specialties
  • Ext2 file system
  • Clustered implementation for efficiency
  • Has hooks, but not implementation for undelete
  • mmap idea
  • A file being accessed randomly can be treated as
    virtual memory
  • Accessing a block is handled through the virtual
    memory subsystem, not the disk block cache
  • Dentry (directory entry) objects
  • Cached
  • Accessed via hashing

6
The file-operations structure (half)
7
The file-operations structure (half)
8
Internal linux structures
  • Directory objects
  • These are artificially constructed for file
    systems without directories (FAT)
  • Dentry objects
  • Multipurpose
  • Acts as a controller for the inode cache
  • In Linux it is effectively an entry in the system
    open file table
  • In-core inodes
  • These are artificially constructed for file
    systems without inodes (FAT)
  • These are always cached hence the term in-core

9
The ext2 file system
  • Efficiency features
  • Block size 1024, 2048, 4096
  • Partitioned into groups to shorten seek time
  • Choice of blocks/inode
  • Preallocated contiguous spaces for regular files
  • Fast symbolic links (link info stored in inode)
  • Safety features
  • Doing operations in repairable order
  • Making new hard link done by
  • Increment refcount in inode
  • Then add new name to directory
  • If crash happens between these two operations,
    fsck finds and fixes
  • Support for (even root cant override these)
  • Immutable files
  • Append-only files

10
Planned new features for ext2
  • Block fragmentation
  • Same block can contain fragments of several file
    ends
  • Access control lists
  • Fine-grained and temporary control of access
  • Handling compressed and encrypted files
  • Note compress first, then encrypt -
  • Logical deletion (supports undelete)
  • Reason is obvious

11
Structure of an ext2 cluster
  • Features and size
  • Bitmaps are all block size so number of items
    ltbits per block
  • Looking at bitmaps word-by-word allows fast
    searching for holes
  • Superblock and group descriptors are copies of
    those in other groups
  • Number of groups/file system gt
    partition_size/group_size

12
Contents of superblock and group
descriptors(partial list)
  • Superblock
  • Must fit in 1024 bytes (why?)
  • Flexible version number, etc.
  • Size and current number of everything global
  • Group descriptor (24 bytes)
  • Location and current number of
  • Bitmaps, inode tables, directories, and data
    blocks
  • Information on each group is found in each
    groups descriptor area each group knows about
    all the others

13
Inodes and the inode table
  • Table size is implied in group descriptor
  • Inode size is a fixed 128
  • Structure is almost like all other unix
    filesystems also
  • Fragment address
  • ACL for descriptor

14
Usage of blocks regular files and directories
  • Directory
  • Names can be up to 255 bytes must contain
    length
  • End of entry is padded to multiple of 4
  • Symbolic link
  • Destination (if less than 60 char) is in inode,
    else in a data block
  • Device file, pipe, and socket
  • Everything fits into inode
  • Bitmap caches are used
  • One each for inode and data blocks

15
Disk space management
  • Goals
  • Avoid fragmentation
  • Time efficiency
  • Methods for achieving these goals
  • Allocation
  • Directories should be evenly distributed among
    groups
  • Files should be near their directories
  • Preallocation allocates adjacent blocks near any
    new one
Write a Comment
User Comments (0)
About PowerShow.com