file systems: why, how and where

38
File Systems: Why, How and Where Philip Derbeko enSilo 2017

Upload: kernel-tlv

Post on 22-Jan-2018

429 views

Category:

Software


1 download

TRANSCRIPT

Page 1: File Systems: Why, How and Where

File Systems: Why, How and Where

Philip DerbekoenSilo2017

Page 2: File Systems: Why, How and Where

The Tragedy of

FileSystems

Page 3: File Systems: Why, How and Where

The Tragedy of FileSystems• Scale and scalability•Reliability •Recovery•Complexity

Page 4: File Systems: Why, How and Where

The Tragedy of FileSystems

Page 5: File Systems: Why, How and Where

The Tragedy of FileSystems• Scale and scalability•Reliability •Recovery•Complexity • Flexibility for developers

Page 6: File Systems: Why, How and Where

Challenges

1. Metadata performance2. Reliability and Recovery 3. Small files performance4. Large files performance 5. Storage Management

Page 7: File Systems: Why, How and Where

Components

•Block allocation•Directory Management• File and Directory operations• Inode handling•Transactions and journaling• Superblock handling• FS tree•Other

Page 8: File Systems: Why, How and Where

Beginning – Sequential

Page 9: File Systems: Why, How and Where

Sequential File System

Header:name,length

Footer:NameCRC

DATA

Page 10: File Systems: Why, How and Where

UNTIL …

Page 11: File Systems: Why, How and Where

Disk – The king of storage

Page 12: File Systems: Why, How and Where

Disk - Anatomy

Page 13: File Systems: Why, How and Where

You are here

Page 14: File Systems: Why, How and Where

Simplest possible FS – FAT

Page 15: File Systems: Why, How and Where

ext2

Page 16: File Systems: Why, How and Where

How it is done

file

file

file

dentry

dentry

inode

inode

File attributes

Direct blocks

Direct blocks

Indirect blocks

Double Indirect blocks

Triple Indirect blocks

DirectDirectDirectDirect

DirectDirectDirect

DirectDirectDirectDirect

Page 17: File Systems: Why, How and Where

Ext2 - fsck

•Unclean mount or mount counter•Not everything can be solved•Plan:

• Superblock check• Free Blocks• Inode sanity• Inode links• Duplicates• Bad Blocks • Directory checks

SLOW!!!

Page 18: File Systems: Why, How and Where

Other consistency options – Soft Updates

•Dependency Rules:1. Never point to uninitialized structure2. Never reuse before nullifying the pointers3. Never reset an old pointer before a new one was set

Page 19: File Systems: Why, How and Where

Other consistency

options - COW

Page 20: File Systems: Why, How and Where

ext3

1. Journaling2. Online file system growth3. Directory indexing (not really, as was done for ext2 as well)

Page 21: File Systems: Why, How and Where

Ext3 - journaling

TxB TxEInodeBit

mapWriteBack

Data

Page 22: File Systems: Why, How and Where

Ext3 - journaling

TxB TxEInodeBit

mapOrdered

Data

Page 23: File Systems: Why, How and Where

Ext3 - journaling

TxB TxEInodeBit

map DataFull Journal

Data

Page 24: File Systems: Why, How and Where

Ext3 – Journal final comments

• Journal-assisted recovery: Redo Logging•Commit Batching• Journal Cleaning – mark the last checkpoint in journal superblock•Deletes and reuse

Page 25: File Systems: Why, How and Where

Ext4

•Backward and forward compatible – up to a certain point• Scalability• “Sequentiality” improvements:

• Extent-based allocations• Journal checksum speed up• Delayed allocations

•Transparent Encryption

Page 26: File Systems: Why, How and Where

Performance Optimizations

1. Synchronization of operations (the less is the better)2. Locality of allocations3. I/O Scheduling4. Scalability5. Caching6. Pre-fetching

Page 27: File Systems: Why, How and Where

New Sheriff in town

Page 28: File Systems: Why, How and Where

New Features

• Snapshotting•Versioning•Backups•Deduplication•Data and meta data checksums

Page 29: File Systems: Why, How and Where

BTRFS (“Better FS”)

Page 30: File Systems: Why, How and Where

BTRFS (“Better FS”)

Page 31: File Systems: Why, How and Where

BTRFS (“Better FS”)

Page 32: File Systems: Why, How and Where

Newer is better?

Page 33: File Systems: Why, How and Where

FS Sizes

Page 34: File Systems: Why, How and Where

FS Patches (Linux 2.6 over 5079 patches)

•Maintenance (45%)•Bugs (35%) – constant bug fixing over the life of FS•Performance •Reliability• Features

FAST 2013 – “A Study of Linux File System Evolution”

Page 35: File Systems: Why, How and Where

Bug Consequences

•Corruption•Crash• Failure of operation•Deadlock•Hang•Memory leak•Other

FAST 2013 – “A Study of Linux File System Evolution”

38% of bugs are on failure paths

freq

uenc

y

Page 36: File Systems: Why, How and Where

“Timeline” – facts should not mess a storyBerkley

FFS

ext2

ext3

ReiserFS

ext4

ZFS

BTRFS

FAT

FAT32

NTFS

WinFS (dead)

ReFS

HFS

HFS+

APFS

Page 37: File Systems: Why, How and Where

What was not covered

• Shared, network, distributed and clustered file systems:• WAFL• AFS• GFS and DFS• WebDav

•Volume Management•UnionFS (Knoppix CD+HDD, Docker layers)

Page 38: File Systems: Why, How and Where

The End

Keep in touch: [email protected]