Commit 8e33fadf authored by Zhang Yi's avatar Zhang Yi Committed by Theodore Ts'o

ext4: remove an unnecessary if statement in __ext4_get_inode_loc()

The "if (!buffer_uptodate(bh))" hunk covered almost the whole code after
getting buffer in __ext4_get_inode_loc() which seems unnecessary, remove
it and switch to check ext4_buffer_uptodate(), it simplify code and make
it more readable.
Signed-off-by: default avatarZhang Yi <yi.zhang@huawei.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20210826130412.3921207-3-yi.zhang@huawei.comSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
parent 0904c9ae
......@@ -4337,15 +4337,10 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
bh = sb_getblk(sb, block);
if (unlikely(!bh))
return -ENOMEM;
if (!buffer_uptodate(bh)) {
lock_buffer(bh);
if (ext4_buffer_uptodate(bh)) {
/* someone brought it uptodate while we waited */
unlock_buffer(bh);
if (ext4_buffer_uptodate(bh))
goto has_buffer;
}
lock_buffer(bh);
/*
* If we have all information of the inode in memory and this
* is the only valid inode in the block, we need not read the
......@@ -4430,7 +4425,6 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
brelse(bh);
return -EIO;
}
}
has_buffer:
iloc->bh = bh;
return 0;
......
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