summaryrefslogtreecommitdiff
path: root/lib/btrfsutil/rebuilt_forrest.go
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-30 10:04:09 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-30 10:04:09 -0600
commitcdc2df19c59965149e11c3a5710458c626ea0668 (patch)
tree2e0bafd99a433d7271bf42e68ab1b5c1eba99e2b /lib/btrfsutil/rebuilt_forrest.go
parent0b092a27122fcf19479d6cdeae5f7c9493d9741a (diff)
parent94aa0ec3e9f7145cdf177ad6f6d3d8b7d5bdbef7 (diff)
Merge branch 'lukeshu/node-cache'
Diffstat (limited to 'lib/btrfsutil/rebuilt_forrest.go')
-rw-r--r--lib/btrfsutil/rebuilt_forrest.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go
index 811e1ac..60f3010 100644
--- a/lib/btrfsutil/rebuilt_forrest.go
+++ b/lib/btrfsutil/rebuilt_forrest.go
@@ -15,7 +15,6 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfstree"
"git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsvol"
"git.lukeshu.com/btrfs-progs-ng/lib/containers"
- "git.lukeshu.com/btrfs-progs-ng/lib/diskio"
"git.lukeshu.com/btrfs-progs-ng/lib/slices"
"git.lukeshu.com/btrfs-progs-ng/lib/textui"
)
@@ -130,7 +129,7 @@ func (cb noopRebuiltForrestCallbacks) LookupUUID(ctx context.Context, uuid btrfs
// NewRebuiltForrest().
type RebuiltForrest struct {
// static
- file diskio.File[btrfsvol.LogicalAddr]
+ file btrfstree.NodeSource
sb btrfstree.Superblock
graph Graph
cb RebuiltForrestCallbacks
@@ -142,13 +141,11 @@ type RebuiltForrest struct {
leafs containers.Cache[btrfsprim.ObjID, map[btrfsvol.LogicalAddr]containers.Set[btrfsvol.LogicalAddr]]
incItems containers.Cache[btrfsprim.ObjID, itemIndex]
excItems containers.Cache[btrfsprim.ObjID, itemIndex]
-
- nodes containers.Cache[btrfsvol.LogicalAddr, btrfstree.Node]
}
// NewRebuiltForrest returns a new RebuiltForrest instance. The
// RebuiltForrestCallbacks may be nil.
-func NewRebuiltForrest(file diskio.File[btrfsvol.LogicalAddr], sb btrfstree.Superblock, graph Graph, cb RebuiltForrestCallbacks) *RebuiltForrest {
+func NewRebuiltForrest(file btrfstree.NodeSource, sb btrfstree.Superblock, graph Graph, cb RebuiltForrestCallbacks) *RebuiltForrest {
ret := &RebuiltForrest{
file: file,
sb: sb,
@@ -171,9 +168,6 @@ func NewRebuiltForrest(file diskio.File[btrfsvol.LogicalAddr], sb btrfstree.Supe
containers.SourceFunc[btrfsprim.ObjID, itemIndex](func(ctx context.Context, treeID btrfsprim.ObjID, excItems *itemIndex) {
*excItems = ret.trees[treeID].uncachedExcItems(ctx)
}))
- ret.nodes = containers.NewARCache[btrfsvol.LogicalAddr, btrfstree.Node](textui.Tunable(8),
- containers.SourceFunc[btrfsvol.LogicalAddr, btrfstree.Node](ret.readNode))
-
if ret.cb == nil {
ret.cb = noopRebuiltForrestCallbacks{
forrest: ret,