imsm: fix metadata reservation

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>
This commit is contained in:
Dan Williams 2008-11-26 15:39:51 -07:00 committed by NeilBrown
parent 208933a7a8
commit dda5855f96
1 changed files with 7 additions and 0 deletions

View 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;
}