summaryrefslogtreecommitdiff
path: root/lib/btrfsprogs
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2022-10-04 23:31:14 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2022-10-04 23:31:14 -0600
commit4173a4e034f989eceeaefc9aa583b0cd23b4cfb1 (patch)
tree044d37ce35635b00bc3d5f4658ea83c1a615a7c6 /lib/btrfsprogs
parent772aede3198d9ea21ce1e8d46249532295927955 (diff)
fix broken tree paths
Diffstat (limited to 'lib/btrfsprogs')
-rw-r--r--lib/btrfsprogs/btrfsutil/broken_btree.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/btrfsprogs/btrfsutil/broken_btree.go b/lib/btrfsprogs/btrfsutil/broken_btree.go
index 0fc42a5..8a72c74 100644
--- a/lib/btrfsprogs/btrfsutil/broken_btree.go
+++ b/lib/btrfsprogs/btrfsutil/broken_btree.go
@@ -8,6 +8,7 @@ import (
"context"
"fmt"
iofs "io/fs"
+ "math"
"sync"
"github.com/datawire/dlib/derror"
@@ -21,6 +22,12 @@ import (
"git.lukeshu.com/btrfs-progs-ng/lib/diskio"
)
+var maxKey = btrfsprim.Key{
+ ObjectID: math.MaxUint64,
+ ItemType: math.MaxUint8,
+ Offset: math.MaxUint64,
+}
+
type treeIndex struct {
TreeRootErr error
Items *containers.RBTree[btrfsprim.Key, treeIndexValue]
@@ -137,7 +144,7 @@ func (bt *brokenTrees) treeIndex(treeID btrfsprim.ObjID) treeIndex {
// indicates a bug in my item parser than a problem with the filesystem.
panic(fmt.Errorf("TODO: error parsing item: %w", err))
}
- cacheEntry.Errors.Insert(err)
+ cacheEntry.Errors.Insert(err) // TODO
},
btrfstree.TreeWalkHandler{
Item: func(path btrfstree.TreePath, item btrfstree.Item) error {
@@ -150,7 +157,7 @@ func (bt *brokenTrees) treeIndex(treeID btrfsprim.ObjID) treeIndex {
cacheEntry.Items.Insert(treeIndexValue{
Key: item.Key,
ItemSize: item.BodySize,
- Path: path.DeepCopy(),
+ Path: path.DeepCopy(), // TODO
})
return nil
},
@@ -246,6 +253,7 @@ func (bt *brokenTrees) TreeWalk(ctx context.Context, treeID btrfsprim.ObjID, err
errHandle(&btrfstree.TreeError{
Path: btrfstree.TreePath{{
FromTree: treeID,
+ ToMaxKey: maxKey,
}},
Err: index.TreeRootErr,
})