From owner-freebsd-current@FreeBSD.ORG Fri Aug 5 09:38:52 2005 Return-Path: X-Original-To: current@FreeBSD.ORG Delivered-To: freebsd-current@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0330F16A420 for ; Fri, 5 Aug 2005 09:38:52 +0000 (GMT) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.FreeBSD.org (Postfix) with ESMTP id A3CD043D45 for ; Fri, 5 Aug 2005 09:38:49 +0000 (GMT) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.13.4/8.13.4) with ESMTP id j759ciT1051026; Fri, 5 Aug 2005 13:38:44 +0400 (MSD) (envelope-from ache@nagual.pp.ru) Received: (from ache@localhost) by nagual.pp.ru (8.13.4/8.13.4/Submit) id j759ch9W051025; Fri, 5 Aug 2005 13:38:43 +0400 (MSD) (envelope-from ache) Date: Fri, 5 Aug 2005 13:38:43 +0400 From: Andrey Chernov To: Peter Jeremy Message-ID: <20050805093842.GA50882@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Peter Jeremy , Maxim.Sobolev@portaone.com, Dan Nelson , "current@freebsd.org" References: <42F0CCD5.9090200@portaone.com> <20050803150117.GD93405@dan.emsphone.com> <42F0E9B2.9080208@portaone.com> <20050804060251.GA21228@nagual.pp.ru> <20050804063908.GA21871@nagual.pp.ru> <20050804075711.GB271@cirb503493.alcatel.com.au> <20050804082527.GA22992@nagual.pp.ru> <20050804104236.GC271@cirb503493.alcatel.com.au> <20050804105208.GA26150@nagual.pp.ru> <20050804193848.GC2104@cirb503493.alcatel.com.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050804193848.GC2104@cirb503493.alcatel.com.au> User-Agent: Mutt/1.5.9i Cc: Maxim.Sobolev@portaone.com, Dan Nelson , "current@freebsd.org" Subject: Re: Sub-optimal libc's read-ahead buffering behaviour X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2005 09:38:52 -0000 On Fri, Aug 05, 2005 at 05:38:48AM +1000, Peter Jeremy wrote: > Consider buffered stdio to a disk device. The underlying device > requires I/O to be in multiples of 512 bytes with an offset at > multiples of 512 bytes. IMHO, these alignment requirements should > be hidden from the user - I should be able to write code like: > c = getc(disk); > fseek(disk, 3, SEEK_CUR); > w = getw(disk); > fseek(disk, 1, SEEK_CUR); > c1 = getc(disk); > fseek(disk, c1, SEEK_CUR); > to work my way through data on the disk. Currently, I can't do that > because the fseek() is transparent and the underlying lseek() will > fail. Instead, I need to write code like: If the underlying lseek() fails, it sounds like _driver_ problem. Ideally it should hide all internal I/O granulation from the user and allow seek to any position. If the position is in the middle, the driver can transfer only needed part of block. So, don't blame _stdio_ for not nice driver behaviour. Looking more practical, aligned seeks and blocked read are enough in most situations, so there is no urgent demand to complicate drivers to do nice things. -- http://ache.pp.ru/