From owner-freebsd-fs@FreeBSD.ORG Tue Aug 31 16:12:09 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 DF1F310656A4 for ; Tue, 31 Aug 2010 16:12:09 +0000 (UTC) (envelope-from kaduk@mit.edu) Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU [18.9.25.12]) by mx1.freebsd.org (Postfix) with ESMTP id 9A8B58FC16 for ; Tue, 31 Aug 2010 16:12:09 +0000 (UTC) X-AuditID: 1209190c-b7c9cae00000753f-5c-4c7d29d89ff0 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-1.mit.edu (Symantec Brightmail Gateway) with SMTP id 9B.62.30015.8D92D7C4; Tue, 31 Aug 2010 12:12:08 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id o7VGC7MG016926; Tue, 31 Aug 2010 12:12:08 -0400 Received: from multics.mit.edu (MULTICS.MIT.EDU [18.187.1.73]) (authenticated bits=56) (User authenticated as kaduk@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id o7VGC53g001583 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 31 Aug 2010 12:12:06 -0400 (EDT) Received: (from kaduk@localhost) by multics.mit.edu (8.12.9.20060308) id o7VGC435001834; Tue, 31 Aug 2010 12:12:04 -0400 (EDT) Date: Tue, 31 Aug 2010 12:12:04 -0400 (EDT) From: Benjamin Kaduk To: Martin Cracauer In-Reply-To: <20100831160840.GA74125@icarus.home.lan> Message-ID: References: <20100830225841.GA9363@cons.org> <20100831160840.GA74125@icarus.home.lan> User-Agent: Alpine 1.10 (GSO 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Brightmail-Tracker: AAAAARXFYDA= 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:12:10 -0000 On Tue, 31 Aug 2010, Jeremy Chadwick wrote: > 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. It is probably also worth noting that disks have been known to lie about having actually flushed bits from their internal cache to the platter. -Ben Kaduk