Skip to content

Commit

Permalink
f2fs: update_sit_entry: Make the judgment condition of f2fs_bug_on mo…
Browse files Browse the repository at this point in the history
…re intuitive

Current judgment condition of f2fs_bug_on in function update_sit_entry():
  new_vblocks >> (sizeof(unsigned short) << 3) ||
	new_vblocks > sbi->blocks_per_seg

which equivalents to:
  new_vblocks < 0 || new_vblocks > sbi->blocks_per_seg

The latter is more intuitive.

Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Reported-by: Jack Qiu <jack.qiu@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Zhihao Cheng authored and Jaegeuk Kim committed Aug 4, 2020
1 parent 58f7e00 commit 9feffe1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -2166,7 +2166,7 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)
new_vblocks = se->valid_blocks + del;
offset = GET_BLKOFF_FROM_SEG0(sbi, blkaddr);

f2fs_bug_on(sbi, (new_vblocks >> (sizeof(unsigned short) << 3) ||
f2fs_bug_on(sbi, (new_vblocks < 0 ||
(new_vblocks > sbi->blocks_per_seg)));

se->valid_blocks = new_vblocks;
Expand Down

0 comments on commit 9feffe1

Please sign in to comment.