diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-09-05 12:43:46 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-09-05 12:43:46 -0600 |
commit | 7fba10e5be51a3fe565a6f69a946ece9f0e59a67 (patch) | |
tree | 91bc89b8d1e5dba3ead0319daeef3181ccc6da4d /lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go | |
parent | abdc8394bcb7080f01859cbfe367beecf5aef06f (diff) |
Try to uniformly use containers.Set
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go index 45fcc23..ef7d284 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/s4_reattach.go @@ -31,7 +31,7 @@ func (a RebuiltNode) ContainsWholeRegion(min, max btrfsprim.Key) int { } } -func reAttachNodes(ctx context.Context, fs _FS, orphanedNodes map[btrfsvol.LogicalAddr]struct{}, rebuiltNodes map[btrfsvol.LogicalAddr]*RebuiltNode) error { +func reAttachNodes(ctx context.Context, fs _FS, orphanedNodes containers.Set[btrfsvol.LogicalAddr], rebuiltNodes map[btrfsvol.LogicalAddr]*RebuiltNode) error { dlog.Info(ctx, "Attaching orphaned nodes to rebuilt nodes...") sb, err := fs.Superblock() @@ -91,12 +91,12 @@ func reAttachNodes(ctx context.Context, fs _FS, orphanedNodes map[btrfsvol.Logic trees := make(containers.Set[btrfsprim.ObjID]) tree := foundRef.Data.Head.Owner for { - trees[tree] = struct{}{} + trees.Insert(tree) var ok bool tree, ok = fs.ParentTree(tree) if !ok { // error; accept anything - trees[0] = struct{}{} + trees.Insert(0) break } if tree == 0 { @@ -113,7 +113,7 @@ func reAttachNodes(ctx context.Context, fs _FS, orphanedNodes map[btrfsvol.Logic if parent.Node.Head.Generation < foundRef.Data.Head.Generation { continue } - if !trees.HasIntersection(parent.InTrees) { + if !trees.HasAny(parent.InTrees) { continue } parent.BodyInternal = append(parent.BodyInternal, btrfstree.KeyPointer{ |