From 6138b82a56ea4af526f7fe53a099fe880b917616 Mon Sep 17 00:00:00 2001 From: yamt Date: Mon, 26 Sep 2005 13:52:20 +0000 Subject: [PATCH] always use nanotime rather than time. it's bad to mix nanotime and time because it sometimes make timestamps go backwards. --- sys/ufs/ext2fs/ext2fs_inode.c | 6 +++--- sys/ufs/ffs/ffs_alloc.c | 6 +++--- sys/ufs/ffs/ffs_snapshot.c | 6 +++--- sys/ufs/lfs/lfs_segment.c | 6 +++--- sys/ufs/ufs/ufs_lookup.c | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sys/ufs/ext2fs/ext2fs_inode.c b/sys/ufs/ext2fs/ext2fs_inode.c index a9389cef5e8e..ea49b49ea9bd 100644 --- a/sys/ufs/ext2fs/ext2fs_inode.c +++ b/sys/ufs/ext2fs/ext2fs_inode.c @@ -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 -__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 #include @@ -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); diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 9367b33bd3aa..34deaf3138b2 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -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 -__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; } diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index f53a3d7ab2fc..e4275bd60ea1 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -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 -__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); diff --git a/sys/ufs/lfs/lfs_segment.c b/sys/ufs/lfs/lfs_segment.c index ff35bf8d0c3a..4bf852fba173 100644 --- a/sys/ufs/lfs/lfs_segment.c +++ b/sys/ufs/lfs/lfs_segment.c @@ -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 -__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; diff --git a/sys/ufs/ufs/ufs_lookup.c b/sys/ufs/ufs/ufs_lookup.c index f71d0eb7b59e..ce43ff1095b0 100644 --- a/sys/ufs/ufs/ufs_lookup.c +++ b/sys/ufs/ufs/ufs_lookup.c @@ -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 -__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);