Skip to content

Commit

Permalink
ext4: move inode eio simulation behind io completeion
Browse files Browse the repository at this point in the history
No EIO simulation is required if the buffer is uptodate, so move the
simulation behind read bio completeion just like inode/block bitmap
simulation does.

Signed-off-by: Zhang Yi <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
zhangyi089 authored and tytso committed Aug 31, 2021
1 parent 4a79a98 commit 0904c9a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fs/ext4/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -4337,8 +4337,6 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
bh = sb_getblk(sb, block);
if (unlikely(!bh))
return -ENOMEM;
if (ext4_simulate_fail(sb, EXT4_SIM_INODE_EIO))
goto simulate_eio;
if (!buffer_uptodate(bh)) {
lock_buffer(bh);

Expand Down Expand Up @@ -4425,8 +4423,8 @@ static int __ext4_get_inode_loc(struct super_block *sb, unsigned long ino,
ext4_read_bh_nowait(bh, REQ_META | REQ_PRIO, NULL);
blk_finish_plug(&plug);
wait_on_buffer(bh);
ext4_simulate_fail_bh(sb, bh, EXT4_SIM_INODE_EIO);
if (!buffer_uptodate(bh)) {
simulate_eio:
if (ret_block)
*ret_block = block;
brelse(bh);
Expand Down

0 comments on commit 0904c9a

Please sign in to comment.