]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: panic instead of warn when splitting extent state not in the tree
authorFilipe Manana <fdmanana@suse.com>
Wed, 11 Mar 2026 16:15:59 +0000 (16:15 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 Apr 2026 16:56:04 +0000 (18:56 +0200)
commit057217f39a7dc89dcd97ce56d12c40ceb5cc51f3
tree093fb2d6e62e2941f64722351e5e60f84049074f
parent0611e2ad02b3a6ede4f1e26b792a80261e63a28e
btrfs: panic instead of warn when splitting extent state not in the tree

We are not expected ever to split an extent state record that is not in
the rbtree, as every record we pass to split_state() was found by
iterating the rbtree, so if that ever happens it means we are not holding
the extent io tree's spinlock or we have some memory corruption.

Instead of simply warning in case the extent state record passed to
split_state() is not in the rbtree, panic as this is a serious problem.
Also tag as unlikely the case where the record is not in the rbtree.

This also makes a tiny reduction the btrfs module's text size.

Before:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2000080  174328   15592 2190000  216ab0 fs/btrfs/btrfs.ko

After:

  $ size fs/btrfs/btrfs.ko
     text    data     bss     dec     hex filename
  2000064  174328   15592 2189984  216aa0 fs/btrfs/btrfs.ko

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-io-tree.c