]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
imsm: round down array size at Create
[thirdparty/mdadm.git] / super-intel.c
index b41ab3b133113dbf45fd3cb1565e3301798f9c04..3415da4706935393ccef8bdfaa72b3f7a724ad1c 100644 (file)
@@ -53,6 +53,7 @@
 
 #define MPB_SECTOR_CNT 418
 #define IMSM_RESERVED_SECTORS 4096
+#define SECT_PER_MB_SHIFT 11
 
 /* Disk configuration info. */
 #define IMSM_MAX_DEVICES 255
@@ -2377,6 +2378,9 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info,
                array_blocks = calc_array_size(info->level, info->raid_disks,
                                               info->layout, info->chunk_size,
                                               info->size*2);
+       /* round array size down to closest MB */
+       array_blocks = (array_blocks >> SECT_PER_MB_SHIFT) << SECT_PER_MB_SHIFT;
+
        dev->size_low = __cpu_to_le32((__u32) array_blocks);
        dev->size_high = __cpu_to_le32((__u32) (array_blocks >> 32));
        dev->status = __cpu_to_le32(0);