From: Josef Bacik Date: Fri, 3 Dec 2021 22:18:16 +0000 (-0500) Subject: btrfs: convert BUG_ON() in btrfs_truncate_inode_items to ASSERT X-Git-Tag: v5.17-rc1~133^2~28 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=56e1edb0e3334db479b8400abc5a9c03602e5ae8;p=tomoyo%2Ftomoyo-test1.git btrfs: convert BUG_ON() in btrfs_truncate_inode_items to ASSERT 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 Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba --- diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c index 44db08e46a49..9356edb75ab4 100644 --- a/fs/btrfs/inode-item.c +++ b/fs/btrfs/inode-item.c @@ -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;