diff options
author | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 10:56:21 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@beefcake.parabola.nu> | 2018-05-19 10:56:21 -0400 |
commit | 8c249c0243f660bf5c5c6fb9d403c008534d2bf3 (patch) | |
tree | 2894fcf366ed428c3025f6d07aa0e969fd28f678 | |
parent | dc5d903a0ec50d137393d42ec2e326bdf9c9824d (diff) |
cow-dedupe: tidy
-rw-r--r-- | go/src/cow-dedupe/dedupe.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/go/src/cow-dedupe/dedupe.go b/go/src/cow-dedupe/dedupe.go index 62fd85d..ba7701c 100644 --- a/go/src/cow-dedupe/dedupe.go +++ b/go/src/cow-dedupe/dedupe.go @@ -47,22 +47,24 @@ func getFiemaps(paths []string) map[string][]string { errhandle(cmd.Start()) rd := bufio.NewReader(stdout) for { + // read filename filename, err := rd.ReadString('\x00') if filename == "" && err == io.EOF { break } + errhandle(err) filename = strings.TrimSuffix(filename, "\x00") if !strings.HasPrefix(filename, "/") { panic("ugly filename") } - errhandle(err) + // read extents fiemap, err := rd.ReadString('\x00') + errhandle(err) fiemap = strings.TrimSuffix(fiemap, "\x00") if !(strings.HasPrefix(fiemap, "logical=") || fiemap == "") { panic("ugly fiemap") } - errhandle(err) - + // do stuff ret[fiemap] = append(ret[fiemap], filename) cnt++ sl.Put(fmt.Sprintf("Mapping extents... %d", cnt)) @@ -133,6 +135,7 @@ func main() { fiemap2filenames := getFiemaps(os.Args[1:]) + fmt.Fprintf(os.Stderr, "building list of spanning files...") filename2fiemap := map[string]string{} for fiemap, filenames := range fiemap2filenames { for _, filename := range filenames { @@ -150,6 +153,7 @@ func main() { i++ } + fmt.Fprintf(os.Stderr, " done\n") checksum2filenames := getChecksums(spanningFiles) checksum2fiemaps := map[string][]string{} |