diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-05 10:10:34 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-09 12:17:50 -0600 |
commit | 8e215721b38972c522b692032bf1c516eb62359f (patch) | |
tree | f77874f4d545d93a4b38d225f071393d29683258 /lib/btrfs/btrfstree/btree.go | |
parent | 825fe95475952b18fc586630de5ddaf3faacbde7 (diff) |
btrfstree: Do a better job of checking node ownership
This now considers the interior nodes *between* the root and the leaf,
instead of just considering the root and the leaf.
Diffstat (limited to 'lib/btrfs/btrfstree/btree.go')
-rw-r--r-- | lib/btrfs/btrfstree/btree.go | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/btrfs/btrfstree/btree.go b/lib/btrfs/btrfstree/btree.go index 25259c0..e7be281 100644 --- a/lib/btrfs/btrfstree/btree.go +++ b/lib/btrfs/btrfstree/btree.go @@ -21,6 +21,11 @@ type Forrest interface { } type Tree interface { + // TreeParentID returns the ID of this tree's parent and the + // generation that this tree was split from its parent. If + // this tree has no parent, then (0, 0, nil) is returned. + TreeParentID(ctx context.Context) (btrfsprim.ObjID, btrfsprim.Generation, error) + // TreeLookup looks up the Item for a given key. // // If no such Item exists, but there is otherwise no error, @@ -70,15 +75,6 @@ type Tree interface { handleFn func(Item) bool, ) error - // CheckOwner returns whether it is permissible for a node - // with .Head.Owner=owner and .Head.Generation=gen to be in - // this tree. - // - // If there is an error determining this, then `failOpen` - // specifies whether it should return an error (false) or nil - // (true). - TreeCheckOwner(ctx context.Context, failOpen bool, owner btrfsprim.ObjID, gen btrfsprim.Generation) error - // TreeWalk is a lower-level call than TreeSubrange. Use with // hesitancy. // |