From 7f1391d48d63a5f8780dddc41817eaa9df3ce880 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 29 Mar 2023 17:11:27 -0600 Subject: tree-wide: Funnel all btrfstree.ReadNode[btrfsvol.LogicalAddr]() calls through btrfstree.NodeSource.ReadNode() --- lib/btrfsutil/rebuilt_forrest.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/btrfsutil/rebuilt_forrest.go') diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go index 811e1ac..4f7a24b 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 @@ -148,7 +147,7 @@ type RebuiltForrest struct { // 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, -- cgit v1.2.3-2-g168b From 94aa0ec3e9f7145cdf177ad6f6d3d8b7d5bdbef7 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 29 Mar 2023 10:00:18 -0600 Subject: btrfstree: Change the NodeSource API so that it can do caching --- lib/btrfsutil/rebuilt_forrest.go | 5 ----- 1 file changed, 5 deletions(-) (limited to 'lib/btrfsutil/rebuilt_forrest.go') diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go index 4f7a24b..60f3010 100644 --- a/lib/btrfsutil/rebuilt_forrest.go +++ b/lib/btrfsutil/rebuilt_forrest.go @@ -141,8 +141,6 @@ 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 @@ -170,9 +168,6 @@ func NewRebuiltForrest(file btrfstree.NodeSource, sb btrfstree.Superblock, graph 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, -- cgit v1.2.3-2-g168b