File 0150-super1-Always-round-data-offset-to-1M.patch of Package mdadm.7989

From 795bd44ed11aafbed2628ba21216c667371e79a5 Mon Sep 17 00:00:00 2001
From: Pawel Baldysiak <pawel.baldysiak@intel.com>
Date: Wed, 26 Jul 2017 16:41:54 +0200
Subject: [PATCH] super1: Always round data offset to 1M
Git-commit: 795bd44ed11aafbed2628ba21216c667371e79a5
Patch-mainline: mdadm-4.0+
References: bsc#1069165, bsc#1069167, bsc#1068030

Currently if metadata requires more then 1M,
data offset will be rounded down to closest MB.
This is not correct, since less then required space is reserved.
Always round data offset up to multiple of 1M.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Signed-off-by: Coly Li <colyli@suse.de>

---
 super1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/super1.c b/super1.c
index 86ec850..b15a1c7 100644
--- a/super1.c
+++ b/super1.c
@@ -2796,8 +2796,7 @@ static int validate_geometry1(struct supertype *st, int level,
 				headroom >>= 1;
 			data_offset = 12*2 + bmspace + headroom;
 			#define ONE_MEG (2*1024)
-			if (data_offset > ONE_MEG)
-				data_offset = (data_offset / ONE_MEG) * ONE_MEG;
+			data_offset = ROUND_UP(data_offset, ONE_MEG);
 			break;
 		}
 	if (st->data_offset == INVALID_SECTORS)
-- 
2.13.6
openSUSE Build Service is sponsored by