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

Re: Ordered Mode vs Journaled Mode

On Oct 02, 2001  14:55 -0700, Mike Fedyk wrote:
> I've been wondering exactly what you gain by using journaled mode over
> ordered mode.
> Are there any known cases where journaled mode could recover where ordered
> mode wouldn't?

I don't think it's as much an issue of recoverability (from the fs metadata
point of view) as it is for data integrity.

With ordered or writeback mode, it is possible that you are in the middle
of writing data into your file when you get a crash.  What is in the file?
Half new data and half old data.  If you have journaled data mode, then
either the data made it into the journal along with the metadata (in which
case it ALL makes it into the file) or the transaction is incomplete (in
which case none of the data is written to your file).

While this isn't 100% true (i.e. if you have very large writes they will
be split into multiple transactions) it is mostly true.

You are also protected from disk hardware problems, where they write
garbage to the disk in a powerfail situation.  If garbage goes to disk
either it is in the journal (where it is discarded) or it will be written
to the filesystem again at journal recovery time.

Finally, data journalling is _way_ faster if you are doing synchronous I/O
like for a mail server.  Both the data and metadata are written in one
pass to the journal, so no seeking, and you can return control to the
application knowing the data is safe.  It can then re-order writes to the
fs safely, since it will be recovered in case of a crash.

Obviously, data journaling adds a lot more overhead to a system, so it
isn't for everyone.  In most cases, however, you don't use your disks at
full speed anyways, so there is little real impact.

Cheers, Andreas
Andreas Dilger  \ "If a man ate a pound of pasta and a pound of antipasto,
                 \  would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/               -- Dogbert

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