gpt: Always use at least 4K to align partitions.
* Many of today's disks that use 4K internally don't advertize this.
This commit is contained in:
@@ -42,12 +42,13 @@
|
|||||||
static off_t
|
static off_t
|
||||||
block_align(partition_data* partition, off_t offset, bool upwards)
|
block_align(partition_data* partition, off_t offset, bool upwards)
|
||||||
{
|
{
|
||||||
if (upwards) {
|
// Take HDs into account that hide the fact they are using a
|
||||||
return ((offset + partition->block_size - 1) / partition->block_size)
|
// block size of 4096 bytes, and round to that.
|
||||||
* partition->block_size;
|
uint32 blockSize = max_c(partition->block_size, 4096);
|
||||||
}
|
if (upwards)
|
||||||
|
return ((offset + blockSize - 1) / blockSize) * blockSize;
|
||||||
|
|
||||||
return (offset / partition->block_size) * partition->block_size;
|
return (offset / blockSize) * blockSize;
|
||||||
}
|
}
|
||||||
#endif // !_BOOT_MODE
|
#endif // !_BOOT_MODE
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user