From owner-freebsd-fs@FreeBSD.ORG Tue Aug 31 16:08:43 2010 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 53AEB10656AB for ; Tue, 31 Aug 2010 16:08:43 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta14.westchester.pa.mail.comcast.net (qmta14.westchester.pa.mail.comcast.net [76.96.59.212]) by mx1.freebsd.org (Postfix) with ESMTP id 020788FC27 for ; Tue, 31 Aug 2010 16:08:42 +0000 (UTC) Received: from omta17.westchester.pa.mail.comcast.net ([76.96.62.89]) by qmta14.westchester.pa.mail.comcast.net with comcast id 10r61f0071vXlb85E48jJi; Tue, 31 Aug 2010 16:08:43 +0000 Received: from koitsu.dyndns.org ([98.248.41.155]) by omta17.westchester.pa.mail.comcast.net with comcast id 148h1f00M3LrwQ23d48i80; Tue, 31 Aug 2010 16:08:43 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 992219B425; Tue, 31 Aug 2010 09:08:40 -0700 (PDT) Date: Tue, 31 Aug 2010 09:08:40 -0700 From: Jeremy Chadwick To: Martin Cracauer Message-ID: <20100831160840.GA74125@icarus.home.lan> References: <20100830225841.GA9363@cons.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100830225841.GA9363@cons.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-fs@freebsd.org Subject: Re: fsync(2) and on-disk write-back cache X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2010 16:08:43 -0000 On Mon, Aug 30, 2010 at 06:58:42PM -0400, Martin Cracauer wrote: > I always assumed the answer to this question is "of course": > > When doing an fsync (waiting for the commit), do we actually tell the > disk to flush the on-disk write-back cache (if that is in use) to the > platters? > > I just went down some code paths in both FreeBSD and Linux and in both > cases the paths for fsync quickly disappear in the generic > block-by-block flushing code that is also used for regular (non-fsync) > flushing. I didn't see anything aware of the on-disk cache. I don't have an authoritative answer to your question, but this thread seems to imply there's a relation between fsync() and an intentional disk flush (BIO_FLUSH). I'm sure when BIO_FLUSH is called depends on the filesystem as well. Funny timing this topic, given a post over in -stable: http://lists.freebsd.org/pipermail/freebsd-stable/2010-August/058525.html -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |