[dm-devel] [PATCH] dm-raid: fix default region size
Mikulas Patocka
mpatocka at redhat.com
Fri Oct 2 15:17:37 UTC 2015
The commit 3a0f9aaee02857609d79b20c809c02a8b7c39d06 should make sure that
the default region size is a power of two. However, the logic is incorrect
and sets the variable region_size to 0 or 1, depending on whether
min_region_size is a power of two.
This patch fixes the logic, so that region_size is set to min_region_size
rounded up to the next power of two.
Signed-off-by: Mikulas Patocka <mpatocka at redhat.com>
Fixes: 3a0f9aaee028 ("dm raid: round region_size to power of two")
Cc: stable at vger.kernel.org # v3.8+
---
drivers/md/dm-raid.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: linux-4.3-rc3/drivers/md/dm-raid.c
===================================================================
--- linux-4.3-rc3.orig/drivers/md/dm-raid.c 2015-10-02 15:20:04.000000000 +0200
+++ linux-4.3-rc3/drivers/md/dm-raid.c 2015-10-02 15:29:34.000000000 +0200
@@ -329,8 +329,7 @@ static int validate_region_size(struct r
*/
if (min_region_size > (1 << 13)) {
/* If not a power of 2, make it the next power of 2 */
- if (min_region_size & (min_region_size - 1))
- region_size = 1 << fls(region_size);
+ region_size = roundup_pow_of_two(min_region_size);
DMINFO("Choosing default region size of %lu sectors",
region_size);
} else {
More information about the dm-devel
mailing list