Skip to content

Commit

Permalink
[backend] add $BSConfig::maxmetahardlink to work around btrfs hardlin…
Browse files Browse the repository at this point in the history
…k limitation
  • Loading branch information
mlschroe authored and adrianschroeter committed May 2, 2012
1 parent 89827cc commit a0b765d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/backend/bs_sched
Expand Up @@ -1694,6 +1694,7 @@ sub update_dst_full {
my %fnew;
my $dep2meta;
$dep2meta = $repodatas{$prp}->{'meta'} if $repodatas{$prp} && $repodatas{$prp}->{'meta'};
my $linkedmeta = 0;
for my $rp (@movetofull) {
my $r = $new{$rp};
my $suf = $rp;
Expand All @@ -1719,8 +1720,13 @@ sub update_dst_full {
delete $old{"$n.rpm"};
}
if ($meta) {
if ($BSConfig::maxmetahardlink && ++$linkedmeta >= $BSConfig::maxmetahardlink) {
# workaround for btrfs hardlink limitation. sigh.
writestr("$meta.dup", $meta, readstr($meta));
$linkedmeta = 0;
}
link($meta, "$meta.dup");
rename("$meta.dup", "$gdst/:full/$n.meta");
rename("$meta.dup", "$gdst/:full/$n.meta") || die("rename $meta.dup $gdst/:full/$n.meta: $!\n");
unlink("$meta.dup");
} else {
unlink("$gdst/:full/$n.meta");
Expand Down

0 comments on commit a0b765d

Please sign in to comment.