diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-27 14:25:01 -0700 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2023-02-27 14:25:01 -0700 |
commit | a7a3b5b08557abf7edc6aa4649e85069c3a450b4 (patch) | |
tree | dc39b1f31f741c206ab56757ad538c36593dca57 /lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go | |
parent | ab32cf0c1916ca0ebf46e4790f61681fef8d8708 (diff) |
rebuildnodes: Don't bother with retries if nothing changed
Diffstat (limited to 'lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go')
-rw-r--r-- | lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go index eb0204c..d1d354a 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild_treecb.go @@ -10,6 +10,7 @@ import ( "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsitem" "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsprim" + "git.lukeshu.com/btrfs-progs-ng/lib/btrfs/btrfsvol" ) // AddedItem implements btrees.Callbacks. @@ -20,6 +21,13 @@ func (o *rebuilder) AddedItem(ctx context.Context, tree btrfsprim.ObjID, key btr }) } +// AddedRoot implements btrees.Callbacks. +func (o *rebuilder) AddedRoot(ctx context.Context, tree btrfsprim.ObjID, root btrfsvol.LogicalAddr) { + if retries := o.retryItemQueue[tree]; retries != nil { + o.addedItemQueue.InsertFrom(retries) + } +} + // LookupRoot implements btrees.Callbacks. func (o *rebuilder) LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offset btrfsprim.Generation, item btrfsitem.Root, ok bool) { wantKey := WantWithTree{ @@ -33,7 +41,7 @@ func (o *rebuilder) LookupRoot(ctx context.Context, tree btrfsprim.ObjID) (offse ctx = withWant(ctx, logFieldTreeWant, "tree Root", wantKey) foundKey, ok := o._want(ctx, wantKey) if !ok { - o.enqueueRetry() + o.enqueueRetry(btrfsprim.ROOT_TREE_OBJECTID) return 0, btrfsitem.Root{}, false } switch itemBody := o.rebuilt.Tree(ctx, wantKey.TreeID).ReadItem(ctx, foundKey).(type) { @@ -57,7 +65,7 @@ func (o *rebuilder) LookupUUID(ctx context.Context, uuid btrfsprim.UUID) (id btr } ctx = withWant(ctx, logFieldTreeWant, "resolve parent UUID", wantKey) if !o._wantOff(ctx, wantKey) { - o.enqueueRetry() + o.enqueueRetry(btrfsprim.UUID_TREE_OBJECTID) return 0, false } switch itemBody := o.rebuilt.Tree(ctx, wantKey.TreeID).ReadItem(ctx, wantKey.Key.Key()).(type) { |