Commit 26a8cfd8 authored by Stephen Lord's avatar Stephen Lord Committed by Nathan Scott

[XFS] optimize timestamp updates, use new hires timestamps more directly,

also fix a bug where the mtime field was not correctly updated.

SGI Modid: 2.5.x-xfs:slinx:142296a
parent 20ac875e
...@@ -200,7 +200,7 @@ vn_revalidate( ...@@ -200,7 +200,7 @@ vn_revalidate(
vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address); vn_trace_entry(vp, "vn_revalidate", (inst_t *)__return_address);
ASSERT(vp->v_fbhv != NULL); ASSERT(vp->v_fbhv != NULL);
va.va_mask = XFS_AT_STAT|XFS_AT_GENCOUNT; va.va_mask = XFS_AT_STAT;
VOP_GETATTR(vp, &va, 0, NULL, error); VOP_GETATTR(vp, &va, 0, NULL, error);
if (!error) { if (!error) {
inode = LINVFS_GET_IP(vp); inode = LINVFS_GET_IP(vp);
...@@ -210,12 +210,9 @@ vn_revalidate( ...@@ -210,12 +210,9 @@ vn_revalidate(
inode->i_gid = va.va_gid; inode->i_gid = va.va_gid;
inode->i_size = va.va_size; inode->i_size = va.va_size;
inode->i_blocks = va.va_nblocks; inode->i_blocks = va.va_nblocks;
inode->i_mtime.tv_sec = va.va_mtime.tv_sec; inode->i_mtime = va.va_mtime;
inode->i_mtime.tv_nsec = va.va_mtime.tv_nsec; inode->i_ctime = va.va_ctime;
inode->i_ctime.tv_sec = va.va_ctime.tv_sec; inode->i_atime = va.va_atime;
inode->i_ctime.tv_nsec = va.va_ctime.tv_nsec;
inode->i_atime.tv_sec = va.va_atime.tv_sec;
inode->i_atime.tv_nsec = va.va_atime.tv_nsec;
VUNMODIFY(vp); VUNMODIFY(vp);
} }
return -error; return -error;
......
...@@ -45,11 +45,7 @@ static inline void delay(long ticks) ...@@ -45,11 +45,7 @@ static inline void delay(long ticks)
static inline void nanotime(struct timespec *tvp) static inline void nanotime(struct timespec *tvp)
{ {
struct timeval tv; *tvp = CURRENT_TIME;
do_gettimeofday(&tv);
tvp->tv_sec = tv.tv_sec;
tvp->tv_nsec = tv.tv_usec * 1000;
} }
#endif /* __XFS_SUPPORT_TIME_H__ */ #endif /* __XFS_SUPPORT_TIME_H__ */
...@@ -3580,16 +3580,19 @@ xfs_ichgtime(xfs_inode_t *ip, ...@@ -3580,16 +3580,19 @@ xfs_ichgtime(xfs_inode_t *ip,
nanotime(&tv); nanotime(&tv);
if (flags & XFS_ICHGTIME_MOD) { if (flags & XFS_ICHGTIME_MOD) {
inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; inode->i_mtime = tv;
inode->i_mtime.tv_nsec = ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec;
} }
if (flags & XFS_ICHGTIME_ACC) { if (flags & XFS_ICHGTIME_ACC) {
inode->i_atime.tv_sec = ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec; inode->i_atime = tv;
inode->i_atime.tv_nsec = ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_atime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_atime.t_nsec = (__int32_t)tv.tv_nsec;
} }
if (flags & XFS_ICHGTIME_CHG) { if (flags & XFS_ICHGTIME_CHG) {
inode->i_ctime.tv_sec = ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; inode->i_ctime = tv;
inode->i_ctime.tv_nsec = ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec;
ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment