btrfs: remove BUG_ON(ret) in alloc_reserved_tree_block
authorJosef Bacik <josef@toxicpanda.com>
Wed, 23 Feb 2022 19:06:43 +0000 (14:06 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 14 Mar 2022 12:13:53 +0000 (13:13 +0100)
Switch this to an ASSERT() and return the error in the normal case.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index b7b49b4..23edecb 100644 (file)
@@ -4761,9 +4761,10 @@ static int alloc_reserved_tree_block(struct btrfs_trans_handle *trans,
        ret = btrfs_update_block_group(trans, extent_key.objectid,
                                       fs_info->nodesize, true);
        if (ret) { /* -ENOENT, logic error */
+               ASSERT(!ret);
                btrfs_err(fs_info, "update block group failed for %llu %llu",
                        extent_key.objectid, extent_key.offset);
-               BUG();
+               return ret;
        }
 
        trace_btrfs_reserved_extent_alloc(fs_info, extent_key.objectid,