summaryrefslogtreecommitdiff
path: root/lib/btrfsutil/rebuilt_readitem.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-04 09:51:34 -0700
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-15 08:03:53 -0600
commit2c2d616b8650dd01818bd29e11e7b06ae2de5891 (patch)
tree94110d079c4e322370b272cd9604ecf94d755f3d /lib/btrfsutil/rebuilt_readitem.go
parent7349ff1a01b29eae7f7e769fe44548f09c253d2b (diff)
tree-wide: Refer to item "slots" rather than "indexes"
Diffstat (limited to 'lib/btrfsutil/rebuilt_readitem.go')
-rw-r--r--lib/btrfsutil/rebuilt_readitem.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/btrfsutil/rebuilt_readitem.go b/lib/btrfsutil/rebuilt_readitem.go
index a508d99..016299c 100644
--- a/lib/btrfsutil/rebuilt_readitem.go
+++ b/lib/btrfsutil/rebuilt_readitem.go
@@ -22,11 +22,11 @@ import (
type ItemPtr struct {
Node btrfsvol.LogicalAddr
- Idx int
+ Slot int
}
func (ptr ItemPtr) String() string {
- return fmt.Sprintf("node@%v[%v]", ptr.Node, ptr.Idx)
+ return fmt.Sprintf("node@%v[%v]", ptr.Node, ptr.Slot)
}
type SizeAndErr struct {
@@ -74,7 +74,7 @@ func (o *KeyIO) InsertNode(nodeRef *diskio.Ref[btrfsvol.LogicalAddr, btrfstree.N
for i, item := range nodeRef.Data.BodyLeaf {
ptr := ItemPtr{
Node: nodeRef.Addr,
- Idx: i,
+ Slot: i,
}
switch itemBody := item.Body.(type) {
case *btrfsitem.Inode:
@@ -159,13 +159,13 @@ func (o *KeyIO) ReadItem(ctx context.Context, ptr ItemPtr) btrfsitem.Item {
if o.graph.Nodes[ptr.Node].Level != 0 {
panic(fmt.Errorf("should not happen: btrfsutil.KeyIO.ReadItem called for non-leaf node@%v", ptr.Node))
}
- if ptr.Idx < 0 {
- panic(fmt.Errorf("should not happen: btrfsutil.KeyIO.ReadItem called for negative item index: %v", ptr.Idx))
+ if ptr.Slot < 0 {
+ panic(fmt.Errorf("should not happen: btrfsutil.KeyIO.ReadItem called for negative item slot: %v", ptr.Slot))
}
items := o.readNode(ctx, ptr.Node).Data.BodyLeaf
- if ptr.Idx >= len(items) {
- panic(fmt.Errorf("should not happen: btrfsutil.KeyIO.ReadItem called for out-of-bounds item index: index=%v len=%v",
- ptr.Idx, len(items)))
+ if ptr.Slot >= len(items) {
+ panic(fmt.Errorf("should not happen: btrfsutil.KeyIO.ReadItem called for out-of-bounds item slot: slot=%v len=%v",
+ ptr.Slot, len(items)))
}
- return items[ptr.Idx].Body.CloneItem()
+ return items[ptr.Slot].Body.CloneItem()
}