Home

This document is a cache from http://www.nobius.org/~dbg/practical-file-system-design.pdf


Practical File System Design

Document source : www.nobius.org


7 . 2
H O W D O E S J O U R N A L I N G W O R K ?
113
Another term used to refer to the log is the journal. The journaling system
records all transactions in the log area. It is possible to put the log on a dif-
ferent device than the rest of the file system for performance reasons. The
log is only written during normal operation, and when old transactions com-
plete, their space in the log is reclaimed. The log is central to the operation
of journaling.
When a transaction has been written to the log, it is sometimes referred to
as a journal entry. A journal entry consists of the addresses of the modified
disk blocks and the data that belongs in each block. A journal entry is usually
stored as a single chunk of memory and is written to the log area of a volume.
When a journaled system reboots, if there are any journal entries that were
not marked as completed, the system must replay the entries to bring the
system up-to-date. Replaying the journal prevents partial updates because
each journal entry is a complete, self-contained transaction.
Write-ahead logging
is when a journaling system writes changes to the log
before modifying the disk. All journaling systems that we know of use write-
ahead logging. We assume that journaling implies write-ahead logging and
mention it only for completeness.
Supporting the basic concept of a transaction and the log are several in-
memory data structures. These structures hold a transaction in memory
while modifications are being made and keep track of which transactions
have successfully completed and which are pending. These structures of
course vary depending on the journaling implementation.
7.2
How Does Journaling Work?
The basic premise of journaling is that all modified blocks used in a transac-
tion are locked in memory until the transaction is finished. Once the trans-
action is finished, the contents of the transaction are written to the log and
the modified blocks are unlocked. When all the cached blocks are eventually
flushed to their respective locations on disk, the transaction is considered
complete. Buffering the transaction in memory and first writing the data to
the log prevents partial updates from happening.
The key to journaling is that it writes the contents of a transaction to the
log area on disk before allowing the writes to happen to their normal place
on disk. That is, once a transaction is successfully written to the log, the
blocks making up the transaction are unlocked from the cache. The cached
blocks are then allowed to be written to their regular locations on disk at
some point in the future (i.e., whenever it is convenient for the cache to flush
them to disk). When the cache flushes the last block of a transaction to disk,
the journal is updated to reflect that the transaction completed.
The "magic" behind journaling is that the disk blocks modified during
a transaction are not written until after the entire transaction is success-
fully written to the log. By buffering the transaction in memory until it
Practical File System Design:The Be File System
, Dominic Giampaolo
page 113







Summary :

Replaying the journal prevents partial updates because each journal entry is a complete, self-contained transaction. Write-ahead logging is when a journaling system writes changes to the log before modifying the disk. The key to journaling is that it writes the contents of a transaction to the log area on disk before allowing the writes to happen to their normal place on disk. The "magic" behind journaling is that the disk blocks modified during a transaction are not written until after the entire transaction is success- fully written to the log.


Tags : disk,system,written,journal,blocks,memory,entry,modified,all,logging,file,data,until





Terms    |    Link pdf-search-files.com    |    Site Map
   |    Content Removal Notice   
   |    Contact   

All books are the property of their respective owners.
Please respect the publisher and the author for their creations if their books copyrighted