diff options
author | Christoph Hellwig <hch@lst.de> | 2006-01-09 23:52:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:30 -0500 |
commit | 870f481793b585323fbda3e87c54efc116f46351 (patch) | |
tree | 08dce269f14c18ae1b1682d3cb0f149b938d40bb /fs | |
parent | 3542c6e18f6470bad2bde1e94331e4f488a8d3f1 (diff) |
[PATCH] replace inode_update_time with file_update_time
To allow various options to work per-mount instead of per-sb we need a
struct vfsmount when updating ctime and mtime. This preparation patch
replaces the inode_update_time routine with a file_update_atime routine so
we can easily get at the vfsmount. (and the file makes more sense in this
context anyway). Also get rid of the unused second argument - we always
want to update the ctime when calling this routine.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@ftp.linux.org.uk>
Cc: Anton Altaparmakov <aia21@cantab.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/inode.c | 27 | ||||
-rw-r--r-- | fs/ncpfs/file.c | 2 | ||||
-rw-r--r-- | fs/ntfs/file.c | 2 | ||||
-rw-r--r-- | fs/ntfs/inode.c | 20 | ||||
-rw-r--r-- | fs/ocfs2/mmap.c | 8 | ||||
-rw-r--r-- | fs/pipe.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/file.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_lrw.c | 2 |
8 files changed, 41 insertions, 24 deletions
diff --git a/fs/inode.c b/fs/inode.c index e08767fd57b..e177769f3b4 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 | { |
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 4947d9b11fc..973b444d691 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c | |||
@@ -262,7 +262,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * | |||
262 | } | 262 | } |
263 | vfree(bouncebuffer); | 263 | vfree(bouncebuffer); |
264 | 264 | ||
265 | inode_update_time(inode, 1); | 265 | file_update_time(file); |
266 | 266 | ||
267 | *ppos = pos; | 267 | *ppos = pos; |
268 | 268 | ||
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 30f71acdc1c..fb413d3d861 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -2173,7 +2173,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb, | |||
2173 | err = remove_suid(file->f_dentry); | 2173 | err = remove_suid(file->f_dentry); |
2174 | if (err) | 2174 | if (err) |
2175 | goto out; | 2175 | goto out; |
2176 | inode_update_time(inode, 1); | 2176 | file_update_time(file); |
2177 | written = ntfs_file_buffered_write(iocb, iov, nr_segs, pos, ppos, | 2177 | written = ntfs_file_buffered_write(iocb, iov, nr_segs, pos, ppos, |
2178 | count); | 2178 | count); |
2179 | out: | 2179 | out: |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index bda7a08911a..ea1bd3feea1 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -2767,7 +2767,25 @@ unm_done: | |||
2767 | up_write(&ni->runlist.lock); | 2767 | up_write(&ni->runlist.lock); |
2768 | done: | 2768 | done: |
2769 | /* Update the mtime and ctime on the base inode. */ | 2769 | /* Update the mtime and ctime on the base inode. */ |
2770 | inode_update_time(VFS_I(base_ni), 1); | 2770 | /* normally ->truncate shouldn't update ctime or mtime, |
2771 | * but ntfs did before so it got a copy & paste version | ||
2772 | * of file_update_time. one day someone should fix this | ||
2773 | * for real. | ||
2774 | */ | ||
2775 | if (!IS_NOCMTIME(VFS_I(base_ni)) && !IS_RDONLY(VFS_I(base_ni))) { | ||
2776 | struct timespec now = current_fs_time(VFS_I(base_ni)->i_sb); | ||
2777 | int sync_it = 0; | ||
2778 | |||
2779 | if (!timespec_equal(&VFS_I(base_ni)->i_mtime, &now) || | ||
2780 | !timespec_equal(&VFS_I(base_ni)->i_ctime, &now)) | ||
2781 | sync_it = 1; | ||
2782 | VFS_I(base_ni)->i_mtime = now; | ||
2783 | VFS_I(base_ni)->i_ctime = now; | ||
2784 | |||
2785 | if (sync_it) | ||
2786 | mark_inode_dirty_sync(VFS_I(base_ni)); | ||
2787 | } | ||
2788 | |||
2771 | if (likely(!err)) { | 2789 | if (likely(!err)) { |
2772 | NInoClearTruncateFailed(ni); | 2790 | NInoClearTruncateFailed(ni); |
2773 | ntfs_debug("Done."); | 2791 | ntfs_debug("Done."); |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index afdeec4b0ee..843cf9ddefe 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -80,12 +80,8 @@ static struct vm_operations_struct ocfs2_file_vm_ops = { | |||
80 | .nopage = ocfs2_nopage, | 80 | .nopage = ocfs2_nopage, |
81 | }; | 81 | }; |
82 | 82 | ||
83 | int ocfs2_mmap(struct file *file, | 83 | int ocfs2_mmap(struct file *file, struct vm_area_struct *vma) |
84 | struct vm_area_struct *vma) | ||
85 | { | 84 | { |
86 | struct address_space *mapping = file->f_dentry->d_inode->i_mapping; | ||
87 | struct inode *inode = mapping->host; | ||
88 | |||
89 | /* We don't want to support shared writable mappings yet. */ | 85 | /* We don't want to support shared writable mappings yet. */ |
90 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) | 86 | if (((vma->vm_flags & VM_SHARED) || (vma->vm_flags & VM_MAYSHARE)) |
91 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { | 87 | && ((vma->vm_flags & VM_WRITE) || (vma->vm_flags & VM_MAYWRITE))) { |
@@ -95,7 +91,7 @@ int ocfs2_mmap(struct file *file, | |||
95 | return -EINVAL; | 91 | return -EINVAL; |
96 | } | 92 | } |
97 | 93 | ||
98 | update_atime(inode); | 94 | file_accessed(file); |
99 | vma->vm_ops = &ocfs2_file_vm_ops; | 95 | vma->vm_ops = &ocfs2_file_vm_ops; |
100 | return 0; | 96 | return 0; |
101 | } | 97 | } |
@@ -347,7 +347,7 @@ out: | |||
347 | kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); | 347 | kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); |
348 | } | 348 | } |
349 | if (ret > 0) | 349 | if (ret > 0) |
350 | inode_update_time(inode, 1); /* mtime and ctime */ | 350 | file_update_time(filp); |
351 | return ret; | 351 | return ret; |
352 | } | 352 | } |
353 | 353 | ||
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 127e7d2cabd..ad6fa964b0e 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -1360,7 +1360,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1360 | if (res) | 1360 | if (res) |
1361 | goto out; | 1361 | goto out; |
1362 | 1362 | ||
1363 | inode_update_time(inode, 1); /* Both mtime and ctime */ | 1363 | file_update_time(file); |
1364 | 1364 | ||
1365 | // Ok, we are done with all the checks. | 1365 | // Ok, we are done with all the checks. |
1366 | 1366 | ||
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c index 5675117ef22..885dfafeabe 100644 --- a/fs/xfs/linux-2.6/xfs_lrw.c +++ b/fs/xfs/linux-2.6/xfs_lrw.c | |||
@@ -713,7 +713,7 @@ start: | |||
713 | } | 713 | } |
714 | 714 | ||
715 | if (likely(!(ioflags & IO_INVIS))) { | 715 | if (likely(!(ioflags & IO_INVIS))) { |
716 | inode_update_time(inode, 1); | 716 | file_update_time(file); |
717 | xfs_ichgtime_fast(xip, inode, | 717 | xfs_ichgtime_fast(xip, inode, |
718 | XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); | 718 | XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); |
719 | } | 719 | } |