Skip to content

Commit

Permalink
ext4: remove unnecessary code in __mb_check_buddy
Browse files Browse the repository at this point in the history
When enter elseif branch, the the MB_CHECK_ASSERT will never fail.
In addtion, the only illegal combination is 0/0, which can be caught
by the first if branch.

Signed-off-by: Jinke Han <hanjinke.666@bytedance.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220404152243.13556-1-hanjinke.666@bytedance.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
  • Loading branch information
Jinke Han authored and tytso committed May 11, 2022
1 parent fac8873 commit af2b327
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,13 +695,10 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
for (i = 0; i < max; i++) {

if (mb_test_bit(i, buddy)) {
/* only single bit in buddy2 may be 1 */
/* only single bit in buddy2 may be 0 */
if (!mb_test_bit(i << 1, buddy2)) {
MB_CHECK_ASSERT(
mb_test_bit((i<<1)+1, buddy2));
} else if (!mb_test_bit((i << 1) + 1, buddy2)) {
MB_CHECK_ASSERT(
mb_test_bit(i << 1, buddy2));
}
continue;
}
Expand Down

0 comments on commit af2b327

Please sign in to comment.