btrfs: convert BUG_ON() in btrfs_truncate_inode_items to ASSERT
authorJosef Bacik <josef@toxicpanda.com>
Fri, 3 Dec 2021 22:18:16 +0000 (17:18 -0500)
committerDavid Sterba <dsterba@suse.com>
Fri, 7 Jan 2022 13:18:25 +0000 (14:18 +0100)
We have a correctness BUG_ON() in btrfs_truncate_inode_items to make
sure that we're always using min_type == BTRFS_EXTENT_DATA_KEY if
new_size is > 0.  Convert this to an ASSERT.

Reviewed-by: Filipe Manana <fdmanana@suse.com>
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/inode-item.c

index 44db08e..9356edb 100644 (file)
@@ -476,7 +476,7 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
        bool should_throttle = false;
 
        ASSERT(control->inode || !control->clear_extent_range);
-       BUG_ON(new_size > 0 && control->min_type != BTRFS_EXTENT_DATA_KEY);
+       ASSERT(new_size == 0 || control->min_type == BTRFS_EXTENT_DATA_KEY);
 
        control->last_size = new_size;
        control->sub_bytes = 0;