lkml.org 
[lkml]   [1996]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: "raw" block devices?


On Thu, 17 Oct 1996, Ingo Molnar wrote:
> >
> > Sure, there are old-fashioned databases that think they can do a better job
> > of it than the kernel does. They are usually wrong, I suspect. They are using
> > raw devices more for historical reasons than anything else, and they could
> > just as well use a filesystem.
>
> [yes, raw devices are a hack, still RDBMS ppl use it because:]
>
> one not-so obvious problem is that an RDBMS >has< to implement a
> write-cache for itself. Thus if the block device would be buffered too (in
> the kernel), then we had double buffering. [as it is buffered now]

Not strictly true. Yes, there are ordering constraints, but you can handle
them on a filesystem too (and people do). A raw device gives you more
low-level control, but on the other hand it _also_ results in less chance for
the OS to optimize data transfers for those cases where the optimizations
would be valid.

You can handle write ordering by using a log-based database (never overwrite
any old data, so write ordering doesn't matter), and do a "fsync()" on the
file when you commit. Voila, you just got guarantees about the file being
on disk (assuming fsync() works as it is supposed to), and it doesn't
matter if the OS decided it needed to write out part of the data earlier
(in fact, that's only good for overlapping IO and calculations).

No, I'm not a database engineer, but I have a fairly good idea of what raw
device accesses do to the kernel and device layer, and that insight allows me
to call raw devices a bad idea. I suspect that whatever can be done with raw
devices can generally be done better (often in another way: I'm not saying
"done better the SAME way") with a filesystem approach.

The problem is generally the fact that people don't wan to do the better
way, they want to do it the way they are used to ;)

And yes, my opinions are definitely coloured by the fact that I don't like
raw devices. Don't take the above as gospel truth, but rather take it as the
reason why the raw devices don't exist..

Linus

\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.140 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site