From 1daabebda57976579465e5c281eaa14088e0e37f Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sun, 19 Apr 2015 21:35:31 +0100 Subject: Speed up reading of flags from GPT partition table. On some machines, calls to ped_disk_new() in libparted take of the order of seconds, so doing this for each flag and partition in turn makes partition_table::gpt::read_one take an inordinate amount of time (mga#15621). Instead, collect the flags during the call to c::get_disk_partitions. --- perl-install/partition_table/gpt.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'perl-install/partition_table') diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 1a284c214..0f0f45c6a 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -111,13 +111,13 @@ sub read_one { # FIXME: just use '@pt = map { ... } c::...' if part_numbers are always linear: foreach (c::get_disk_partitions($hd->{file})) { # fix detecting ESP (special case are they're detected through pt_type): - if (c::get_partition_flag($hd->{file}, $_->{part_number}, 'ESP')) { + if ($_->{flag} eq 'ESP') { $_->{pt_type} = 0xef; - } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'LVM')) { + } elsif ($_->{flag} eq 'LVM') { $_->{pt_type} = 0x8e; - } elsif (c::get_partition_flag($hd->{file}, $_->{part_number}, 'RAID')) { + } elsif ($_->{flag} eq 'RAID') { $_->{pt_type} = 0xfd; - } elsif (c::is_recovery_partition($hd->{file}, $_->{part_number})) { + } elsif ($_->{flag} eq 'RECOVERY') { $_->{pt_type} = 0x12; } $_->{fs_type} = 'swap' if $_->{fs_type} eq 'linux-swap(v1)'; -- cgit v1.2.1