btrfs fscked up, too?
Posted Mar 17, 2009 10:22 UTC (Tue) by
forthy (guest, #1525)
In reply to:
btrfs fscked up, too? by tytso
Parent article:
Garrett: ext4, application expectations and power management
Sorry, you still refer to the fact that POSIX "allows" to replace all
files with pumpkins in case of a crash (especially for squashfs, this is
the "obviously right" action ;-). That's not the issue, that's not what
we discuss here - we are talking about file systems doing something
actually reasonable in case of a crash, which is similar to well
specified behavior under normal operation. If you rename a file during
operation, and at the same time open that file in another process, and
read it, you either read the old data or the new data, but no empty
files, no garbage files, no pumpkins (unless, of course, the file
deliberately contains a pumpkin image). It is obvious that file metadata
is closely tied to actual file data.
BTW reading: I've implemented two Forth compilers from a standard back
in the early 90s, and I've been doing my best to implement reasonable
behavior in those corner cases where the standard says "an ambiguous
condition exists...". The Forth community was quite picky back then about
all those ambiguous conditions in the standard, because many people were
used to well-defined behavior from their particular systems they used -
however, this well-defined behavior might not have been portable. The
result of the discussion was that I first started to make one of these
two Forth compilers a "model implementation", which had well-defined
behavior on those parts where the standard was just sloppy without proper
reason. This continued over time, and now the community is revising the
standard, and we are now trying to be more precise and less ambiguous
(the draft standard document now even includes a test suite). So now, I'm
not just reading standard documents, I'm writing them.
What resulted of this activity on my side is a different view upon
standard documents, and how to read them. Standards encode common
practice. People have not always been careful when implementing things. A
standard document is a compromise between different systems. If you
implement your system, it's not your job to find excuses for unreasonable
behavior, it's your job to find reasonable ways to deal with ambiguous
conditions. And if you are really good at it, it's your job to implement
these things in a way that can serve as model for others (it's always the
duty of those who are good to serve as example). Take the compiler
example again: If a symbol encountered by the compiler is neither a
number nor a pre- or user-defined function or variable, this is an
ambiguous condition. The compiler is "allowed" by the standard to
transform the user into a pumpkin (by magic, of course), teaching him a
final lesson about proper programming. The reasonable action on a syntax
error however is to print a message which states file, source line and
position within that line, plus a meaningful error message about the
problem. No language standard will define this action. Yet, most
compilers in the world (regardless of the language) stick to that
behavior, and even use a similar output format to make IDEs happy.
I hope you now understand why I say you didn't read POSIX, but you
duck behind it. With "reading" I mean: Try to find out what best practice
would be in a case where POSIX indeed does not really define how it
should be. And "best practice" is both what your users will be happy with
and what serves as good example for other file system writers (pumpkins
are no option). If you raise the bar of expectation, do it.
(
Log in to post comments)