Ts'o: Delayed allocation and the zero-length file problem
Posted Mar 13, 2009 16:14 UTC (Fri) by forthy
In reply to: Ts'o: Delayed allocation and the zero-length file problem
Parent article: Ts'o: Delayed allocation and the zero-length file problem
You have the same problems with badly designed
applications with XFS or Btrfs, for example.
Actually, not with Btrfs. This is a log structured file system with
COW, i.e. it preserves file system operation order. You either get new
data and new metadata, or you get old data and old metadata, but no mix
like in ext4 or XFS. BTW: This discussion is old as dirt. See Anton
Ertl's very old rant on it: What's
wrong with synchronous metadata updates. If you don't understand
what's wrong with synchronous metadata updates, don't even try to write a
robust file system. You can still write a fast, but fragile file system,
but this doesn't need synchronous metadata updates.
If you move the problem of creating a consistent file system to the
applications, you will fail. fsync() only syncs the data - the metadata
still can be whatever the file system designer likes (old, new, not yet
allocated, trash that will settle down in five seconds). The file system
still can be broken beyond repair after a crash. And using fsync() is
horribly slow, increases file system fragmentation, and so on. If you are
a responsible file system designer, you don't mitigate your consistency
problems to the user. You solve them.
The fact that ext3 is broken the same way, just with a shorter period,
is no excuse. ReiserFS was broken in a similar way, until they added data
journalling as default. Btrfs gets it right by design, but then, we
better wait for Btrfs to mature than to "fix" ext4.
The applications in question like KDE are not broken. They just rely
on a robust, consistent file system. There is no guarantee for that, as
POSIX does not specify that the file system should be robust in case of
crashes. But it is a sound assumption for writing user code. If you can't
rely on your operating system, write one yourself.
to post comments)