--------------------- PatchSet 11201 Date: 2007/01/26 00:44:01 Author: adrian Branch: HEAD Tag: (none) Log: Add in some simple debugging that lets us trace the caller of the store lock/unlock operators. Members: src/protos.h:1.521->1.522 src/store.c:1.571->1.572 Index: squid/src/protos.h =================================================================== RCS file: /cvsroot/squid/squid/src/protos.h,v retrieving revision 1.521 retrieving revision 1.522 diff -u -r1.521 -r1.522 --- squid/src/protos.h 21 Jan 2007 12:54:00 -0000 1.521 +++ squid/src/protos.h 26 Jan 2007 00:44:01 -0000 1.522 @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.521 2007/01/21 12:54:00 adrian Exp $ + * $Id: protos.h,v 1.522 2007/01/26 00:44:01 adrian Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -908,9 +908,11 @@ extern void storeInit(void); extern void storeAbort(StoreEntry *); extern void storeAppend(StoreEntry *, const char *, int); -extern void storeLockObject(StoreEntry *); +extern void storeLockObjectDebug(StoreEntry *, const char *file, const int line); extern void storeRelease(StoreEntry *); -extern int storeUnlockObject(StoreEntry *); +extern int storeUnlockObjectDebug(StoreEntry *, const char *file, const int line); +#define storeLockObject(a) storeLockObjectDebug(a, __FILE__, __LINE__); +#define storeUnlockObject(a) storeUnlockObjectDebug(a, __FILE__, __LINE__); extern EVH storeMaintainSwapSpace; extern void storeExpireNow(StoreEntry *); extern void storeReleaseRequest(StoreEntry *); Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid/squid/src/store.c,v retrieving revision 1.571 retrieving revision 1.572 diff -u -r1.571 -r1.572 --- squid/src/store.c 21 Jan 2007 12:54:00 -0000 1.571 +++ squid/src/store.c 26 Jan 2007 00:44:01 -0000 1.572 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.571 2007/01/21 12:54:00 adrian Exp $ + * $Id: store.c,v 1.572 2007/01/26 00:44:01 adrian Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -261,10 +261,10 @@ } void -storeLockObject(StoreEntry * e) +storeLockObjectDebug(StoreEntry * e, const char *file, const int line) { e->lock_count++; - debug(20, 3) ("storeLockObject: key '%s' count=%d\n", + debug(20, 3) ("storeLockObject: (%s:%d): key '%s' count=%d\n", file, line, storeKeyText(e->hash.key), (int) e->lock_count); e->lastref = squid_curtime; storeEntryReferenced(e); @@ -289,10 +289,10 @@ /* unlock object, return -1 if object get released after unlock * otherwise lock_count */ int -storeUnlockObject(StoreEntry * e) +storeUnlockObjectDebug(StoreEntry * e, const char *file, const int line) { e->lock_count--; - debug(20, 3) ("storeUnlockObject: key '%s' count=%d\n", + debug(20, 3) ("storeUnlockObject: (%s:%d): key '%s' count=%d\n", file, line, storeKeyText(e->hash.key), e->lock_count); if (e->lock_count) return (int) e->lock_count; @@ -1371,14 +1371,17 @@ pages_needed = (size / SM_PAGE_SIZE) + 1; if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) return; - debug(20, 2) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed); + debug(20, 3) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed); /* XXX what to set as max_scan here? */ walker = mem_policy->PurgeInit(mem_policy, 100000); while ((e = walker->Next(walker))) { + debug(20, 3) ("storeGetMemSpace: purging %p\n", e); storePurgeMem(e); released++; - if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) + if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max) { + debug(20, 3) ("storeGetMemSpace: we finally have enough free memory!\n"); break; + } } walker->Done(walker); debug(20, 3) ("storeGetMemSpace stats:\n");