diff options
Diffstat (limited to 'fs/inode.c')
-rw-r--r-- | fs/inode.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/inode.c b/fs/inode.c index e08767fd57b0..e177769f3b41 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -1204,16 +1204,20 @@ void update_atime(struct inode *inode) | |||
1204 | EXPORT_SYMBOL(update_atime); | 1204 | EXPORT_SYMBOL(update_atime); |
1205 | 1205 | ||
1206 | /** | 1206 | /** |
1207 | * inode_update_time - update mtime and ctime time | 1207 | * file_update_time - update mtime and ctime time |
1208 | * @inode: inode accessed | 1208 | * @file: file accessed |
1209 | * @ctime_too: update ctime too | ||
1210 | * | 1209 | * |
1211 | * Update the mtime time on an inode and mark it for writeback. | 1210 | * Update the mtime and ctime members of an inode and mark the inode |
1212 | * When ctime_too is specified update the ctime too. | 1211 | * for writeback. Note that this function is meant exclusively for |
1212 | * usage in the file write path of filesystems, and filesystems may | ||
1213 | * choose to explicitly ignore update via this function with the | ||
1214 | * S_NOCTIME inode flag, e.g. for network filesystem where these | ||
1215 | * timestamps are handled by the server. | ||
1213 | */ | 1216 | */ |
1214 | 1217 | ||
1215 | void inode_update_time(struct inode *inode, int ctime_too) | 1218 | void file_update_time(struct file *file) |
1216 | { | 1219 | { |
1220 | struct inode *inode = file->f_dentry->d_inode; | ||
1217 | struct timespec now; | 1221 | struct timespec now; |
1218 | int sync_it = 0; | 1222 | int sync_it = 0; |
1219 | 1223 | ||
@@ -1227,16 +1231,15 @@ void inode_update_time(struct inode *inode, int ctime_too) | |||
1227 | sync_it = 1; | 1231 | sync_it = 1; |
1228 | inode->i_mtime = now; | 1232 | inode->i_mtime = now; |
1229 | 1233 | ||
1230 | if (ctime_too) { | 1234 | if (!timespec_equal(&inode->i_ctime, &now)) |
1231 | if (!timespec_equal(&inode->i_ctime, &now)) | 1235 | sync_it = 1; |
1232 | sync_it = 1; | 1236 | inode->i_ctime = now; |
1233 | inode->i_ctime = now; | 1237 | |
1234 | } | ||
1235 | if (sync_it) | 1238 | if (sync_it) |
1236 | mark_inode_dirty_sync(inode); | 1239 | mark_inode_dirty_sync(inode); |
1237 | } | 1240 | } |
1238 | 1241 | ||
1239 | EXPORT_SYMBOL(inode_update_time); | 1242 | EXPORT_SYMBOL(file_update_time); |
1240 | 1243 | ||
1241 | int inode_needs_sync(struct inode *inode) | 1244 | int inode_needs_sync(struct inode *inode) |
1242 | { | 1245 | { |