From owner-freebsd-fs@FreeBSD.ORG Thu Nov 28 07:18:27 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00CDC858 for ; Thu, 28 Nov 2013 07:18:26 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7F2C519FA for ; Thu, 28 Nov 2013 07:18:26 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id rAS7IMDt012306; Thu, 28 Nov 2013 09:18:22 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua rAS7IMDt012306 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id rAS7ILol012305; Thu, 28 Nov 2013 09:18:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 28 Nov 2013 09:18:21 +0200 From: Konstantin Belousov To: Kirk McKusick Subject: Re: RFC: NFS client patch to reduce sychronous writes Message-ID: <20131128071821.GH59496@kib.kiev.ua> References: <661293549.22251424.1385592648623.JavaMail.root@uoguelph.ca> <201311272320.rARNKEKQ045789@chez.mckusick.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="GI+6NRUBHXI5NCMC" Content-Disposition: inline In-Reply-To: <201311272320.rARNKEKQ045789@chez.mckusick.com> User-Agent: Mutt/1.5.22 (2013-10-16) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: FreeBSD FS X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Nov 2013 07:18:27 -0000 --GI+6NRUBHXI5NCMC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Nov 27, 2013 at 03:20:14PM -0800, Kirk McKusick wrote: > The ``fix'' of bzero'ing every buffer cache page was made to UFS/FFS > for this problem and it killed write performance of the filesystem > by nearly half. We corrected this by only doing the bzero when the > file is mmap'ed which helped things considerably (since most files > being written are not also bmap'ed). I am not sure that I follow. For UFS, leaving any part of the buffer with undefined garbage would cause the garbage to appear on the next mmap(2), since page in is implemented as translation of the file offsets into disk offsets and than reading disk blocks. The read always fetch full page. UFS cannot know if the file would be mapped sometime in future, or after the reboot. In fact, UFS is quite plentiful WRT zeroing buffers on write. It is easy to see almost all places where it is done, by searching for BA_CLRBUF flag for UFS_BALLOC(). UFS does perform the optimization of _trying_ to not clear newly allocated buffer on write if uio covers the whole buffer range. Still, on error it falls back to clearing, which is performed by vfs_bio_clrbuf() call in ffs_write(). --GI+6NRUBHXI5NCMC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJSlu48AAoJEJDCuSvBvK1BGvAP+wdCrnmlXGV5S8Rc6S8aYqP3 +gLf+MmOOkEkbUttXgt6UU56pDZ0gm9NPGwTwdIT5YkjJ6gAvnA3jwFJ1Sqf8NC7 x1cKrXsy5/GIpKfa/mtFrLjVQk+dqYCNWA3tvqPHIQlhEu9sV2G8SpFqu1OcTUpu 3Kzi8/nC75Il2WsjaU3zk7NTiFdyg0iaCg5vm0IlA/P9GF721jEMpue+ccyvgpXQ FZr9OO2Wq8rKNuGE/dzV33Tj67/yRgkLxqBjZz84g7BXslS3dhVazfrA/UnNJRJr J7oZV7L9ot2t5RgAdxWLbDYsLc4OpjtzFQ6WjxyRNVZgrOGfSwIJbIqSDflRlVsm NbJLoaBoDvVUj4Okv/PhMTxcicFFfwDqO8IhLa6ETvMEt+9pqjJDgx9WmBBfTkLX xAfm91wes3J+fOaRozLSh8Gwg2S7s/VOFDibp2f7Zh97AMGAzpB5vXecEAd6S4fu 7Xk3TCVrWrYCGMFhH7ftFUFKY1rEteN584xcNWEjeFoILt+K+DctuVBx6MkQQ7ud zAUcVAWypvzhdM86N7l+Fl+9RsGuxheVdFvbRnhcefXD3hzqojcPWY/0MLKw4h5e NGR7bea73Xr5R5wt2ldTCFZcTpSBMHGj4/n0Qk7ILCd6yi79fJSIakFalgPWWkhY YjilSDQU+SiHxg/6kb/z =D01p -----END PGP SIGNATURE----- --GI+6NRUBHXI5NCMC--