mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
[Scheduler] Map deletion complexity: log(n) => O(1)
This commit is contained in:
parent
c70e3e93bd
commit
31afb24244
@ -110,10 +110,8 @@ func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v
|
|||||||
|
|
||||||
attachedVolumeCount := map[string]int{}
|
attachedVolumeCount := map[string]int{}
|
||||||
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
|
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
|
||||||
if _, ok := newVolumes[volumeUniqueName]; ok {
|
// Don't count single volume used in multiple pods more than once
|
||||||
// Don't count single volume used in multiple pods more than once
|
delete(newVolumes, volumeUniqueName)
|
||||||
delete(newVolumes, volumeUniqueName)
|
|
||||||
}
|
|
||||||
attachedVolumeCount[volumeLimitKey]++
|
attachedVolumeCount[volumeLimitKey]++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,9 +244,7 @@ func (pl *nonCSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod
|
|||||||
|
|
||||||
// filter out already-mounted volumes
|
// filter out already-mounted volumes
|
||||||
for k := range existingVolumes {
|
for k := range existingVolumes {
|
||||||
if _, ok := newVolumes[k]; ok {
|
delete(newVolumes, k)
|
||||||
delete(newVolumes, k)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
numNewVolumes := len(newVolumes)
|
numNewVolumes := len(newVolumes)
|
||||||
|
Loading…
Reference in New Issue
Block a user