Block device

Scott Long scottl at samsco.org
Tue Nov 4 08:33:26 PST 2008


Patrick M. Hausen wrote:
> h, all,
> 
> On Tue, Nov 04, 2008 at 03:32:01PM +0100, d_elbracht wrote:
>> Hi list,
>>
>> can someone please explain, why 
>>  	stat -x /dev/da1
>>
>> show the SCSI-Drive as a character-device ?
> 
> http://www.freebsd.org/doc/en/books/arch-handbook/driverbasics-block.html
> 

Wow that's a confusing and misleading article.

1. disk access in the driver layer still happens on a block basis.  It's
true that to the application layer, the device has character dev
semantics, meaning that arbitrary numbers of bytes can be accessed
randomly without any restrictions.  But deep down inside the kernel,
it's still doing block-by-block access.

2. caching still happens at the filesystem level.  Doing I/O directly to
/dev/daX or adX or whatever will not be cached/buffered, but doing I/O 
to a file on any of these devices will.

3. Cache coherency between the block and character device
representations was indeed an issue, but removing the block/cached
representation was really a matter of policy over tools, and it's
one reason why FreeBSD gets creamed in the silly-io-benchmarch
department.

4. However, in the not-so-silly-io-benchmark department, I think FreeBSD
does a whole lot better because you don't have the blind caching of the
block device trying to out-guess what the filesystem is trying to do.

Scott


More information about the freebsd-stable mailing list