estimate free space by inodes, too.
This commit is contained in:
parent
28745ebffa
commit
3a8c8e86a8
|
@ -53,7 +53,11 @@ my @backup_dirs = map {
|
|||
my($bsize, $frsize, $blocks, $bfree, $bavail,
|
||||
$files, $ffree, $favail, $flag, $namemax)
|
||||
= statvfs($_);
|
||||
[ $_, $bsize * $bavail ]
|
||||
my $available_bytes = $bsize * $bavail;
|
||||
my $avg_file_size = $bavail * ($blocks - $bfree) / ($files - $ffree);
|
||||
my $available_bytes_by_files = $avg_file_size * $favail;
|
||||
$available_bytes = $available_bytes_by_files if $available_bytes_by_files < $available_bytes;
|
||||
[ $_, $available_bytes ]
|
||||
} glob("/backup/*/active");
|
||||
my $sum_free = 0;
|
||||
$sum_free += $_->[1] for (@backup_dirs);
|
||||
|
@ -62,8 +66,10 @@ my $count_free = 0;
|
|||
my $backup_dir;
|
||||
for(@backup_dirs) {
|
||||
$count_free += $_->[1];
|
||||
$ca->log(3, "considering base $_->[0] (est. $_->[1] bytes)\n");
|
||||
if ($count_free >= $rnd) {
|
||||
$backup_dir = $_->[0];
|
||||
$ca->log(3, "using base $_->[0]\n");
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue