[gparted] Stop over rounding up of signature zeroing lengths (#756829)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Stop over rounding up of signature zeroing lengths (#756829)
- Date: Mon, 2 Nov 2015 19:21:12 +0000 (UTC)
commit eec78cd2b203d9e895c730a547345e4acafc40cf
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sat Oct 31 10:14:03 2015 +0000
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
src/GParted_Core.cc | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 7616e24..87f9578 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -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 ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]