From owner-freebsd-fs@FreeBSD.ORG Sat Nov 30 22:57:08 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AFD9EA40 for ; Sat, 30 Nov 2013 22:57:08 +0000 (UTC) Received: from esa-annu.net.uoguelph.ca (esa-annu.mail.uoguelph.ca [131.104.91.36]) by mx1.freebsd.org (Postfix) with ESMTP id 741001F82 for ; Sat, 30 Nov 2013 22:57:07 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqAEAAVsmlKDaFve/2dsb2JhbABZhBKCerVjgS90giUBAQUjBFIbDgoCAg0ZAlkGiBSvGo9TF4EpjSs0B4JrgUgDiUKgZYNHHoFu X-IronPort-AV: E=Sophos;i="4.93,804,1378872000"; d="scan'208";a="74165800" Received: from muskoka.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.222]) by esa-annu.net.uoguelph.ca with ESMTP; 30 Nov 2013 17:57:01 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 25CD7B3F51; Sat, 30 Nov 2013 17:57:01 -0500 (EST) Date: Sat, 30 Nov 2013 17:57:01 -0500 (EST) From: Rick Macklem To: Konstantin Belousov Message-ID: <1288055532.23818811.1385852221143.JavaMail.root@uoguelph.ca> In-Reply-To: <20131130132233.GZ59496@kib.kiev.ua> Subject: Re: RFC: NFS client patch to reduce sychronous writes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.209] X-Mailer: Zimbra 7.2.1_GA_2790 (ZimbraWebClient - FF3.0 (Win)/7.2.1_GA_2790) Cc: Kirk McKusick , 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: Sat, 30 Nov 2013 22:57:08 -0000 Kostik wrote: > On Thu, Nov 28, 2013 at 06:50:20PM -0500, Rick Macklem wrote: > > obcount = np->n_size - (lbn * biosize); > > *** This sets obcount to the byte offset within the buffer cache > > block of > > EOF before it is grown by this write (or file size mod biosize, > > if you prefer) > > bp = nfs_getcacheblk(vp, lbn, obcount, td); > > > > if (bp != NULL) { > > long save; > > > > mtx_lock(&np->n_mtx); > > np->n_size = uio->uio_offset + n; > > np->n_flag |= NMODIFIED; > > vnode_pager_setsize(vp, np->n_size); > > *** n_size is now grown to the new EOF for after the write. > > mtx_unlock(&np->n_mtx); > > > > save = bp->b_flags & B_CACHE; > > bcount = on + n; > > allocbuf(bp, bcount); > > bp->b_flags |= save; > > if (noncontig_write != 0 && bcount > obcount) > > vfs_bio_bzero_buf(bp, obcount, bcount - > > obcount); > > *** This zeros bytes from "obcount" (the offset of the old EOF) to > > "bcount" > > (which is the offset of EOF after the write). > > I believe that I got it now, the patch in the other message looks > fine. > Thank you for the patience. > Thanks for the review. It got me to look more closely at the patch and replace "bcount" with "on", plus other improvements. Have fun, rick