diff options
author | Christoph Hellwig <hch@infradead.org> | 2008-08-13 02:45:13 -0400 |
---|---|---|
committer | Lachlan McIlroy <lachlan@redback.melbourne.sgi.com> | 2008-08-13 02:45:13 -0400 |
commit | 8e5975c82f66bce36955f38e9abc259d5143a72a (patch) | |
tree | def4ae55c36f02f920037b769a268f389c5b513a /fs | |
parent | dff35fd41f252476cba7f761d7204dd9f47d739e (diff) |
[XFS] optimize xfs_ichgtime
Port a little optmization from file_update_time to xfs_ichgtime, and only
update the timestamp and mark the inode dirty if the timestamp actually
changes in the timer tick resultion supported by the running kernel.
SGI-PV: 981498
SGI-Modid: xfs-linux-melb:xfs-kern:31827a
Signed-off-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_iops.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/fs/xfs/linux-2.6/xfs_iops.c b/fs/xfs/linux-2.6/xfs_iops.c index d6947f818f29..0e7ca2155956 100644 --- a/fs/xfs/linux-2.6/xfs_iops.c +++ b/fs/xfs/linux-2.6/xfs_iops.c | |||
@@ -97,17 +97,23 @@ xfs_ichgtime( | |||
97 | { | 97 | { |
98 | struct inode *inode = VFS_I(ip); | 98 | struct inode *inode = VFS_I(ip); |
99 | timespec_t tv; | 99 | timespec_t tv; |
100 | int sync_it = 0; | ||
100 | 101 | ||
101 | nanotime(&tv); | 102 | tv = current_fs_time(inode->i_sb); |
102 | if (flags & XFS_ICHGTIME_MOD) { | 103 | |
104 | if ((flags & XFS_ICHGTIME_MOD) && | ||
105 | !timespec_equal(&inode->i_mtime, &tv)) { | ||
103 | inode->i_mtime = tv; | 106 | inode->i_mtime = tv; |
104 | ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; | 107 | ip->i_d.di_mtime.t_sec = (__int32_t)tv.tv_sec; |
105 | ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; | 108 | ip->i_d.di_mtime.t_nsec = (__int32_t)tv.tv_nsec; |
109 | sync_it = 1; | ||
106 | } | 110 | } |
107 | if (flags & XFS_ICHGTIME_CHG) { | 111 | if ((flags & XFS_ICHGTIME_CHG) && |
112 | !timespec_equal(&inode->i_ctime, &tv)) { | ||
108 | inode->i_ctime = tv; | 113 | inode->i_ctime = tv; |
109 | ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; | 114 | ip->i_d.di_ctime.t_sec = (__int32_t)tv.tv_sec; |
110 | ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; | 115 | ip->i_d.di_ctime.t_nsec = (__int32_t)tv.tv_nsec; |
116 | sync_it = 1; | ||
111 | } | 117 | } |
112 | 118 | ||
113 | /* | 119 | /* |
@@ -119,10 +125,11 @@ xfs_ichgtime( | |||
119 | * ensure that the compiler does not reorder the update | 125 | * ensure that the compiler does not reorder the update |
120 | * of i_update_core above the timestamp updates above. | 126 | * of i_update_core above the timestamp updates above. |
121 | */ | 127 | */ |
122 | SYNCHRONIZE(); | 128 | if (sync_it) { |
123 | ip->i_update_core = 1; | 129 | SYNCHRONIZE(); |
124 | if (!(inode->i_state & I_NEW)) | 130 | ip->i_update_core = 1; |
125 | mark_inode_dirty_sync(inode); | 131 | mark_inode_dirty_sync(inode); |
132 | } | ||
126 | } | 133 | } |
127 | 134 | ||
128 | /* | 135 | /* |