Block device

Ronald Klop ronald-freebsd8 at klop.yi.org
Tue Nov 4 16:04:43 PST 2008


On Tue, 04 Nov 2008 17:32:51 +0100, Scott Long <scottl at samsco.org> wrote:

> 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

This explains some things to me as a simple user reading the linked  
article.
I'm not a kernel programmer, but do understand computers and this article  
made me wonder if I missed something last years about disks and caches.

Ronald.


More information about the freebsd-stable mailing list