From owner-freebsd-current Wed Feb 25 18:57:52 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA07965 for freebsd-current-outgoing; Wed, 25 Feb 1998 18:57:52 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from lamb.sas.com (root@lamb.sas.com [192.35.83.8]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA07959 for ; Wed, 25 Feb 1998 18:57:50 -0800 (PST) (envelope-from jwd@unx.sas.com) Received: from mozart (markham.southpeak.com [192.58.185.8]) by lamb.sas.com (8.8.7/8.8.7) with SMTP id VAA04499 for ; Wed, 25 Feb 1998 21:57:43 -0500 (EST) Received: from iluvatar.unx.sas.com by mozart (5.65c/SAS/Domains/5-6-90) id AA12271; Wed, 25 Feb 1998 21:57:43 -0500 From: "John W. DeBoskey" Received: by iluvatar.unx.sas.com (5.65c/SAS/Generic 9.01/3-26-93) id AA06409; Wed, 25 Feb 1998 21:57:42 -0500 Message-Id: <199802260257.AA06409@iluvatar.unx.sas.com> Subject: vfs_bio.c/vfs_page_set_valid() NFS bug (and fix) To: freebsd-current@FreeBSD.ORG Date: Wed, 25 Feb 1998 21:57:42 -0500 (EST) Cc: jwd@unx.sas.com (John W. DeBoskey) X-Mailer: ELM [version 2.4 PL23] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, Please commit the following patch to vfs_bio.c/vfs_page_set_valid(). * $Id: vfs_bio.c,v 1.151 1998/02/11 20:06:48 dg Exp $ # diff vfs_bio.c.orig vfs_bio.c 2127c2127 < ev = off + (bp->b_validend & ~(DEV_BSIZE - 1)); --- > ev = off + ((bp->b_validend + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1)); Due to the incorrect (trunc'ing) of ev, no partial block caching is done for NFS based files. ie: A file of 16385 bytes will have the 1st 16k correctly cached, but the single byte of data will always be dumped, thus forcing a readrpc to always be executed. The above has been tested and works correctly. I also beleive that 'sv' is incorrectly calculated, and should be done as a trunc (like ev was). sv = off + ((bp->b_validoff + DEV_BSIZE - 1) & ~(DEV_BSIZE - 1)); should be: sv = off + (bp->b_validoff & ~(DEV_BSIZE - 1)); I have not tested this out though with a physical gdb -k session and an appropriate test program. Your comments are welcome. Summary: sv should be trunc'd to the next lower DEV_BSIZE boundary. ev should be rounded up to the next higher DEV_BSIZE boundary. This causes a major performance boost for nfs mounted system builds. Thanks, John ps: Now to work on the unrequired lookup & attr calls. pss: I beleive that there are some bugs in either nfsstat or the actual data collection scheme. nfsstat is supplying information that doesn't match what I'm getting with my sniffer. I trust the sniffer. Comments? -- jwd@unx.sas.com (w) John W. De Boskey (919) 677-8000 x6915 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message