summaryrefslogtreecommitdiff
path: root/lib/btrfsutil/rebuilt_callbacks.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-04-14 07:19:45 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2023-04-14 07:19:45 -0600
commitc2c6fa42233cd3911b81bb9449329816f645cec5 (patch)
treec8d3663a5d1d03f033a0c133983061bc2ef61418 /lib/btrfsutil/rebuilt_callbacks.go
parent163e8a157ab812a8eafa3a1d2d2b8c0e45431559 (diff)
parent9a63a26b4e23a8977a9558b7e9a79792eb5b6d18 (diff)
Merge branch 'lukeshu/rebuilt-v2-pt1-naive'
Diffstat (limited to 'lib/btrfsutil/rebuilt_callbacks.go')
-rw-r--r--lib/btrfsutil/rebuilt_callbacks.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/btrfsutil/rebuilt_callbacks.go b/lib/btrfsutil/rebuilt_callbacks.go
index 3a7e6e6..fdc826c 100644
--- a/lib/btrfsutil/rebuilt_callbacks.go
+++ b/lib/btrfsutil/rebuilt_callbacks.go
@@ -32,8 +32,8 @@ func (noopRebuiltForrestCallbacks) AddedRoot(context.Context, btrfsprim.ObjID, b
}
func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, _item btrfsitem.Root, ok bool) {
- rootTree := cb.forrest.RebuiltTree(ctx, btrfsprim.ROOT_TREE_OBJECTID)
- if rootTree == nil {
+ rootTree, err := cb.forrest.RebuiltTree(ctx, btrfsprim.ROOT_TREE_OBJECTID)
+ if err != nil {
return 0, btrfsitem.Root{}, false
}
tgt := btrfsprim.Key{
@@ -48,9 +48,9 @@ func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfs
if !ok {
return 0, btrfsitem.Root{}, false
}
- itemBody := cb.forrest.readItem(ctx, itemPtr)
- defer itemBody.Free()
- switch itemBody := itemBody.(type) {
+ item := cb.forrest.readItem(ctx, itemPtr)
+ defer item.Body.Free()
+ switch itemBody := item.Body.(type) {
case *btrfsitem.Root:
return btrfsprim.Generation(itemKey.Offset), *itemBody, true
case *btrfsitem.Error:
@@ -63,8 +63,8 @@ func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfs
}
func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btrfsprim.ObjID, ok bool) {
- uuidTree := cb.forrest.RebuiltTree(ctx, btrfsprim.UUID_TREE_OBJECTID)
- if uuidTree == nil {
+ uuidTree, err := cb.forrest.RebuiltTree(ctx, btrfsprim.UUID_TREE_OBJECTID)
+ if err != nil {
return 0, false
}
tgt := btrfsitem.UUIDToKey(uuid)
@@ -73,9 +73,9 @@ func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfs
if !ok {
return 0, false
}
- itemBody := cb.forrest.readItem(ctx, itemPtr)
- defer itemBody.Free()
- switch itemBody := itemBody.(type) {
+ item := cb.forrest.readItem(ctx, itemPtr)
+ defer item.Body.Free()
+ switch itemBody := item.Body.(type) {
case *btrfsitem.UUIDMap:
return itemBody.ObjID, true
case *btrfsitem.Error: