diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-02 11:24:13 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-04 14:08:38 -0600 |
commit | 52143763329ab004ce28d660a8f67eac32fa481c (patch) | |
tree | b2a0c9d6b80a18a97bd4df94e7d525603b832383 /lib/btrfsutil/rebuilt_forrest.go | |
parent | 5d2729a4e15dca6e22187cd5de272a2a2d191131 (diff) |
btrfsutil: RebuiltTree: Take better advantage of cache pinning
Diffstat (limited to 'lib/btrfsutil/rebuilt_forrest.go')
-rw-r--r-- | lib/btrfsutil/rebuilt_forrest.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go index fcfb353..d6e1fbb 100644 --- a/lib/btrfsutil/rebuilt_forrest.go +++ b/lib/btrfsutil/rebuilt_forrest.go @@ -43,10 +43,11 @@ func (cb noopRebuiltForrestCallbacks) LookupRoot(ctx context.Context, tree btrfs ObjectID: tree, ItemType: btrfsprim.ROOT_ITEM_KEY, } - itemKey, itemPtr, ok := rootTree.RebuiltItems(ctx).Search(func(key btrfsprim.Key, _ ItemPtr) int { + itemKey, itemPtr, ok := rootTree.RebuiltAcquireItems(ctx).Search(func(key btrfsprim.Key, _ ItemPtr) int { key.Offset = 0 return tgt.Compare(key) }) + rootTree.RebuiltReleaseItems() if !ok { return 0, btrfsitem.Root{}, false } @@ -70,7 +71,8 @@ func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfs return 0, false } tgt := btrfsitem.UUIDToKey(uuid) - itemPtr, ok := uuidTree.RebuiltItems(ctx).Load(tgt) + itemPtr, ok := uuidTree.RebuiltAcquireItems(ctx).Load(tgt) + uuidTree.RebuiltReleaseItems() if !ok { return 0, false } @@ -118,8 +120,9 @@ func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfs // - it provides several RebuiltTree methods that provide advice on // what roots should be added to a tree in order to repair it: // -// .RebuiltItems() and RebuiltPotentialItems() to compare what's -// in the tree and what could be in the tree. +// .RebuiltAcquireItems()/.RebuiltReleaseItems() and +// .RebuiltAcquirePotentialItems()/.RebuiltReleasePotentialItems() +// to compare what's in the tree and what could be in the tree. // // .RebuiltLeafToRoots() to map potential items to things that can // be passed to .RebuiltAddRoot(). |