btrfs: change BUG_ONs to assertions in btrfs_qgroup_trace_subtree()
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)
The only caller do_walk_down() of btrfs_qgroup_trace_subtree() validates
the value of level and uses it several times before it's passed as an
argument. Same for root_eb that's called 'next' in the caller.

Change both BUG_ONs to assertions as this is to assure proper interface
use rather than real errors.

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

index 5470e1cdf10c5348df676cd290bef45811a46019..cfe366110a6949c582c497f7df88cc540e06eef0 100644 (file)
@@ -2505,8 +2505,8 @@ int btrfs_qgroup_trace_subtree(struct btrfs_trans_handle *trans,
        struct extent_buffer *eb = root_eb;
        struct btrfs_path *path = NULL;
 
-       BUG_ON(root_level < 0 || root_level >= BTRFS_MAX_LEVEL);
-       BUG_ON(root_eb == NULL);
+       ASSERT(0 <= root_level && root_level < BTRFS_MAX_LEVEL);
+       ASSERT(root_eb != NULL);
 
        if (!btrfs_qgroup_full_accounting(fs_info))
                return 0;