aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ext4/ialloc.c1
-rw-r--r--fs/ext4/inode.c55
-rw-r--r--include/linux/ext4_fs.h15
-rw-r--r--include/linux/ext4_fs_i.h1
4 files changed, 34 insertions, 38 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 00b152b92480..17b5df14f85b 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -709,7 +709,6 @@ got:
709 if (!S_ISDIR(mode)) 709 if (!S_ISDIR(mode))
710 ei->i_flags &= ~EXT4_DIRSYNC_FL; 710 ei->i_flags &= ~EXT4_DIRSYNC_FL;
711 ei->i_file_acl = 0; 711 ei->i_file_acl = 0;
712 ei->i_dir_acl = 0;
713 ei->i_dtime = 0; 712 ei->i_dtime = 0;
714 ei->i_block_alloc_info = NULL; 713 ei->i_block_alloc_info = NULL;
715 ei->i_block_group = group; 714 ei->i_block_group = group;
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 7bcec1860084..e6634550cfc8 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2694,7 +2694,6 @@ void ext4_read_inode(struct inode * inode)
2694 inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16; 2694 inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
2695 } 2695 }
2696 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count); 2696 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
2697 inode->i_size = le32_to_cpu(raw_inode->i_size);
2698 2697
2699 ei->i_state = 0; 2698 ei->i_state = 0;
2700 ei->i_dir_start_lookup = 0; 2699 ei->i_dir_start_lookup = 0;
@@ -2720,15 +2719,11 @@ void ext4_read_inode(struct inode * inode)
2720 ei->i_flags = le32_to_cpu(raw_inode->i_flags); 2719 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
2721 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo); 2720 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo);
2722 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != 2721 if (EXT4_SB(inode->i_sb)->s_es->s_creator_os !=
2723 cpu_to_le32(EXT4_OS_HURD)) 2722 cpu_to_le32(EXT4_OS_HURD)) {
2724 ei->i_file_acl |= 2723 ei->i_file_acl |=
2725 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32; 2724 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
2726 if (!S_ISREG(inode->i_mode)) {
2727 ei->i_dir_acl = le32_to_cpu(raw_inode->i_dir_acl);
2728 } else {
2729 inode->i_size |=
2730 ((__u64)le32_to_cpu(raw_inode->i_size_high)) << 32;
2731 } 2725 }
2726 inode->i_size = ext4_isize(raw_inode);
2732 ei->i_disksize = inode->i_size; 2727 ei->i_disksize = inode->i_size;
2733 inode->i_generation = le32_to_cpu(raw_inode->i_generation); 2728 inode->i_generation = le32_to_cpu(raw_inode->i_generation);
2734 ei->i_block_group = iloc.block_group; 2729 ei->i_block_group = iloc.block_group;
@@ -2852,7 +2847,6 @@ static int ext4_do_update_inode(handle_t *handle,
2852 raw_inode->i_gid_high = 0; 2847 raw_inode->i_gid_high = 0;
2853 } 2848 }
2854 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); 2849 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
2855 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
2856 2850
2857 EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode); 2851 EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
2858 EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode); 2852 EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode);
@@ -2867,32 +2861,27 @@ static int ext4_do_update_inode(handle_t *handle,
2867 raw_inode->i_file_acl_high = 2861 raw_inode->i_file_acl_high =
2868 cpu_to_le16(ei->i_file_acl >> 32); 2862 cpu_to_le16(ei->i_file_acl >> 32);
2869 raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl); 2863 raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl);
2870 if (!S_ISREG(inode->i_mode)) { 2864 ext4_isize_set(raw_inode, ei->i_disksize);
2871 raw_inode->i_dir_acl = cpu_to_le32(ei->i_dir_acl); 2865 if (ei->i_disksize > 0x7fffffffULL) {
2872 } else { 2866 struct super_block *sb = inode->i_sb;
2873 raw_inode->i_size_high = 2867 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb,
2874 cpu_to_le32(ei->i_disksize >> 32); 2868 EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
2875 if (ei->i_disksize > 0x7fffffffULL) { 2869 EXT4_SB(sb)->s_es->s_rev_level ==
2876 struct super_block *sb = inode->i_sb; 2870 cpu_to_le32(EXT4_GOOD_OLD_REV)) {
2877 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, 2871 /* If this is the first large file
2878 EXT4_FEATURE_RO_COMPAT_LARGE_FILE) || 2872 * created, add a flag to the superblock.
2879 EXT4_SB(sb)->s_es->s_rev_level == 2873 */
2880 cpu_to_le32(EXT4_GOOD_OLD_REV)) { 2874 err = ext4_journal_get_write_access(handle,
2881 /* If this is the first large file 2875 EXT4_SB(sb)->s_sbh);
2882 * created, add a flag to the superblock. 2876 if (err)
2883 */ 2877 goto out_brelse;
2884 err = ext4_journal_get_write_access(handle, 2878 ext4_update_dynamic_rev(sb);
2885 EXT4_SB(sb)->s_sbh); 2879 EXT4_SET_RO_COMPAT_FEATURE(sb,
2886 if (err)
2887 goto out_brelse;
2888 ext4_update_dynamic_rev(sb);
2889 EXT4_SET_RO_COMPAT_FEATURE(sb,
2890 EXT4_FEATURE_RO_COMPAT_LARGE_FILE); 2880 EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
2891 sb->s_dirt = 1; 2881 sb->s_dirt = 1;
2892 handle->h_sync = 1; 2882 handle->h_sync = 1;
2893 err = ext4_journal_dirty_metadata(handle, 2883 err = ext4_journal_dirty_metadata(handle,
2894 EXT4_SB(sb)->s_sbh); 2884 EXT4_SB(sb)->s_sbh);
2895 }
2896 } 2885 }
2897 } 2886 }
2898 raw_inode->i_generation = cpu_to_le32(inode->i_generation); 2887 raw_inode->i_generation = cpu_to_le32(inode->i_generation);
diff --git a/include/linux/ext4_fs.h b/include/linux/ext4_fs.h
index 6894f361d01d..a8f3faea8eff 100644
--- a/include/linux/ext4_fs.h
+++ b/include/linux/ext4_fs.h
@@ -275,7 +275,7 @@ struct ext4_mount_options {
275struct ext4_inode { 275struct ext4_inode {
276 __le16 i_mode; /* File mode */ 276 __le16 i_mode; /* File mode */
277 __le16 i_uid; /* Low 16 bits of Owner Uid */ 277 __le16 i_uid; /* Low 16 bits of Owner Uid */
278 __le32 i_size; /* Size in bytes */ 278 __le32 i_size_lo; /* Size in bytes */
279 __le32 i_atime; /* Access time */ 279 __le32 i_atime; /* Access time */
280 __le32 i_ctime; /* Inode Change time */ 280 __le32 i_ctime; /* Inode Change time */
281 __le32 i_mtime; /* Modification time */ 281 __le32 i_mtime; /* Modification time */
@@ -298,7 +298,7 @@ struct ext4_inode {
298 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */ 298 __le32 i_block[EXT4_N_BLOCKS];/* Pointers to blocks */
299 __le32 i_generation; /* File version (for NFS) */ 299 __le32 i_generation; /* File version (for NFS) */
300 __le32 i_file_acl_lo; /* File ACL */ 300 __le32 i_file_acl_lo; /* File ACL */
301 __le32 i_dir_acl; /* Directory ACL */ 301 __le32 i_size_high;
302 __le32 i_obso_faddr; /* Obsoleted fragment address */ 302 __le32 i_obso_faddr; /* Obsoleted fragment address */
303 union { 303 union {
304 struct { 304 struct {
@@ -330,7 +330,6 @@ struct ext4_inode {
330 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ 330 __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */
331}; 331};
332 332
333#define i_size_high i_dir_acl
334 333
335#define EXT4_EPOCH_BITS 2 334#define EXT4_EPOCH_BITS 2
336#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1) 335#define EXT4_EPOCH_MASK ((1 << EXT4_EPOCH_BITS) - 1)
@@ -1049,7 +1048,17 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1049 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32); 1048 es->s_r_blocks_count_hi = cpu_to_le32(blk >> 32);
1050} 1049}
1051 1050
1051static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1052{
1053 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1054 le32_to_cpu(raw_inode->i_size_lo);
1055}
1052 1056
1057static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
1058{
1059 raw_inode->i_size_lo = cpu_to_le32(i_size);
1060 raw_inode->i_size_high = cpu_to_le32(i_size >> 32);
1061}
1053 1062
1054#define ext4_std_error(sb, errno) \ 1063#define ext4_std_error(sb, errno) \
1055do { \ 1064do { \
diff --git a/include/linux/ext4_fs_i.h b/include/linux/ext4_fs_i.h
index 2b4e3700c725..f1cd4934e46f 100644
--- a/include/linux/ext4_fs_i.h
+++ b/include/linux/ext4_fs_i.h
@@ -85,7 +85,6 @@ struct ext4_inode_info {
85 __le32 i_data[15]; /* unconverted */ 85 __le32 i_data[15]; /* unconverted */
86 __u32 i_flags; 86 __u32 i_flags;
87 ext4_fsblk_t i_file_acl; 87 ext4_fsblk_t i_file_acl;
88 __u32 i_dir_acl;
89 __u32 i_dtime; 88 __u32 i_dtime;
90 89
91 /* 90 /*