summaryrefslogtreecommitdiff
path: root/lib/btrfs/btrfstree
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-03-22 13:43:15 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2023-03-23 18:35:46 -0600
commitd11a5357df7d155a7a3e92a67971d3d52ff6ad86 (patch)
tree1d9bfe0ce8b12bb2698f2ff961198534718ba051 /lib/btrfs/btrfstree
parent5520c20c493d52d83288bc2e321117006e38fd1a (diff)
btrfstree: Add a 'generation' argument the owner validation
Validating a node's owner properly requires the generation. But don't worry about actually doing it properly yet, just update the API first.
Diffstat (limited to 'lib/btrfs/btrfstree')
-rw-r--r--lib/btrfs/btrfstree/readnode.go2
-rw-r--r--lib/btrfs/btrfstree/types_node.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/btrfs/btrfstree/readnode.go b/lib/btrfs/btrfstree/readnode.go
index c2e3b0f..7cc42f5 100644
--- a/lib/btrfs/btrfstree/readnode.go
+++ b/lib/btrfs/btrfstree/readnode.go
@@ -41,7 +41,7 @@ func FSReadNode(
}
var treeParents []btrfsprim.ObjID
- checkOwner := func(owner btrfsprim.ObjID) error {
+ checkOwner := func(owner btrfsprim.ObjID, _ btrfsprim.Generation) error {
exp := path.Node(-1).FromTree
for {
if owner == exp {
diff --git a/lib/btrfs/btrfstree/types_node.go b/lib/btrfs/btrfstree/types_node.go
index 622f23c..bfcbbf4 100644
--- a/lib/btrfs/btrfstree/types_node.go
+++ b/lib/btrfs/btrfstree/types_node.go
@@ -417,7 +417,7 @@ type NodeExpectations struct {
// Things knowable from the parent.
Level containers.Optional[uint8]
Generation containers.Optional[btrfsprim.Generation]
- Owner func(btrfsprim.ObjID) error
+ Owner func(btrfsprim.ObjID, btrfsprim.Generation) error
MinItem containers.Optional[btrfsprim.Key]
// Things knowable from the structure of the tree.
MaxItem containers.Optional[btrfsprim.Key]
@@ -547,7 +547,7 @@ func (exp NodeExpectations) Check(node *Node) error {
exp.Generation.Val, node.Head.Generation))
}
if exp.Owner != nil {
- if err := exp.Owner(node.Head.Owner); err != nil {
+ if err := exp.Owner(node.Head.Owner, node.Head.Generation); err != nil {
errs = append(errs, err)
}
}