summaryrefslogtreecommitdiffstats
path: root/perl-install/diskdrake
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-03-18 10:38:14 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-03-18 15:45:14 +0100
commitbc754db56b4cb301cc6167d2e50f36ba446a8d69 (patch)
treefbf9724a3fe3dc5db4318a6665c76526686094cc /perl-install/diskdrake
parent01c03167421615cbfbe6c6f626fed22ac6e0992c (diff)
downloaddrakx-bc754db56b4cb301cc6167d2e50f36ba446a8d69.tar
drakx-bc754db56b4cb301cc6167d2e50f36ba446a8d69.tar.gz
drakx-bc754db56b4cb301cc6167d2e50f36ba446a8d69.tar.bz2
drakx-bc754db56b4cb301cc6167d2e50f36ba446a8d69.tar.xz
drakx-bc754db56b4cb301cc6167d2e50f36ba446a8d69.zip
(_set_min_size_from_avail_space) split it out
Diffstat (limited to 'perl-install/diskdrake')
-rw-r--r--perl-install/diskdrake/interactive.pm17
1 files changed, 11 insertions, 6 deletions
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 0b449a460..898f1de58 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -770,6 +770,13 @@ sub _get_dir_for_online_resize {
return $dir;
}
+sub _set_min_size_from_avail_space {
+ my ($part, $min) = @_;
+ if (defined(my $free = fs::df($part))) {
+ $$min = max($$min, $part->{size} - $free);
+ }
+}
+
sub Resize {
my ($in, $hd, $part) = @_;
my (%nice_resize);
@@ -816,18 +823,16 @@ sub Resize {
$nice_resize{reiserfs} = 1;
if ($part->{isMounted}) {
$min = $part->{size}; #- ensure the user can only increase
- } elsif (defined(my $free = fs::df($part))) {
- $min = max($min, $part->{size} - $free);
+ } else {
+ _set_min_size_from_avail_space($part, \$min);
}
} elsif ($part->{fs_type} eq 'xfs' && isLVM($hd) && $::isStandalone && $part->{isMounted}) {
$min = $part->{size}; #- ensure the user can only increase
$nice_resize{xfs} = 1;
} elsif ($part->{fs_type} eq 'btrfs') {
write_partitions($in, $hd) or return;
- if (defined(my $free = fs::df($part))) {
- $nice_resize{btrfs} = 1;
- $min = max($min, $part->{size} - $free);
- }
+ $nice_resize{btrfs} = 1;
+ _set_min_size_from_avail_space($part, \$min);
}
#- make sure that even after normalizing the size to cylinder boundaries, the minimun will be saved,
#- this save at least a cylinder (less than 8Mb).