diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 10:04:09 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-03-30 10:04:09 -0600 |
commit | cdc2df19c59965149e11c3a5710458c626ea0668 (patch) | |
tree | 2e0bafd99a433d7271bf42e68ab1b5c1eba99e2b /cmd | |
parent | 0b092a27122fcf19479d6cdeae5f7c9493d9741a (diff) | |
parent | 94aa0ec3e9f7145cdf177ad6f6d3d8b7d5bdbef7 (diff) |
Merge branch 'lukeshu/node-cache'
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/btrfs-rec/inspect/rebuildtrees/scan.go | 8 | ||||
-rw-r--r-- | cmd/btrfs-rec/inspect_lstrees.go | 5 |
2 files changed, 7 insertions, 6 deletions
diff --git a/cmd/btrfs-rec/inspect/rebuildtrees/scan.go b/cmd/btrfs-rec/inspect/rebuildtrees/scan.go index 3339270..a6f9c7a 100644 --- a/cmd/btrfs-rec/inspect/rebuildtrees/scan.go +++ b/cmd/btrfs-rec/inspect/rebuildtrees/scan.go @@ -71,17 +71,17 @@ func ScanDevices(ctx context.Context, fs *btrfs.FS, nodeList []btrfsvol.LogicalA if err := ctx.Err(); err != nil { return ScanDevicesResult{}, err } - node, err := btrfstree.ReadNode[btrfsvol.LogicalAddr](fs, *sb, laddr, btrfstree.NodeExpectations{ + node, err := fs.AcquireNode(ctx, laddr, btrfstree.NodeExpectations{ LAddr: containers.OptionalValue(laddr), }) if err != nil { - node.Free() + fs.ReleaseNode(node) return ScanDevicesResult{}, err } ret.insertNode(node) - node.Free() + fs.ReleaseNode(node) stats.N++ progressWriter.Set(stats) @@ -93,7 +93,7 @@ func ScanDevices(ctx context.Context, fs *btrfs.FS, nodeList []btrfsvol.LogicalA dlog.Info(ctx, "... done reading node data") ctx = dlog.WithField(ctx, "btrfs.inspect.rebuild-trees.read.substep", "check") - if err := ret.Graph.FinalCheck(ctx, fs, *sb); err != nil { + if err := ret.Graph.FinalCheck(ctx, fs); err != nil { return ScanDevicesResult{}, err } diff --git a/cmd/btrfs-rec/inspect_lstrees.go b/cmd/btrfs-rec/inspect_lstrees.go index 1449a21..bdbdca2 100644 --- a/cmd/btrfs-rec/inspect_lstrees.go +++ b/cmd/btrfs-rec/inspect_lstrees.go @@ -101,16 +101,16 @@ func init() { treeErrCnt = 0 treeItemCnt = make(map[btrfsitem.Type]int) textui.Fprintf(os.Stdout, "lost+found\n") - sb, _ := fs.Superblock() for _, laddr := range nodeList { if visitedNodes.Has(laddr) { continue } visitedNodes.Insert(laddr) - node, err := btrfstree.ReadNode[btrfsvol.LogicalAddr](fs, *sb, laddr, btrfstree.NodeExpectations{ + node, err := fs.AcquireNode(ctx, laddr, btrfstree.NodeExpectations{ LAddr: containers.OptionalValue(laddr), }) if err != nil { + fs.ReleaseNode(node) treeErrCnt++ continue } @@ -118,6 +118,7 @@ func init() { typ := item.Key.ItemType treeItemCnt[typ]++ } + fs.ReleaseNode(node) } flush() } |