aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <mricon@kernel.org>2011-11-27 15:30:02 -0500
committerKonstantin Ryabitsev <mricon@kernel.org>2011-11-27 15:35:02 -0500
commit1b30206ee78c592d7ecb967ebfea05c917437483 (patch)
tree9e33eafe4a01b003af25922b8f1e36dd6018f60d
parent71b6c016c7456fec2776a441d29fef1dec1eed77 (diff)
downloadkup-1b30206ee78c592d7ecb967ebfea05c917437483.tar.gz
Add some feedback about compressing large files.
-rwxr-xr-xkup-server33
1 files changed, 26 insertions, 7 deletions
diff --git a/kup-server b/kup-server
index 9fa2f33..f505a34 100755
--- a/kup-server
+++ b/kup-server
@@ -115,12 +115,12 @@ my $lock_file = $cfg->param('paths.lock_file');
my $tmp_path = $cfg->param('paths.tmp_path');
my $pgp_path = $cfg->param('paths.pgp_path');
-my $max_data = int($cfg->param('limits.max_data'));
-my $bufsiz = int($cfg->param('limits.bufsiz'));
+my $max_data = int($cfg->param('limits.max_data'));
+my $bufsiz = int($cfg->param('limits.bufsiz'));
-my $timeout_command = int($cfg->param('limits.timeout_command'));
-my $timeout_data = int($cfg->param('limits.timeout_data'));
-my $timeout_compress = int($cfg->param('limits.timeout_compress'));
+my $timeout_command = int($cfg->param('limits.timeout_command'));
+my $timeout_dat = int($cfg->param('limits.timeout_data'));
+my $timeout_compress = int($cfg->param('limits.timeout_compress'));
# Make sure the user can't create insanely large files
setrlimit(RLIMIT_FSIZE, $max_data, $max_data);
@@ -576,6 +576,14 @@ sub make_compressed_data()
my %workers;
my $nworkers = 0;
+ my $tarsize = -s $tmpdir.'/data';
+
+ if ($tarsize gt 26214400) {
+ # Only warn when file size is over 25MB
+ printf "Compressing %u bytes into %s, be patient...\n", $tarsize,
+ (join " ", keys(%zformats));
+ }
+
foreach my $e (keys(%zformats)) {
my @c = ($zformats{$e}, '-9');
@@ -626,8 +634,19 @@ sub make_compressed_data()
}
fatal("Failed to compress output data");
}
- syslog(LOG_DEBUG, "%s compression: %u -> %u bytes",
- $e, -s $tmpdir.'/data', -s $tmpdir.'/data'.$e);
+
+ my $zsize = -s $tmpdir.'/data'.$e;
+ my $zpc = int($zsize / $tarsize * 100);
+
+ if ($tarsize gt 26214400) {
+ $| = 1;
+ printf "%s complete: %u bytes (%d%% original size)\n", $e,
+ $tarsize, $zpc;
+ }
+
+
+ syslog(LOG_DEBUG, "%s compression: %u -> %u bytes (%d%%)",
+ $e, $tarsize, $zsize, $zpc);
$nworkers--;
}