btrfs: use extent_io_tree_panic() instead of BUG_ON()

There's no need to call BUG_ON(), instead call extent_io_tree_panic(),
which also calls BUG(), but it prints an additional error message with
some useful information before hitting BUG().

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Filipe Manana 2026-03-11 12:35:33 +00:00 committed by David Sterba
parent f5405ffce7
commit 6fc58dec5b

View File

@ -395,7 +395,8 @@ static void set_state_bits(struct extent_io_tree *tree,
btrfs_set_delalloc_extent(tree->inode, state, bits);
ret = add_extent_changeset(state, bits_to_set, changeset, 1);
BUG_ON(ret < 0);
if (unlikely(ret))
extent_io_tree_panic(tree, state, "add_extent_changeset", ret);
state->state |= bits_to_set;
}
@ -567,7 +568,8 @@ static struct extent_state *clear_state_bit(struct extent_io_tree *tree,
btrfs_clear_delalloc_extent(tree->inode, state, bits);
ret = add_extent_changeset(state, bits_to_clear, changeset, 0);
BUG_ON(ret < 0);
if (unlikely(ret))
extent_io_tree_panic(tree, state, "add_extent_changeset", ret);
state->state &= ~bits_to_clear;
if (wake)
wake_up(&state->wq);