Skip to content

Commit af2b327

Browse files
Jinke Hantytso
authored andcommitted
ext4: remove unnecessary code in __mb_check_buddy
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>
1 parent fac8873 commit af2b327

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

fs/ext4/mballoc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,13 +695,10 @@ static int __mb_check_buddy(struct ext4_buddy *e4b, char *file,
695695
for (i = 0; i < max; i++) {
696696

697697
if (mb_test_bit(i, buddy)) {
698-
/* only single bit in buddy2 may be 1 */
698+
/* only single bit in buddy2 may be 0 */
699699
if (!mb_test_bit(i << 1, buddy2)) {
700700
MB_CHECK_ASSERT(
701701
mb_test_bit((i<<1)+1, buddy2));
702-
} else if (!mb_test_bit((i << 1) + 1, buddy2)) {
703-
MB_CHECK_ASSERT(
704-
mb_test_bit(i << 1, buddy2));
705702
}
706703
continue;
707704
}

0 commit comments

Comments
 (0)