146 |
if ( -s $path ) { |
if ( -s $path ) { |
147 |
file_copy( '<:gzip', $path, '>', $tmp ) |
file_copy( '<:gzip', $path, '>', $tmp ) |
148 |
} else { |
} else { |
149 |
confess "ASSERT: filesystem corruption, $path is zero size\n"; |
confess "ASSERT: filesystem corruption, $path is zero size in ",dump( $pending ); |
150 |
} |
} |
151 |
$path = $tmp; |
$path = $tmp; |
152 |
$op = 'created'; |
$op = 'created'; |
155 |
confess "ASSERT: open shouldn't exist for $file in ", dump( $pending ) if defined( $pending->{$file}->{open} ); |
confess "ASSERT: open shouldn't exist for $file in ", dump( $pending ) if defined( $pending->{$file}->{open} ); |
156 |
$pending->{$file}->{path} = $path; |
$pending->{$file}->{path} = $path; |
157 |
$pending->{$file}->{open} = 0; # not really opened, just uncompressed |
$pending->{$file}->{open} = 0; # not really opened, just uncompressed |
158 |
warn "## tmp_file( $file ) $op $path [", -s $path, "]\n"; |
warn "## tmp_file( $file ) $op $path [", -s $path, "]\n" if $debug; |
159 |
} |
} |
160 |
return $path; |
return $path; |
161 |
} |
} |
174 |
} elsif ( ! $path ) { |
} elsif ( ! $path ) { |
175 |
$path = $pending_path; |
$path = $pending_path; |
176 |
} elsif ( $pending_path ne $path ) { |
} elsif ( $pending_path ne $path ) { |
177 |
confess "ASSERT: compressing into $path instead of $pending_path\n"; |
confess "ASSERT: compressing into $path instead of $pending_path"; |
178 |
} |
} |
179 |
} |
} |
180 |
|
|
203 |
my ( $size_path, $size_comp ) = ( -s $path, -s $comp ); |
my ( $size_path, $size_comp ) = ( -s $path, -s $comp ); |
204 |
|
|
205 |
if ( $size_path <= $size_comp ) { |
if ( $size_path <= $size_comp ) { |
206 |
warn ">>> $size_path <= $size_comp leaving uncompressed\n"; |
warn ">>> $size_path <= $size_comp leaving uncompressed $dest\n"; |
207 |
unlink $comp || confess "can't remove: $comp: $!"; |
unlink $comp || confess "can't remove: $comp: $!"; |
208 |
|
file_copy( '<', $path, '>', $dest ) if ( $path ne $dest ); |
209 |
} else { |
} else { |
210 |
warn ">>> compressed $size_path -> $size_comp ",int(($size_comp * 100) / $size_path),"% $comp\n"; |
warn ">>> compressed $size_path -> $size_comp ",int(($size_comp * 100) / $size_path),"% $comp\n"; |
211 |
|
|
374 |
my $tmp = $mount->{tmp} . '/' . $old; |
my $tmp = $mount->{tmp} . '/' . $old; |
375 |
if ( -e $tmp ) { |
if ( -e $tmp ) { |
376 |
if ( $new =~ m#\Q/.fuse_hidden\E# ) { |
if ( $new =~ m#\Q/.fuse_hidden\E# ) { |
377 |
unlink $tmp || confess "can't unlink $tmp for $new\n"; |
unlink $tmp || confess "can't unlink $tmp for $new"; |
378 |
} else { |
} else { |
379 |
my $new_tmp = $mount->{tmp} . '/' . $new; |
my $new_tmp = $mount->{tmp} . '/' . $new; |
380 |
rename $tmp, $new_tmp || confess "can't rename $tmp -> $new_tmp : $!"; |
rename $tmp, $new_tmp || confess "can't rename $tmp -> $new_tmp : $!"; |