aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorJean Noel Cordenner <jean-noel.cordenner@bull.net>2008-01-28 23:58:27 -0500
committerTheodore Ts'o <tytso@mit.edu>2008-01-28 23:58:27 -0500
commit25ec56b518257a56d2ff41a941d288e4b5ff9488 (patch)
tree77e84d38a5ad242f9d73a006f009649f223378f1 /fs/ext4/inode.c
parent7a224228ed79d587ece2304869000aad1b8e97dd (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 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 89cd35386ff5..a06a3b7cfc34 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2781,6 +2781,13 @@ void ext4_read_inode(struct inode * inode)
2781 EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode); 2781 EXT4_INODE_GET_XTIME(i_atime, inode, raw_inode);
2782 EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode); 2782 EXT4_EINODE_GET_XTIME(i_crtime, ei, raw_inode);
2783 2783
2784 inode->i_version = le32_to_cpu(raw_inode->i_disk_version);
2785 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
2786 if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
2787 inode->i_version |=
2788 (__u64)(le32_to_cpu(raw_inode->i_version_hi)) << 32;
2789 }
2790
2784 if (S_ISREG(inode->i_mode)) { 2791 if (S_ISREG(inode->i_mode)) {
2785 inode->i_op = &ext4_file_inode_operations; 2792 inode->i_op = &ext4_file_inode_operations;
2786 inode->i_fop = &ext4_file_operations; 2793 inode->i_fop = &ext4_file_operations;
@@ -2963,8 +2970,14 @@ static int ext4_do_update_inode(handle_t *handle,
2963 } else for (block = 0; block < EXT4_N_BLOCKS; block++) 2970 } else for (block = 0; block < EXT4_N_BLOCKS; block++)
2964 raw_inode->i_block[block] = ei->i_data[block]; 2971 raw_inode->i_block[block] = ei->i_data[block];
2965 2972
2966 if (ei->i_extra_isize) 2973 raw_inode->i_disk_version = cpu_to_le32(inode->i_version);
2974 if (ei->i_extra_isize) {
2975 if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi))
2976 raw_inode->i_version_hi =
2977 cpu_to_le32(inode->i_version >> 32);
2967 raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize); 2978 raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize);
2979 }
2980
2968 2981
2969 BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata"); 2982 BUFFER_TRACE(bh, "call ext4_journal_dirty_metadata");
2970 rc = ext4_journal_dirty_metadata(handle, bh); 2983 rc = ext4_journal_dirty_metadata(handle, bh);
@@ -3191,6 +3204,9 @@ int ext4_mark_iloc_dirty(handle_t *handle,
3191{ 3204{
3192 int err = 0; 3205 int err = 0;
3193 3206
3207 if (test_opt(inode->i_sb, I_VERSION))
3208 inode_inc_iversion(inode);
3209
3194 /* the do_update_inode consumes one bh->b_count */ 3210 /* the do_update_inode consumes one bh->b_count */
3195 get_bh(iloc->bh); 3211 get_bh(iloc->bh);
3196 3212