mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
raid: use 64bit arithmetic
Coverity - keep multiplication for size cals in 64bit (otherwise it's just 32b x 32b)
This commit is contained in:
parent
e3a51537c5
commit
4a727a3ccd
@ -1690,7 +1690,7 @@ static int _reshape_adjust_to_size(struct logical_volume *lv,
|
|||||||
|
|
||||||
/* Externally visible LV size w/o reshape space */
|
/* Externally visible LV size w/o reshape space */
|
||||||
lv->le_count = seg->len = new_le_count;
|
lv->le_count = seg->len = new_le_count;
|
||||||
lv->size = (lv->le_count - new_image_count * _reshape_len_per_dev(seg)) * lv->vg->extent_size;
|
lv->size = (uint64_t) (lv->le_count - new_image_count * _reshape_len_per_dev(seg)) * lv->vg->extent_size;
|
||||||
/* seg->area_len does not change */
|
/* seg->area_len does not change */
|
||||||
|
|
||||||
if (old_image_count < new_image_count) {
|
if (old_image_count < new_image_count) {
|
||||||
@ -1861,7 +1861,7 @@ static int _raid_reshape_remove_images(struct logical_volume *lv,
|
|||||||
|
|
||||||
reduced_le_count -= seg->reshape_len * _data_rimages_count(seg, new_image_count);
|
reduced_le_count -= seg->reshape_len * _data_rimages_count(seg, new_image_count);
|
||||||
current_le_count = lv->le_count - seg->reshape_len * _data_rimages_count(seg, old_image_count);
|
current_le_count = lv->le_count - seg->reshape_len * _data_rimages_count(seg, old_image_count);
|
||||||
extend_le_count = current_le_count * current_le_count / reduced_le_count;
|
extend_le_count = (uint32_t)((uint64_t) current_le_count * current_le_count / reduced_le_count);
|
||||||
log_warn("WARNING: Removing stripes from active%s logical "
|
log_warn("WARNING: Removing stripes from active%s logical "
|
||||||
"volume %s will shrink it from %s to %s!",
|
"volume %s will shrink it from %s to %s!",
|
||||||
info.open_count ? " and open" : "", display_lvname(lv),
|
info.open_count ? " and open" : "", display_lvname(lv),
|
||||||
|
@ -2582,7 +2582,7 @@ static int _segdata_offset(struct dm_report *rh, struct dm_pool *mem,
|
|||||||
|
|
||||||
if (lv_raid_data_offset(lv, &data_offset)) {
|
if (lv_raid_data_offset(lv, &data_offset)) {
|
||||||
if (new_data_offset && !lv_raid_image_in_sync(seg->lv))
|
if (new_data_offset && !lv_raid_image_in_sync(seg->lv))
|
||||||
data_offset = data_offset ? 0 : seg->reshape_len * lv->vg->extent_size;
|
data_offset = data_offset ? 0 : (uint64_t) seg->reshape_len * lv->vg->extent_size;
|
||||||
|
|
||||||
return dm_report_field_uint64(rh, field, &data_offset);
|
return dm_report_field_uint64(rh, field, &data_offset);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user