aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2015-10-17 16:18:43 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-10-17 16:18:43 -0400
commite2b911c53584a92266943f3b7f2cdbc19c1a4e80 (patch)
tree2f1fd1771ef5e3a24b05c1fad3dc9026b3ecd73d /fs/ext4/inode.c
parent6a797d2737838906f2ea0a31686e87c3151e21ca (diff)
ext4: clean up feature test macros with predicate functions
Create separate predicate functions to test/set/clear feature flags, thereby replacing the wordy old macros. Furthermore, clean out the places where we open-coded feature tests. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 2b9278867caf..e8d620a484f6 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -2642,8 +2642,7 @@ static int ext4_nonda_switch(struct super_block *sb)
2642/* We always reserve for an inode update; the superblock could be there too */ 2642/* We always reserve for an inode update; the superblock could be there too */
2643static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len) 2643static int ext4_da_write_credits(struct inode *inode, loff_t pos, unsigned len)
2644{ 2644{
2645 if (likely(EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, 2645 if (likely(ext4_has_feature_large_file(inode->i_sb)))
2646 EXT4_FEATURE_RO_COMPAT_LARGE_FILE)))
2647 return 1; 2646 return 1;
2648 2647
2649 if (pos + len <= 0x7fffffffULL) 2648 if (pos + len <= 0x7fffffffULL)
@@ -4049,8 +4048,7 @@ static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
4049 struct inode *inode = &(ei->vfs_inode); 4048 struct inode *inode = &(ei->vfs_inode);
4050 struct super_block *sb = inode->i_sb; 4049 struct super_block *sb = inode->i_sb;
4051 4050
4052 if (EXT4_HAS_RO_COMPAT_FEATURE(sb, 4051 if (ext4_has_feature_huge_file(sb)) {
4053 EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) {
4054 /* we are using combined 48 bit field */ 4052 /* we are using combined 48 bit field */
4055 i_blocks = ((u64)le16_to_cpu(raw_inode->i_blocks_high)) << 32 | 4053 i_blocks = ((u64)le16_to_cpu(raw_inode->i_blocks_high)) << 32 |
4056 le32_to_cpu(raw_inode->i_blocks_lo); 4054 le32_to_cpu(raw_inode->i_blocks_lo);
@@ -4173,7 +4171,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4173 ei->i_flags = le32_to_cpu(raw_inode->i_flags); 4171 ei->i_flags = le32_to_cpu(raw_inode->i_flags);
4174 inode->i_blocks = ext4_inode_blocks(raw_inode, ei); 4172 inode->i_blocks = ext4_inode_blocks(raw_inode, ei);
4175 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo); 4173 ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo);
4176 if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_64BIT)) 4174 if (ext4_has_feature_64bit(sb))
4177 ei->i_file_acl |= 4175 ei->i_file_acl |=
4178 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32; 4176 ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
4179 inode->i_size = ext4_isize(raw_inode); 4177 inode->i_size = ext4_isize(raw_inode);
@@ -4337,7 +4335,7 @@ static int ext4_inode_blocks_set(handle_t *handle,
4337 ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE); 4335 ext4_clear_inode_flag(inode, EXT4_INODE_HUGE_FILE);
4338 return 0; 4336 return 0;
4339 } 4337 }
4340 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_HUGE_FILE)) 4338 if (!ext4_has_feature_huge_file(sb))
4341 return -EFBIG; 4339 return -EFBIG;
4342 4340
4343 if (i_blocks <= 0xffffffffffffULL) { 4341 if (i_blocks <= 0xffffffffffffULL) {
@@ -4498,8 +4496,7 @@ static int ext4_do_update_inode(handle_t *handle,
4498 need_datasync = 1; 4496 need_datasync = 1;
4499 } 4497 }
4500 if (ei->i_disksize > 0x7fffffffULL) { 4498 if (ei->i_disksize > 0x7fffffffULL) {
4501 if (!EXT4_HAS_RO_COMPAT_FEATURE(sb, 4499 if (!ext4_has_feature_large_file(sb) ||
4502 EXT4_FEATURE_RO_COMPAT_LARGE_FILE) ||
4503 EXT4_SB(sb)->s_es->s_rev_level == 4500 EXT4_SB(sb)->s_es->s_rev_level ==
4504 cpu_to_le32(EXT4_GOOD_OLD_REV)) 4501 cpu_to_le32(EXT4_GOOD_OLD_REV))
4505 set_large_file = 1; 4502 set_large_file = 1;
@@ -4548,8 +4545,7 @@ static int ext4_do_update_inode(handle_t *handle,
4548 if (err) 4545 if (err)
4549 goto out_brelse; 4546 goto out_brelse;
4550 ext4_update_dynamic_rev(sb); 4547 ext4_update_dynamic_rev(sb);
4551 EXT4_SET_RO_COMPAT_FEATURE(sb, 4548 ext4_set_feature_large_file(sb);
4552 EXT4_FEATURE_RO_COMPAT_LARGE_FILE);
4553 ext4_handle_sync(handle); 4549 ext4_handle_sync(handle);
4554 err = ext4_handle_dirty_super(handle, sb); 4550 err = ext4_handle_dirty_super(handle, sb);
4555 } 4551 }