[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

how ext3 works



n the past few days, I've been reading about ext3/journalling/... In order to fully understand how it works I have a few questions.
 
*Imagine the following situation: you opened a file in vi(m), you are editing, but haven't yet saved your work. The system crashes: what will be the result? Will the metadata be modified (assume both atime and noatime)? Will the data itself be corrupted? Or will there be no modification whatsoever because you hadn't saved yet (your work will simply be lost)?
*What happens when the system crashes during a write to the journal? Can the journal be corrupted?
 
*About ext3's ordered mode
[quote]from Wikipedia:
Ordered
    (medium speed, medium risk) Ordered is as with writeback, but forces file contents to be written before its associated metadata is marked as committed in the journal.[/quote]

What's the sequence of events here?
1. user issues command to write his work to disk
2. metadata is recorded in the journal, but is marked as "not yet executed" (or something similar)
3. data (file contents) and metadata are written to disk
4. metadata flag is set as "executed"
 
If a crash happens between step 1 and 2, we are in the situation as described above (first situation): not yet written
If a crash happens between step 2 and 3, isn't this the same as writeback? Or is this impossible (I read something about a single transaction, but I forgot where)?
Crash between 3 and 4, can be corrected by replaying the journal.
 
Is this a correct view of things?

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]