Skip to content
This repository
Browse code

[backend] add $BSConfig::maxmetahardlink to work around btrfs hardlin…

…k limitation
  • Loading branch information...
commit a0b765d51dc49226aed68c2885acbfccfd952342 1 parent 89827cc
Michael Schroeder authored May 02, 2012 adrianschroeter committed May 02, 2012

Showing 1 changed file with 7 additions and 1 deletion. Show diff stats Hide diff stats

  1. 8  src/backend/bs_sched
8  src/backend/bs_sched
@@ -1694,6 +1694,7 @@ sub update_dst_full {
1694 1694
   my %fnew;
1695 1695
   my $dep2meta;
1696 1696
   $dep2meta = $repodatas{$prp}->{'meta'} if $repodatas{$prp} && $repodatas{$prp}->{'meta'};
  1697
+  my $linkedmeta = 0;
1697 1698
   for my $rp (@movetofull) {
1698 1699
     my $r = $new{$rp};
1699 1700
     my $suf = $rp;
@@ -1719,8 +1720,13 @@ sub update_dst_full {
1719 1720
       delete $old{"$n.rpm"};
1720 1721
     }
1721 1722
     if ($meta) {
  1723
+      if ($BSConfig::maxmetahardlink && ++$linkedmeta >= $BSConfig::maxmetahardlink) {
  1724
+	# workaround for btrfs hardlink limitation. sigh.
  1725
+	writestr("$meta.dup", $meta, readstr($meta));
  1726
+	$linkedmeta = 0;
  1727
+      }
1722 1728
       link($meta, "$meta.dup");
1723  
-      rename("$meta.dup", "$gdst/:full/$n.meta");
  1729
+      rename("$meta.dup", "$gdst/:full/$n.meta") || die("rename $meta.dup $gdst/:full/$n.meta: $!\n");
1724 1730
       unlink("$meta.dup");
1725 1731
     } else {
1726 1732
       unlink("$gdst/:full/$n.meta");

0 notes on commit a0b765d

Please sign in to comment.
Something went wrong with that request. Please try again.