diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-02 16:25:03 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-07-02 16:43:01 -0600 |
commit | 9ddcd2c3ed2f85247161c5ffa653f33e6a01a9cd (patch) | |
tree | 5d673cf90f37ae7e75b1b4bbe41bc700cfe98c1f /cmd/btrfs-fsck/pass2.go | |
parent | eab4dbebf66fa92597a2804c39eb4a4670f5e2ca (diff) |
move things around
Diffstat (limited to 'cmd/btrfs-fsck/pass2.go')
-rw-r--r-- | cmd/btrfs-fsck/pass2.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/cmd/btrfs-fsck/pass2.go b/cmd/btrfs-fsck/pass2.go index 989b79f..95a307c 100644 --- a/cmd/btrfs-fsck/pass2.go +++ b/cmd/btrfs-fsck/pass2.go @@ -5,17 +5,18 @@ import ( iofs "io/fs" "lukeshu.com/btrfs-tools/pkg/btrfs" + "lukeshu.com/btrfs-tools/pkg/btrfs/btrfsvol" "lukeshu.com/btrfs-tools/pkg/btrfsmisc" "lukeshu.com/btrfs-tools/pkg/util" ) -func pass2(fs *btrfs.FS, foundNodes map[btrfs.LogicalAddr]struct{}) { +func pass2(fs *btrfs.FS, foundNodes map[btrfsvol.LogicalAddr]struct{}) { fmt.Printf("\nPass 2: orphaned nodes\n") - visitedNodes := make(map[btrfs.LogicalAddr]struct{}) + visitedNodes := make(map[btrfsvol.LogicalAddr]struct{}) btrfsmisc.WalkFS(fs, btrfsmisc.WalkFSHandler{ TreeWalkHandler: btrfs.TreeWalkHandler{ - Node: func(path btrfs.TreePath, node *util.Ref[btrfs.LogicalAddr, btrfs.Node], err error) error { + Node: func(path btrfs.TreePath, node *util.Ref[btrfsvol.LogicalAddr, btrfs.Node], err error) error { visitedNodes[node.Addr] = struct{}{} return nil }, @@ -25,20 +26,20 @@ func pass2(fs *btrfs.FS, foundNodes map[btrfs.LogicalAddr]struct{}) { }, }) - orphanedNodes := make(map[btrfs.LogicalAddr]int) + orphanedNodes := make(map[btrfsvol.LogicalAddr]int) for foundNode := range foundNodes { if _, visited := visitedNodes[foundNode]; !visited { orphanedNodes[foundNode] = 0 } } - orphanedRoots := make(map[btrfs.LogicalAddr]struct{}, len(orphanedNodes)) + orphanedRoots := make(map[btrfsvol.LogicalAddr]struct{}, len(orphanedNodes)) for node := range orphanedNodes { orphanedRoots[node] = struct{}{} } for potentialRoot := range orphanedRoots { if err := fs.TreeWalk(potentialRoot, btrfs.TreeWalkHandler{ - Node: func(path btrfs.TreePath, _ *util.Ref[btrfs.LogicalAddr, btrfs.Node], _ error) error { + Node: func(path btrfs.TreePath, _ *util.Ref[btrfsvol.LogicalAddr, btrfs.Node], _ error) error { nodeAddr := path[len(path)-1].NodeAddr if nodeAddr != potentialRoot { delete(orphanedRoots, nodeAddr) |