From: wessels <> Date: Sat, 20 May 2006 02:22:56 +0000 (+0000) Subject: Converted storeRelease() to a StoreEntry method. X-Git-Tag: SQUID_3_0_PRE4~120 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5f33b71db43c1ae957abed35b50adb3cbfb2676d;p=thirdparty%2Fsquid.git Converted storeRelease() to a StoreEntry method. --- diff --git a/src/Store.h b/src/Store.h index 195315c15f..14f32837c3 100644 --- a/src/Store.h +++ b/src/Store.h @@ -1,6 +1,6 @@ /* - * $Id: Store.h,v 1.22 2006/05/19 17:19:09 wessels Exp $ + * $Id: Store.h,v 1.23 2006/05/19 20:22:56 wessels Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -153,6 +153,7 @@ public: virtual void lock() ; + virtual void release(); private: static MemImplementingAllocator *pool; @@ -283,7 +284,6 @@ SQUIDCEXTERN void storeCreateMemObject(StoreEntry *, const char *, const char *) SQUIDCEXTERN void storeInit(void); SQUIDCEXTERN void storeAbort(StoreEntry *); SQUIDCEXTERN void storeAppend(StoreEntry *, const char *, int); -SQUIDCEXTERN void storeRelease(StoreEntry *); SQUIDCEXTERN void storeExpireNow(StoreEntry *); SQUIDCEXTERN void storeReleaseRequest(StoreEntry *); SQUIDCEXTERN void storeConfigure(void); diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index 866b1837b4..f9dd5c8e9e 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -1,6 +1,6 @@ /* - * $Id: client_side_reply.cc,v 1.107 2006/05/19 17:19:09 wessels Exp $ + * $Id: client_side_reply.cc,v 1.108 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 88 Client-side Reply Routines * AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c) @@ -993,7 +993,7 @@ clientReplyContext::purgeDoPurgeGet(StoreEntry *newEntry) if (!newEntry->isNull()) { /* Release the cached URI */ debug(88, 4) ("clientPurgeRequest: GET '%s'\n", storeUrl(newEntry)); - storeRelease(newEntry); + newEntry->release(); purgeStatus = HTTP_OK; } @@ -1006,7 +1006,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry) { if (newEntry && !newEntry->isNull()) { debug(88, 4) ("clientPurgeRequest: HEAD '%s'\n", storeUrl(newEntry)); - storeRelease(newEntry); + newEntry->release(); purgeStatus = HTTP_OK; } @@ -1019,7 +1019,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry) if (entry) { debug(88, 4) ("clientPurgeRequest: Vary GET '%s'\n", storeUrl(entry)); - storeRelease(entry); + entry->release(); purgeStatus = HTTP_OK; } @@ -1028,7 +1028,7 @@ clientReplyContext::purgeDoPurgeHead(StoreEntry *newEntry) if (entry) { debug(88, 4) ("clientPurgeRequest: Vary HEAD '%s'\n", storeUrl(entry)); - storeRelease(entry); + entry->release(); purgeStatus = HTTP_OK; } } diff --git a/src/fs/coss/store_dir_coss.cc b/src/fs/coss/store_dir_coss.cc index 9dff81de45..b97a06746e 100644 --- a/src/fs/coss/store_dir_coss.cc +++ b/src/fs/coss/store_dir_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_coss.cc,v 1.61 2005/07/03 20:41:46 serassio Exp $ + * $Id: store_dir_coss.cc,v 1.62 2006/05/19 20:22:56 wessels Exp $ * vim: set et : * * DEBUG: section 47 Store COSS Directory Routines @@ -447,7 +447,7 @@ storeCossRebuildFromSwapLog(void *data) e->swap_filen = -1; } - storeRelease(e); + e->release(); /* Fake an unlink here, this is a bad hack :( */ storeCossRemove(rb->sd, e); rb->counts.objcount--; diff --git a/src/fs/coss/store_io_coss.cc b/src/fs/coss/store_io_coss.cc index e3ef13a611..482359fa69 100644 --- a/src/fs/coss/store_io_coss.cc +++ b/src/fs/coss/store_io_coss.cc @@ -1,6 +1,6 @@ /* - * $Id: store_io_coss.cc,v 1.26 2004/12/20 16:30:43 robertc Exp $ + * $Id: store_io_coss.cc,v 1.27 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 79 Storage Manager COSS Interface * AUTHOR: Eric Stern @@ -583,7 +583,7 @@ CossSwapDir::createMemBuf(size_t start, sfileno curfn, int *collision) *collision = 1; /* Mark an object alloc collision */ if ((o >= (off_t)newmb->diskstart) && (o < (off_t)newmb->diskend)) { - storeRelease(e); + e->release(); numreleased++; } else break; diff --git a/src/fs/ufs/store_dir_ufs.cc b/src/fs/ufs/store_dir_ufs.cc index 32712e6263..4aea6c549a 100644 --- a/src/fs/ufs/store_dir_ufs.cc +++ b/src/fs/ufs/store_dir_ufs.cc @@ -1,6 +1,6 @@ /* - * $Id: store_dir_ufs.cc,v 1.72 2006/05/08 23:38:35 robertc Exp $ + * $Id: store_dir_ufs.cc,v 1.73 2006/05/19 20:22:57 wessels Exp $ * * DEBUG: section 47 Store Directory Routines * AUTHOR: Duane Wessels @@ -392,7 +392,7 @@ UFSSwapDir::maintain() removed++; - storeRelease(e); + e->release(); } walker->Done(walker); diff --git a/src/fs/ufs/ufscommon.cc b/src/fs/ufs/ufscommon.cc index 67d3b1c97a..08412c4a40 100644 --- a/src/fs/ufs/ufscommon.cc +++ b/src/fs/ufs/ufscommon.cc @@ -1,5 +1,5 @@ /* - * $Id: ufscommon.cc,v 1.4 2005/01/06 13:16:39 serassio Exp $ + * $Id: ufscommon.cc,v 1.5 2006/05/19 20:22:57 wessels Exp $ * vim: set et : * * DEBUG: section 47 Store Directory Routines @@ -285,7 +285,7 @@ RebuildState::rebuildFromDirectory() } else if (NULL != e) { /* URL already exists, this swapfile not being used */ /* junk old, load new */ - storeRelease(e); /* release old entry */ + e->release(); /* release old entry */ counts.dupcount++; } @@ -393,7 +393,7 @@ RebuildState::rebuildFromSwapLog() currentEntry()->swap_dirn = -1; } - storeRelease(currentEntry()); + currentEntry()->release(); counts.objcount--; counts.cancelcount++; } @@ -509,7 +509,7 @@ RebuildState::rebuildFromSwapLog() currentEntry()->swap_dirn = -1; } - storeRelease(currentEntry()); + currentEntry()->release(); counts.dupcount++; } else { /* URL doesnt exist, swapfile not in use */ diff --git a/src/ftp.cc b/src/ftp.cc index af2f7a0c69..f51f960fb5 100644 --- a/src/ftp.cc +++ b/src/ftp.cc @@ -1,6 +1,6 @@ /* - * $Id: ftp.cc,v 1.397 2006/05/16 16:05:08 hno Exp $ + * $Id: ftp.cc,v 1.398 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 9 File Transfer Protocol (FTP) * AUTHOR: Harvest Derived @@ -3170,11 +3170,11 @@ FtpStateData::appendSuccessHeader() /* * Authenticated requests can't be cached. */ - storeRelease(e); + e->release(); } else if (EBIT_TEST(e->flags, ENTRY_CACHABLE) && !restarted_offset) { storeSetPublicKey(e); } else { - storeRelease(e); + e->release(); } } diff --git a/src/http.cc b/src/http.cc index 990b527a1a..6c0fd89fc3 100644 --- a/src/http.cc +++ b/src/http.cc @@ -1,6 +1,6 @@ /* - * $Id: http.cc,v 1.497 2006/05/08 23:38:33 robertc Exp $ + * $Id: http.cc,v 1.498 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 11 Hypertext Transfer Protocol (HTTP) * AUTHOR: Harvest Derived @@ -270,7 +270,7 @@ httpMaybeRemovePublic(StoreEntry * e, http_status status) if (pe != NULL) { assert(e != pe); - storeRelease(pe); + pe->release(); } /* @@ -284,7 +284,7 @@ httpMaybeRemovePublic(StoreEntry * e, http_status status) if (pe != NULL) { assert(e != pe); - storeRelease(pe); + pe->release(); } if (forbidden) @@ -317,7 +317,7 @@ httpMaybeRemovePublic(StoreEntry * e, http_status status) if (pe != NULL) { assert(e != pe); - storeRelease(pe); + pe->release(); } break; diff --git a/src/store.cc b/src/store.cc index 532d1509b0..a3b3dbc716 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.591 2006/05/19 17:19:10 wessels Exp $ + * $Id: store.cc,v 1.592 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -452,7 +452,7 @@ storePurgeMem(StoreEntry * e) destroy_MemObject(e); if (e->swap_status != SWAPOUT_DONE) - storeRelease(e); + e->release(); } /* RBC 20050104 this is wrong- memory ref counting @@ -520,7 +520,7 @@ StoreEntry::unlock() assert(storePendingNClients(this) == 0); if (EBIT_TEST(flags, RELEASE_REQUEST)) - storeRelease(this); + this->release(); else if (storeKeepInMemory(this)) { Store::Root().dereference(*this); storeSetMemStatus(this, IN_MEMORY); @@ -694,7 +694,7 @@ storeSetPublicKey(StoreEntry * e) pe = storeGetPublic(mem->url, mem->method); if (pe) - storeRelease(pe); + pe->release(); } /* Make sure the request knows the variance status */ @@ -757,7 +757,7 @@ storeSetPublicKey(StoreEntry * e) if ((e2 = (StoreEntry *) hash_lookup(store_table, newkey))) { debug(20, 3) ("storeSetPublicKey: Making old '%s' private.\n", mem->url); storeSetPrivateKey(e2); - storeRelease(e2); + e2->release(); if (mem->request) newkey = storeKeyPublicByRequest(mem->request); @@ -1274,67 +1274,66 @@ StoreController::maintain() PROF_stop(storeMaintainSwapSpace); } - /* release an object from a cache */ void -storeRelease(StoreEntry * e) +StoreEntry::release() { PROF_start(storeRelease); - debug(20, 3) ("storeRelease: Releasing: '%s'\n", e->getMD5Text()); + debug(20, 3) ("storeRelease: Releasing: '%s'\n", getMD5Text()); /* If, for any reason we can't discard this object because of an * outstanding request, mark it for pending release */ - if (storeEntryLocked(e)) { - storeExpireNow(e); + if (storeEntryLocked(this)) { + storeExpireNow(this); debug(20, 3) ("storeRelease: Only setting RELEASE_REQUEST bit\n"); - storeReleaseRequest(e); + storeReleaseRequest(this); PROF_stop(storeRelease); return; } - if (store_dirs_rebuilding && e->swap_filen > -1) { - storeSetPrivateKey(e); + if (store_dirs_rebuilding && swap_filen > -1) { + storeSetPrivateKey(this); - if (e->mem_obj) - destroy_MemObject(e); + if (mem_obj) + destroy_MemObject(this); - if (e->swap_filen > -1) { + if (swap_filen > -1) { /* * Fake a call to StoreEntry->lock() When rebuilding is done, * we'll just call StoreEntry->unlock() on these. */ - e->lock_count++; - e->setReleaseFlag(); - LateReleaseStack.push_back(e); + lock_count++; + setReleaseFlag(); + LateReleaseStack.push_back(this); PROF_stop(storeRelease); return; } else { - destroyStoreEntry(static_cast(e)); + destroyStoreEntry(static_cast(this)); } } - storeLog(STORE_LOG_RELEASE, e); + storeLog(STORE_LOG_RELEASE, this); - if (e->swap_filen > -1) { - e->unlink(); + if (swap_filen > -1) { + unlink(); - if (e->swap_status == SWAPOUT_DONE) - if (EBIT_TEST(e->flags, ENTRY_VALIDATED)) - e->store()->updateSize(e->swap_file_sz, -1); + if (swap_status == SWAPOUT_DONE) + if (EBIT_TEST(flags, ENTRY_VALIDATED)) + store()->updateSize(swap_file_sz, -1); - if (!EBIT_TEST(e->flags, KEY_PRIVATE)) - storeDirSwapLog(e, SWAP_LOG_DEL); + if (!EBIT_TEST(flags, KEY_PRIVATE)) + storeDirSwapLog(this, SWAP_LOG_DEL); #if 0 /* From 2.4. I think we do this in storeUnlink? */ - storeSwapFileNumberSet(e, -1); + storeSwapFileNumberSet(this, -1); #endif } - storeSetMemStatus(e, NOT_IN_MEMORY); - destroyStoreEntry(static_cast(e)); + storeSetMemStatus(this, NOT_IN_MEMORY); + destroyStoreEntry(static_cast(this)); PROF_stop(storeRelease); } diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index b65a7e6b2a..64889398e3 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -1,6 +1,6 @@ /* - * $Id: store_rebuild.cc,v 1.83 2006/05/08 23:38:33 robertc Exp $ + * $Id: store_rebuild.cc,v 1.84 2006/05/19 20:22:56 wessels Exp $ * * DEBUG: section 20 Store Rebuild Routines * AUTHOR: Duane Wessels @@ -85,7 +85,7 @@ storeCleanup(void *datanotused) continue; /* - * Calling storeRelease() has no effect because we're + * Calling StoreEntry->release() has no effect because we're * still in 'store_rebuilding' state */ if (e->swap_filen < 0)