aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_iops.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@sgi.com>2006-01-10 23:35:17 -0500
committerNathan Scott <nathans@sgi.com>2006-01-10 23:35:17 -0500
commit42fe2b1f7fe788ed5304a7bfa0a0b0db81bc03a8 (patch)
treebbf454c788e4370faf569fdf51893529b3f71ab3 /fs/xfs/linux-2.6/xfs_iops.c
parentdd954c69d189cd91571b42d3f926e70351395dc3 (diff)
[XFS] fix, speedup and simplify atime handling let the VFS handle atime
updates and only sync back to the xfs inode when nessecary SGI-PV: 946679 SGI-Modid: xfs-linux-melb:xfs-kern:203362a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_iops.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_iops.c58
1 files changed, 24 insertions, 34 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c
index 97fb1470cf28..8fd274fc26d5 100644
--- a/fs/xfs/linux-2.6/xfs_iops.c
+++ b/fs/xfs/linux-2.6/xfs_iops.c
@@ -58,6 +58,24 @@
58 (S_ISDIR(inode->i_mode) && inode->i_sb->s_flags & MS_NODIRATIME)) 58 (S_ISDIR(inode->i_mode) && inode->i_sb->s_flags & MS_NODIRATIME))
59 59
60/* 60/*
61 * Bring the atime in the XFS inode uptodate.
62 * Used before logging the inode to disk or when the Linux inode goes away.
63 */
64void
65xfs_synchronize_atime(
66 xfs_inode_t *ip)
67{
68 vnode_t *vp;
69
70 vp = XFS_ITOV_NULL(ip);
71 if (vp) {
72 struct inode *inode = &vp->v_inode;
73 ip->i_d.di_atime.t_sec = (__int32_t)inode->i_atime.tv_sec;
74 ip->i_d.di_atime.t_nsec = (__int32_t)inode->i_atime.tv_nsec;
75 }
76}
77
78/*
61 * Change the requested timestamp in the given inode. 79 * Change the requested timestamp in the given inode.
62 * We don't lock across timestamp updates, and we don't log them but 80 * We don't lock across timestamp updates, and we don't log them but
63 * we do record the fact that there is dirty information in core. 81 * we do record the fact that there is dirty information in core.
@@ -76,23 +94,6 @@ xfs_ichgtime(
76 struct inode *inode = LINVFS_GET_IP(XFS_ITOV(ip)); 94 struct inode *inode = LINVFS_GET_IP(XFS_ITOV(ip));
77 timespec_t tv; 95 timespec_t tv;
78 96
79 /*
80 * We're not supposed to change timestamps in readonly-mounted
81 * filesystems. Throw it away if anyone asks us.
82 */
83 if (unlikely(IS_RDONLY(inode)))
84 return;
85
86 /*
87 * Don't update access timestamps on reads if mounted "noatime".
88 * Throw it away if anyone asks us.
89 */
90 if (unlikely(
91 (ip->i_mount->m_flags & XFS_MOUNT_NOATIME || IS_NOATIME(inode)) &&
92 (flags & (XFS_ICHGTIME_ACC|XFS_ICHGTIME_MOD|XFS_ICHGTIME_CHG)) ==
93 XFS_ICHGTIME_ACC))
94 return;
95
96 nanotime(&tv); 97 nanotime(&tv);
97 if (flags & XFS_ICHGTIME_MOD) { 98 if (flags & XFS_ICHGTIME_MOD) {
98 inode->i_mtime = tv; 99 inode->i_mtime = tv;
@@ -129,8 +130,6 @@ xfs_ichgtime(
129 * Variant on the above which avoids querying the system clock 130 * Variant on the above which avoids querying the system clock
130 * in situations where we know the Linux inode timestamps have 131 * in situations where we know the Linux inode timestamps have
131 * just been updated (and so we can update our inode cheaply). 132 * just been updated (and so we can update our inode cheaply).
132 * We also skip the readonly and noatime checks here, they are
133 * also catered for already.
134 */ 133 */
135void 134void
136xfs_ichgtime_fast( 135xfs_ichgtime_fast(
@@ -141,20 +140,16 @@ xfs_ichgtime_fast(
141 timespec_t *tvp; 140 timespec_t *tvp;
142 141
143 /* 142 /*
144 * We're not supposed to change timestamps in readonly-mounted 143 * Atime updates for read() & friends are handled lazily now, and
145 * filesystems. Throw it away if anyone asks us. 144 * explicit updates must go through xfs_ichgtime()
146 */ 145 */
147 if (unlikely(IS_RDONLY(inode))) 146 ASSERT((flags & XFS_ICHGTIME_ACC) == 0);
148 return;
149 147
150 /* 148 /*
151 * Don't update access timestamps on reads if mounted "noatime". 149 * We're not supposed to change timestamps in readonly-mounted
152 * Throw it away if anyone asks us. 150 * filesystems. Throw it away if anyone asks us.
153 */ 151 */
154 if (unlikely( 152 if (unlikely(IS_RDONLY(inode)))
155 (ip->i_mount->m_flags & XFS_MOUNT_NOATIME || IS_NOATIME(inode)) &&
156 ((flags & (XFS_ICHGTIME_ACC|XFS_ICHGTIME_MOD|XFS_ICHGTIME_CHG)) ==
157 XFS_ICHGTIME_ACC)))
158 return; 153 return;
159 154
160 if (flags & XFS_ICHGTIME_MOD) { 155 if (flags & XFS_ICHGTIME_MOD) {
@@ -162,11 +157,6 @@ xfs_ichgtime_fast(
162 ip->i_d.di_mtime.t_sec = (__int32_t)tvp->tv_sec; 157 ip->i_d.di_mtime.t_sec = (__int32_t)tvp->tv_sec;
163 ip->i_d.di_mtime.t_nsec = (__int32_t)tvp->tv_nsec; 158 ip->i_d.di_mtime.t_nsec = (__int32_t)tvp->tv_nsec;
164 } 159 }
165 if (flags & XFS_ICHGTIME_ACC) {
166 tvp = &inode->i_atime;
167 ip->i_d.di_atime.t_sec = (__int32_t)tvp->tv_sec;
168 ip->i_d.di_atime.t_nsec = (__int32_t)tvp->tv_nsec;
169 }
170 if (flags & XFS_ICHGTIME_CHG) { 160 if (flags & XFS_ICHGTIME_CHG) {
171 tvp = &inode->i_ctime; 161 tvp = &inode->i_ctime;
172 ip->i_d.di_ctime.t_sec = (__int32_t)tvp->tv_sec; 162 ip->i_d.di_ctime.t_sec = (__int32_t)tvp->tv_sec;