Re: [PATCH 1/7] block: Add block_flush_device()

Linus Torvalds
2009-03-31T03:01:35Z

On Mon, 30 Mar 2009, Ric Wheeler wrote:
>
> One thing the caller could do is to disable the write cache on the device.

First off, that's not the callers job. If the sysadmin enabled it, some
random filesystem shouldn't disable it.

Secondly, this whole insane belief that "write cache" has anything to do
with "unable to flush" is just bogus.

> A second would be to stop using the transactions - skip the journal,
> just go back to ext2 mode or BSD like soft updates.

f*ck me, what's so hard with understanding that EOPNOTSUPP doesn't mean
"no ordering". It means what it says - the op isn't supported. For all you
know, ALL WRITES MAY BE TOTALLY ORDERED, but perhaps there is no way to
make a _single_ write totally atomic (ie the "set barrier on a command
that actually does IO").

Besides, why the hell do you think the filesystem (again) should do
something that the admin didn't ask it to do.

If the admin wants the thing to fall back to ext2, then he can ask to
disable the journal.

> Basically, it lets the file system know that its data integrity building
> blocks are not really there and allows it (if it cares) to try and minimize
> the chance of data loss.

Your whole idiotic "as a filesystem designer I know better than everybody
else" model where the filesystem is in total control is total crap.

The fact is, it's not the filesystems job to make that decision. If the
admin wants to have write caching enabled, the filesystem should get the
hell out of the way.

What about laptop mode? Do you expect your filesystem to always decide
that "ok, the user wanted to spin down disks, but I know better"?

What about people who have UPS's and don't worry about that part? They
want write caching on the disk, and simply don't want to sync? They still
worry about OS crashing, since they run random -git development kernels?

In short, stop this IDIOTIC notion that you know better. YOU DO NOT KNOW
BETTER. The filesystem DOES NOT KNOW BETTER. It should damn well not do
those kinds of decisions that are simply not filesystem decisions to make!

Linus