Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs Just use the "time" variable in the *_getattr fun...



details:   https://anonhg.NetBSD.org/src/rev/a64aebf6679a
branches:  trunk
changeset: 534795:a64aebf6679a
user:      simonb <simonb%NetBSD.org@localhost>
date:      Sat Aug 03 04:52:44 2002 +0000

description:
Just use the "time" variable in the *_getattr functions instead of a call
to (the potentially expensive) microtime().

diffstat:

 sys/miscfs/kernfs/kernfs_vnops.c |  12 ++++++------
 sys/miscfs/portal/portal_vnops.c |  13 +++++++------
 sys/miscfs/procfs/procfs_vnops.c |  13 +++++++------
 3 files changed, 20 insertions(+), 18 deletions(-)

diffs (130 lines):

diff -r d1a91812da20 -r a64aebf6679a sys/miscfs/kernfs/kernfs_vnops.c
--- a/sys/miscfs/kernfs/kernfs_vnops.c  Sat Aug 03 03:58:06 2002 +0000
+++ b/sys/miscfs/kernfs/kernfs_vnops.c  Sat Aug 03 04:52:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kernfs_vnops.c,v 1.82 2002/07/19 18:35:44 jdolecek Exp $       */
+/*     $NetBSD: kernfs_vnops.c,v 1.83 2002/08/03 04:52:44 simonb Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.82 2002/07/19 18:35:44 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vnops.c,v 1.83 2002/08/03 04:52:44 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -466,7 +466,6 @@
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
        struct vattr *vap = ap->a_vap;
-       struct timeval tv;
        int error = 0;
        char strbuf[KSTRING], *buf;
 
@@ -478,10 +477,11 @@
        vap->va_size = 0;
        vap->va_blocksize = DEV_BSIZE;
        /*
-        * Make all times be current TOD.
+        * Make all times be current TOD.  Avoid microtime(9), it's slow.
+        * We don't guard the read from time(9) with splclock(9) since we
+        * don't actually need to be THAT sure the access is atomic. 
         */
-       microtime(&tv);
-       TIMEVAL_TO_TIMESPEC(&tv, &vap->va_ctime);
+       TIMEVAL_TO_TIMESPEC(&time, &vap->va_ctime);
        vap->va_atime = vap->va_mtime = vap->va_ctime;
        vap->va_gen = 0;
        vap->va_flags = 0;
diff -r d1a91812da20 -r a64aebf6679a sys/miscfs/portal/portal_vnops.c
--- a/sys/miscfs/portal/portal_vnops.c  Sat Aug 03 03:58:06 2002 +0000
+++ b/sys/miscfs/portal/portal_vnops.c  Sat Aug 03 04:52:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: portal_vnops.c,v 1.42 2002/07/05 03:24:07 lukem Exp $  */
+/*     $NetBSD: portal_vnops.c,v 1.43 2002/08/03 04:52:45 simonb Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: portal_vnops.c,v 1.42 2002/07/05 03:24:07 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: portal_vnops.c,v 1.43 2002/08/03 04:52:45 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -545,7 +545,6 @@
        } */ *ap = v;
        struct vnode *vp = ap->a_vp;
        struct vattr *vap = ap->a_vap;
-       struct timeval tv;
 
        memset(vap, 0, sizeof(*vap));
        vattr_null(vap);
@@ -555,10 +554,12 @@
        vap->va_size = DEV_BSIZE;
        vap->va_blocksize = DEV_BSIZE;
        /*
-        * Make all times be current TOD.
+        * Make all times be current TOD.  Avoid microtime(9), it's slow.
+        * We don't guard the read from time(9) with splclock(9) since we
+        * don't actually need to be THAT sure the access is atomic. 
         */
-       microtime(&tv);
-       TIMEVAL_TO_TIMESPEC(&tv, &vap->va_ctime);
+       TIMEVAL_TO_TIMESPEC(&time, &vap->va_ctime);
+       vap->va_atime = vap->va_mtime = vap->va_ctime;
        vap->va_atime = vap->va_mtime = vap->va_ctime;
        vap->va_gen = 0;
        vap->va_flags = 0;
diff -r d1a91812da20 -r a64aebf6679a sys/miscfs/procfs/procfs_vnops.c
--- a/sys/miscfs/procfs/procfs_vnops.c  Sat Aug 03 03:58:06 2002 +0000
+++ b/sys/miscfs/procfs/procfs_vnops.c  Sat Aug 03 04:52:44 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: procfs_vnops.c,v 1.89 2002/05/09 15:44:45 thorpej Exp $        */
+/*     $NetBSD: procfs_vnops.c,v 1.90 2002/08/03 04:52:45 simonb Exp $ */
 
 /*
  * Copyright (c) 1993 Jan-Simon Pendry
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.89 2002/05/09 15:44:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vnops.c,v 1.90 2002/08/03 04:52:45 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -469,7 +469,6 @@
        struct pfsnode *pfs = VTOPFS(ap->a_vp);
        struct vattr *vap = ap->a_vap;
        struct proc *procp;
-       struct timeval tv;
        int error;
 
        /* first check the process still exists */
@@ -500,15 +499,17 @@
        vap->va_blocksize = PAGE_SIZE;
 
        /*
-        * Make all times be current TOD.
+        * Make all times be current TOD.  Avoid microtime(9), it's slow.
+        * We don't guard the read from time(9) with splclock(9) since we
+        * don't actually need to be THAT sure the access is atomic. 
+        *
         * It would be possible to get the process start
         * time from the p_stat structure, but there's
         * no "file creation" time stamp anyway, and the
         * p_stat structure is not addressible if u. gets
         * swapped out for that process.
         */
-       microtime(&tv);
-       TIMEVAL_TO_TIMESPEC(&tv, &vap->va_ctime);
+       TIMEVAL_TO_TIMESPEC(&time, &vap->va_ctime);
        vap->va_atime = vap->va_mtime = vap->va_ctime;
 
        switch (pfs->pfs_type) {



Home | Main Index | Thread Index | Old Index