]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
btrfs: remove redundant BUG_ON() from __btrfs_inc_extent_ref()
authorFilipe Manana <fdmanana@suse.com>
Fri, 8 Sep 2023 17:20:24 +0000 (18:20 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 20 Sep 2023 18:42:47 +0000 (20:42 +0200)
At __btrfs_inc_extent_ref() we are doing a BUG_ON() if we are dealing with
a tree block reference that has a reference count that is different from 1,
but we have already dealt with this case at run_delayed_tree_ref(), making
it useless. So remove the BUG_ON().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
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-tree.c

index 4282bdb5a9f1adf06118d62e202bee42cbac0466..fd80129acc3c9e661c9baba4c19e8085b615f42f 100644 (file)
@@ -1514,15 +1514,14 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
        btrfs_release_path(path);
 
        /* now insert the actual backref */
-       if (owner < BTRFS_FIRST_FREE_OBJECTID) {
-               BUG_ON(refs_to_add != 1);
+       if (owner < BTRFS_FIRST_FREE_OBJECTID)
                ret = insert_tree_block_ref(trans, path, bytenr, parent,
                                            root_objectid);
-       } else {
+       else
                ret = insert_extent_data_ref(trans, path, bytenr, parent,
                                             root_objectid, owner, offset,
                                             refs_to_add);
-       }
+
        if (ret)
                btrfs_abort_transaction(trans, ret);
 out: