From owner-freebsd-stable@FreeBSD.ORG Tue Nov 4 16:33:26 2008 Return-Path: Delivered-To: stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D935D1065680 for ; Tue, 4 Nov 2008 16:33:26 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 8F5798FC14 for ; Tue, 4 Nov 2008 16:33:26 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.local ([192.168.254.200]) (authenticated bits=0) by pooker.samsco.org (8.14.2/8.14.2) with ESMTP id mA4GWpkv033069; Tue, 4 Nov 2008 09:32:52 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <49107933.7070907@samsco.org> Date: Tue, 04 Nov 2008 09:32:51 -0700 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: "Patrick M. Hausen" References: <004901c93e8a$1b556500$639049d9@EC1a> <20081104145144.GB14539@hugo10.ka.punkt.de> In-Reply-To: <20081104145144.GB14539@hugo10.ka.punkt.de> X-Enigmail-Version: 0.95.6 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=3.8 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: stable@freebsd.org, d_elbracht Subject: Re: Block device X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 16:33:26 -0000 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