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>
Upstream-commit: 6d347aeb6984ebdcb1051212ab3103880ef69ab0
Component: engine
This commit is contained in:
Vivek Goyal
2014-12-03 13:06:43 -05:00
committed by root
parent 9318108e88
commit f0bbf70516

View File

@ -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
}