[Fai-commit] r6063 - branches/experimental/patches
Michael Tautschnig
mt at alioth.debian.org
Fri Sep 17 22:12:14 UTC 2010
Author: mt
Date: 2010-09-17 22:12:06 +0000 (Fri, 17 Sep 2010)
New Revision: 6063
Modified:
branches/experimental/patches/setup-storage_extended-is-not-last
branches/experimental/patches/setup-storage_gpt-bios-fix
branches/experimental/patches/setup-storage_no-cylinder-boundaries
branches/experimental/patches/setup-storage_preserve-format-all
branches/experimental/patches/setup-storage_user-100-percent
Log:
Extended no-cylinder-boundaries patch to also provide optional user-defined
partition alignment (using new align-at option)
Modified: branches/experimental/patches/setup-storage_extended-is-not-last
===================================================================
--- branches/experimental/patches/setup-storage_extended-is-not-last 2010-09-17 21:14:02 UTC (rev 6062)
+++ branches/experimental/patches/setup-storage_extended-is-not-last 2010-09-17 22:12:06 UTC (rev 6063)
@@ -25,7 +25,7 @@
}
# on gpt, ensure that the partition ends at a sector boundary
-@@ -687,37 +681,45 @@
+@@ -697,37 +691,45 @@
# reference to the current partition
my $part = (\%FAI::configs)->{$config}->{partitions}->{$part_id};
@@ -90,4 +90,4 @@
+ shift @worklist;
} else {
($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id,
- $config, $disk, $next_start, $min_req_total_space, \@worklist);
+ $config, $disk, $next_start, $block_size, $min_req_total_space, \@worklist);
Modified: branches/experimental/patches/setup-storage_gpt-bios-fix
===================================================================
--- branches/experimental/patches/setup-storage_gpt-bios-fix 2010-09-17 21:14:02 UTC (rev 6062)
+++ branches/experimental/patches/setup-storage_gpt-bios-fix 2010-09-17 22:12:06 UTC (rev 6063)
@@ -31,7 +31,7 @@
===================================================================
--- trunk.orig/lib/setup-storage/Sizes.pm
+++ trunk/lib/setup-storage/Sizes.pm
-@@ -655,19 +655,6 @@
+@@ -665,19 +665,6 @@
# the space required by the GPTs
$min_req_total_space += 33 * $current_disk->{sector_size};
Modified: branches/experimental/patches/setup-storage_no-cylinder-boundaries
===================================================================
--- branches/experimental/patches/setup-storage_no-cylinder-boundaries 2010-09-17 21:14:02 UTC (rev 6062)
+++ branches/experimental/patches/setup-storage_no-cylinder-boundaries 2010-09-17 22:12:06 UTC (rev 6063)
@@ -1,17 +1,55 @@
-2009-10-14 Michael Tautschnig <mt at debian.org>
+2010-09-18 Michael Tautschnig <mt at debian.org>
- * setup-storage/Sizes.pm: Align partition sizes to sectors on all disk labels,
- dropping DOS cylinder-alignment.
+ * setup-storage/{Parser.pm,Sizes.pm}: Align partition sizes to sectors or
+ user-requested alignment on all disk labels, dropping DOS
+ cylinder-alignment. Thanks Patrick Cervicek for suggesting the
+ user-specified alignment.
+ * setup-storage.8: Document new align-at option.
Index: trunk/lib/setup-storage/Sizes.pm
===================================================================
--- trunk.orig/lib/setup-storage/Sizes.pm
+++ trunk/lib/setup-storage/Sizes.pm
-@@ -560,23 +560,9 @@
+@@ -436,8 +436,9 @@
+ #
+ # @param $part_id Partition id within $config
+ # @param $config Disk config
+-# @param $current_disk Current config of this disk
++# @param $disk This disk
+ # @param $next_start Start of the next partition
++# @param $block_size Requested alignment
+ # @param $min_req_total_space Minimum space required on disk
+ # @param $worklist Reference to the remaining partitions
+ #
+@@ -446,7 +447,7 @@
+ ################################################################################
+ sub do_partition_real {
+
+- my ($part_id, $config, $disk, $next_start, $min_req_total_space, $worklist) = @_;
++ my ($part_id, $config, $disk, $next_start, $block_size, $min_req_total_space, $worklist) = @_;
+ # reference to the current disk config
+ my $current_disk = $FAI::current_config{$disk};
+
+@@ -549,34 +550,22 @@
+ $current_disk->{sector_size};
+ }
+
+- # partition starts at where we currently are, or remains fixed in case of
+- # resized ntfs
++ # partition starts at where we currently are + requested alignment, or remains
++ # fixed in case of resized ntfs
+ if ($FAI::configs{$config}{partitions}{$part_id}{size}{resize} &&
+ ($current_disk->{partitions}->{$part_id}->{filesystem} eq "ntfs")) {
+ ($next_start <= $current_disk->{partitions}->{$part_id}->{begin_byte})
+ or die "Cannot preserve start byte of ntfs volume on partition $part_id, space before it is too small\n";
+ $next_start = $current_disk->{partitions}->{$part_id}->{begin_byte};
++ } elsif (0 != $next_start % $block_size) {
++ $next_start += $block_size - ($next_start % $block_size);
+ }
$FAI::configs{$config}{partitions}{$part_id}{start_byte} =
$next_start;
- # the end may need some alignment, depending on the disk label
-+ # partitions must end at sector boundary
++ # partitions must end at the requested alignment
my $end_byte = $next_start + $start - 1;
-
- # on msdos, ensure that the partition ends at a cylinder boundary
@@ -28,11 +66,25 @@
- $end_byte -=
- ($end_byte + 1) % $current_disk->{sector_size};
- }
-+ $end_byte -= ($end_byte + 1) % $current_disk->{sector_size};
++ $end_byte -= ($end_byte + 1) % $block_size;
# set $start and $end to the effective values
$start = $end_byte - $next_start + 1;
-@@ -651,10 +637,6 @@
+@@ -623,6 +612,13 @@
+ # reference to the current disk config
+ my $current_disk = $FAI::current_config{$disk};
+
++ # user-defined alignment or alignment to sector boundaries
++ my $block_size = $current_disk->{sector_size};
++ defined ($FAI::configs{$config}{align_at}) and
++ $block_size = $FAI::configs{$config}{align_at};
++ (0 == $block_size % $current_disk->{sector_size}) or
++ die "Alignment must be set to a multiple of the underlying disk sector size\n";
++
+ # at various points the following code highly depends on the desired disk label!
+ # initialise variables
+ # the id of the extended partition to be created, if required
+@@ -651,10 +647,6 @@
$next_start = $current_disk->{bios_sectors_per_track} *
$current_disk->{sector_size};
@@ -43,7 +95,7 @@
} elsif ($FAI::configs{$config}{disklabel} eq "gpt") {
# on GPT-EFI disk labels the first 34 and last 33 sectors must be left alone
$next_start = 34 * $current_disk->{sector_size};
-@@ -666,13 +648,12 @@
+@@ -666,13 +658,12 @@
$min_req_total_space += (34 + 33) * $current_disk->{sector_size};
} elsif ($FAI::configs{$config}{disklabel} eq "gpt-bios") {
@@ -62,3 +114,52 @@
# apparently parted insists in having some space left at the end too
# modify the disk to claim the space for the second partition table
+@@ -739,7 +730,7 @@
+ shift @worklist;
+ } else {
+ ($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id,
+- $config, $disk, $next_start, $min_req_total_space, \@worklist);
++ $config, $disk, $next_start, $block_size, $min_req_total_space, \@worklist);
+
+ # msdos does not support partitions larger than 2TiB
+ ($part->{size}->{eff_size} > (&FAI::convert_unit("2TiB") * 1024.0 *
+Index: trunk/lib/setup-storage/Parser.pm
+===================================================================
+--- trunk.orig/lib/setup-storage/Parser.pm
++++ trunk/lib/setup-storage/Parser.pm
+@@ -581,6 +581,10 @@
+ {
+ $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
+ }
++ | /^align-at:(\d+[kMGTPiB]*)/
++ {
++ $FAI::configs{$FAI::device}{align_at} = &FAI::convert_unit($1) * 1024.0 * 1024.0;
++ }
+
+ volume: /^vg\s+/ name devices vgcreateopt(s?)
+ | /^raid([0156]|10)\s+/
+Index: trunk/man/setup-storage.8
+===================================================================
+--- trunk.orig/man/setup-storage.8
++++ trunk/man/setup-storage.8
+@@ -282,6 +282,20 @@
+ .br
+ */
+ .br
++ | align-at:([[:digit:]]+[kMGTPiB]*)
++.br
++ /* Align partitions at multiples of the given block size (unit
++.br
++ defaults to MiB, if omitted). Such an alignment, e.g., 4K, might be
++.br
++ important for proper performance of RAID arrays which use a logical
++.br
++ block size other than the sector size of the underlying disks. It
++.br
++ must, however, always be a multiple of this sector size.
++.br
++ */
++.br
+
+
+ volume ::= <type> <mountpoint> <size> <filesystem> <mount_options> <fs_options>
Modified: branches/experimental/patches/setup-storage_preserve-format-all
===================================================================
--- branches/experimental/patches/setup-storage_preserve-format-all 2010-09-17 21:14:02 UTC (rev 6062)
+++ branches/experimental/patches/setup-storage_preserve-format-all 2010-09-17 22:12:06 UTC (rev 6063)
@@ -313,9 +313,9 @@
+ $FAI::configs{$FAI::device}{partitions}{$_}{size}{always_format} = 1 foreach (split(",", $1));
+ }
}
-
- volume: /^vg\s+/ name devices vgcreateopt(s?)
-@@ -600,9 +669,14 @@
+ | /^align-at:(\d+[kMGTPiB]*)/
+ {
+@@ -604,9 +673,14 @@
$FAI::configs{RAID}{volumes}{$vol_id}{mode} = $1;
# initialise the hash of devices
$FAI::configs{RAID}{volumes}{$vol_id}{devices} = {};
@@ -332,7 +332,7 @@
# set the reference to the current volume
# the reference is used by all further processing of this config line
$FAI::partition_pointer = (\%FAI::configs)->{RAID}->{volumes}->{$vol_id};
-@@ -673,13 +747,17 @@
+@@ -677,13 +751,17 @@
# initialise the new hash
defined($FAI::configs{$FAI::device}{volumes}{$2}) or
$FAI::configs{$FAI::device}{volumes}{$2} = {};
Modified: branches/experimental/patches/setup-storage_user-100-percent
===================================================================
--- branches/experimental/patches/setup-storage_user-100-percent 2010-09-17 21:14:02 UTC (rev 6062)
+++ branches/experimental/patches/setup-storage_user-100-percent 2010-09-17 22:12:06 UTC (rev 6063)
@@ -33,20 +33,21 @@
($start > $curr_part->{count_byte} || $end < $curr_part->{count_byte})
and warn "Preserved partition $part_dev_name retains size " .
$curr_part->{count_byte} . "B\n";
-@@ -433,6 +433,7 @@
- # @param $current_disk Current config of this disk
+@@ -434,6 +434,7 @@
# @param $next_start Start of the next partition
+ # @param $block_size Requested alignment
# @param $min_req_total_space Minimum space required on disk
+# @param $max_avail The maximum size of a partition on this disk
# @param $worklist Reference to the remaining partitions
#
# @return Updated values of ($next_start, $min_req_total_space)
-@@ -440,15 +441,14 @@
+@@ -441,15 +442,15 @@
################################################################################
sub do_partition_real {
-- my ($part_id, $config, $disk, $next_start, $min_req_total_space, $worklist) = @_;
-+ my ($part_id, $config, $disk, $next_start, $min_req_total_space, $max_avail, $worklist) = @_;
+- my ($part_id, $config, $disk, $next_start, $block_size, $min_req_total_space, $worklist) = @_;
++ my ($part_id, $config, $disk, $next_start, $block_size, $min_req_total_space,
++ $max_avail, $worklist) = @_;
# reference to the current disk config
my $current_disk = $FAI::current_config{$disk};
@@ -59,7 +60,7 @@
# check, whether the size is fixed
if ($end != $start) {
-@@ -487,8 +487,7 @@
+@@ -488,8 +489,7 @@
next;
} else {
my ($min_size, $max_size) = &FAI::make_range(
@@ -69,7 +70,7 @@
# logical partitions require the space for the EPBR to be left
# out
-@@ -630,6 +629,7 @@
+@@ -640,6 +640,7 @@
# on msdos disk labels, the first partitions starts at head #1
$next_start = $current_disk->{bios_sectors_per_track} *
$current_disk->{sector_size};
@@ -77,7 +78,7 @@
} elsif ($FAI::configs{$config}{disklabel} eq "gpt") {
# on GPT-EFI disk labels the first 34 and last 33 sectors must be left alone
-@@ -657,6 +657,11 @@
+@@ -667,6 +668,11 @@
$min_req_total_space += 33 * $current_disk->{sector_size};
}
@@ -89,7 +90,7 @@
# the list of partitions that we need to find start and end bytes for
my @worklist = (&numsort(keys %{ $FAI::configs{$config}{partitions} }));
-@@ -703,13 +708,13 @@
+@@ -713,13 +719,14 @@
# the partition $part_id must be preserved
} elsif ($part->{size}->{preserve}) {
($next_start, $min_req_total_space) = &FAI::do_partition_preserve($part_id,
@@ -100,8 +101,9 @@
shift @worklist;
} else {
($next_start, $min_req_total_space) = &FAI::do_partition_real($part_id,
-- $config, $disk, $next_start, $min_req_total_space, \@worklist);
-+ $config, $disk, $next_start, $min_req_total_space, $max_avail, \@worklist);
+- $config, $disk, $next_start, $block_size, $min_req_total_space, \@worklist);
++ $config, $disk, $next_start, $block_size, $min_req_total_space,
++ $max_avail, \@worklist);
# msdos does not support partitions larger than 2TiB
($part->{size}->{eff_size} > (&FAI::convert_unit("2TiB") * 1024.0 *
More information about the Fai-commit
mailing list