libfdisk: (gpt) align size of partition by default
LastUsableLBA (field in GPT header) is calculated to use all free
space on the device. The problem is that size of this area is
unaligned to optimal I/O (or physical sector size) on devices where
the logical sector is 512 bytes, but the physical sector size is 4K.
(Note that after LastUsableLBA is backup GPT header and size of this
backup is calculated by logical sectors.)
The problem is visible for the last partition on the device because
this partition ends on LastUsableLBA.
The ideal solution would be align directly LastUsableLBA number in the
GPT header. Unfortunately, this solution is useless for libfdisk,
because we have to be backwardly compatible with sfdisk scripts
generated by old versions where is explicitly specified partition
size.
It seems usable compromise is to align only last partition if the size
of the partition is unspecified or specified by relative number
(+100M) -- in this case we already align partition, so there is no
change in fdisk semantic (well, last partition will be smaller than in
previous libfdisk versions).
The unaligned partition size is a problem for dm-crypt where device
size is used dynamically, and when unaligned, DM uses 512-bytes with a
negative impact on performance.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=
2044108
Addresses: https://marc.info/?l=dm-crypt&m=
164306225923513&w=2
Signed-off-by: Karel Zak <kzak@redhat.com>