From owner-freebsd-performance@FreeBSD.ORG Sun Mar 4 11:55:01 2007 Return-Path: X-Original-To: freebsd-performance@FreeBSD.org Delivered-To: freebsd-performance@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D84916A400 for ; Sun, 4 Mar 2007 11:55:01 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailout2.pacific.net.au (mailout2-3.pacific.net.au [61.8.2.226]) by mx1.freebsd.org (Postfix) with ESMTP id 0F74E13C481 for ; Sun, 4 Mar 2007 11:55:01 +0000 (UTC) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout2.pacific.net.au (Postfix) with ESMTP id CCD746E1B1; Sun, 4 Mar 2007 22:54:55 +1100 (EST) Received: from besplex.bde.org (katana.zip.com.au [61.8.7.246]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 8C44F2740A; Sun, 4 Mar 2007 22:54:58 +1100 (EST) Date: Sun, 4 Mar 2007 22:54:56 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alexander Leidinger In-Reply-To: <20070303110940.32893388@Magellan.Leidinger.net> Message-ID: <20070304225448.R7151@besplex.bde.org> References: <20070302120018.5830716A4A9@hub.freebsd.org> <45E8B994.2010100@umn.edu> <20070303110940.32893388@Magellan.Leidinger.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-performance@FreeBSD.org, Alan Amesbury Subject: Re: (S)ATA performance in FBSD 6.2/7.0 X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2007 11:55:01 -0000 On Sat, 3 Mar 2007, Alexander Leidinger wrote: > In FreeBSD we have 3 types, not 2. We have "sync", "noasync" (default) > and "async". Are you sure? 2 independent flags give 4 states. I think the flags are not completely independent, but sync doesn't cancel async in all cases (partly because of layering violations in ffs_update()) so sync together with async gives sync data with an undocumented combination of sync and async metadata. > For async the complete IO is done asynchronous (the meta-data too). Exccept possibly for (small) bugs. > And for sync the complete IO is synchronous. Except certainly for (larger) bugs. ffs_inode() normally refuses to do sync writes unless !DOINGASYNC(vp). When DOINGASYNC(vp), it mostly ignores its waitfor arg (this is its layering violation) and does a delayed write (not an async write, but an async write after a delay). This breaks cases where its caller wants to force a non-async write. Callers want to do this in the following cases: - sync together with async on the mount. sync should have precedence. I think the sync code knows to set waitfor = 1 for the call, but doesn't know that ffs_inode() will ignore the setting. - async on the mount with explicit fsync(2) or O_[F]SYNC. fsync(2) sets waitfor = 1, so the inode should get synced even if DOINGASYNC(vp), but it doesn't due to the layering violation. fsync(2) doesn't know how to sync all the directories above the file, and their metadata. O_[F]SYNC for the file together with async for the mount should work for the file like sync together with async for the mount work for all files, but has much the same bugs as fsync(2). > mount(8) tells this with some more words. It has related bugs. It literally says that sync and async have precedence over each other, but this is impossible. Bruce