mirror of https://github.com/digint/btrbk
btrbk: add vinfo_mkdir
parent
2bdd5eb8fc
commit
7aece45dbf
17
btrbk
17
btrbk
|
@ -356,6 +356,7 @@ my %mountinfo_cache; # map MACHINE_ID to mount points (sorted descending by file
|
||||||
my %mount_source_cache; # map URL_PREFIX:mount_source (aka device) to btr_tree node
|
my %mount_source_cache; # map URL_PREFIX:mount_source (aka device) to btr_tree node
|
||||||
my %uuid_cache; # map UUID to btr_tree node
|
my %uuid_cache; # map UUID to btr_tree node
|
||||||
my %realpath_cache; # map URL to realpath (symlink target). undef denotes an error.
|
my %realpath_cache; # map URL to realpath (symlink target). undef denotes an error.
|
||||||
|
my %mkdir_cache; # map URL to mkdir status: 1=created, undef=error
|
||||||
|
|
||||||
my $tree_inject_id = 0; # fake subvolume id for injected nodes (negative)
|
my $tree_inject_id = 0; # fake subvolume id for injected nodes (negative)
|
||||||
my $fake_uuid_prefix = 'XXXXXXXX-XXXX-XXXX-XXXX-'; # plus 0-padded inject_id: XXXXXXXX-XXXX-XXXX-XXXX-000000000000
|
my $fake_uuid_prefix = 'XXXXXXXX-XXXX-XXXX-XXXX-'; # plus 0-padded inject_id: XXXXXXXX-XXXX-XXXX-XXXX-000000000000
|
||||||
|
@ -1999,7 +2000,6 @@ sub system_mkdir($)
|
||||||
);
|
);
|
||||||
end_transaction("mkdir", defined($ret));
|
end_transaction("mkdir", defined($ret));
|
||||||
return undef unless(defined($ret));
|
return undef unless(defined($ret));
|
||||||
delete $realpath_cache{$vol->{URL}};
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2909,6 +2909,19 @@ sub vinfo_realpath($@)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub vinfo_mkdir($)
|
||||||
|
{
|
||||||
|
my $vol = shift // die;
|
||||||
|
my $url = $vol->{URL} // die;
|
||||||
|
return $mkdir_cache{$url} if(exists($mkdir_cache{$url}));
|
||||||
|
return -1 if(vinfo_realpath($vol));
|
||||||
|
return undef unless($mkdir_cache{$url} = system_mkdir($vol));
|
||||||
|
$vol->{SUBDIR_CREATED} = 1;
|
||||||
|
delete $realpath_cache{$url}; # clear realpath cache (allow retry)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub vinfo_mountpoint
|
sub vinfo_mountpoint
|
||||||
{
|
{
|
||||||
my $vol = shift // die;
|
my $vol = shift // die;
|
||||||
|
@ -5999,7 +6012,7 @@ MAIN:
|
||||||
vinfo_assign_config($droot);
|
vinfo_assign_config($droot);
|
||||||
unless($archive_raw ? vinfo_init_raw_root($droot) : vinfo_init_root($droot)) {
|
unless($archive_raw ? vinfo_init_raw_root($droot) : vinfo_init_root($droot)) {
|
||||||
DEBUG "Failed to fetch " . ($archive_raw ? "raw target metadata" : "subvolume detail") . " for '$droot->{PRINT}'";
|
DEBUG "Failed to fetch " . ($archive_raw ? "raw target metadata" : "subvolume detail") . " for '$droot->{PRINT}'";
|
||||||
unless(system_mkdir($droot)) {
|
unless(vinfo_mkdir($droot)) {
|
||||||
ABORTED($droot, "Failed to create directory: $droot->{PRINT}/");
|
ABORTED($droot, "Failed to create directory: $droot->{PRINT}/");
|
||||||
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot), @stderr;
|
WARN "Skipping archive target \"$droot->{PRINT}\": " . ABORTED_TEXT($droot), @stderr;
|
||||||
next;
|
next;
|
||||||
|
|
Loading…
Reference in New Issue