Chris sez time is volatile
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 8 Jul 1992 08:30:04 +0000 (00:30 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 8 Jul 1992 08:30:04 +0000 (00:30 -0800)
SCCS-vsn: sys/ufs/ffs/ffs_inode.c 7.60
SCCS-vsn: sys/ufs/ffs/ffs_vnops.c 7.87

usr/src/sys/ufs/ffs/ffs_inode.c
usr/src/sys/ufs/ffs/ffs_vnops.c

index ea1315b..fd145af 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ffs_inode.c 7.59 (Berkeley) %G%
+ *     @(#)ffs_inode.c 7.60 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -102,8 +102,6 @@ ffs_update(ap)
 /*
  * Truncate the inode ip to at most length size.  Free affected disk
  * blocks -- the blocks of the file are removed in reverse order.
 /*
  * Truncate the inode ip to at most length size.  Free affected disk
  * blocks -- the blocks of the file are removed in reverse order.
- *
- * NB: triple indirect blocks are untested.
  */
 ffs_truncate(ap)
        struct vop_truncate_args /* {
  */
 ffs_truncate(ap)
        struct vop_truncate_args /* {
@@ -124,12 +122,14 @@ ffs_truncate(ap)
        struct buf *bp;
        int offset, size, level;
        long count, nblocks, blocksreleased = 0;
        struct buf *bp;
        int offset, size, level;
        long count, nblocks, blocksreleased = 0;
+       struct timeval tv;
        register int i;
        int aflags, error, allerror;
        struct inode tip;
        off_t osize;
 
        oip = VTOI(ovp);
        register int i;
        int aflags, error, allerror;
        struct inode tip;
        off_t osize;
 
        oip = VTOI(ovp);
+       tv = time;
        if (ovp->v_type == VLNK && ovp->v_mount->mnt_maxsymlinklen > 0) {
 #ifdef DIAGNOSTIC
                if (length != 0)
        if (ovp->v_type == VLNK && ovp->v_mount->mnt_maxsymlinklen > 0) {
 #ifdef DIAGNOSTIC
                if (length != 0)
@@ -138,11 +138,11 @@ ffs_truncate(ap)
                bzero((char *)&oip->i_shortlink, (u_int)oip->i_size);
                oip->i_size = 0;
                oip->i_flag |= ICHG|IUPD;
                bzero((char *)&oip->i_shortlink, (u_int)oip->i_size);
                oip->i_size = 0;
                oip->i_flag |= ICHG|IUPD;
-               return (VOP_UPDATE(ovp, &time, &time, 1));
+               return (VOP_UPDATE(ovp, &tv, &tv, 1));
        }
        if (oip->i_size <= length) {
                oip->i_flag |= ICHG|IUPD;
        }
        if (oip->i_size <= length) {
                oip->i_flag |= ICHG|IUPD;
-               return (VOP_UPDATE(ovp, &time, &time, 1));
+               return (VOP_UPDATE(ovp, &tv, &tv, 1));
        }
        vnode_pager_setsize(ovp, (u_long)length);
        /*
        }
        vnode_pager_setsize(ovp, (u_long)length);
        /*
@@ -206,7 +206,7 @@ ffs_truncate(ap)
                oip->i_db[i] = 0;
        oip->i_flag |= ICHG|IUPD;
        allerror = vinvalbuf(ovp, length > 0, ap->a_cred, ap->a_p);
                oip->i_db[i] = 0;
        oip->i_flag |= ICHG|IUPD;
        allerror = vinvalbuf(ovp, length > 0, ap->a_cred, ap->a_p);
-       if (error = VOP_UPDATE(ovp, &time, &time, MNT_WAIT))
+       if (error = VOP_UPDATE(ovp, &tv, &tv, MNT_WAIT))
                allerror = error;
 
        /*
                allerror = error;
 
        /*
index 87b2600..c09ef89 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ffs_vnops.c 7.86 (Berkeley) %G%
+ *     @(#)ffs_vnops.c 7.87 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -263,6 +263,7 @@ ffs_write(ap)
        register struct fs *fs;
        struct proc *p = uio->uio_procp;
        int ioflag = ap->a_ioflag;
        register struct fs *fs;
        struct proc *p = uio->uio_procp;
        int ioflag = ap->a_ioflag;
+       struct timeval tv;
        struct buf *bp;
        daddr_t lbn, bn;
        off_t osize;
        struct buf *bp;
        daddr_t lbn, bn;
        off_t osize;
@@ -345,8 +346,10 @@ ffs_write(ap)
                uio->uio_offset -= resid - uio->uio_resid;
                uio->uio_resid = resid;
        }
                uio->uio_offset -= resid - uio->uio_resid;
                uio->uio_resid = resid;
        }
-       if (!error && (ioflag & IO_SYNC))
-               error = VOP_UPDATE(vp, &time, &time, 1);
+       if (!error && (ioflag & IO_SYNC)) {
+               tv = time;
+               error = VOP_UPDATE(vp, &tv, &tv, 1);
+       }
        return (error);
 }
 
        return (error);
 }
 
@@ -366,6 +369,7 @@ ffs_fsync(ap)
        register struct vnode *vp = ap->a_vp;
        struct inode *ip = VTOI(vp);
        register struct buf *bp;
        register struct vnode *vp = ap->a_vp;
        struct inode *ip = VTOI(vp);
        register struct buf *bp;
+       struct timeval tv;
        struct buf *nbp;
        int s;
 
        struct buf *nbp;
        int s;
 
@@ -406,7 +410,8 @@ loop:
 #endif
        }
        splx(s);
 #endif
        }
        splx(s);
-       return (VOP_UPDATE(ap->a_vp, &time, &time, ap->a_waitfor == MNT_WAIT));
+       tv = time;
+       return (VOP_UPDATE(ap->a_vp, &tv, &tv, ap->a_waitfor == MNT_WAIT));
 }
 
 /*
 }
 
 /*
@@ -421,6 +426,7 @@ ffs_inactive(ap)
 {
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip = VTOI(vp);
 {
        register struct vnode *vp = ap->a_vp;
        register struct inode *ip = VTOI(vp);
+       struct timeval tv;
        int mode, error;
        extern int prtactive;
 
        int mode, error;
        extern int prtactive;
 
@@ -448,8 +454,10 @@ ffs_inactive(ap)
                ip->i_flag |= IUPD|ICHG;
                VOP_VFREE(vp, ip->i_number, mode);
        }
                ip->i_flag |= IUPD|ICHG;
                VOP_VFREE(vp, ip->i_number, mode);
        }
-       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD))
-               VOP_UPDATE(vp, &time, &time, 0);
+       if (ip->i_flag&(IUPD|IACC|ICHG|IMOD)) {
+               tv = time;
+               VOP_UPDATE(vp, &tv, &tv, 0);
+       }
        IUNLOCK(ip);
        ip->i_flag = 0;
        /*
        IUNLOCK(ip);
        ip->i_flag = 0;
        /*