mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
devmapper: Remove unnecessary condition check in updatePoolTransactionId()
Currently updatePoolTransactionId() checks if NewTransactionId and TransactionId are not same only then update the transaction Id in pool. This check is redundant. Currently we call updatePoolTransactionId() only from two places and both of these first allocate a new transaction Id. Also updatePoolTransactionId() should only be called after allocating new transaction Id otherwise it does not make any sense. Remove the redundant check and reduce confusion. Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
@@ -205,12 +205,10 @@ func (devices *DeviceSet) allocateTransactionId() uint64 {
|
||||
}
|
||||
|
||||
func (devices *DeviceSet) updatePoolTransactionId() error {
|
||||
if devices.NewTransactionId != devices.TransactionId {
|
||||
if err := devicemapper.SetTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.NewTransactionId); err != nil {
|
||||
return fmt.Errorf("Error setting devmapper transaction ID: %s", err)
|
||||
}
|
||||
devices.TransactionId = devices.NewTransactionId
|
||||
if err := devicemapper.SetTransactionId(devices.getPoolDevName(), devices.TransactionId, devices.NewTransactionId); err != nil {
|
||||
return fmt.Errorf("Error setting devmapper transaction ID: %s", err)
|
||||
}
|
||||
devices.TransactionId = devices.NewTransactionId
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user