From 8e215721b38972c522b692032bf1c516eb62359f Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 5 Apr 2023 10:10:34 -0600 Subject: 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. --- lib/btrfs/btrfstree/btree.go | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'lib/btrfs/btrfstree/btree.go') 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. // -- cgit v1.2.3-2-g168b