Presentation is loading. Please wait.

Presentation is loading. Please wait.

4/8/14CS161 Spring 201411 FFS Recovery: Soft Updates Learning Objectives Explain how to enforce write-ordering without synchronous writes. Identify and.

Similar presentations


Presentation on theme: "4/8/14CS161 Spring 201411 FFS Recovery: Soft Updates Learning Objectives Explain how to enforce write-ordering without synchronous writes. Identify and."— Presentation transcript:

1 4/8/14CS161 Spring 201411 FFS Recovery: Soft Updates Learning Objectives Explain how to enforce write-ordering without synchronous writes. Identify and discuss tradeoffs between synchronous updates and soft updates. Topics Recap Deriving soft updates Soft updates challenges and solutions

2 Recap FFS Synchronous writes to ensure that things can be made consistent. FSCK to check and repair on-disk state to make things consistent. Two fundamental problems: Synchronous updates make FFS slow Running fsck on a large file system, before you can do anything else makes recovery unacceptably slow. What can you do? Recall why we performed synchronous writes and see if we can get around them. 4/8/14CS161 Spring 20142

3 Improving FFS Why did we perform synchronous writes? 4/8/14CS161 Spring 20143

4 Improving FFS Why did we perform synchronous writes? To ensure certain ordering constraints. What alternatives are there to these ordering constraints? 4/8/14CS161 Spring 20144

5 Improving FFS Why did we perform synchronous writes? To ensure certain ordering constraints. What alternatives are there to these ordering constraints? Enforce the ordering in the kernel (buffer cache). 4/8/14CS161 Spring 20145

6 Approach 2: Soft Updates What are the synchronous updates really doing? Enforcing: Never point to a structure before it has been initialized. Never reuse a resource before invalidating all previous references to it. Never reset the last pointer to a live resource before a new pointer has been set. Principles: Prioritize latency over durability: buffer writes and ensure recoverability rather than pushing writes to disk synchronously. Applications should never wait for a disk write unless they explicitly ask to do so. Propagate data to disk using the minimum number of I/Os possible. Minimize memory requirements. Avoid constraining cache write-back and disk ordering (enable intelligent disk scheduling). Soft Updates, Ganger 1994, Ganger, McKusick et al 2000 4/8/14CS161 Spring 20146

7 The Original Soft Updates Maintain dependency information between blocks in the buffer cache. Make sure that blocks are flushed to disk in an order that preserves those dependencies. 4/8/14CS161 Spring 20147 Inode 8 Inode 9 Inode 10 Inode 11 Inode 12 Inode 13 Inode 14 Inode 15 Inode Block Create file bar., #52.., #75 Directory Block foo, #10 bar, #11 Create ordering dependency

8 The Problem Maintain dependency information between blocks in the buffer cache. Make sure that blocks are flushed to disk in an order that preserves those dependencies. 4/8/14CS161 Spring 20148 Inode 8 Inode 9 Inode 10 Inode 11 Inode 12 Inode 13 Inode 14 Inode 15 Inode Block Create file bar., #52.., #75 Directory Block bar, #11 foo, #10 Create ordering dependency Remove file foo Create ordering dependency Which block do you write first?

9 The Solution Maintain fine-grain dependency information Maintain dependencies on a per pointer or per-field basis. In addition, keep before and after versions, so that you can undo an update before writing a block and then redo the update to preserve it in-memory. 4/8/14CS161 Spring 20149 Inode 8 Inode 9 Inode 10 Inode 11 Inode 12 Inode 13 Inode 14 Inode 15 Inode Block 1. Create file bar., #52.., #75 Directory Block foo, #10 bar, #11 Initialize inode 11 Add entry: bar, #11 Depends on 2. Remove file foo Remove entry: foo, #10 Nullify inode #10 Depends on

10 The Solution: Writing the Inode Block Maintain fine-grain dependency information Maintain dependencies on a per pointer or per-field basis. In addition, keep before and after versions, so that you can undo an update before writing a block and then redo the update to preserve it in-memory. 4/8/14CS161 Spring 201410 Inode 8 Inode 9 Inode 10 Inode 11 Inode 12 Inode 13 Inode 14 Inode 15 Inode Block., #52.., #75 Directory Block foo, #10 bar, #11 Initialize inode 11 Add entry: bar, #11 Depends on Remove entry: foo, #10 Nullify inode #10 Depends on 1.Check block for dependencies. 2.No dependency on inode #11 3.Dependency for inode #10 4.Undo update on inode #10 5.Write block 6.Redo update on inode #14

11 The Solution: Writing Directory Block Maintain fine-grain dependency information Maintain dependencies on a per pointer or per-field basis. In addition, keep before and after versions, so that you can undo an update before writing a block and then redo the update to preserve it in-memory. 4/8/14CS161 Spring 201411 Inode 8 Inode 9 Inode 10 Inode 11 Inode 12 Inode 13 Inode 14 Inode 15 Inode Block., #52.., #75 Directory Block foo, #10 bar, #11 Initialize inode 11 Add entry: foo, #11 Depends on Remove entry: bar, #10 Nullify inode #10 Depends on 1.Check block for dependencies. 2.No dependency on remove 3.Dependency on add 4.Undo add of bar, #11 5.Write block 6.Redo add of bar, #11

12 Soft Updates: Summary Fine-grain dependency tracking allows any block to be written at any time. Blocks involved in cycles may be written multiple times. Dirty blocks not in cycles written once. Post-crash on-disk state is always consistent, except possibly for bitmaps. Order bitmap operations so bitmaps are always conservative: may think a block is allocated that isnt, but never thinks a block is free when it isnt. Bitmaps can be reclaimed in the background. No long fsck before mounting file system. 4/8/14CS161 Spring 201412

13 From Soft Updates to Logging In soft updates, we tag each buffer with information that tells us how to undo and redo the various changes we have made to a buffer. The database folks have used such information for years to make databases recoverable after a failure. Write-ahead logging: Before writing a dirty buffer to disk, write a log record to the log (a sequentially written and read file) describing the changes to the buffer. After a crash, replay the log to bring the system to a consistent state. Coming next: two approaches to logging Journaling Log-structured file systems 4/8/14CS161 Spring 201413


Download ppt "4/8/14CS161 Spring 201411 FFS Recovery: Soft Updates Learning Objectives Explain how to enforce write-ordering without synchronous writes. Identify and."

Similar presentations


Ads by Google