diff options
author | Jean Noel Cordenner <jean-noel.cordenner@bull.net> | 2008-01-28 23:58:27 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-01-28 23:58:27 -0500 |
commit | 25ec56b518257a56d2ff41a941d288e4b5ff9488 (patch) | |
tree | 77e84d38a5ad242f9d73a006f009649f223378f1 /include/linux | |
parent | 7a224228ed79d587ece2304869000aad1b8e97dd (diff) |
ext4: Add inode version support in ext4
This patch adds 64-bit inode version support to ext4. The lower 32 bits
are stored in the osd1.linux1.l_i_version field while the high 32 bits
are stored in the i_version_hi field newly created in the ext4_inode.
This field is incremented in case the ext4_inode is large enough. A
i_version mount option has been added to enable the feature.
Signed-off-by: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Jean Noel Cordenner <jean-noel.cordenner@bull.net>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/ext4_fs.h | 6 | ||||
-rw-r--r-- | include/linux/fs.h | 16 |
2 files changed, 20 insertions, 2 deletions
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h index cd406dba0e64..b6092940c8b8 100644 --- a/include/linux/ext4_fs.h +++ b/include/linux/ext4_fs.h | |||
@@ -292,7 +292,7 @@ struct ext4_inode { | |||
292 | __le32 i_flags; /* File flags */ | 292 | __le32 i_flags; /* File flags */ |
293 | union { | 293 | union { |
294 | struct { | 294 | struct { |
295 | __u32 l_i_reserved1; | 295 | __le32 l_i_version; |
296 | } linux1; | 296 | } linux1; |
297 | struct { | 297 | struct { |
298 | __u32 h_i_translator; | 298 | __u32 h_i_translator; |
@@ -334,6 +334,7 @@ struct ext4_inode { | |||
334 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ | 334 | __le32 i_atime_extra; /* extra Access time (nsec << 2 | epoch) */ |
335 | __le32 i_crtime; /* File Creation time */ | 335 | __le32 i_crtime; /* File Creation time */ |
336 | __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ | 336 | __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ |
337 | __le32 i_version_hi; /* high 32 bits for 64-bit version */ | ||
337 | }; | 338 | }; |
338 | 339 | ||
339 | 340 | ||
@@ -407,6 +408,8 @@ do { \ | |||
407 | raw_inode->xtime ## _extra); \ | 408 | raw_inode->xtime ## _extra); \ |
408 | } while (0) | 409 | } while (0) |
409 | 410 | ||
411 | #define i_disk_version osd1.linux1.l_i_version | ||
412 | |||
410 | #if defined(__KERNEL__) || defined(__linux__) | 413 | #if defined(__KERNEL__) || defined(__linux__) |
411 | #define i_reserved1 osd1.linux1.l_i_reserved1 | 414 | #define i_reserved1 osd1.linux1.l_i_reserved1 |
412 | #define i_file_acl_high osd2.linux2.l_i_file_acl_high | 415 | #define i_file_acl_high osd2.linux2.l_i_file_acl_high |
@@ -469,6 +472,7 @@ do { \ | |||
469 | #define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ | 472 | #define EXT4_MOUNT_EXTENTS 0x400000 /* Extents support */ |
470 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ | 473 | #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */ |
471 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ | 474 | #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */ |
475 | #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */ | ||
472 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ | 476 | /* Compatibility, for having both ext2_fs.h and ext4_fs.h included at once */ |
473 | #ifndef _LINUX_EXT2_FS_H | 477 | #ifndef _LINUX_EXT2_FS_H |
474 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | 478 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 9608839552b3..a516b6716870 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1396,7 +1396,21 @@ static inline void inode_dec_link_count(struct inode *inode) | |||
1396 | mark_inode_dirty(inode); | 1396 | mark_inode_dirty(inode); |
1397 | } | 1397 | } |
1398 | 1398 | ||
1399 | extern void inode_inc_iversion(struct inode *inode); | 1399 | /** |
1400 | * inode_inc_iversion - increments i_version | ||
1401 | * @inode: inode that need to be updated | ||
1402 | * | ||
1403 | * Every time the inode is modified, the i_version field will be incremented. | ||
1404 | * The filesystem has to be mounted with i_version flag | ||
1405 | */ | ||
1406 | |||
1407 | static inline void inode_inc_iversion(struct inode *inode) | ||
1408 | { | ||
1409 | spin_lock(&inode->i_lock); | ||
1410 | inode->i_version++; | ||
1411 | spin_unlock(&inode->i_lock); | ||
1412 | } | ||
1413 | |||
1400 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); | 1414 | extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry); |
1401 | static inline void file_accessed(struct file *file) | 1415 | static inline void file_accessed(struct file *file) |
1402 | { | 1416 | { |