Skip to content

Commit 50c134f

Browse files
fdmananamorbidrsa
authored andcommitted
btrfs: move WARN_ON on unexpected error in __add_tree_block()
There's no point in having the WARN_ON(1) inside the if statement for the unexpected error. Move it into the if statement's condition, which brings a couple benefits: 1) It marks the branch as unlikely, hinting the compiler to generate better code; 2) The WARN_ON() produces a stack trace after the dumped leaf and error message which can hide that more important information in case we get a truncated dmesg/syslog. Reviewed-by: Qu Wenruo <wqu@suse.com> Signed-off-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent f51228e commit 50c134f

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/btrfs/relocation.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,13 +3200,12 @@ static int __add_tree_block(struct reloc_control *rc,
32003200
goto again;
32013201
}
32023202
}
3203-
if (ret) {
3203+
if (WARN_ON(ret)) {
32043204
ASSERT(ret == 1);
32053205
btrfs_print_leaf(path->nodes[0]);
32063206
btrfs_err(fs_info,
32073207
"tree block extent item (%llu) is not found in extent tree",
32083208
bytenr);
3209-
WARN_ON(1);
32103209
return -EINVAL;
32113210
}
32123211

0 commit comments

Comments
 (0)