tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: write alignment matters?



On Sat, 25 Jun 2011, der Mouse wrote:

> That "what it is reasonable for a disk to do" consensus *is* the
> interface spec I was talking about, not the de-jure non-spec of "you
> get whatever the device (via its driver) feels like giving you".

That's sort of the point.  If you want "what it is reasonable for a disk 
to do" you should be using the block device (which should actually be 
called the "character emulation for block device" but this being unix 
everything is truncated.)

The raw device is supposed to be just that: a raw interface to the device.  
It gives you access to all the mis-behavior of the device with all its 
gory niggling little details.  

There are two reasons to use the raw interface.  The first is if you need 
to rely on some peculiarity of the device which is prevented by the 
assistance the OS gives you on the block interface.  The second is the 
reduced overhead you can get if you think you can do a better job of 
implementing a buffer cache than the OS can.  This is often true for 
DBMSs.

Keep in mind that Linux does not have a raw device and everything always 
went through the block device and block/buffer/page cache-du-jour.  To 
make the DBMS guys happy O_DIRECT was recently added.

So if you can tweak the HBA driver to get rid of the hardware alignment 
restrictions it's a good thing as long as it doesn't affect performance.  
But if you need to use bounce buffers then use the block device.  It's 
what it's there for.

Eduardo


Home | Main Index | Thread Index | Old Index