diff options
author | Filipe Manana <fdmanana@suse.com> | 2023-06-09 12:49:07 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-06-19 13:59:39 +0200 |
commit | 7569141e8fa855b509e674456132b83bca5f087c (patch) | |
tree | 131723aa2437731c2d680aba7f81cffbe8fba870 /drivers/usb | |
parent | btrfs: do not BUG_ON() on tree mod log failures at btrfs_del_ptr() (diff) | |
download | linux-7569141e8fa855b509e674456132b83bca5f087c.tar.xz linux-7569141e8fa855b509e674456132b83bca5f087c.zip |
btrfs: replace BUG_ON() at split_item() with proper error handling
There's no need to BUG_ON() at split_item() if the leaf does not have
enough free space for the new item, we can just return -ENOSPC since
the caller can deal with errors from split_item(). Also, as this is a
very unlikely condition to happen, because the caller has invoked
setup_leaf_for_split() before calling split_item(), surround the
condition with a WARN_ON() which makes it easier to notice this
unexpected condition and tags the if branch with 'unlikely' as well.
I've actually once hit this BUG_ON() with some incorrect code changes
I had, which was very inconvenient as it required rebooting the VM.
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'drivers/usb')
0 files changed, 0 insertions, 0 deletions