From af5f03de8052d144027e7ba99000e3196056adce Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Thu, 5 Jan 2023 00:35:48 -0700 Subject: rebuildnodes: Speed up treeAugmentQueue.has() --- lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go index 9a4bfab..ebca2bd 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go @@ -495,18 +495,19 @@ func shortenWantKey(wantKey string) string { func (treeQueue *treeAugmentQueue) has(wantKey string) bool { if treeQueue != nil { + wantKey = shortenWantKey(wantKey) if treeQueue.zero != nil { - if _, ok := treeQueue.zero[shortenWantKey(wantKey)]; ok { + if _, ok := treeQueue.zero[wantKey]; ok { return true } } if treeQueue.single != nil { - if _, ok := treeQueue.single[shortenWantKey(wantKey)]; ok { + if _, ok := treeQueue.single[wantKey]; ok { return true } } if treeQueue.multi != nil { - if _, ok := treeQueue.multi[shortenWantKey(wantKey)]; ok { + if _, ok := treeQueue.multi[wantKey]; ok { return true } } -- cgit v1.2.3-2-g168b