1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00

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:
Zhang Yi 2021-08-26 21:04:08 +08:00 committed by Theodore Ts'o
parent 0904c9ae34
commit 8e33fadf94

View file

@ -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;