summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorPawel Baldysiak <pawel.baldysiak@intel.com>2017-07-26 16:41:54 +0200
committerJes Sorensen <jsorensen@fb.com>2017-07-27 11:32:32 +0200
commit795bd44ed11aafbed2628ba21216c667371e79a5 (patch)
tree1ef9db054cc2f403b06a5cd3a0954f1faf49c91f /super1.c
parentMonitor: don't assume mdadm parameter is a block device (diff)
downloadmdadm-795bd44ed11aafbed2628ba21216c667371e79a5.tar.xz
mdadm-795bd44ed11aafbed2628ba21216c667371e79a5.zip
super1: Always round data offset to 1M
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>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/super1.c b/super1.c
index 86ec850d..b15a1c7a 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)