]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
imsm: fix metadata reservation
authorDan Williams <dan.j.williams@intel.com>
Wed, 26 Nov 2008 22:39:51 +0000 (15:39 -0700)
committerNeilBrown <neilb@suse.de>
Thu, 27 Nov 2008 04:41:03 +0000 (15:41 +1100)
1/ When truncating the space reserved for the metadata round down to an
   even numbered sector count to avoid an off-by-one error when
   sysfs_add_disk rounds up.
2/ Set the current metadata parameter block size
   as a floor.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
super-intel.c

index 5d8944cef037784b972ea0d7c7bf9abba85087ab..99419ffd5cc6cbc2acf0a16caa67df622963bd28 100644 (file)
@@ -489,6 +489,13 @@ static struct extent *get_extents(struct intel_super *super, struct dl *dl)
 
                remainder = __le32_to_cpu(dl->disk.total_blocks) - 
                            (last->start + last->size);
+               /* round down to 1k block to satisfy precision of the kernel
+                * 'size' interface
+                */
+               remainder &= ~1UL;
+               /* make sure remainder is still sane */
+               if (remainder < ROUND_UP(super->len, 512) >> 9)
+                       remainder = ROUND_UP(super->len, 512) >> 9;
                if (reservation > remainder)
                        reservation = remainder;
        }