nfs_serv.c (24381) | nfs_serv.c (25663) |
---|---|
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 | 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 $ | 37 * $Id: nfs_serv.c,v 1.40 1997/03/29 12:40:18 bde 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 } | 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 NFS_DPF(WG, ("Q%03x", nfsd->nd_retxid & 0xfff)); |
|
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; | 1003 if (owp) { 1004 LIST_INSERT_AFTER(owp, nfsd, nd_tq); 1005 } else { 1006 LIST_INSERT_HEAD(&slp->ns_tq, nfsd, nd_tq); 1007 } 1008 if (nfsd->nd_mrep) { 1009 wpp = NWDELAYHASH(slp, nfsd->nd_fh.fh_fid.fid_data); 1010 owp = NULL; --- 35 unchanged lines hidden (view full) --- 1046 cur_usec = (u_quad_t)time.tv_sec * 1000000 + (u_quad_t)time.tv_usec; 1047 s = splsoftclock(); 1048 for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = owp) { 1049 owp = nfsd->nd_tq.le_next; 1050 if (nfsd->nd_time > cur_usec) 1051 break; 1052 if (nfsd->nd_mreq) 1053 continue; |
1054 NFS_DPF(WG, ("P%03x", nfsd->nd_retxid & 0xfff)); |
|
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 { | 1055 LIST_REMOVE(nfsd, nd_tq); 1056 LIST_REMOVE(nfsd, nd_hash); 1057 splx(s); 1058 mrep = nfsd->nd_mrep; 1059 nfsd->nd_mrep = NULL; 1060 cred = &nfsd->nd_cr; 1061 v3 = (nfsd->nd_flag & ND_NFSV3); 1062 forat_ret = aftat_ret = 1; --- 60 unchanged lines hidden (view full) --- 1123 } 1124 1125 /* 1126 * Loop around generating replies for all write rpcs that have 1127 * now been completed. 1128 */ 1129 swp = nfsd; 1130 do { |
1131 NFS_DPF(WG, ("R%03x", nfsd->nd_retxid & 0xfff)); |
|
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) { | 1132 if (error) { 1133 nfsm_writereply(NFSX_WCCDATA(v3), v3); 1134 if (v3) { 1135 nfsm_srvwcc_data(forat_ret, &forat, aftat_ret, &va); 1136 } 1137 } else { 1138 nfsm_writereply(NFSX_PREOPATTR(v3) + 1139 NFSX_POSTOPORFATTR(v3) + 2 * NFSX_UNSIGNED + --- 43 unchanged lines hidden (view full) --- 1183 splx(s); 1184 1185 /* 1186 * Search for a reply to return. 1187 */ 1188 s = splsoftclock(); 1189 for (nfsd = slp->ns_tq.lh_first; nfsd; nfsd = nfsd->nd_tq.le_next) 1190 if (nfsd->nd_mreq) { |
1191 NFS_DPF(WG, ("X%03x", nfsd->nd_retxid & 0xfff)); |
|
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; | 1192 LIST_REMOVE(nfsd, nd_tq); 1193 *mrq = nfsd->nd_mreq; 1194 *ndp = nfsd; 1195 break; 1196 } 1197 splx(s); 1198 return (0); 1199} --- 8 unchanged lines hidden (view full) --- 1208 */ 1209static void 1210nfsrvw_coalesce(owp, nfsd) 1211 register struct nfsrv_descript *owp; 1212 register struct nfsrv_descript *nfsd; 1213{ 1214 register int overlap; 1215 register struct mbuf *mp; |
1216 struct nfsrv_descript *p; |
|
1212 | 1217 |
1218 NFS_DPF(WG, ("C%03x-%03x", 1219 nfsd->nd_retxid & 0xfff, owp->nd_retxid & 0xfff)); |
|
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); | 1220 LIST_REMOVE(nfsd, nd_hash); 1221 LIST_REMOVE(nfsd, nd_tq); 1222 if (owp->nd_eoff < nfsd->nd_eoff) { 1223 overlap = owp->nd_eoff - nfsd->nd_off; 1224 if (overlap < 0) 1225 panic("nfsrv_coalesce: bad off"); 1226 if (overlap > 0) 1227 m_adj(nfsd->nd_mrep, overlap); --- 6 unchanged lines hidden (view full) --- 1234 m_freem(nfsd->nd_mrep); 1235 nfsd->nd_mrep = NULL; 1236 if (nfsd->nd_stable == NFSV3WRITE_FILESYNC) 1237 owp->nd_stable = NFSV3WRITE_FILESYNC; 1238 else if (nfsd->nd_stable == NFSV3WRITE_DATASYNC && 1239 owp->nd_stable == NFSV3WRITE_UNSTABLE) 1240 owp->nd_stable = NFSV3WRITE_DATASYNC; 1241 LIST_INSERT_HEAD(&owp->nd_coalesce, nfsd, nd_tq); |
1242 1243 /* 1244 * If nfsd had anything else coalesced into it, transfer them 1245 * to owp, otherwise their replies will never get sent. 1246 */ 1247 for (p = nfsd->nd_coalesce.lh_first; p; 1248 p = nfsd->nd_coalesce.lh_first) { 1249 LIST_REMOVE(p, nd_tq); 1250 LIST_INSERT_HEAD(&owp->nd_coalesce, p, nd_tq); 1251 } |
|
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 --- | 1252} 1253 1254/* 1255 * Sort the group list in increasing numerical order. 1256 * (Insertion sort by Chris Torek, who was grossed out by the bubble sort 1257 * that used to be here.) 1258 */ 1259void --- 2170 unchanged lines hidden --- |