summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe Manana <fdmanana@suse.com>2026-03-11 15:35:33 +0300
committerDavid Sterba <dsterba@suse.com>2026-04-07 19:56:03 +0300
commit6fc58dec5b83685dee058bf0e86effa8fff0c96a (patch)
treed60a26d4d15571c43863b68872e8b11a1cd5a7f7
parentf5405ffce78d6e79babc8246df6566b7e001dadb (diff)
downloadlinux-6fc58dec5b83685dee058bf0e86effa8fff0c96a.tar.xz
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>
-rw-r--r--fs/btrfs/extent-io-tree.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index 5972fe28716e..c2ede01f1762 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -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);