diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-29 19:25:47 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2022-08-30 21:29:00 -0600 |
commit | b6a7ab5f6c1fe993271242021c3ed4050733fdf2 (patch) | |
tree | 2a0a099e0adc5bf58c586a76d9dd49c725d4dba7 /lib/btrfs/io3_btree.go | |
parent | 8aea2c35c9475293c89293a148134c0e6d5c4e7b (diff) |
wip
Diffstat (limited to 'lib/btrfs/io3_btree.go')
-rw-r--r-- | lib/btrfs/io3_btree.go | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/btrfs/io3_btree.go b/lib/btrfs/io3_btree.go index 8455eee..26acc22 100644 --- a/lib/btrfs/io3_btree.go +++ b/lib/btrfs/io3_btree.go @@ -58,18 +58,23 @@ func (fs *FS) populateTreeUUIDs(ctx context.Context) { } func (fs *FS) ParentTree(tree btrfsprim.ObjID) (btrfsprim.ObjID, bool) { - ctx := context.TODO() - if tree < btrfsprim.FIRST_FREE_OBJECTID { + if tree < btrfsprim.FIRST_FREE_OBJECTID || tree > btrfsprim.LAST_FREE_OBJECTID { + // no parent + return 0, true + } + fs.populateTreeUUIDs(context.TODO()) + parentUUID, ok := fs.cacheTreeParent[tree] + if !ok { + // could not look up parent info return 0, false } - fs.populateTreeUUIDs(ctx) - parentUUID := fs.cacheTreeParent[tree] if parentUUID == (btrfsprim.UUID{}) { - return 0, false + // no parent + return 0, true } parentObjID, ok := fs.cacheUUID2ObjID[parentUUID] if !ok { - dlog.Errorf(ctx, "dbg: could not resolve parentUUID=%v to an ObjID", parentUUID) + // could not look up parent info return 0, false } return parentObjID, true |