From owner-freebsd-current@FreeBSD.ORG Wed Oct 1 21:15:29 2003 Return-Path: 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 2D32616A4B3 for ; Wed, 1 Oct 2003 21:15:29 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id A5D8C43F85 for ; Wed, 1 Oct 2003 21:15:27 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id OAA30875; Thu, 2 Oct 2003 14:14:45 +1000 Date: Thu, 2 Oct 2003 14:12:59 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Nate Lawson In-Reply-To: <20031001111502.F85421@root.org> Message-ID: <20031002135340.O8330@gamplex.bde.org> References: <20030930172903.S82394@root.org> <20031001142825.K4031@gamplex.bde.org> <20031001111502.F85421@root.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@freebsd.org Subject: Re: umass(4)/uhci(4) REALLY slow X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Thu, 02 Oct 2003 04:15:29 -0000 On Wed, 1 Oct 2003, Nate Lawson wrote: > On Wed, 1 Oct 2003, Bruce Evans wrote: > > On Tue, 30 Sep 2003, Nate Lawson wrote: > > > Here are "iostat 5" results for my USB thumb drive on a uhci(4) controller > > > with 5.1-CURRENT. On windows on the same box, it runs reasonably quickly. > > > On FreeBSD, it really lags. This is for a cp of a large file to a > > ... > > This is probably due to something we're not doing in msdosfs. 1K is > > probably your msdosfs file system block size. > > Yes, I checked and it has a 1K block size. The flash device is 64 MB. > > > msdosfs is missing support > > for clustering. None of the lower levels (buffer cache, driver, usb) > > in FreeBSD does clustering (the buffer cache has some support for it, > > ... > > What would need to be done to add msdosfs clustered reads/writes or > perhaps do this in a more general way in the buffer cache? Not a lot for msdosfs. Basically, add some B_CLUSTEROK's and vfs_bio_awrite()s, and 1 cluster_write() to msdosfs_write(). Merge them from ffs_write(). Better, merge more of ffs_write(). IIRC, using cluster_write() is only a small optimization -- write clustering mostly work if you throw everything into the buffer cache using bdwrite() without neglecting to set B_CLUSTEROK. Not much more for the buffer cache if you only do what bdwrite() and B_CLUSTEROK do. Non-delayed writes can't be clustered very effectively at the buffer cache level. Similarly for read clustering except it is cluster_read() and larger read-ahead instead of cluster_write() and B_CLUSTEROK/vfs_bio_awrite() that are needed. The file system must be more involved since reads are less predictable than writes at the buffer cache level. Bruce