File System Design: May 10, 2012

Kirby Cool, Taylor Lee

Table of Contents

Filesystem Performance
FAT Filesystem
Unix filesystem

File System Performance (continued)







Directory

File1

File2

Unused

File3

Unused

File4

File5

Unused


Directory:

File entry 1

File entry 2

File entry 3

File entry4

Example File Entry:

Name

Command.c

Byte offset

1096320

Size (in bytes)

3369


FAT Filesystem

Boot Sector

Super Block

FAT

Data



Boot Sector

  • Normally contains boot loader

Super Block

  • Conatains meta data

    • Size

    • blocks in use

    • Version

    • etc.

Data

  • Broken into blocks of fixed size (typically 4 kB)




Example:


FAT

4

0

7

0

2

0

0

EOC

0

0



Corresponding Data Blocks

F

b

L

l

I

h

bl

E

a

h


Reading the file starting at block 0 would yield “FILE”



Advantages

  • Easy to grow a file, just continue the FAT entry to point to free space

  • No external fragmentation

  • No artificial limit to # of files

Disadvantages

  • Sequential reads are slow (This can be partially solved with defrag)

  • Random access is slow (must follow pointers from beginning)

Unix Filesystem (UFS)

Boot Sector

Super Block

Node Table

Data



Boot Sector

  • Normally contains boot loader

Super Block

  • Conatains meta data

    • Size

    • blocks in use

    • Version

    • etc.

Data

  • Broken into blocks of fixed size (typically 4 kB)



Advantages

  • Maintains advantages of FAT

    • Easy to grow file

    • No external fragmentation

  • Random access can be faster

    • lseek order O(1)

Disadvantages

  • Internal fragmentation can be a problem

    • ie a very small file with a huge amount of holes

  • lseek requires at least 4 seeks to look up the location from the inode → slower in some common cases