aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-09 23:52:01 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-10 11:01:30 -0500
commit870f481793b585323fbda3e87c54efc116f46351 (patch)
tree08dce269f14c18ae1b1682d3cb0f149b938d40bb
parent3542c6e18f6470bad2bde1e94331e4f488a8d3f1 (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>
-rw-r--r--fs/inode.c27
-rw-r--r--fs/ncpfs/file.c2
-rw-r--r--fs/ntfs/file.c2
-rw-r--r--fs/ntfs/inode.c20
-rw-r--r--fs/ocfs2/mmap.c8
-rw-r--r--fs/pipe.c2
-rw-r--r--fs/reiserfs/file.c2
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c2
-rw-r--r--include/linux/fs.h2
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/filemap_xip.c2
11 files changed, 44 insertions, 27 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)
1204EXPORT_SYMBOL(update_atime); 1204EXPORT_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
1215void inode_update_time(struct inode *inode, int ctime_too) 1218void 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
1239EXPORT_SYMBOL(inode_update_time); 1242EXPORT_SYMBOL(file_update_time);
1240 1243
1241int inode_needs_sync(struct inode *inode) 1244int inode_needs_sync(struct inode *inode)
1242{ 1245{
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c
index 4947d9b11fc1..973b444d6914 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 30f71acdc1cb..fb413d3d8618 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);
2179out: 2179out:
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index bda7a08911a5..ea1bd3feea1b 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);
2768done: 2768done:
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 afdeec4b0eef..843cf9ddefe8 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
83int ocfs2_mmap(struct file *file, 83int 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}
diff --git a/fs/pipe.c b/fs/pipe.c
index acb030b61fb0..eef0f29e86ef 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -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 127e7d2cabdd..ad6fa964b0e7 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 5675117ef227..885dfafeabee 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 }
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 92ae3e2067b0..1feee2e7e47b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1716,7 +1716,7 @@ extern ssize_t simple_read_from_buffer(void __user *, size_t, loff_t *, const vo
1716extern int inode_change_ok(struct inode *, struct iattr *); 1716extern int inode_change_ok(struct inode *, struct iattr *);
1717extern int __must_check inode_setattr(struct inode *, struct iattr *); 1717extern int __must_check inode_setattr(struct inode *, struct iattr *);
1718 1718
1719extern void inode_update_time(struct inode *inode, int ctime_too); 1719extern void file_update_time(struct file *file);
1720 1720
1721static inline ino_t parent_ino(struct dentry *dentry) 1721static inline ino_t parent_ino(struct dentry *dentry)
1722{ 1722{
diff --git a/mm/filemap.c b/mm/filemap.c
index 5fca2737c971..96de772be487 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2108,7 +2108,7 @@ __generic_file_aio_write_nolock(struct kiocb *iocb, const struct iovec *iov,
2108 if (err) 2108 if (err)
2109 goto out; 2109 goto out;
2110 2110
2111 inode_update_time(inode, 1); 2111 file_update_time(file);
2112 2112
2113 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ 2113 /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */
2114 if (unlikely(file->f_flags & O_DIRECT)) { 2114 if (unlikely(file->f_flags & O_DIRECT)) {
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index e2b34e95913e..b960ac8e5918 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -383,7 +383,7 @@ xip_file_write(struct file *filp, const char __user *buf, size_t len,
383 if (ret) 383 if (ret)
384 goto out_backing; 384 goto out_backing;
385 385
386 inode_update_time(inode, 1); 386 file_update_time(filp);
387 387
388 ret = __xip_file_write (filp, buf, count, pos, ppos); 388 ret = __xip_file_write (filp, buf, count, pos, ppos);
389 389