Stop over rounding up of signature zeroing lengths (#756829)
Following the previous commit "Add erasing of SWRaid metadata 0.90 and 1.0 super blocks (#756829)" signature zeroing specified to write 4 KiB of zeros at position end - 64 KiB, aligned to 64 KiB. Example operation details from formatting a 1 GiB partition to cleared: Format /dev/sdb8 as cleared + calibrate /dev/sdb8 + clear old file system signatures in /dev/sdb8 + write 68.00 KiB of zeros as byte offset 0 + wite 4.00 KiB of zeros at byte offset 67108864 + wite 64.00 KiB of zeros at byte offset 1073676288 + write 8.00 KiB of zeros at byte offset 1073733632 + flush operating system cache of /dev/sdb However it actually wrote 64 KiB. This is because the rounding / alignment was also applied to the zeroing length. Before this commit rounding / alignment was always less than or equal to the length so this wasn't seen before. Instead just apply device sector size rounding up to the length. Bug 756829 - SWRaid member detection enhancements
This commit is contained in:
parent
743968ef68
commit
eec78cd2b2
|
@ -3667,19 +3667,21 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition, Ope
|
|||
Byte_Value byte_offset ;
|
||||
Byte_Value byte_len ;
|
||||
|
||||
//Compute range to be erased taking into minimum desired rounding requirements and
|
||||
// negative offsets. Range may become larger, but not smaller than requested.
|
||||
// Compute range to be erased. Starting position takes into account
|
||||
// negative offsets from the end of the partition and minimum desired
|
||||
// rounding requirements. Length is only rounded to device sector size.
|
||||
// Ranges may become larger, but not smaller than requested.
|
||||
if ( ranges[i] .offset >= 0LL )
|
||||
{
|
||||
byte_offset = Utils::floor_size( ranges[i] .offset, rounding_size ) ;
|
||||
byte_len = Utils::ceil_size( ranges[i] .offset + ranges[i] .length, rounding_size )
|
||||
byte_len = Utils::ceil_size( ranges[i].offset + ranges[i].length, lp_device->sector_size )
|
||||
- byte_offset ;
|
||||
}
|
||||
else //Negative offsets
|
||||
{
|
||||
Byte_Value notional_offset = Utils::floor_size( partition .get_byte_length() + ranges[i] .offset, ranges[i]. rounding ) ;
|
||||
byte_offset = Utils::floor_size( notional_offset, rounding_size ) ;
|
||||
byte_len = Utils::ceil_size( notional_offset + ranges[i] .length, rounding_size )
|
||||
byte_len = Utils::ceil_size( notional_offset + ranges[i].length, lp_device->sector_size )
|
||||
- byte_offset ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue