summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--go/src/cow-dedupe/dedupe.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go
index bc543f1..742cd60 100644
--- a/go/src/cow-dedupe/dedupe.go
+++ b/go/src/cow-dedupe/dedupe.go
@@ -254,14 +254,18 @@ func main() {
for _, filename := range filenames {
fiemaps = append(fiemaps, filename2fiemap[filename])
}
- // Now we choose the fiemap with the fewest extents
+ // Now we choose the fiemap with the fewest
+ // extents and the most files
minFiemap := fiemaps[0]
minFiemapLen := strings.Count(minFiemap, "\n")
+ minFiemapCnt := len(fiemap2filenames[minFiemap])
for _, fiemap := range fiemaps {
fiemapLen := strings.Count(fiemap, "\n")
- if fiemapLen < minFiemapLen {
+ fiemapCnt := len(fiemap2filenames[fiemap])
+ if fiemapLen < minFiemapLen || (fiemapLen == minFiemapLen && fiemapCnt > minFiemapCnt) {
minFiemap = fiemap
minFiemapLen = fiemapLen
+ minFiemapCnt = fiemapCnt
}
}
// Set srcFile and dupFiles based on that