outline for today journaling vs. soft updates administrative
TRANSCRIPT
![Page 1: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/1.jpg)
Outline for Today
Journaling vs. Soft Updates Administrative
![Page 2: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/2.jpg)
JOURNALING VERSUS SOFT UPDATES: ASYNCHRONOUS META-DATA PROTECTION IN FILE SYSTEMS
Margo I. Seltzer, Harvard Gregory R. Ganger, CMUM. Kirk McKusickKeith A. Smith, HarvardCraig A. N. Soules, CMUChristopher A. Stein, Harvard
![Page 3: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/3.jpg)
Introduction Paper discusses two most popular
approaches for improving the performance of metadata operations and recovery: Journaling Soft Updates
Journaling systems record metadata operations on an auxiliary log (Hagmann)
Soft Updates uses ordered writes(Ganger & Patt, OSDI 94)
![Page 4: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/4.jpg)
Metadata Operations
Metadata operations modify the structure of the file system Creating, deleting, or renaming
files, directories, or special files Data must be written to disk in such a
way that the file system can be recovered to a consistent state after a system crash
![Page 5: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/5.jpg)
General Rules of Ordering
1) Never point to a structure before it has been initialized (inode < direntry)
2) Never re-use a resource before nullifying all previous pointers to it
3) Never reset the old pointer to a live resource before the new pointer has been set (renaming)
![Page 6: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/6.jpg)
Metadata Integrity
FFS uses synchronous writes to guarantee the integrity of metadata Any operation modifying multiple pieces of
metadata will write its data to disk in a specific order
These writes will be blocking Guarantees integrity and durability of
metadata updates
![Page 7: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/7.jpg)
Deleting a file
abc
def
ghi
i-node-1
i-node-2
i-node-3
Assume we want to delete file “def”
![Page 8: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/8.jpg)
Deleting a file
abc
def
ghi
i-node-1
i-node-3
Cannot delete i-node before directory entry “def”
?
![Page 9: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/9.jpg)
Deleting a file
Correct sequence is1. Write to disk directory block containing deleted
directory entry “def”
2. Write to disk i-node block containing deleted i-node
Leaves the file system in a consistent state
![Page 10: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/10.jpg)
Creating a file
abc
ghi
i-node-1
i-node-3
Assume we want to create new file “tuv”
![Page 11: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/11.jpg)
Creating a file
abc
ghi
tuv
i-node-1
i-node-3
Cannot write directory entry “tuv” before i-node
?
![Page 12: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/12.jpg)
Creating a file
Correct sequence is1. Write to disk i-node block containing new i-node
2. Write to disk directory block containing new directory entry
Leaves the file system in a consistent state
![Page 13: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/13.jpg)
Synchronous Updates
Used by FFS to guarantee consistency of metadata: All metadata updates are done through
blocking writes
Increases the cost of metadata updates Can significantly impact the
performance of whole file system
![Page 14: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/14.jpg)
SOFT UPDATES
Use delayed writes (write back) Maintain dependency information
about cached pieces of metadata:This i-node must be updated before/after this directory entry
Guarantee that metadata blocks are written to disk in the required order
![Page 15: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/15.jpg)
First Problem
Synchronous writes guaranteed that metadata operations were durable once the system call returned
Soft Updates guarantee that file system will recover into a consistent state but not necessarily the most recent one Some updates could be lost
![Page 16: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/16.jpg)
Second Problem
Cyclical dependencies: Same directory block contains entries to be
created and entries to be deleted These entries point to i-nodes in the same
block
![Page 17: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/17.jpg)
Example
We want to delete file “def” and create new file “xyz”
i-node-2 def
NEW xyz
NEW i-node-3
--- ----------
Block A Block B
![Page 18: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/18.jpg)
Example
Cannot write block A before block B: Block A contains a new directory entry
pointing to block B Cannot write block B before block A:
Block A contains a deleted directory entry pointing to block B
![Page 19: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/19.jpg)
The Solution Roll back metadata in one of the blocks to an
earlier, safe state
(Safe state does not contain new directory entry)
def
--- Block A’
![Page 20: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/20.jpg)
The Solution Write first block with metadata that were
rolled back (block A’ of example) Write blocks that can be written after first
block has been written (block B of example) Roll forward block that was rolled back Write that block Breaks the cyclical dependency but must now
write twice block A
![Page 21: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/21.jpg)
Journaling Journaling systems maintain an
auxiliary log that records all meta-data operations
Write-ahead logging ensures that the log is written to disk before any blocks containing data modified by the corresponding operations. After a crash, can replay the log to bring
the file system to a consistent state
![Page 22: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/22.jpg)
Journaling
Log writes are performed in addition to the regular writes
Journaling systems incur log write overhead but Log writes can be performed efficiently
because they are sequential Metadata blocks do not need to be written
back after each update
![Page 23: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/23.jpg)
Journaling Journaling systems can provide
same durability semantics as FFS if log is forced to disk after each meta-data operation
the laxer semantics of Soft Updates if log writes are buffered until entire buffers are full
Will discuss two implementations LFS-File LFS-wafs
![Page 24: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/24.jpg)
LFS-File
Maintains a circular log in a pre-allocated file in the FFS (about 1% of file system size)
Buffer manager uses a write-ahead logging protocol to ensure proper synchronization between regular file data and the log
![Page 25: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/25.jpg)
LFS-File Buffer header of each modified block in cache
identifies the first and last log entries describing an update to the block
System uses First item to decide which log entries can be
purged from log Second item to ensure that all relevant log entries
are written to disk before the block is flushed from the cache
![Page 26: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/26.jpg)
LFS-File
LFFS-file maintains its log asynchronously Maintains file system integrity, but does not
guarantee durability of updates
![Page 27: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/27.jpg)
LFS-wafs Implements its log in an auxiliary file system:
Write Ahead File System (WAFS) Can be mounted and unmounted Can append data Can return data by sequential or keyed reads
Keys for keyed reads are log-sequence-numbers (LSNs) that correspond to logical offsets in the log
![Page 28: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/28.jpg)
LFS-wafs Log is implemented as a circular buffer within
the physical space allocated to the file system.
Buffer header of each modified block in cache contains LSNs of first and last log entries describing an update to the block
LFFS-wafs uses the same checkpointing scheme and the same write-ahead logging protocol as LFFS-file
![Page 29: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/29.jpg)
LFS-wafs Major advantage of WAFS is additional
flexibility: Can put WAFS on separate disk drive to avoid I/O
contention Can even put it in NVRAM
LFS-wafs normally uses synchronous writes Metadata operations are persistent upon return
from the system call Same durability semantics as FFS
![Page 30: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/30.jpg)
LFFS Recovery Superblock has address of last checkpoint
LFFS-file has frequent checkpoints LFFS-wafs much less frequent checkpoints
First recover the log Read then the log from logical end (backward
pass) and undo all aborted operations Do forward pass and reapply all updates that
have not yet been written to disk
![Page 31: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/31.jpg)
Other Approaches Using non-volatile cache (Network
Appliances) Ultimate solution: can keep data in cache forever Additional cost of NVRAM
Simulating NVRAM with Uninterruptible power supplies Hardware-protected RAM (Rio): cache is marked
read-only most of the time
![Page 32: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/32.jpg)
Other Approaches
Log-structured file systems Not always possible to write all related
meta-data in a single disk transfer Sprite-LFS adds small log entries to the
beginning of segments BSD-LFS make segments temporary until
all metadata necessary to ensure the recoverability of the file system are on disk.
![Page 33: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/33.jpg)
System Comparison Compared performances of
Standard FFS FFS mounted with the async option FFS mounted with Soft Updates FFS augmented with a file log using either
synchronous or asynchronous log writes FFS augmented with a WAFS log using
either synchronous or asynchronous log writes and WAFS log on same or different drive
![Page 34: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/34.jpg)
Feature Comparison
![Page 35: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/35.jpg)
Microbenchmark Results
clusteringindirect block
backgrounddeletes
![Page 36: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/36.jpg)
Macrobenchmark Results
Large data set exceeds cachedependency rollbacks hit
![Page 37: Outline for Today Journaling vs. Soft Updates Administrative](https://reader035.vdocuments.site/reader035/viewer/2022070413/5697bfeb1a28abf838cb8004/html5/thumbnails/37.jpg)
Conclusions
Journaling alone is not sufficient to “solve” the meta-data update problem Cannot realize its full potential when
synchronous semantics are required When that condition is relaxed,
journaling and Soft Updates perform comparably in most cases