diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-15 09:00:58 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-16 09:35:05 -0600 |
commit | 0322e9e1b9ff017f084555286d1569e88ecaf8a8 (patch) | |
tree | 10feb684f9ca9790f615e37604e4145e490faad9 /lib/btrfsutil/rebuilt_tree.go | |
parent | f90f698bf409eb10f7fd7826d5b1eb9075e3aa28 (diff) |
btrfsutil: RebuiltTree: Drop pointless `if`/indentation
Diffstat (limited to 'lib/btrfsutil/rebuilt_tree.go')
-rw-r--r-- | lib/btrfsutil/rebuilt_tree.go | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/lib/btrfsutil/rebuilt_tree.go b/lib/btrfsutil/rebuilt_tree.go index d890dc4..70be4c8 100644 --- a/lib/btrfsutil/rebuilt_tree.go +++ b/lib/btrfsutil/rebuilt_tree.go @@ -216,33 +216,31 @@ nextKP: } indexer.node(ctx, kp.FromNode, stack) - if len(indexer.nodeToRoots[kp.FromNode]) > 0 { - for root, rootInfo := range indexer.nodeToRoots[kp.FromNode] { - if kp.FromSlot+1 < len(indexer.tree.forrest.graph.EdgesFrom[kp.FromNode]) { - rootInfo.loMaxItem = indexer.tree.forrest.graph.EdgesFrom[kp.FromNode][kp.FromSlot+1].ToKey.Mm() - rootInfo.hiMaxItem = rootInfo.loMaxItem - } else { - // OK, now check the MaxItem expectation. - // - // We'll use the hiMaxItem, because it only needs to be - // valid in *one* of the paths to this node. - kpMaxItem := rootInfo.hiMaxItem - if kpMaxItem.Compare(nodeInfo.MaxItem(indexer.tree.forrest.graph)) < 0 { - continue nextKP - } - } - oldRootInfo, ok := roots[root] - if ok && rootInfo.loMaxItem.Compare(oldRootInfo.loMaxItem) > 0 { - rootInfo.loMaxItem = oldRootInfo.loMaxItem - } - if ok && rootInfo.hiMaxItem.Compare(oldRootInfo.hiMaxItem) < 0 { - rootInfo.hiMaxItem = oldRootInfo.hiMaxItem - } - if roots == nil { - roots = make(rebuiltRoots) + for root, rootInfo := range indexer.nodeToRoots[kp.FromNode] { + if kp.FromSlot+1 < len(indexer.tree.forrest.graph.EdgesFrom[kp.FromNode]) { + rootInfo.loMaxItem = indexer.tree.forrest.graph.EdgesFrom[kp.FromNode][kp.FromSlot+1].ToKey.Mm() + rootInfo.hiMaxItem = rootInfo.loMaxItem + } else { + // OK, now check the MaxItem expectation. + // + // We'll use the hiMaxItem, because it only needs to be + // valid in *one* of the paths to this node. + kpMaxItem := rootInfo.hiMaxItem + if kpMaxItem.Compare(nodeInfo.MaxItem(indexer.tree.forrest.graph)) < 0 { + continue nextKP } - roots[root] = rootInfo } + oldRootInfo, ok := roots[root] + if ok && rootInfo.loMaxItem.Compare(oldRootInfo.loMaxItem) > 0 { + rootInfo.loMaxItem = oldRootInfo.loMaxItem + } + if ok && rootInfo.hiMaxItem.Compare(oldRootInfo.hiMaxItem) < 0 { + rootInfo.hiMaxItem = oldRootInfo.hiMaxItem + } + if roots == nil { + roots = make(rebuiltRoots) + } + roots[root] = rootInfo } } if roots == nil { |