Module Name:    src
Committed By:   christos
Date:           Mon Jun 13 14:23:26 UTC 2016

Modified Files:
        src/sys/nfs: nfs_clntsocket.c

Log Message:
Simplify, no functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/nfs/nfs_clntsocket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/nfs/nfs_clntsocket.c
diff -u src/sys/nfs/nfs_clntsocket.c:1.3 src/sys/nfs/nfs_clntsocket.c:1.4
--- src/sys/nfs/nfs_clntsocket.c:1.3	Tue Jul 14 23:28:55 2015
+++ src/sys/nfs/nfs_clntsocket.c	Mon Jun 13 10:23:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_clntsocket.c,v 1.3 2015/07/15 03:28:55 manu Exp $	*/
+/*	$NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.3 2015/07/15 03:28:55 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_clntsocket.c,v 1.4 2016/06/13 14:23:26 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_nfs.h"
@@ -403,67 +403,69 @@ nfsmout:
 		 * Iff no match, just drop the datagram
 		 */
 		TAILQ_FOREACH(rep, &nfs_reqq, r_chain) {
-			if (rep->r_mrep == NULL && rxid == rep->r_xid) {
-				/* Found it.. */
-				rep->r_mrep = mrep;
-				rep->r_md = md;
-				rep->r_dpos = dpos;
-				if (nfsrtton) {
-					struct rttl *rt;
-
-					rt = &nfsrtt.rttl[nfsrtt.pos];
-					rt->proc = rep->r_procnum;
-					rt->rto = NFS_RTO(nmp, nfs_proct[rep->r_procnum]);
-					rt->sent = nmp->nm_sent;
-					rt->cwnd = nmp->nm_cwnd;
-					rt->srtt = nmp->nm_srtt[nfs_proct[rep->r_procnum] - 1];
-					rt->sdrtt = nmp->nm_sdrtt[nfs_proct[rep->r_procnum] - 1];
-					rt->fsid = nmp->nm_mountp->mnt_stat.f_fsidx;
-					getmicrotime(&rt->tstamp);
-					if (rep->r_flags & R_TIMING)
-						rt->rtt = rep->r_rtt;
-					else
-						rt->rtt = 1000000;
-					nfsrtt.pos = (nfsrtt.pos + 1) % NFSRTTLOGSIZ;
-				}
-				/*
-				 * Update congestion window.
-				 * Do the additive increase of
-				 * one rpc/rtt.
-				 */
-				if (nmp->nm_cwnd <= nmp->nm_sent) {
-					nmp->nm_cwnd +=
-					   (NFS_CWNDSCALE * NFS_CWNDSCALE +
-					   (nmp->nm_cwnd >> 1)) / nmp->nm_cwnd;
-					if (nmp->nm_cwnd > NFS_MAXCWND)
-						nmp->nm_cwnd = NFS_MAXCWND;
-				}
-				rep->r_flags &= ~R_SENT;
-				nmp->nm_sent -= NFS_CWNDSCALE;
+			if (rep->r_mrep != NULL || rxid != rep->r_xid)
+				continue;
+
+			/* Found it.. */
+			rep->r_mrep = mrep;
+			rep->r_md = md;
+			rep->r_dpos = dpos;
+			if (nfsrtton) {
+				struct rttl *rt;
+				int proct = nfs_proct[rep->r_procnum];
+
+				rt = &nfsrtt.rttl[nfsrtt.pos];
+				rt->proc = rep->r_procnum;
+				rt->rto = NFS_RTO(nmp, proct);
+				rt->sent = nmp->nm_sent;
+				rt->cwnd = nmp->nm_cwnd;
+				rt->srtt = nmp->nm_srtt[proct - 1];
+				rt->sdrtt = nmp->nm_sdrtt[proct - 1];
+				rt->fsid = nmp->nm_mountp->mnt_stat.f_fsidx;
+				getmicrotime(&rt->tstamp);
+				if (rep->r_flags & R_TIMING)
+					rt->rtt = rep->r_rtt;
+				else
+					rt->rtt = 1000000;
+				nfsrtt.pos = (nfsrtt.pos + 1) % NFSRTTLOGSIZ;
+			}
+			/*
+			 * Update congestion window.
+			 * Do the additive increase of
+			 * one rpc/rtt.
+			 */
+			if (nmp->nm_cwnd <= nmp->nm_sent) {
+				nmp->nm_cwnd +=
+				   (NFS_CWNDSCALE * NFS_CWNDSCALE +
+				   (nmp->nm_cwnd >> 1)) / nmp->nm_cwnd;
+				if (nmp->nm_cwnd > NFS_MAXCWND)
+					nmp->nm_cwnd = NFS_MAXCWND;
+			}
+			rep->r_flags &= ~R_SENT;
+			nmp->nm_sent -= NFS_CWNDSCALE;
+			/*
+			 * Update rtt using a gain of 0.125 on the mean
+			 * and a gain of 0.25 on the deviation.
+			 */
+			if (rep->r_flags & R_TIMING) {
 				/*
-				 * Update rtt using a gain of 0.125 on the mean
-				 * and a gain of 0.25 on the deviation.
+				 * Since the timer resolution of
+				 * NFS_HZ is so course, it can often
+				 * result in r_rtt == 0. Since
+				 * r_rtt == N means that the actual
+				 * rtt is between N+dt and N+2-dt ticks,
+				 * add 1.
 				 */
-				if (rep->r_flags & R_TIMING) {
-					/*
-					 * Since the timer resolution of
-					 * NFS_HZ is so course, it can often
-					 * result in r_rtt == 0. Since
-					 * r_rtt == N means that the actual
-					 * rtt is between N+dt and N+2-dt ticks,
-					 * add 1.
-					 */
-					t1 = rep->r_rtt + 1;
-					t1 -= (NFS_SRTT(rep) >> 3);
-					NFS_SRTT(rep) += t1;
-					if (t1 < 0)
-						t1 = -t1;
-					t1 -= (NFS_SDRTT(rep) >> 2);
-					NFS_SDRTT(rep) += t1;
-				}
-				nmp->nm_timeouts = 0;
-				break;
+				t1 = rep->r_rtt + 1;
+				t1 -= (NFS_SRTT(rep) >> 3);
+				NFS_SRTT(rep) += t1;
+				if (t1 < 0)
+					t1 = -t1;
+				t1 -= (NFS_SDRTT(rep) >> 2);
+				NFS_SDRTT(rep) += t1;
 			}
+			nmp->nm_timeouts = 0;
+			break;
 		}
 		nfs_rcvunlock(nmp);
 		/*

Reply via email to