From: Christoph Hellwig 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 Cc: Al Viro Signed-off-by: Andrew Morton --- fs/inode.c | 23 +++++++++++------------ fs/ncpfs/file.c | 2 +- fs/pipe.c | 2 +- fs/reiserfs/file.c | 2 +- fs/xfs/linux-2.6/xfs_lrw.c | 2 +- include/linux/fs.h | 2 +- mm/filemap.c | 2 +- mm/filemap_xip.c | 2 +- 8 files changed, 18 insertions(+), 19 deletions(-) diff -puN fs/inode.c~replace-inode_update_time-with-file_update_time fs/inode.c --- devel/fs/inode.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/fs/inode.c 2005-12-10 21:52:33.000000000 -0800 @@ -1204,16 +1204,16 @@ void update_atime(struct inode *inode) EXPORT_SYMBOL(update_atime); /** - * inode_update_time - update mtime and ctime time - * @inode: inode accessed - * @ctime_too: update ctime too + * file_update_time - update mtime and ctime time + * @file: file accessed * - * Update the mtime time on an inode and mark it for writeback. - * When ctime_too is specified update the ctime too. + * Update the mtime and ctime members of an inode and mark the inode + * for writeback. */ -void inode_update_time(struct inode *inode, int ctime_too) +void file_update_time(struct file *file) { + struct inode *inode = file->f_dentry->d_inode; struct timespec now; int sync_it = 0; @@ -1227,16 +1227,15 @@ void inode_update_time(struct inode *ino sync_it = 1; inode->i_mtime = now; - if (ctime_too) { - if (!timespec_equal(&inode->i_ctime, &now)) - sync_it = 1; - inode->i_ctime = now; - } + if (!timespec_equal(&inode->i_ctime, &now)) + sync_it = 1; + inode->i_ctime = now; + if (sync_it) mark_inode_dirty_sync(inode); } -EXPORT_SYMBOL(inode_update_time); +EXPORT_SYMBOL(file_update_time); int inode_needs_sync(struct inode *inode) { diff -puN fs/ncpfs/file.c~replace-inode_update_time-with-file_update_time fs/ncpfs/file.c --- devel/fs/ncpfs/file.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/fs/ncpfs/file.c 2005-12-10 21:52:33.000000000 -0800 @@ -262,7 +262,7 @@ ncp_file_write(struct file *file, const } vfree(bouncebuffer); - inode_update_time(inode, 1); + file_update_time(file); *ppos = pos; diff -puN fs/pipe.c~replace-inode_update_time-with-file_update_time fs/pipe.c --- devel/fs/pipe.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/fs/pipe.c 2005-12-10 21:52:33.000000000 -0800 @@ -347,7 +347,7 @@ out: kill_fasync(PIPE_FASYNC_READERS(*inode), SIGIO, POLL_IN); } if (ret > 0) - inode_update_time(inode, 1); /* mtime and ctime */ + file_update_time(filp); return ret; } diff -puN fs/reiserfs/file.c~replace-inode_update_time-with-file_update_time fs/reiserfs/file.c --- devel/fs/reiserfs/file.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/fs/reiserfs/file.c 2005-12-10 21:52:33.000000000 -0800 @@ -1360,7 +1360,7 @@ static ssize_t reiserfs_file_write(struc if (res) goto out; - inode_update_time(inode, 1); /* Both mtime and ctime */ + file_update_time(file); // Ok, we are done with all the checks. diff -puN fs/xfs/linux-2.6/xfs_lrw.c~replace-inode_update_time-with-file_update_time fs/xfs/linux-2.6/xfs_lrw.c --- devel/fs/xfs/linux-2.6/xfs_lrw.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/fs/xfs/linux-2.6/xfs_lrw.c 2005-12-10 21:52:33.000000000 -0800 @@ -691,7 +691,7 @@ start: } if (likely(!(ioflags & IO_INVIS))) { - inode_update_time(inode, 1); + file_update_time(file); xfs_ichgtime_fast(xip, inode, XFS_ICHGTIME_MOD | XFS_ICHGTIME_CHG); } diff -puN include/linux/fs.h~replace-inode_update_time-with-file_update_time include/linux/fs.h --- devel/include/linux/fs.h~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/include/linux/fs.h 2005-12-10 21:52:33.000000000 -0800 @@ -1728,7 +1728,7 @@ extern ssize_t simple_read_from_buffer(v extern int inode_change_ok(struct inode *, struct iattr *); extern int __must_check inode_setattr(struct inode *, struct iattr *); -extern void inode_update_time(struct inode *inode, int ctime_too); +extern void file_update_time(struct file *file); static inline ino_t parent_ino(struct dentry *dentry) { diff -puN mm/filemap.c~replace-inode_update_time-with-file_update_time mm/filemap.c --- devel/mm/filemap.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/mm/filemap.c 2005-12-10 21:52:33.000000000 -0800 @@ -2108,7 +2108,7 @@ __generic_file_aio_write_nolock(struct k if (err) goto out; - inode_update_time(inode, 1); + file_update_time(file); /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ if (unlikely(file->f_flags & O_DIRECT)) { diff -puN mm/filemap_xip.c~replace-inode_update_time-with-file_update_time mm/filemap_xip.c --- devel/mm/filemap_xip.c~replace-inode_update_time-with-file_update_time 2005-12-10 21:52:33.000000000 -0800 +++ devel-akpm/mm/filemap_xip.c 2005-12-10 21:52:33.000000000 -0800 @@ -383,7 +383,7 @@ xip_file_write(struct file *filp, const if (ret) goto out_backing; - inode_update_time(inode, 1); + file_update_time(filp); ret = __xip_file_write (filp, buf, count, pos, ppos); _