Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/nfs Simplify, no functional change.



details:   https://anonhg.NetBSD.org/src/rev/4009975c5223
branches:  trunk
changeset: 345889:4009975c5223
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jun 13 14:23:26 2016 +0000

description:
Simplify, no functional change.

diffstat:

 sys/nfs/nfs_clntsocket.c |  120 +++++++++++++++++++++++-----------------------
 1 files changed, 61 insertions(+), 59 deletions(-)

diffs (145 lines):

diff -r 967cf7326c27 -r 4009975c5223 sys/nfs/nfs_clntsocket.c
--- a/sys/nfs/nfs_clntsocket.c  Mon Jun 13 08:37:15 2016 +0000
+++ b/sys/nfs/nfs_clntsocket.c  Mon Jun 13 14:23:26 2016 +0000
@@ -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 @@
                 * 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;
+                       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, 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;
-                               }
+                               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 congestion window.
-                                * Do the additive increase of
-                                * one rpc/rtt.
+                                * 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 (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) {
-                                       /*
-                                        * 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);
                /*



Home | Main Index | Thread Index | Old Index