Fast File System Don Porter 1 CSE 306: Opera.ng Systems How to - - PowerPoint PPT Presentation

fast file system
SMART_READER_LITE
LIVE PREVIEW

Fast File System Don Porter 1 CSE 306: Opera.ng Systems How to - - PowerPoint PPT Presentation

CSE 306: Opera.ng Systems Fast File System Don Porter 1 CSE 306: Opera.ng Systems How to place a file system on disk? Lets assume we have the following: Super block (allocaCon bitmap, FS-level metadata) Inodes (file-level


slide-1
SLIDE 1

CSE 306: Opera.ng Systems

Fast File System

Don Porter

1

slide-2
SLIDE 2

CSE 306: Opera.ng Systems

How to place a file system on disk?

  • Let’s assume we have the following:

– Super block (allocaCon bitmap, FS-level metadata) – Inodes (file-level metadata) – Data blocks

  • Thoughts?

2

slide-3
SLIDE 3

CSE 306: Opera.ng Systems

Strawman

  • Problems?

3

Super- block Inodes Data DISKSZ

slide-4
SLIDE 4

CSE 306: Opera.ng Systems

Typical file access paOern

  • cat a
  • cat b
  • cat c

4

Super- block Inodes Data DISKSZ Head

Lots of seeking – no locality for head across files

slide-5
SLIDE 5

CSE 306: Opera.ng Systems

Metadata locality

  • File data and metadata (inode) are frequently

accessed together

  • Simple design fails to capture this paOern
  • Any ideas?

5

slide-6
SLIDE 6

CSE 306: Opera.ng Systems

Block (or Cylinder) Group

  • Stripe smaller chunks of these triples across disk
  • Superblock:

– Some data replicated (good for crash tolerance) – Some data distributed (free block bitmap)

  • Per-group inodes and blocks

6

S Ino des Data DISKSZ S Ino des Data S Ino des Data

slide-7
SLIDE 7

CSE 306: Opera.ng Systems

Block (or Cylinder) Group

  • What does this give you?

– Average case: Inode + data relaCvely close

  • Reduce average-case seek Cme
  • Performance goal:

– Put things together that are accessed together – How?

7

S Ino des Data DISKSZ S Ino des Data S Ino des Data

slide-8
SLIDE 8

CSE 306: Opera.ng Systems

FFS data placement heurisCcs

  • Keep related things together
  • Keep unrelated things far apart
  • Directories:

– New directories placed in least-uClized cylinder group

  • Low number of total directories + plenty of free inodes
  • Why?
  • Files:

– Blocks of files should be allocated in same group as inode – Place files in same directory in same group

8

Edge cases?

slide-9
SLIDE 9

CSE 306: Opera.ng Systems

Edge case 1: Large files

  • Where to place a big file (e.g., movie download)?

– OpCon 1: Fill up 1+ enCre block groups (best fit)

  • Pro: Data is close together
  • Con: Wastes inodes in block group (or causes them to be far apart
  • Requires a lot of free space in 1+ groups to work

– Degenerate case: only a few blocks free in each group

– OpCon 2: Spread data across many block groups (worst fit)

  • Pro: Tries to keep larger regions of free space
  • Cons: Can end up seeking across many block groups

9

slide-10
SLIDE 10

CSE 306: Opera.ng Systems

AmorCzing seeks

  • Seeks have a fixed cost

– Let’s say 10 ms on a current HDD

  • Transfer Cme is proporConal to amount of

conCguous data moved

– Let’s say 125 MB/s on a current HDD

  • Insight: We can control fracCon of Cme spent

seeking by data allocaCon size

10

slide-11
SLIDE 11

CSE 306: Opera.ng Systems

AmorCzing seeks

  • Suppose we want to spend half of our Cme seeking:

– I.e., we want to spend 10 ms in transfer Cme

  • Suppose we want to spend 10% of our Cme seeking

11

125MB 1s * 1s 1000ms *10ms =1.25MB 125MB 1s * 1s 1000ms *90ms =11.25MB

Caveat: You need to actually use this much data

slide-12
SLIDE 12

CSE 306: Opera.ng Systems

FragmentaCon

  • Not fragmenCng free space becomes very important

to performance

  • Internal: Lots of files smaller than 1.25 MB

– Idea: pack mulCple small files into one 1.25 MB chunk

  • Called sub-blocking
  • External: Need to keep enough free space in a block

group for a directory

– Approach: load balance across block groups – No good soluCon when disk is nearly full

12

slide-13
SLIDE 13

CSE 306: Opera.ng Systems

Edge case 2: Renaming

  • How does rename work?

– Change the pointer from name to inode

  • ImplicaCon for locality if you move files across

directories?

– Create in one block group – Rename to directory in a different block group – Directory contents no longer in same group

13

slide-14
SLIDE 14

CSE 306: Opera.ng Systems

Edge case 2: Renaming

  • What to do?

– Live with it (one of several was a file system ages) – Move the data (slow):

  • BetrFS v.1 does this; takes 5 minutes to rename a 4 GB file

14

slide-15
SLIDE 15

CSE 306: Opera.ng Systems

FFS Summary

  • First file system designed for good performance
  • Design principles sCll in use today

– Ext* family on Linux – FFS sCll used in BSD

  • Key ideas:

– Block/cylinder groups – Data placement heurisCcs – AmorCzing seeks

15