1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Fix adjusted_mirror_region_size() for 64-bit size.

This commit is contained in:
Alasdair Kergon 2006-11-10 19:35:03 +00:00
parent a89d601463
commit f96cde8cbd
2 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,7 @@
Version 2.02.14 - Version 2.02.14 -
=================================== ===================================
Add some missing bounds checks on 32 bit extent counters. Fix adjusted_mirror_region_size() to handle 64-bit size.
Add some missing bounds checks on 32-bit extent counters.
Add Petabyte and Exabyte support. Add Petabyte and Exabyte support.
Fix lvcreate error message when 0 extents requested. Fix lvcreate error message when 0 extents requested.
lvremove man page: volumes must be cluster inactive before being removed. lvremove man page: volumes must be cluster inactive before being removed.

View File

@ -36,20 +36,20 @@ struct lv_segment *find_mirror_seg(struct lv_segment *seg)
} }
/* /*
* Ensure region size is compatible with volume size. * Reduce the region size if necessary to ensure
* the volume size is a multiple of the region size.
*/ */
uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents, uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
uint32_t region_size) uint32_t region_size)
{ {
uint32_t region_max; uint64_t region_max;
region_max = (1 << (ffs((int)extents) - 1)) * extent_size; region_max = (1 << (ffs((int)extents) - 1)) * extent_size;
if (region_max < region_size) { if (region_max < UINT32_MAX && region_size > region_max) {
region_size = region_max; region_size = (uint32_t) region_max;
log_print("Using reduced mirror region size of %" PRIu32 log_print("Using reduced mirror region size of %" PRIu32
" sectors", region_max); " sectors", region_size);
return region_max;
} }
return region_size; return region_size;