always use nanotime rather than time.

it's bad to mix nanotime and time because it sometimes
make timestamps go backwards.
This commit is contained in:
yamt 2005-09-26 13:52:20 +00:00
parent 21ef7cfd14
commit 6138b82a56
5 changed files with 16 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_inode.c,v 1.48 2005/09/12 16:24:41 christos Exp $ */
/* $NetBSD: ext2fs_inode.c,v 1.49 2005/09/26 13:52:20 yamt Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.48 2005/09/12 16:24:41 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ext2fs_inode.c,v 1.49 2005/09/26 13:52:20 yamt Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -161,7 +161,7 @@ ext2fs_inactive(void *v)
if (ext2fs_size(ip) != 0) {
error = VOP_TRUNCATE(vp, (off_t)0, 0, NOCRED, NULL);
}
TIMEVAL_TO_TIMESPEC(&time, &ts);
nanotime(&ts);
ip->i_e2fs_dtime = ts.tv_sec;
ip->i_flag |= IN_CHANGE | IN_UPDATE;
VOP_VFREE(vp, ip->i_number, ip->i_e2fs_mode);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_alloc.c,v 1.86 2005/08/19 02:04:09 christos Exp $ */
/* $NetBSD: ffs_alloc.c,v 1.87 2005/09/26 13:52:20 yamt Exp $ */
/*
* Copyright (c) 2002 Networks Associates Technology, Inc.
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.86 2005/08/19 02:04:09 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_alloc.c,v 1.87 2005/09/26 13:52:20 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -724,7 +724,7 @@ ffs_valloc(void *v)
ip->i_gen++;
DIP_ASSIGN(ip, gen, ip->i_gen);
if (fs->fs_magic == FS_UFS2_MAGIC) {
TIMEVAL_TO_TIMESPEC(&time, &ts);
nanotime(&ts);
ip->i_ffs2_birthtime = ts.tv_sec;
ip->i_ffs2_birthnsec = ts.tv_nsec;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_snapshot.c,v 1.19 2005/08/19 02:04:09 christos Exp $ */
/* $NetBSD: ffs_snapshot.c,v 1.20 2005/09/26 13:52:20 yamt Exp $ */
/*
* Copyright 2000 Marshall Kirk McKusick. All Rights Reserved.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.19 2005/08/19 02:04:09 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ffs_snapshot.c,v 1.20 2005/09/26 13:52:20 yamt Exp $");
#if defined(_KERNEL_OPT)
#include "opt_ffs.h"
@ -510,7 +510,7 @@ out1:
/*
* Set the mtime to the time the snapshot has been taken.
*/
TIMEVAL_TO_TIMESPEC(&starttime, &ts);
nanotime(&ts);
if (ctime)
*ctime = ts;
DIP_ASSIGN(ip, mtime, ts.tv_sec);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_segment.c,v 1.166 2005/09/12 16:24:41 christos Exp $ */
/* $NetBSD: lfs_segment.c,v 1.167 2005/09/26 13:52:20 yamt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.166 2005/09/12 16:24:41 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: lfs_segment.c,v 1.167 2005/09/26 13:52:20 yamt Exp $");
#ifdef DEBUG
# define vndebug(vp, str) do { \
@ -168,7 +168,7 @@ lfs_imtime(struct lfs *fs)
struct inode *ip;
ASSERT_MAYBE_SEGLOCK(fs);
TIMEVAL_TO_TIMESPEC(&time, &ts);
nanotime(&ts);
ip = VTOI(fs->lfs_ivnode);
ip->i_ffs1_mtime = ts.tv_sec;
ip->i_ffs1_mtimensec = ts.tv_nsec;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_lookup.c,v 1.67 2005/08/23 08:05:13 christos Exp $ */
/* $NetBSD: ufs_lookup.c,v 1.68 2005/09/26 13:52:20 yamt Exp $ */
/*
* Copyright (c) 1989, 1993
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.67 2005/08/23 08:05:13 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: ufs_lookup.c,v 1.68 2005/09/26 13:52:20 yamt Exp $");
#ifdef _KERNEL_OPT
#include "opt_ffs.h"
@ -839,7 +839,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
if (softdep_setup_directory_add(bp, dp, dp->i_offset,
ufs_rw32(dirp->d_ino, needswap), newdirbp, 1) == 0) {
bdwrite(bp);
TIMEVAL_TO_TIMESPEC(&time, &ts);
nanotime(&ts);
return VOP_UPDATE(dvp, &ts, &ts, UPDATE_DIROP);
}
/* We have just allocated a directory block in an
@ -864,7 +864,7 @@ ufs_direnter(struct vnode *dvp, struct vnode *tvp, struct direct *dirp,
} else {
error = VOP_BWRITE(bp);
}
TIMEVAL_TO_TIMESPEC(&time, &ts);
nanotime(&ts);
ret = VOP_UPDATE(dvp, &ts, &ts, UPDATE_DIROP);
if (error == 0)
return (ret);