From owner-FreeBSD-users-jp@jp.freebsd.org  Sat Oct 12 13:31:31 1996
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) id NAA19591
	Sat, 12 Oct 1996 13:31:31 +0900 (JST)
Received: by mail.jp.freebsd.org (8.7.3+2.6Wbeta5/8.7.3) with ESMTP id NAA19586
	for <FreeBSD-users-jp@jp.freebsd.org>; Sat, 12 Oct 1996 13:31:29 +0900 (JST)
Received: by uno.sat.t.u-tokyo.ac.jp (8.7.3+2.6Wbeta5/8.7.3) with ESMTP
	id NAA06936; Sat, 12 Oct 1996 13:31:28 +0900 (JST)
To: FreeBSD-users-jp@jp.freebsd.org
X-Mailer: Mew version 1.06 on Emacs 19.28.1, Mule 2.3
Mime-Version: 1.0
Content-Type: Text/Plain; charset=iso-2022-jp
Date: Sat, 12 Oct 1996 13:31:28 +0900
Message-ID: <6934.845094688@sat.t.u-tokyo.ac.jp>
From: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
Reply-To: FreeBSD-users-jp@jp.freebsd.org
X-Distribute: distribute [version 2.1 (Alpha) patchlevel=19]
X-Sequence: FreeBSD-users-jp 5201
Subject: [FreeBSD-users-jp 5201] Re: NFS client performance of current
Errors-To: owner-FreeBSD-users-jp@jp.freebsd.org
Sender: owner-FreeBSD-users-jp@jp.freebsd.org

$B2<@n!wElBg$G$9(B.

karl> $B!d(Bfj.os.bsd.freebsd$B$K$bF1FbMF$N(Bpost$B$r$7$?$N$G$9$,!$(B
karl> $B!d0JA0$+$i(Bcurrent$B$N(BNFS$B$N@-G=$,:#0l$@$C$?$N$G!$D>$7$^$7$?!%(B
karl> $B!d$I$NDxEY2~A1$5$l$?$N$+$H!$(Bdelayed write$B$r(Bdefault$B$K$7$?$[$&$,NI$$$+(B
karl> $B!d$H$$$&$N$rCN$j$?$$$N$G!$8f6(NO$*4j$$$7$^$9!%(B
karl> 
karl>   2.2-961006-SNAP(98) $B$GF~$l$F$_$?$$$N$G!"J,NL$,Bg$-$/(B
karl> $B$J$1$l$P(Bcommit$B$7$?%Q%C%A$H8@$&$b$N$rEj9F$7$F$b$i$($^$9(B
karl> $B$+!)(B

$B$H$C$F$b>.$5$$$N$G(Bpost$B$7$^$9!%(B
$BB.$$(Bclient$B$[$I8z2L$,$"$k$H;W$$$^$9!%(B

$B!t$H$$$&$+!$A0$OB.$$(Bclient$B$[$ICY$+$C$?!%!%!%!%(B

Index: nfs_bio.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/nfs/nfs_bio.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -c -r1.25 -r1.26
*** nfs_bio.c	1996/09/19 18:20:54	1.25
--- nfs_bio.c	1996/10/11 10:15:30	1.26
***************
*** 34,40 ****
   * SUCH DAMAGE.
   *
   *	@(#)nfs_bio.c	8.5 (Berkeley) 1/4/94
!  * $Id: nfs_bio.c,v 1.25 1996/09/19 18:20:54 nate Exp $
   */
  
  #include <sys/param.h>
--- 34,40 ----
   * SUCH DAMAGE.
   *
   *	@(#)nfs_bio.c	8.5 (Berkeley) 1/4/94
!  * $Id: nfs_bio.c,v 1.26 1996/10/11 10:15:30 dfr Exp $
   */
  
  #include <sys/param.h>
***************
*** 46,51 ****
--- 46,52 ----
  #include <sys/vnode.h>
  #include <sys/mount.h>
  #include <sys/kernel.h>
+ #include <sys/sysctl.h>
  
  #include <vm/vm.h>
  #include <vm/vm_param.h>
***************
*** 65,70 ****
--- 66,74 ----
  extern int nfs_numasync;
  extern struct nfsstats nfsstats;
  
+ int nfs_dwrite = 1;
+ SYSCTL_INT(_vfs_nfs, OID_AUTO, dwrite, CTLFLAG_RW, &nfs_dwrite, 0, "");
+ 
  /*
   * Ifdefs for FreeBSD-current's merged VM/buffer cache. It is unfortunate
   * that this isn't done inside getblk() and brelse() so these calls
***************
*** 750,755 ****
--- 754,767 ----
  	 * synchronously.
  	 */
  	if (bp->b_flags & (B_READ | B_WRITEINPROG | B_NOCACHE))
+ 		return (EIO);
+ 
+ 	/*
+ 	 * Allow the administrator to override the choice of using a delayed
+ 	 * write since it is a pessimization for some servers, notably some
+ 	 * Solaris servers.
+ 	 */
+ 	if (!nfs_dwrite)
  		return (EIO);
  
  	/*
Index: nfs_socket.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -c -r1.17 -r1.18
*** nfs_socket.c	1996/07/11 16:32:45	1.17
--- nfs_socket.c	1996/10/11 10:15:33	1.18
***************
*** 34,40 ****
   * SUCH DAMAGE.
   *
   *	@(#)nfs_socket.c	8.3 (Berkeley) 1/12/94
!  * $Id: nfs_socket.c,v 1.17 1996/07/11 16:32:45 wollman Exp $
   */
  
  /*
--- 34,40 ----
   * SUCH DAMAGE.
   *
   *	@(#)nfs_socket.c	8.3 (Berkeley) 1/12/94
!  * $Id: nfs_socket.c,v 1.18 1996/10/11 10:15:33 dfr Exp $
   */
  
  /*
***************
*** 681,695 ****
  		 * sbwait() after someone else has received my reply for me.
  		 * Also necessary for connection based protocols to avoid
  		 * race conditions during a reconnect.
  		 */
  		error = nfs_rcvlock(myrep);
  		if (error)
  			return (error);
- 		/* Already received, bye bye */
- 		if (myrep->r_mrep != NULL) {
- 			nfs_rcvunlock(&nmp->nm_flag);
- 			return (0);
- 		}
  		/*
  		 * Get the next Rpc reply off the socket
  		 */
--- 681,697 ----
  		 * sbwait() after someone else has received my reply for me.
  		 * Also necessary for connection based protocols to avoid
  		 * race conditions during a reconnect.
+ 		 * If nfs_rcvlock() returns EALREADY, that means that
+ 		 * the reply has already been recieved by another
+ 		 * process and we can return immediately.  In this
+ 		 * case, the lock is not taken to avoid races with
+ 		 * other processes.
  		 */
  		error = nfs_rcvlock(myrep);
+ 		if (error == EALREADY)
+ 			return (0);
  		if (error)
  			return (error);
  		/*
  		 * Get the next Rpc reply off the socket
  		 */
***************
*** 1494,1499 ****
--- 1496,1509 ----
  		*flagp |= NFSMNT_WANTRCV;
  		(void) tsleep((caddr_t)flagp, slpflag | (PZERO - 1), "nfsrcvlk",
  			slptimeo);
+ 		/*
+ 		 * If our reply was recieved while we were sleeping,
+ 		 * then just return without taking the lock to avoid a
+ 		 * situation where a single iod could 'capture' the
+ 		 * recieve lock.
+ 		 */
+ 		if (rep->r_mrep != NULL)
+ 			return (EALREADY);
  		if (slpflag == PCATCH) {
  			slpflag = 0;
  			slptimeo = 2 * hz;

/\ Hidetoshi Shimokawa
\/  simokawa@sat.t.u-tokyo.ac.jp
PGP public key: finger -l simokawa@sat.t.u-tokyo.ac.jp
