stripe_nr = div64_u64(stripe_nr, stripe_len);
stripe_offset = stripe_nr * stripe_len;
- if (offset < stripe_offset) {
- btrfs_crit(fs_info, "stripe math has gone wrong, "
- "stripe_offset=%llu, offset=%llu, start=%llu, "
- "logical=%llu, stripe_len=%llu\n",
- (unsigned long long)stripe_offset,
- (unsigned long long)offset,
- (unsigned long long)em->start,
- (unsigned long long)logical,
- (unsigned long long)stripe_len);
- free_extent_map(em);
- return -EINVAL;
- }
+ BUG_ON(offset < stripe_offset);
/* stripe_offset is the offset of this block in its stripe*/
stripe_offset = offset - stripe_offset;
&stripe_index);
mirror_num = stripe_index + 1;
}
- if (stripe_index >= map->num_stripes) {
- btrfs_crit(fs_info, "stripe index math went horribly wrong, "
- "got stripe_index=%lu, num_stripes=%lu\n",
- (unsigned long)stripe_index,
- (unsigned long)map->num_stripes);
- ret = -EINVAL;
- goto out;
- }
+ BUG_ON(stripe_index >= map->num_stripes);
num_alloc_stripes = num_stripes;
if (dev_replace_is_ongoing) {