Remove extra map lookup for volume drivers.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
This commit is contained in:
Anusha Ragunathan 2016-07-19 08:35:36 -07:00
parent 6875f71d7c
commit 5d4627331e

View file

@ -107,19 +107,15 @@ func lookup(name string) (volume.Driver, error) {
return nil, fmt.Errorf("Error looking up volume plugin %s: %v", name, err)
}
drivers.Lock()
defer drivers.Unlock()
if ext, ok := drivers.extensions[name]; ok {
return ext, nil
}
d := NewVolumeDriver(name, p.Client())
if err := validateDriver(d); err != nil {
return nil, err
}
if p.IsLegacy() {
drivers.Lock()
drivers.extensions[name] = d
drivers.Unlock()
}
return d, nil
}