diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-15 11:09:35 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-15 11:09:35 -0600 |
commit | c2925f0f8a5d69369b43de0d2d201291fe5ed9d1 (patch) | |
tree | 996f557b23618650983146ff0e93e8204a8ff5d3 /lib/btrfsutil/graph_loops.go | |
parent | 9ff81649f425370bf3c1aee32542a784119947f8 (diff) | |
parent | bb9dafebfbf3bfd6ea111c88371844f3402f3f3f (diff) |
Merge branch 'lukeshu/misc'
Diffstat (limited to 'lib/btrfsutil/graph_loops.go')
-rw-r--r-- | lib/btrfsutil/graph_loops.go | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/btrfsutil/graph_loops.go b/lib/btrfsutil/graph_loops.go index 3382705..b5690af 100644 --- a/lib/btrfsutil/graph_loops.go +++ b/lib/btrfsutil/graph_loops.go @@ -22,15 +22,15 @@ func (g Graph) renderNode(node btrfsvol.LogicalAddr) []string { fmt.Sprintf("{addr: %v,", node), fmt.Sprintf(" level: %v,", nodeData.Level), fmt.Sprintf(" gen: %v,", nodeData.Generation), - fmt.Sprintf(" num_items: %v,", nodeData.NumItems), + fmt.Sprintf(" num_items: %v,", len(nodeData.Items)), fmt.Sprintf(" min_item: {%d,%v,%d},", - nodeData.MinItem.ObjectID, - nodeData.MinItem.ItemType, - nodeData.MinItem.Offset), + nodeData.MinItem().ObjectID, + nodeData.MinItem().ItemType, + nodeData.MinItem().Offset), fmt.Sprintf(" max_item: {%d,%v,%d}}", - nodeData.MaxItem.ObjectID, - nodeData.MaxItem.ItemType, - nodeData.MaxItem.Offset), + nodeData.MaxItem().ObjectID, + nodeData.MaxItem().ItemType, + nodeData.MaxItem().Offset), } } else if nodeErr, ok := g.BadNodes[node]; ok { return []string{ @@ -120,11 +120,12 @@ func checkNodeExpectations(kp GraphEdge, toNode GraphNode) error { errs = append(errs, fmt.Errorf("kp.generation=%v != node.generation=%v", kp.ToGeneration, toNode.Generation)) } - if toNode.NumItems == 0 { + switch { + case len(toNode.Items) == 0: errs = append(errs, fmt.Errorf("node.num_items=0")) - } else if kp.ToKey != (btrfsprim.Key{}) && toNode.MinItem != kp.ToKey { + case kp.ToKey != (btrfsprim.Key{}) && toNode.MinItem() != kp.ToKey: errs = append(errs, fmt.Errorf("kp.key=%v != node.items[0].key=%v", - kp.ToKey, toNode.MinItem)) + kp.ToKey, toNode.MinItem())) } if len(errs) > 0 { return errs |