aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJosef Bacik <josef@redhat.com>2012-03-26 09:59:21 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 12:07:25 -0400
commitc3b2da314834499f34cba94f7053e55f6d6f92d8 (patch)
tree7012b569ee9e0781761a8eb388190979441583c7 /include
parent033369d1af1264abc23bea2e174aa47cdd212f6f (diff)
fs: introduce inode operation ->update_time
Btrfs has to make sure we have space to allocate new blocks in order to modify the inode, so updating time can fail. We've gotten around this by having our own file_update_time but this is kind of a pain, and Christoph has indicated he would like to make xfs do something different with atime updates. So introduce ->update_time, where we will deal with i_version an a/m/c time updates and indicate which changes need to be made. The normal version just does what it has always done, updates the time and marks the inode dirty, and then filesystems can choose to do something different. I've gone through all of the users of file_update_time and made them check for errors with the exception of the fault code since it's complicated and I wasn't quite sure what to do there, also Jan is going to be pushing the file time updates into page_mkwrite for those who have it so that should satisfy btrfs and make it not a big deal to check the file_update_time() return code in the generic fault path. Thanks, Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cdc1a9630948..57fc70574d20 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1684,6 +1684,7 @@ struct inode_operations {
1684 void (*truncate_range)(struct inode *, loff_t, loff_t); 1684 void (*truncate_range)(struct inode *, loff_t, loff_t);
1685 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, 1685 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,
1686 u64 len); 1686 u64 len);
1687 int (*update_time)(struct inode *, struct timespec *, int);
1687} ____cacheline_aligned; 1688} ____cacheline_aligned;
1688 1689
1689struct seq_file; 1690struct seq_file;
@@ -1843,6 +1844,13 @@ static inline void inode_inc_iversion(struct inode *inode)
1843 spin_unlock(&inode->i_lock); 1844 spin_unlock(&inode->i_lock);
1844} 1845}
1845 1846
1847enum file_time_flags {
1848 S_ATIME = 1,
1849 S_MTIME = 2,
1850 S_CTIME = 4,
1851 S_VERSION = 8,
1852};
1853
1846extern void touch_atime(struct path *); 1854extern void touch_atime(struct path *);
1847static inline void file_accessed(struct file *file) 1855static inline void file_accessed(struct file *file)
1848{ 1856{
@@ -2579,7 +2587,7 @@ extern int inode_change_ok(const struct inode *, struct iattr *);
2579extern int inode_newsize_ok(const struct inode *, loff_t offset); 2587extern int inode_newsize_ok(const struct inode *, loff_t offset);
2580extern void setattr_copy(struct inode *inode, const struct iattr *attr); 2588extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2581 2589
2582extern void file_update_time(struct file *file); 2590extern int file_update_time(struct file *file);
2583 2591
2584extern int generic_show_options(struct seq_file *m, struct dentry *root); 2592extern int generic_show_options(struct seq_file *m, struct dentry *root);
2585extern void save_mount_options(struct super_block *sb, char *options); 2593extern void save_mount_options(struct super_block *sb, char *options);