Top Banner
1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes Shant Hovsepian * Andrew Matsuoka Lei Zhang * UCLA Google UT Austin http://featherstitch.cs.ucla.edu/ 1 orted by the NSF, Microsoft, and Intel.
41

1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

1

Generalized File System Dependencies

Christopher Frost* Mike Mammarella* Eddie Kohler*

Andrew de los Reyes† Shant Hovsepian*

Andrew Matsuoka‡ Lei Zhang†

*UCLA †Google ‡UT Austin

http://featherstitch.cs.ucla.edu/

1Supported by the NSF, Microsoft, and Intel.

Page 2: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

2

Featherstitch Summary

• A new architecture for constructing file systems• The generalized dependency abstraction

– Simplifies consistency code within file systems– Applications can define consistency requirements for file

systems to enforce

Page 3: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

3

File System Consistency

• Want: don’t lose file system data after a crash• Solution: keep file system consistent after every write

– Disks do not provide atomic, multi-block writes

• Example: journaling

• Enforce write-before relationships

Update FileSystem Contents

Commit JournalTransaction

Log JournalTransaction

Page 4: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

4

File System Consistency Issues

• Durability features vs. performance– Journaling, ACID transactions, WAFL, soft updates– Each file system picks one tradeoff– Applications get that tradeoff plus sync

• Why no extensible consistency?– Difficult to implement– Caches complicate

write-before relations– Correctness is critical

FreeBSD and NetBSD have each recently attempted to add journaling to UFS.Each declared failure.

“Personally, it took me about 5 years to thoroughly understand soft updates and I haven't met anyone other than the authors who claimed to understand it well enough to implement it.” – Valerie Henson

Page 5: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

5

The Problem

Can we develop a simple, general mechanism

for implementing any consistency model?

Yes! With the patch abstraction in Featherstitch:

• File systems specify low-level write-before requirements

• The buffer cache commits disk changes, obeying their order requirements

Page 6: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

6

Featherstitch Contributions

• The patch and patchgroup abstractions– Write-before relations become explicit and file system agnostic

• Featherstitch– Replaces Linux’s file system and buffer cache layer– ext2, UFS implementations

– Journaling, WAFL, and soft updates,

implemented using just patch arrangements

• Patch optimizations make patches practical

Page 7: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

7

Patches

Problem

Patches for file systems

Patches for applications

Patch optimizations

Evaluation

Page 8: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

8

Patch Model

Undo data

Patch

Dependency

Disk block

P

A B

A patch represents:• a disk data change• any dependencies on other disk data changes

Benefits:• separate write-before specification and enforcement• explicit write-before relationships

Q

patch_create(block* block, int offset, int length, char* data, patch* dep)

Featherstitch Buffer Cache

Page 9: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

9

Base Consistency Models

• Fast– Asynchronous

• Consistent– Soft updates– Journaling

• Extended– WAFL– Consistency in file system images

• All implemented in Featherstitch

Page 10: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

10

Patch Example: Asynchronous rename()

target dir source dir

adddirent

removedirent

File lost.

targetsourceaddrem

,

A valid block writeout:

time

Page 11: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

11

Patch Example: rename() With Soft Updates

inode table target dir source dir

adddirent

removedirent

inc #refs

A valid block writeout:

time

inc #refs

dec #refs

Page 12: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

12

Patch Example: rename() With Soft Updates

inode table

target dir

source dir

inode table target dir source dir

adddirent

removedirent

inc #refs

inc #refs

dec #refs

Block level cycle:

Page 13: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

13

Patch Example: rename() With Soft Updates

inode table target dir source dir

adddirent

removedirent

inc #refs

inc #refs

dec #refs

Not a patch level cycle:

adddirent

inc #refs removedirent

dec #refs

Page 14: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

14

Patch Example: rename() With Soft Updates

inode table target dir source dir

adddirent

removedirent

dec #refs

inc #refs

Undo data

A valid block writeout:

inodeinc

time

Page 15: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

15

Patch Example: rename() With Soft Updates

inode table target dir source dir

adddirent

removedirent

dec #refs

Undo data

A valid block writeout:

inodeinc

time

Page 16: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

16

Patch Example: rename() With Soft Updates

inode table target dir source dir

adddirent

removedirent

A valid block writeout:

inodeinc

time

targetadd

, sourcerem

, inodedec

,

dec #refs

Page 17: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

17

Patch Example: rename() With Journaling

target dir source dir

adddirent

removedirent

committxn

txn log

block copy

adddirent

removedirent

block copy

Journal

committxn

completetxn

Page 18: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

18

Patch Example: rename() With WAFLsuperblock

new source dirnew target dir

new inode table

duplicate old block

new block bitmap

duplicate old block

duplicate old blockduplicate old block

old source dirold target dir

old inode tableold block bitmap

Page 19: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

19

Meta-data journaling file system

Patch Example: Loopback Block Device

Loopback block device

Meta-data journaling file system

SATA block device

Meta-data journaling file system obeys file data requirements

Buffer cache block device

Block device

Block device

File system

Block device

File system

Backed by file

Page 20: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

20

Patchgroups

Problem

Patches for file systems

Patches for applications

Patch optimizations

Evaluation

Page 21: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

21

• Application-defined consistency requirements– Databases, Email, Version control

• Common techniques:– Tell buffer cache to write to disk immediately (fsync et al)– Depend on underlying file system (e.g., ordered journaling)

Application Consistency

Page 22: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

22

• Extend patches to applications: patchgroups– Specify write-before requirements among system calls

• Adapted gzip, Subversion client, and UW IMAP server

Patchgroups

write(b)

unlink(a)write(d)

rename(c)

Page 23: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

23

Patchgroups for UW IMAP

fsync

fsync

fsync

pg_depend

pg_depend

Unmodified UW IMAP Patchgroup UW IMAP

Page 24: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

24

Patch Optimizations

Problem

Patches for file systems

Patches for applications

Patch optimizations

Evaluation

Page 25: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

25

Patch Optimizations

Page 26: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

26

• In our initial implementation:– Patch manipulation time was the system bottleneck

– Patches consumed more memory than the buffer cache

• File system agnostic patch optimizations to reduce:– Undo memory usage

– Number of patches and dependencies

• Optimized Featherstitch is not much slower than Linux ext3

Patch Optimizations

Page 27: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

27

• Primary memory overhead: unused (!) undo data

• Optimize away unused undo data allocations?– Can’t detect “unused” until it’s too late

• Restrict the patch API to reason about the future?

Optimizing Undo Data

Page 28: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

28

Theorem: A patch that must be reverted to make progress must induce a block-level cycle.

Induces cycle

Optimizing Undo Data

P

R

Q

Page 29: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

29

• Detect block-level cycle inducers when allocating?– Restrict the patch API: supply all dependencies

at patch creation*

• Now, any patch that will need to be revertedmust induce a block-level cycle at creationtime

• We call a patch with undo data omitted a hard patch. A soft patch has its undo data.

Hard patch

Hard Patches

Soft patch

QP

R

Page 30: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

30

• Hard patch merging

• Overlap patch merging

Patch Merging

B

A A+B

BA A + B

Page 31: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

31

Evaluation

Problem

Patches for file systems

Patches for applications

Patch optimizations

Evaluation

Page 32: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

32

Efficient Disk Write Ordering

• Featherstitch needs to efficiently:– Detect when a write becomes durable– Ensure disk caches safely reorder writes

• SCSI TCQ or modern SATA NCQ+ FUA requests or WT drive cache

• Evaluation uses disk cache safely for both Featherstitch and Linux

P Q

Page 33: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

33

Evaluation

• Measure patch optimization effectiveness

• Compare performance with Linux ext2/ext3

• Assess consistency correctness

• Compare UW IMAP performance

Page 34: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

34

Evaluation: Patch Optimizations

Optimization # Patches Undo data System time

None 4.6 M 3.2 GB 23.6 sec

Hard patches 2.5 M 1.6 GB 18.6 sec

Overlap merging

550 k 1.6 GB 12.9 sec

Both 675 k 0.1 MB 11.0 sec

PostMark

Page 35: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

35

Evaluation: Patch Optimizations

Optimization # Patches Undo data System time

None 4.6 M 3.2 GB 23.6 sec

Hard patches 2.5 M 1.6 GB 18.6 sec

Overlap merging

550 k 1.6 GB 12.9 sec

Both 675 k 0.1 MB 11.0 sec

PostMark

Page 36: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

36

0

10

20

30

40

50

60

70

80

90 PostMark

Evaluation: Linux Comparison

Tim

e (s

econ

ds)

Fstitch total time Fstitch system time Linux total time Linux system time

Full datajournal

Meta datajournal

Soft updates

• Faster than ext2/ext3 on other benchmarks– Block allocation strategy differences dwarf overhead

Page 37: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

37

Evaluation: Consistency Correctness

• Are consistency implementations correct?

• Crash the operating system at random

• Soft updates:– Warning: High inode reference counts (expected)

• Journaling:– Consistent (expected)

• Asynchronous:– Errors: References to deleted inodes, and others (expected)

Page 38: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

38

Evaluation: Patchgroups

• Patchgroup-enabled vs. unmodified UW IMAP server benchmark: move 1,000 messages

• Reduces runtime by 50% for SU, 97% for journaling

Page 39: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

39

Related Work

• Soft updates [Ganger ’00]

• Consistency research– WAFL [Hitz ‘94]– ACID transactions [Gal ’05, Liskov ’04, Wright ’06]

• Echo and CAPFS distributed file systems

[Mann ’94, Vilayannur ’05]

• Asynchronous write graphs [Burnett ’06]

• xsyncfs [Nightingale ’05]

Page 40: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

40

Conclusions

• Patches provide new write-before abstraction

• Patches simplify the implementation of consistency models like journaling, WAFL, soft updates

• Applications can precisely and explicitly specify consistency requirements using patchgroups

• Thanks to optimizations, patch performance is competitive with ad hoc consistency implementations

Page 41: 1 Generalized File System Dependencies Christopher Frost * Mike Mammarella * Eddie Kohler * Andrew de los Reyes † Shant Hovsepian * Andrew Matsuoka ‡ Lei.

41

Featherstitch source:http://featherstitch.cs.ucla.edu/

Thanks to the NSF, Microsoft, and Intel.