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

Linus Torvalds
2009-03-31T16:08:04Z

On Tue, 31 Mar 2009, Linus Torvalds wrote:
>
> Ok? Until you can see the bigger picture, just don't bother.

And this is really what it boils down to. Abstraction. Bigger picture. And
the fact that the filesystem should DAMN WELL NOT THINK IT KNOWS WHAT IS
GOING ON!

This is also fundamentally why returning that particular error is
pointless. If the driver returns EOPNOTSUPP, there is simply never _any_
possible reason for upper layers to ever be informed about it - because
there is not _any_ possible situation where they can do anything about it.

Even _thinking_ that they can do something about it is fundamentally
flawed. It misses the entire point of having layering and abstraction and
having a "block layer" there to do these kinds of things.

If you want to write your filesystem so that it interacts with the
low-level device directly, go and write an MTD filesystem instead. Don't
even _claim_ to care about generic filesystems like 'ext3' or something
like that.

But if you try to be a "real" filesystem (ie general-purpose, meant to
work on any random block device), don't come and whine about it when the
block device then doesn't really do anything but read or write, or when
the driver literally doesn't even _know_ how to serialize something
because it doesn't even make sense in its world-view.

Don't mix up block layer and low-level driver issues with filesystem
issues. The filesystem should say "block layer: flush the pending writes".
And the block layer should try its best, but if the low-level driver says
"that operation doesn't make sense for me", the block layer should just
say "ok, whatever".

And the filesystem shouldn't know, and it most definitely mustr not act
any differently. Because that's behind the abstraction, and there's no
sane way to bring it _out_ of the abstraction that isn't fundamentally
flawed (like thinking that it's always a SATA-II drive).

Linus