Merge "liblp: Always align the first usable sector."
This commit is contained in:
commit
1230ddc94b
1 changed files with 7 additions and 2 deletions
|
|
@ -268,8 +268,13 @@ bool MetadataBuilder::Init(const BlockDeviceInfo& device_info, uint32_t metadata
|
|||
}
|
||||
|
||||
// Compute the first free sector, factoring in alignment.
|
||||
uint64_t free_area_start =
|
||||
AlignTo(total_reserved, device_info.alignment, device_info.alignment_offset);
|
||||
uint64_t free_area_start = total_reserved;
|
||||
if (device_info.alignment || device_info.alignment_offset) {
|
||||
free_area_start =
|
||||
AlignTo(free_area_start, device_info.alignment, device_info.alignment_offset);
|
||||
} else {
|
||||
free_area_start = AlignTo(free_area_start, device_info.logical_block_size);
|
||||
}
|
||||
uint64_t first_sector = free_area_start / LP_SECTOR_SIZE;
|
||||
|
||||
// There must be one logical block of free space remaining (enough for one partition).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue