btrbk: for action "info", print "btrfs filesystem usage" instead of "btrfs filesystem df/show"

pull/30/head
Axel Burri 2015-01-25 13:36:07 +01:00
parent 4dd89e35e1
commit 6a0820abae
1 changed files with 20 additions and 10 deletions

30
btrbk
View File

@ -482,7 +482,7 @@ sub btr_filesystem_show($;$)
} }
sub btr_filesystem_df($;$@) sub btr_filesystem_df($;$)
{ {
my $vol = shift || die; my $vol = shift || die;
my $config = shift; my $config = shift;
@ -492,6 +492,16 @@ sub btr_filesystem_df($;$@)
} }
sub btr_filesystem_usage($;$)
{
my $vol = shift || die;
my $config = shift;
my ($rsh, $real_vol) = get_rsh($vol, $config);
my $ret = run_cmd("$rsh /sbin/btrfs filesystem usage $real_vol", 1);
return $ret;
}
sub btr_subvolume_list($;$@) sub btr_subvolume_list($;$@)
{ {
my $vol = shift || die; my $vol = shift || die;
@ -1106,11 +1116,11 @@ MAIN:
print " Config: $config->{SRC_FILE}\n"; print " Config: $config->{SRC_FILE}\n";
print "================================================================================\n"; print "================================================================================\n";
print "\n--------------------------------------------------------------------------------\n"; # print "\n--------------------------------------------------------------------------------\n";
print "All local btrfs filesystems\n"; # print "All local btrfs filesystems\n";
print "--------------------------------------------------------------------------------\n"; # print "--------------------------------------------------------------------------------\n";
print btr_filesystem_show_all_local(); # print (btr_filesystem_show_all_local() // "");
print "\n"; # print "\n";
my %processed; my %processed;
foreach my $config_vol (@{$config->{VOLUME}}) foreach my $config_vol (@{$config->{VOLUME}})
@ -1121,9 +1131,9 @@ MAIN:
print "\n--------------------------------------------------------------------------------\n"; print "\n--------------------------------------------------------------------------------\n";
print "Source volume: $sroot\n"; print "Source volume: $sroot\n";
print "--------------------------------------------------------------------------------\n"; print "--------------------------------------------------------------------------------\n";
print btr_filesystem_show($sroot, $config_vol); # print (btr_filesystem_show($sroot, $config_vol) // "");
print "\n\n"; # print "\n\n";
print btr_filesystem_df($sroot, $config_vol); print (btr_filesystem_usage($sroot, $config_vol) // "");
print "\n"; print "\n";
$processed{$sroot} = 1; $processed{$sroot} = 1;
} }
@ -1141,7 +1151,7 @@ MAIN:
print "Target volume: $droot\n"; print "Target volume: $droot\n";
print " ^--- $sroot\n"; print " ^--- $sroot\n";
print "--------------------------------------------------------------------------------\n"; print "--------------------------------------------------------------------------------\n";
print btr_filesystem_df($droot, $config_target); print (btr_filesystem_usage($droot, $config_target) // "");
print "\n"; print "\n";
$processed{$droot} = 1; $processed{$droot} = 1;
} }