Re: [PATCH v9 03/11] btrfs: add support for inserting raid stripe extents

From: David Sterba
Date: Thu Sep 14 2023 - 14:10:59 EST


On Thu, Sep 14, 2023 at 09:06:58AM -0700, Johannes Thumshirn wrote:
> + map_type = list_first_entry(&ordered_extent->bioc_list, typeof(*bioc),
> + ordered_entry)->map_type;
> +
> + switch (map_type & BTRFS_BLOCK_GROUP_PROFILE_MASK) {
> + case BTRFS_BLOCK_GROUP_DUP:
> + case BTRFS_BLOCK_GROUP_RAID1:
> + case BTRFS_BLOCK_GROUP_RAID1C3:
> + case BTRFS_BLOCK_GROUP_RAID1C4:
> + ret = btrfs_insert_mirrored_raid_extents(trans, ordered_extent,
> + map_type);
> + break;
> + case BTRFS_BLOCK_GROUP_RAID0:
> + ret = btrfs_insert_striped_raid_extents(trans, ordered_extent,
> + map_type);
> + break;
> + case BTRFS_BLOCK_GROUP_RAID10:
> + ret = btrfs_insert_striped_mirrored_raid_extents(trans, ordered_extent, map_type);
> + break;
> + default:
> + btrfs_err(trans->fs_info, "unknown block-group profile %lld",
> + map_type & BTRFS_BLOCK_GROUP_PROFILE_MASK);
> + ASSERT(0);

Please don't use ASSERT(0), the error is handled and no need to crash
here.

> + ret = -EINVAL;
> + break;
> + }