LWN.net Logo

Write barriers

Write barriers

Posted Jan 24, 2009 2:21 UTC (Sat) by dlang (✭ supporter ✭, #313)
In reply to: Write barriers by i3839
Parent article: Ext4 to be standard for Fedora 11, Btrfs also included (heise online)

in this case it is known that ext3 ignoring barriers puts data at risk, but the performance overhead of turning them on by default (something like 30%) was deemed 'too expensive' by one person, so they remain off

I think you will find arguments where Ted Tso is arguing that they need to be on for data safety and Andrew says that it's unacceptable to introduce the performance regression that would result from doing so.


(Log in to post comments)

Write barriers

Posted Jan 26, 2009 20:29 UTC (Mon) by zlynx (subscriber, #2285) [Link]

Ext3 generally works without barriers because hard drive write caches usually write the journal first for whatever reasons. From what I recall reading, because the journal is all in one chunk at the beginning of the drive far away from the data, and that write caches usually flush in-order from lowest block to highest.

Note all the generally and usually qualifiers in there.

I recall reading about Ext3 journal corruption issues when the power fails as the journal is wrapping around, because the drive writes the end of the journal, some data, then back to the beginning of the journal instead of writing end of the journal, start of the journal, some data.

Write barriers

Posted Jan 29, 2009 16:47 UTC (Thu) by anton (guest, #25547) [Link]

Who knows what drives do or don't do when in write-caching mode? The last time I tested this 10 years ago the drives I used apparently wrote the blocks in-order, except when a block was overwritten; then the data might never reach the platter (if it's overwritten again and again). I should do some experiments with my new drives.

Also, why should writing to the journal first be safer than writing the other stuff first? With meta-data journaling as typically used in ext3 this would lead to typical meta-data update bugs.

Actually the data=ordered mode writes the data before the corresponding journal entries to prevent that from happening. So if the disks then write the journal entries before the data thanks to write-caching disks without barriers, that subverts the safety data=ordered provides. If the disks write stuff out-of-order in other ways, other failure modes are possible.

I guess that the reason we don't see lots of reports of data destroyed by ext3 without barriers is that most people don't have lots of write traffic going on (but then they won't notice any performance penalty from barriers either), and you expect to lose the file you write when the system dies anyway.

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds