aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Song <liu.song11@zte.com.cn>2018-08-02 00:11:16 -0400
committerTheodore Ts'o <tytso@mit.edu>2018-08-02 00:11:16 -0400
commitbc716523462f98ea6bfef3e1a5926daadbf32e9e (patch)
treea517b11b54edcae628c69c32899d68039f564664
parent1a5d5e5d51e75a5bca67dadbcea8c841934b7b85 (diff)
ext4: improve code readability in ext4_iget()
Merge the duplicated complex conditions to improve code readability. Signed-off-by: Liu Song <liu.song11@zte.com.cn> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
-rw-r--r--fs/ext4/inode.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 60432498acfb..8f6ad7667974 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -4982,17 +4982,14 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4982 ret = -EFSCORRUPTED; 4982 ret = -EFSCORRUPTED;
4983 goto bad_inode; 4983 goto bad_inode;
4984 } else if (!ext4_has_inline_data(inode)) { 4984 } else if (!ext4_has_inline_data(inode)) {
4985 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { 4985 /* validate the block references in the inode */
4986 if ((S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 4986 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
4987 (S_ISLNK(inode->i_mode) && 4987 (S_ISLNK(inode->i_mode) &&
4988 !ext4_inode_is_fast_symlink(inode)))) 4988 !ext4_inode_is_fast_symlink(inode))) {
4989 /* Validate extent which is part of inode */ 4989 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))
4990 ret = ext4_ext_check_inode(inode); 4990 ret = ext4_ext_check_inode(inode);
4991 } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 4991 else
4992 (S_ISLNK(inode->i_mode) && 4992 ret = ext4_ind_check_inode(inode);
4993 !ext4_inode_is_fast_symlink(inode))) {
4994 /* Validate block references which are part of inode */
4995 ret = ext4_ind_check_inode(inode);
4996 } 4993 }
4997 } 4994 }
4998 if (ret) 4995 if (ret)