1 VFS: Add 64 bit inode version support
3 From: Jean Noel Cordenner <jean-noel.cordenner@bull.net>
5 The i_version field of the inode is changed to be a 64-bit counter that
6 is set on every inode creation and that is incremented every time the
7 inode data is modified (similarly to the "ctime" time-stamp).
8 The aim is to fulfill a NFSv4 requirement for rfc3530.
9 This first part concerns the vfs, it converts the 32-bit i_version in
10 the generic inode to a 64-bit, a flag is added in the super block in
11 order to check if the feature is enabled and the i_version is
12 incremented in the vfs.
14 Signed-off-by: Mingming Cao <cmm@us.ibm.com>
15 Signed-off-by: Jean Noel Cordenner <jean-noel.cordenner@bull.net>
16 Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
18 fs/inode.c | 22 ++++++++++++++++++++++
19 include/linux/fs.h | 5 ++++-
20 2 files changed, 26 insertions(+), 1 deletion(-)
22 Index: linux-2.6.24-rc3/include/linux/fs.h
23 ===================================================================
24 --- linux-2.6.24-rc3.orig/include/linux/fs.h 2007-11-20 17:11:39.000000000 -0800
25 +++ linux-2.6.24-rc3/include/linux/fs.h 2007-11-20 17:15:24.000000000 -0800
26 @@ -124,6 +124,7 @@ extern int dir_notify_enable;
27 #define MS_SHARED (1<<20) /* change to shared */
28 #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
29 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
30 +#define MS_I_VERSION (1<<23) /* Update inode I_version field */
31 #define MS_ACTIVE (1<<30)
32 #define MS_NOUSER (1<<31)
34 @@ -173,6 +174,7 @@ extern int dir_notify_enable;
35 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
36 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
37 #define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
38 +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
40 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
41 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
42 @@ -599,7 +601,7 @@ struct inode {
46 - unsigned long i_version;
49 #ifdef __NEED_I_SIZE_ORDERED
50 seqcount_t i_size_seqcount;
51 @@ -1394,6 +1396,7 @@ static inline void inode_dec_link_count(
52 mark_inode_dirty(inode);
55 +extern void inode_inc_iversion(struct inode *inode);
56 extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
57 static inline void file_accessed(struct file *file)
59 Index: linux-2.6.24-rc3/fs/inode.c
60 ===================================================================
61 --- linux-2.6.24-rc3.orig/fs/inode.c 2007-11-16 21:16:36.000000000 -0800
62 +++ linux-2.6.24-rc3/fs/inode.c 2007-11-20 17:12:52.000000000 -0800
63 @@ -1243,6 +1243,23 @@ void touch_atime(struct vfsmount *mnt, s
64 EXPORT_SYMBOL(touch_atime);
67 + * inode_inc_iversion - increments i_version
68 + * @inode: inode that need to be updated
70 + * Every time the inode is modified, the i_version field
71 + * will be incremented.
72 + * The filesystem has to be mounted with i_version flag
76 +void inode_inc_iversion(struct inode *inode)
78 + spin_lock(&inode->i_lock);
80 + spin_unlock(&inode->i_lock);
84 * file_update_time - update mtime and ctime time
85 * @file: file accessed
87 @@ -1276,6 +1293,11 @@ void file_update_time(struct file *file)
91 + if (IS_I_VERSION(inode)) {
92 + inode_inc_iversion(inode);
97 mark_inode_dirty_sync(inode);