btrfs: change BUG_ON to assertion in tree_move_down()
authorDavid Sterba <dsterba@suse.com>
Tue, 6 Feb 2024 22:06:46 +0000 (23:06 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:51 +0000 (16:24 +0100)
There's only one caller of tree_move_down() that does not pass level 0
so the assertion is better suited here.

Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/send.c

index 5b7ec4f99aad4d942d8f27af67f38c6cddacf1eb..dc18d5624ec73ba1dfa0a4219ebef282616b0973 100644 (file)
@@ -7447,8 +7447,8 @@ static int tree_move_down(struct btrfs_path *path, int *level, u64 reada_min_gen
        u64 reada_done = 0;
 
        lockdep_assert_held_read(&parent->fs_info->commit_root_sem);
+       ASSERT(*level != 0);
 
-       BUG_ON(*level == 0);
        eb = btrfs_read_node_slot(parent, slot);
        if (IS_ERR(eb))
                return PTR_ERR(eb);