Re: dedicated logging devices

From: Andreas Dilger (adilger@turbolabs.com)
Date: Fri Jun 09 2000 - 13:35:25 EST


Chris Meadors writes:
> Question: On a journaling file system do you want unwritten journal data
> written to disk after power is restored?

It is irrelevant if it actually makes it to disk or not (although, the more
that makes it to disk, the less new data lost).

> I guess if the OS thinks it has hit the physical disk then it would be
> fine to commit it. So what if you didn't have a battery backed cache, and
> data the OS thought was on disk didn't make it?

What happens with the ext3 journalling is along the lines of:

1) the data/metadata is written to a journal.
2) once the journal is on definitely on disk, the journal thread copies the
   data from the journal to the actual location in the filesystem.
3) when the data has been copied from the journal to the correct place in
   the filesystem, the journal marks that this transaction is complete.

If you crash during (1), then it is like the operation never happened.
If you crash during (2), then the recovery copies the data from the journal
to the disk again.
If you crash before (3), see (2). If you crash after (3) then you don't
care, as the change has been saved to disk. Goto (1) for next change.

What you REALLY don't want is for the disk to say that (1) is complete
when (2) starts. However, in the current ext3 implementation, there are
many seconds between (1) and (2), so normal disks will have written even
their internal caches in that time. There would be a problem if you had
a disk or cache controller with 10's of MB of write cache that didn't have
any battery backup.

> Should a journaled FS always have uncorrupt data in the files no matter
> what state the various caches are in?

In the case of the current ext3, yes. However, in the case of most
journal filesystems, no. The full-data-logging "feature" of ext3 is
currently there because it is easier to implement this way. In the
future it will be removed (hopefully with the option of keeping it
for those that want this).

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

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Jun 15 2000 - 21:00:19 EST