Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28530214 authored by Yunlong Song's avatar Yunlong Song Committed by Jaegeuk Kim
Browse files

f2fs: do not change the valid_block value if cur_valid_map was wrongly set or cleared



commit 35ee82ca133a58011e648a407d4ab13275c975d4 upstream.

Signed-off-by: default avatarYunlong Song <yunlong.song@huawei.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent a0a6bcde
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1679,6 +1679,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
			f2fs_msg(sbi->sb, KERN_ERR,
				"Bitmap was wrongly set, blk:%u", blkaddr);
			f2fs_bug_on(sbi, 1);
			se->valid_blocks--;
			del = 0;
		}

		if (f2fs_discard_en(sbi) &&
@@ -1706,6 +1708,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
			f2fs_msg(sbi->sb, KERN_ERR,
				"Bitmap was wrongly cleared, blk:%u", blkaddr);
			f2fs_bug_on(sbi, 1);
			se->valid_blocks++;
			del = 0;
		}

		if (f2fs_discard_en(sbi) &&