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:
parent
ad9118c696
commit
6d347aeb69
1 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue