From 6d347aeb6984ebdcb1051212ab3103880ef69ab0 Mon Sep 17 00:00:00 2001 From: Vivek Goyal Date: Wed, 3 Dec 2014 13:06:43 -0500 Subject: [PATCH] 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 --- daemon/graphdriver/devmapper/deviceset.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/daemon/graphdriver/devmapper/deviceset.go b/daemon/graphdriver/devmapper/deviceset.go index 713d1d60bc..40fb4e2d42 100644 --- a/daemon/graphdriver/devmapper/deviceset.go +++ b/daemon/graphdriver/devmapper/deviceset.go @@ -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 }