mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #90283 from gaurav1086/scheduler_cleanup_map_deletion
[Scheduler] Improve complexity from O(logN) to O(1)
This commit is contained in:
commit
18b5c4ddbb
@ -110,10 +110,8 @@ func (pl *CSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod *v
|
||||
|
||||
attachedVolumeCount := map[string]int{}
|
||||
for volumeUniqueName, volumeLimitKey := range attachedVolumes {
|
||||
if _, ok := newVolumes[volumeUniqueName]; ok {
|
||||
// Don't count single volume used in multiple pods more than once
|
||||
delete(newVolumes, volumeUniqueName)
|
||||
}
|
||||
// Don't count single volume used in multiple pods more than once
|
||||
delete(newVolumes, volumeUniqueName)
|
||||
attachedVolumeCount[volumeLimitKey]++
|
||||
}
|
||||
|
||||
|
@ -244,9 +244,7 @@ func (pl *nonCSILimits) Filter(ctx context.Context, _ *framework.CycleState, pod
|
||||
|
||||
// filter out already-mounted volumes
|
||||
for k := range existingVolumes {
|
||||
if _, ok := newVolumes[k]; ok {
|
||||
delete(newVolumes, k)
|
||||
}
|
||||
delete(newVolumes, k)
|
||||
}
|
||||
|
||||
numNewVolumes := len(newVolumes)
|
||||
|
Loading…
Reference in New Issue
Block a user