Increment dirty counter only if setDirty(true) is called.

Currently, we increment the counter even if setDirty(false) is called,
which sets the storage clean.
This commit is contained in:
beorn7 2015-06-22 18:12:55 +02:00
parent ccbc801d19
commit 9016917d1c
1 changed files with 3 additions and 1 deletions

View File

@ -316,7 +316,9 @@ func (p *persistence) isDirty() bool {
// dirty during our runtime, there is no way back. If we were dirty from the
// start, a clean-up might make us clean again.)
func (p *persistence) setDirty(dirty bool) {
p.dirtyCounter.Inc()
if dirty {
p.dirtyCounter.Inc()
}
p.dirtyMtx.Lock()
defer p.dirtyMtx.Unlock()
if p.becameDirty {