Deleted Added
full compact
nfs_srvsubs.c (35066) nfs_srvsubs.c (36176)
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_subs.c 8.3 (Berkeley) 1/4/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_subs.c 8.3 (Berkeley) 1/4/94
37 * $Id: nfs_subs.c,v 1.52 1998/03/30 09:54:12 phk Exp $
37 * $Id: nfs_subs.c,v 1.53 1998/04/06 11:41:07 phk Exp $
38 */
39
40/*
41 * These functions support the macros and help fiddle mbuf chains for
42 * the nfs op functions. They do things like create the rpc header and
43 * copy data between mbuf chains and uio lists.
44 */
45#include <sys/param.h>

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

1358 vaper->va_atime = np->n_atim;
1359 if (np->n_flag & NUPD)
1360 vaper->va_mtime = np->n_mtim;
1361 }
1362 }
1363 return (0);
1364}
1365
38 */
39
40/*
41 * These functions support the macros and help fiddle mbuf chains for
42 * the nfs op functions. They do things like create the rpc header and
43 * copy data between mbuf chains and uio lists.
44 */
45#include <sys/param.h>

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

1358 vaper->va_atime = np->n_atim;
1359 if (np->n_flag & NUPD)
1360 vaper->va_mtime = np->n_mtim;
1361 }
1362 }
1363 return (0);
1364}
1365
1366#ifdef NFS_ACDEBUG
1367#include <sys/sysctl.h>
1368static int nfs_acdebug;
1369SYSCTL_INT(_vfs_nfs, OID_AUTO, acdebug, CTLFLAG_RW, &nfs_acdebug, 0, "");
1370#endif
1371
1366/*
1367 * Check the time stamp
1368 * If the cache is valid, copy contents to *vap and return 0
1369 * otherwise return an error
1370 */
1371int
1372nfs_getattrcache(vp, vaper)
1373 register struct vnode *vp;
1374 struct vattr *vaper;
1375{
1372/*
1373 * Check the time stamp
1374 * If the cache is valid, copy contents to *vap and return 0
1375 * otherwise return an error
1376 */
1377int
1378nfs_getattrcache(vp, vaper)
1379 register struct vnode *vp;
1380 struct vattr *vaper;
1381{
1376 register struct nfsnode *np = VTONFS(vp);
1382 register struct nfsnode *np;
1377 register struct vattr *vap;
1383 register struct vattr *vap;
1384 struct nfsmount *nmp;
1385 int timeo;
1378
1386
1379 if ((time_second - np->n_attrstamp) >= NFS_ATTRTIMEO(np)) {
1387 np = VTONFS(vp);
1388 vap = &np->n_vattr;
1389 nmp = VFSTONFS(vp->v_mount);
1390 /* XXX n_mtime doesn't seem to be updated on a miss-and-reload */
1391 timeo = (time_second - np->n_mtime) / 10;
1392
1393#ifdef NFS_ACDEBUG
1394 if (nfs_acdebug>1)
1395 printf("nfs_getattrcache: initial timeo = %d\n", timeo);
1396#endif
1397
1398 if (vap->va_type == VDIR) {
1399 if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acdirmin)
1400 timeo = nmp->nm_acdirmin;
1401 else if (timeo > nmp->nm_acdirmax)
1402 timeo = nmp->nm_acdirmax;
1403 } else {
1404 if ((np->n_flag & NMODIFIED) || timeo < nmp->nm_acregmin)
1405 timeo = nmp->nm_acregmin;
1406 else if (timeo > nmp->nm_acregmax)
1407 timeo = nmp->nm_acregmax;
1408 }
1409
1410#ifdef NFS_ACDEBUG
1411 if (nfs_acdebug > 2)
1412 printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n",
1413 nmp->nm_acregmin, nmp->nm_acregmax,
1414 nmp->nm_acdirmin, nmp->nm_acdirmax);
1415
1416 if (nfs_acdebug)
1417 printf("nfs_getattrcache: age = %d; final timeo = %d\n",r
1418 (time_second - np->n_attrstamp), timeo);
1419#endif
1420
1421 if ((time_second - np->n_attrstamp) >= timeo) {
1380 nfsstats.attrcache_misses++;
1381 return (ENOENT);
1382 }
1383 nfsstats.attrcache_hits++;
1422 nfsstats.attrcache_misses++;
1423 return (ENOENT);
1424 }
1425 nfsstats.attrcache_hits++;
1384 vap = &np->n_vattr;
1385 if (vap->va_size != np->n_size) {
1386 if (vap->va_type == VREG) {
1387 if (np->n_flag & NMODIFIED) {
1388 if (vap->va_size < np->n_size)
1389 vap->va_size = np->n_size;
1390 else
1391 np->n_size = vap->va_size;
1392 } else

--- 705 unchanged lines hidden ---
1426 if (vap->va_size != np->n_size) {
1427 if (vap->va_type == VREG) {
1428 if (np->n_flag & NMODIFIED) {
1429 if (vap->va_size < np->n_size)
1430 vap->va_size = np->n_size;
1431 else
1432 np->n_size = vap->va_size;
1433 } else

--- 705 unchanged lines hidden ---