mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
devmapper: Pass info rather than hash to setInitialized
We already have this at the caller, no need to look up again. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
This commit is contained in:
parent
5955846774
commit
74edcaf1e8
1 changed files with 2 additions and 7 deletions
|
@ -864,7 +864,7 @@ func (devices *DeviceSet) MountDevice(hash, path string, mountLabel string) erro
|
||||||
info.mountPath = path
|
info.mountPath = path
|
||||||
info.floating = false
|
info.floating = false
|
||||||
|
|
||||||
return devices.setInitialized(hash)
|
return devices.setInitialized(info)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error {
|
func (devices *DeviceSet) UnmountDevice(hash string, mode UnmountMode) error {
|
||||||
|
@ -955,12 +955,7 @@ func (devices *DeviceSet) HasActivatedDevice(hash string) bool {
|
||||||
return devinfo != nil && devinfo.Exists != 0
|
return devinfo != nil && devinfo.Exists != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (devices *DeviceSet) setInitialized(hash string) error {
|
func (devices *DeviceSet) setInitialized(info *DevInfo) error {
|
||||||
info := devices.Devices[hash]
|
|
||||||
if info == nil {
|
|
||||||
return fmt.Errorf("Unknown device %s", hash)
|
|
||||||
}
|
|
||||||
|
|
||||||
info.Initialized = true
|
info.Initialized = true
|
||||||
if err := devices.saveMetadata(); err != nil {
|
if err := devices.saveMetadata(); err != nil {
|
||||||
info.Initialized = false
|
info.Initialized = false
|
||||||
|
|
Loading…
Add table
Reference in a new issue