diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-16 14:22:34 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-04-16 14:22:34 -0600 |
commit | 4adcf5f67965bf355cc7e16ec11e2293c2506700 (patch) | |
tree | 951abfa0b0bd9cb98c2bfe25b7f3e973d6abf960 /lib/btrfsutil/rebuilt_forrest.go | |
parent | c2c6fa42233cd3911b81bb9449329816f645cec5 (diff) | |
parent | 2300adb18820d09f73746f00df0e64ccbba25052 (diff) |
Merge branch 'lukeshu/rebuilt-misc'
Diffstat (limited to 'lib/btrfsutil/rebuilt_forrest.go')
-rw-r--r-- | lib/btrfsutil/rebuilt_forrest.go | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/btrfsutil/rebuilt_forrest.go b/lib/btrfsutil/rebuilt_forrest.go index b935d85..019d824 100644 --- a/lib/btrfsutil/rebuilt_forrest.go +++ b/lib/btrfsutil/rebuilt_forrest.go @@ -124,6 +124,7 @@ func (ts *RebuiltForrest) RebuiltTree(ctx context.Context, treeID btrfsprim.ObjI if tree.rootErr != nil { return nil, tree.rootErr } + tree.initRoots(ctx) return tree, nil } @@ -156,27 +157,26 @@ func (ts *RebuiltForrest) rebuildTree(ctx context.Context, treeID btrfsprim.ObjI Roots: make(containers.Set[btrfsvol.LogicalAddr]), forrest: ts, } - var root btrfsvol.LogicalAddr switch treeID { case btrfsprim.ROOT_TREE_OBJECTID: - sb, _ := ts.inner.Superblock() - root = sb.RootTree + sb, _ := ts.Superblock() + ts.trees[treeID].Root = sb.RootTree case btrfsprim.CHUNK_TREE_OBJECTID: - sb, _ := ts.inner.Superblock() - root = sb.ChunkTree + sb, _ := ts.Superblock() + ts.trees[treeID].Root = sb.ChunkTree case btrfsprim.TREE_LOG_OBJECTID: - sb, _ := ts.inner.Superblock() - root = sb.LogTree + sb, _ := ts.Superblock() + ts.trees[treeID].Root = sb.LogTree case btrfsprim.BLOCK_GROUP_TREE_OBJECTID: - sb, _ := ts.inner.Superblock() - root = sb.BlockGroupRoot + sb, _ := ts.Superblock() + ts.trees[treeID].Root = sb.BlockGroupRoot default: rootOff, rootItem, ok := ts.cb.LookupRoot(ctx, treeID) if !ok { ts.trees[treeID].rootErr = btrfstree.ErrNoTree return } - root = rootItem.ByteNr + ts.trees[treeID].Root = rootItem.ByteNr ts.trees[treeID].UUID = rootItem.UUID if rootItem.ParentUUID != (btrfsprim.UUID{}) { ts.trees[treeID].ParentGen = rootOff @@ -197,10 +197,6 @@ func (ts *RebuiltForrest) rebuildTree(ctx context.Context, treeID btrfsprim.ObjI } } } - - if root != 0 { - ts.trees[treeID].RebuiltAddRoot(ctx, root) - } } func (ts *RebuiltForrest) flushNegativeCache(ctx context.Context) { |