From adbddb6198ae7d11bf27de847dfdaf8957507a0e Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Sat, 6 Aug 2011 22:34:01 +0000 Subject: partition_table: align partitions to 1MB boundaries to avoid performance issues with drives with 4k physical sectors (mga#1215) --- perl-install/NEWS | 3 +++ perl-install/install/NEWS | 3 +++ perl-install/partition_table.pm | 13 +++++++++++++ perl-install/partition_table/raw.pm | 15 ++------------- 4 files changed, 21 insertions(+), 13 deletions(-) (limited to 'perl-install') diff --git a/perl-install/NEWS b/perl-install/NEWS index 9168b98c6..82a6f5830 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -1,5 +1,8 @@ - finish-install: o "Multi languages" => "Multiple languages" (mga#1011) +- diskdrake: + o always align partitions to start at megabyte boundaries to avoid + performance issues with drives with 4k physical sectors (mga#1215) Version 13.61 - 01 August 2011 diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index 40633a7d9..4780e5ace 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -1,3 +1,6 @@ +- always align partitions to start at megabyte boundaries to avoid + performance issues with drives with 4k physical sectors (mga#1215) + Version 13.61.1 - 05 August 2011 - do not crash if there's no mirror cache to erase diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index ee801fc79..1e594ddf5 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -32,9 +32,22 @@ sub description { $hd->{info}, $hd->{mntpoint}, $hd->{fs_type}); } +#- align partition start to the next MB boundary +sub align_to_MB_boundaries { + my ($part) = @_; + + my $end = $part->{start} + $part->{size}; + $part->{start} = round_up($part->{start}, MB(1)); + $part->{size} = $end - $part->{start}; +} + sub adjustStartAndEnd { my ($hd, $part) = @_; + # always align partition start to MB boundaries + # (this accounts for devices with non-512 physical sector sizes): + align_to_MB_boundaries($part); + $hd->adjustStart($part); $hd->adjustEnd($part); } diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm index 7659a390b..ed89595b3 100644 --- a/perl-install/partition_table/raw.pm +++ b/perl-install/partition_table/raw.pm @@ -73,20 +73,9 @@ sub last_usable_sector { sub max_partition_start { 1e99 } sub max_partition_size { 1e99 } -#- default method for starting a partition, only head size or twice -#- is allowed for starting a partition after a cylinder boundarie. -sub adjustStart($$) { - my ($hd, $part) = @_; - my $end = $part->{start} + $part->{size}; +#- default method for starting a partition +sub adjustStart($$) {} - if (cylinder_size($hd)) { - $part->{start} = round_up($part->{start}, - $part->{start} % cylinder_size($hd) < 2 * $hd->{geom}{sectors} ? - $hd->{geom}{sectors} : cylinder_size($hd)); - $part->{size} = $end - $part->{start}; - $part->{size} > 0 or die "adjustStart get a too small partition to handle correctly"; - } -} #- adjusting end to match a cylinder boundary, two methods are used and must #- match at the end, else something is wrong and nothing will be done on #- partition table. -- cgit v1.2.1