Tracker in Edgy?

John Richard Moser nigelenki at
Sun Jul 2 20:39:35 BST 2006

Hash: SHA1

Jamie McCracken wrote:
> John Richard Moser wrote:
>> Data journaling does not magically solve anything, it just slows things
>> down.  As for meta-data journaling, different implementations have
>> different problems; some methods can truncate if you're shrinking a
>> file, some methods can zero-fill a file for whatever reason, and some
>> will just remove the file.
> With FS that support atomic file operations , it gives you protection
> against half written records ( and I presume resizes too else it
> wouldn;t be atomic then!). Updates to a file either happen completely or
> not at all.
> To quote Reiser4 : Reiser4 is an atomic filesystem, which means that
> your filesystem operations either entirely occur, or they entirely
> don't, and they don't corrupt due to half occuring. We do this without
> significant performance losses, because we invented algorithms to do it
> without copying the data twice.

"without copying data twice" => Data is written where it belongs on disk
once.  Data journaling writes data to the journal, then to the
allocation unit.

As for not corrupting, the file system isn't corrupt because it lost a
few thousand files, or truncated them.  It's corrupt because three files
point to the same allocation unit; the free space count plus the used
space count doesn't equal the size of the file system; and/or blocks are
denoted in use when they really aren't.  Journaling does not prevent
data loss from crash/power fail; it prevents data loss from using a file
system that's not in a consistent state.

> This is what Im referring to wrt to making mysql super robust (I presume
> *data* journaling gives you atomic updates). You shouldn't have to worry
> about DBs corrupting with an atomic journalised FS (providing its not
> buggy of course!).

No, the file system is "atomic" because meta-data changes are atomic.  A
file uses 16KiB of space in 4 4KiB blocks, 0x0a 0x0b 0x0c 0x0d.  If you
truncate the file, you have to:

 - Set its size to 0
 - Update its mtime and atime
 - Mark blocks 0x0a 0x0b 0x0c 0x0d as free
 - Subtract 16KiB from file system usage
 - Add 16KiB to file system free space
 - Adjust quota values

A journaled file system is atomic because it will make note the change
being made and make sure that no matter how many times you down the
system in the process, when it comes back up it will A) reverse the
changes; or B) apply the changes correctly.  It either undoes it or
starts over from the beginning; but before the file system is finished
mounting, it will be in a consistent state.

Think of what a fsck does, and then isolate the reason it's needed, and
then refine this to make sure there's always a record of what the FS may
have been doing at the time so you have enough information to locate and
correct any damage without a full file system scan.  That's a journal.


- --
All content of all messages exchanged herein are left in the
Public Domain, unless otherwise explicitly stated.

    Creative brains are a valuable, limited resource. They shouldn't be
    wasted on re-inventing the wheel when there are so many fascinating
    new problems waiting out there.
                                                 -- Eric Steven Raymond

    We will enslave their women, eat their children and rape their
                  -- Bosc, Evil alien overlord from the fifth dimension
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla -


More information about the ubuntu-devel mailing list