Deleted Added
sdiff udiff text old ( 24381 ) new ( 25663 )
full compact
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Rick Macklem at The University of Guelph.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
37 * $Id: nfs_serv.c,v 1.39 1997/03/25 05:13:40 peter Exp $
38 */
39
40/*
41 * nfs version 2 and 3 server calls to vnode ops
42 * - these routines generally have 3 phases
43 * 1 - break down and validate rpc request in mbuf list
44 * 2 - do the vnode ops for the request
45 * (surprisingly ?? many are very similar to syscalls in vfs_syscalls.c)

--- 948 unchanged lines hidden (view full) ---

994 */
995 s = splsoftclock();
996 owp = NULL;
997 wp = slp->ns_tq.lh_first;
998 while (wp && wp->nd_time < nfsd->nd_time) {
999 owp = wp;
1000 wp = wp->nd_tq.le_next;
1001 }
1002 if (owp) {
1003 LIST_INSERT_AFTER(owp, nfsd, nd_tq);
1004 } else {
1005 LIST_INSERT_HEAD(&slp->ns_tq, nfsd, nd_tq);
1006 }
1007 if (nfsd->nd_mrep) {
1008 wpp = NWDELAYHASH(slp, nfsd->nd_fh.fh_fid.fid_data);
1009 owp = NULL;

--- 35 unchanged lines hidden (view full) ---

1045 cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec;
1046 s = splsoftclock();
1047 for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = owp) {
1048 owp = nfsd->nd_tq.le_next;
1049 if (nfsd->nd_time > cur_usec)
1050 break;
1051 if (nfsd->nd_mreq)
1052 continue;
1053 LIST_REMOVE(nfsd, nd_tq);
1054 LIST_REMOVE(nfsd, nd_hash);
1055 splx(s);
1056 mrep = nfsd->nd_mrep;
1057 nfsd->nd_mrep = NULL;
1058 cred = &nfsd->nd_cr;
1059 v3 = (nfsd->nd_flag & ND_NFSV3);
1060 forat_ret = aftat_ret = 1;

--- 60 unchanged lines hidden (view full) ---

1121 }
1122
1123 /*
1124 * Loop around generating replies for all write rpcs that have
1125 * now been completed.
1126 */
1127 swp = nfsd;
1128 do {
1129 if (error) {
1130 nfsm_writereply(NFSX_WCCDATA(v3), v3);
1131 if (v3) {
1132 nfsm_srvwcc_data(forat_ret, &forat, aftat_ret, &va);
1133 }
1134 } else {
1135 nfsm_writereply(NFSX_PREOPATTR(v3) +
1136 NFSX_POSTOPORFATTR(v3) + 2 * NFSX_UNSIGNED +

--- 43 unchanged lines hidden (view full) ---

1180 splx(s);
1181
1182 /*
1183 * Search for a reply to return.
1184 */
1185 s = splsoftclock();
1186 for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = nfsd->nd_tq.le_next)
1187 if (nfsd->nd_mreq) {
1188 LIST_REMOVE(nfsd, nd_tq);
1189 *mrq = nfsd->nd_mreq;
1190 *ndp = nfsd;
1191 break;
1192 }
1193 splx(s);
1194 return (0);
1195}

--- 8 unchanged lines hidden (view full) ---

1204 */
1205static void
1206nfsrvw_coalesce(owp, nfsd)
1207 register struct nfsrv_descript *owp;
1208 register struct nfsrv_descript *nfsd;
1209{
1210 register int overlap;
1211 register struct mbuf *mp;
1212
1213 LIST_REMOVE(nfsd, nd_hash);
1214 LIST_REMOVE(nfsd, nd_tq);
1215 if (owp->nd_eoff < nfsd->nd_eoff) {
1216 overlap = owp->nd_eoff - nfsd->nd_off;
1217 if (overlap < 0)
1218 panic("nfsrv_coalesce: bad off");
1219 if (overlap > 0)
1220 m_adj(nfsd->nd_mrep, overlap);

--- 6 unchanged lines hidden (view full) ---

1227 m_freem(nfsd->nd_mrep);
1228 nfsd->nd_mrep = NULL;
1229 if (nfsd->nd_stable == NFSV3WRITE_FILESYNC)
1230 owp->nd_stable = NFSV3WRITE_FILESYNC;
1231 else if (nfsd->nd_stable == NFSV3WRITE_DATASYNC &&
1232 owp->nd_stable == NFSV3WRITE_UNSTABLE)
1233 owp->nd_stable = NFSV3WRITE_DATASYNC;
1234 LIST_INSERT_HEAD(&owp->nd_coalesce, nfsd, nd_tq);
1235}
1236
1237/*
1238 * Sort the group list in increasing numerical order.
1239 * (Insertion sort by Chris Torek, who was grossed out by the bubble sort
1240 * that used to be here.)
1241 */
1242void

--- 2170 unchanged lines hidden ---