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: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20210826130412.3921207-3-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
0904c9ae34
commit
8e33fadf94
1 changed files with 79 additions and 85 deletions
|
@ -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 @@ make_io:
|
|||
brelse(bh);
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
has_buffer:
|
||||
iloc->bh = bh;
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue