Skip to contentSkip to conversation

master - mirror: Restrict region size to power of 2.

PATCH Alasdair Kergon 1 participant 1 message Dec 2, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=de53e0955dc43d5f069604553b038fa672463da9
Commit:        de53e0955dc43d5f069604553b038fa672463da9
Parent:        9258e57a50451fbbabd72a197e6a78a2a5d898db
Author:        Alasdair G Kergon <[email protected]>
AuthorDate:    Tue Dec 2 14:24:21 2014 +0000
Committer:     Alasdair G Kergon <[email protected]>
CommitterDate: Tue Dec 2 14:24:21 2014 +0000

mirror: Restrict region size to power of 2.

---
 WHATS_NEW             |    1 +
 lib/metadata/mirror.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index 645450c..54e46d9 100644
@@ -1,5 +1,6 @@
 Version 2.02.115 -
 =====================================
+  Still restrict mirror region size to power of 2 when VG extent size is not.
 
 Version 2.02.114 - 28th November 2014
 =====================================
lib/metadata/mirror.c +1 -1
index ba3ff6b..d0b1ebf 100644
@@ -164,7 +164,7 @@ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents,
 {
 	uint64_t region_max;
 
-	region_max = (1 << (ffs((int)extents) - 1)) * (uint64_t) extent_size;
+	region_max = (1 << (ffs((int)extents) - 1)) * (uint64_t) (1 << (ffs((int)extent_size) - 1));
 
 	if (region_max < UINT32_MAX && region_size > region_max) {
 		region_size = (uint32_t) region_max;