From 3a7a736d1a6dd574a03e31ca7bcde2ea60767fd6 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Tue, 3 Jan 2023 21:40:38 -0700 Subject: rebuildnodes: Don't store negative results that are unlikely to come up again --- lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/btrfsprogs/btrfsinspect') diff --git a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go index 87d9f35..9a4bfab 100644 --- a/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go +++ b/lib/btrfsprogs/btrfsinspect/rebuildnodes/rebuild.go @@ -515,6 +515,10 @@ func (treeQueue *treeAugmentQueue) has(wantKey string) bool { } func (treeQueue *treeAugmentQueue) store(wantKey string, choices containers.Set[btrfsvol.LogicalAddr]) { + if len(choices) == 0 && (strings.Contains(wantKey, " name=") || strings.Contains(wantKey, "-")) { + // This wantKey is unlikely to come up again, so it's not worth storing a negative result. + return + } wantKey = shortenWantKey(wantKey) beg := treeQueue.keyBuf.Len() if treeQueue.keyBuf.Cap()-beg < len(wantKey) { -- cgit v1.2.3-2-g168b