From: Alex Rousskov Date: Sun, 6 Feb 2011 04:44:08 +0000 (-0700) Subject: Fixed busy slot accounting X-Git-Tag: take02~10 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4512bb2e0d41c7097bca4178e4e0bd706d1cab7f;p=thirdparty%2Fsquid.git Fixed busy slot accounting The number of busy slots does not go up when a new slot overwrites an old one. --- diff --git a/src/fs/rock/RockDirMap.cc b/src/fs/rock/RockDirMap.cc index 3d716fdc56..e230fb7a50 100644 --- a/src/fs/rock/RockDirMap.cc +++ b/src/fs/rock/RockDirMap.cc @@ -43,10 +43,11 @@ Rock::DirMap::openForWriting(const cache_key *const key, sfileno &fileno) if (s.exclusiveLock()) { assert(s.state != Slot::Writeable); // until we start breaking locks + if (s.state == Slot::Empty) // we may also overwrite a Readable slot + ++shared->count; s.state = Slot::Writeable; s.setKey(key); fileno = idx; - ++shared->count; debugs(79, 5, HERE << " opened slot at " << fileno << " for key " << storeKeyText(key) << " for writing in map [" << path << ']'); return &s.seBasics; // and keep the entry locked @@ -118,11 +119,12 @@ Rock::DirMap::putAt(const StoreEntry &e, const sfileno fileno) if (s.exclusiveLock()) { assert(s.state != Slot::Writeable); // until we start breaking locks + if (s.state == Slot::Empty) // we may also overwrite a Readable slot + ++shared->count; s.setKey(static_cast(e.key)); s.seBasics.set(e); s.state = Slot::Readable; s.releaseExclusiveLock(); - ++shared->count; debugs(79, 5, HERE << " put slot at " << fileno << " for key " << storeKeyText(key) << " in map [" << path << ']'); return true;