Clean up lock-instrumentation and improve comments (#3499)

- Add a lockStat type to group counters
- Remove unnecessary helper functions
- Fix stats computation on force unlock
- Removed unnecessary checks and cleaned up comments
This commit is contained in:
Krishnan Parthasarathi
2016-12-26 23:59:55 +05:30
committed by Harshavardhana
parent e8ce3b64ed
commit 36fd317eb2
5 changed files with 176 additions and 180 deletions

View File

@@ -61,6 +61,7 @@ func initNSLock(isDistXL bool) {
globalNSMutex = &nsLockMap{
isDistXL: isDistXL,
lockMap: make(map[nsParam]*nsLock),
counters: &lockStat{},
}
// Initialize nsLockMap with entry for instrumentation information.
@@ -91,10 +92,8 @@ type nsLock struct {
// Unlock, RLock and RUnlock.
type nsLockMap struct {
// Lock counter used for lock debugging.
globalLockCounter int64 // Total locks held.
blockedCounter int64 // Total operations blocked waiting for locks.
runningLockCounter int64 // Total locks held but not released yet.
debugLockMap map[nsParam]*debugLockInfoPerVolumePath // Info for instrumentation on locks.
counters *lockStat
debugLockMap map[nsParam]*debugLockInfoPerVolumePath // Info for instrumentation on locks.
// Indicates whether the locking service is part
// of a distributed setup or not.