Skip to content

Commit

Permalink
Remove extra map lookup for volume drivers.
Browse files Browse the repository at this point in the history
Signed-off-by: Anusha Ragunathan <[email protected]>
  • Loading branch information
anusha-ragunathan committed Jul 19, 2016
1 parent 6875f71 commit 5d46273
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions volume/drivers/extpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 5d46273

Please sign in to comment.