Commit bc716523 authored by Liu Song's avatar Liu Song Committed by Theodore Ts'o

ext4: improve code readability in ext4_iget()

Merge the duplicated complex conditions to improve code readability.
Signed-off-by: default avatarLiu Song <liu.song11@zte.com.cn>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Reviewed-by: default avatarJiang Biao <jiang.biao2@zte.com.cn>
parent 1a5d5e5d
...@@ -4982,17 +4982,14 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) ...@@ -4982,17 +4982,14 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
ret = -EFSCORRUPTED; ret = -EFSCORRUPTED;
goto bad_inode; goto bad_inode;
} else if (!ext4_has_inline_data(inode)) { } else if (!ext4_has_inline_data(inode)) {
if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { /* validate the block references in the inode */
if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
(S_ISLNK(inode->i_mode) && (S_ISLNK(inode->i_mode) &&
!ext4_inode_is_fast_symlink(inode)))) !ext4_inode_is_fast_symlink(inode))) {
/* Validate extent which is part of inode */ if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
ret = ext4_ext_check_inode(inode); ret = ext4_ext_check_inode(inode);
} else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || else
(S_ISLNK(inode->i_mode) && ret = ext4_ind_check_inode(inode);
!ext4_inode_is_fast_symlink(inode))) {
/* Validate block references which are part of inode */
ret = ext4_ind_check_inode(inode);
} }
} }
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment