diff --git a/internal/index/indexmap.go b/internal/index/indexmap.go index 15f253d76..c709f7b3a 100644 --- a/internal/index/indexmap.go +++ b/internal/index/indexmap.go @@ -99,18 +99,15 @@ func (m *indexMap) get(id restic.ID) *indexEntry { } func (m *indexMap) grow() { - old := m.buckets m.buckets = make([]uint, growthFactor*len(m.buckets)) - for _, ei := range old { - for ei != 0 { - e := m.resolve(ei) - h := m.hash(e.id) - next := e.next - e.next = m.buckets[h] - m.buckets[h] = ei - ei = next - } + blockCount := m.blockList.Size() + for i := uint(1); i < blockCount; i++ { + e := m.resolve(i) + + h := m.hash(e.id) + e.next = m.buckets[h] + m.buckets[h] = i } }