From owner-freebsd-fs@FreeBSD.ORG Wed Sep 1 06:48:20 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 3D0C610656AE for ; Wed, 1 Sep 2010 06:48:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 930618FC1E for ; Wed, 1 Sep 2010 06:48:19 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o816m5iw082303 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 1 Sep 2010 09:48:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o816m5Xf032224; Wed, 1 Sep 2010 09:48:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o816m5uB032223; Wed, 1 Sep 2010 09:48:05 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 1 Sep 2010 09:48:05 +0300 From: Kostik Belousov To: Martin Cracauer Message-ID: <20100901064805.GF2396@deviant.kiev.zoral.com.ua> References: <20100830225841.GA9363@cons.org> <20100831160840.GA74125@icarus.home.lan> <20100831230728.GA36384@cons.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Zv6RaYeLzrVfNTUZ" Content-Disposition: inline In-Reply-To: <20100831230728.GA36384@cons.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua 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: Wed, 01 Sep 2010 06:48:20 -0000 --Zv6RaYeLzrVfNTUZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 31, 2010 at 07:07:28PM -0400, Martin Cracauer wrote: > Benjamin Kaduk wrote on Tue, Aug 31, 2010 at 12:12:04PM -0400:=20 > > On Tue, 31 Aug 2010, Jeremy Chadwick wrote: > >=20 > > >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. >=20 > I just went the for-dummies way and annotated all relevant BIO_FLUSH > places with debug print statements. They don't seem to be called when > doing an fsync on a file in a local filesystem. ufs (no softupdates) > -> old-style SCSI disk. >=20 > I'll snoop around some more, try it on ZFS/SATA and do some timing > tests. Be assured that all variants of UFS (sync, async, SU, SU+J) do not call BIO_FLUSH. --Zv6RaYeLzrVfNTUZ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkx99yQACgkQC3+MBN1Mb4jcqQCgyqLtkAiTxZoEw9bmpPfUteaC UiIAoO4PRdQ7q/P3EAjErhh7h2G/m7IZ =lyKn -----END PGP SIGNATURE----- --Zv6RaYeLzrVfNTUZ--