]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super1: Always round data offset to 1M
authorPawel Baldysiak <pawel.baldysiak@intel.com>
Wed, 26 Jul 2017 14:41:54 +0000 (16:41 +0200)
committerJes Sorensen <jsorensen@fb.com>
Thu, 27 Jul 2017 09:32:32 +0000 (05:32 -0400)
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>
super1.c

index 86ec850d03bd022d57b4494479312e7ef4420a89..b15a1c7a7854b313673bb09f60c72ad0a626012a 100644 (file)
--- 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)