From: Zygo Blaxell Date: Thu, 13 May 2010 21:13:59 +0000 (-0400) Subject: Fold the inode and digest trees into a single structure that shares the non-leaf... X-Git-Tag: dm6-0.20100514~5^2~4 X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=dupemerge;a=commitdiff_plain;h=1bba5d988a86b9f4a258d7baad545485913293ee Fold the inode and digest trees into a single structure that shares the non-leaf directories we create. --- diff --git a/dm6 b/dm6 index 2d554e3..9b614cd 100755 --- a/dm6 +++ b/dm6 @@ -125,7 +125,7 @@ while () { next if ($st->nlink > $link_count_max); # Check link to inode - my $inode_link = prepare_parents("$link_dir/inode", $st->ino); + my $inode_link = prepare_parents($link_dir, $st->ino . 'I'); print STDERR 'I'; my $inode_st = lstat($inode_link); my $update_links; @@ -156,7 +156,7 @@ while () { $digest =~ y:/:_:; # Check link to digest - my $digest_link = prepare_parents("$link_dir/digest", $digest); + my $digest_link = prepare_parents($link_dir, "${digest}D"); print STDERR 'D'; my $digest_st = lstat($digest_link); if ($digest_st) { @@ -189,7 +189,7 @@ while () { } # A link to the inode indicates we are done, so do it last - $inode_link = prepare_parents("$link_dir/inode", $keep_ino); + $inode_link = prepare_parents($link_dir, "${keep_ino}I"); print STDERR ' '; link_files($digest_link, $inode_link); @@ -202,9 +202,9 @@ while () { print STDERR "\nGarbage collection in '$link_dir'..."; chdir($link_dir) || die "chdir: $link_dir: $!"; print STDERR "\nRemoving files with link count < 3..."; -system("find digest inode -type f -links -3 -print0 | xargs -0 rm -f") and die "system: exit status $?"; +system("find . -type f -links -3 -print0 | xargs -0 rm -f") and die "system: exit status $?"; print STDERR "\nRemoving empty directories..."; -system("find digest inode -type d -empty -print0 | xargs -0r rmdir -p --ignore-fail-on-non-empty") and die "system: exit status $?"; +system("find . -type d -empty -print0 | xargs -0r rmdir -p --ignore-fail-on-non-empty") and die "system: exit status $?"; print STDERR "\nDone.\n"; exit(0);