]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Converted storeRelease() to a StoreEntry method.
authorwessels <>
Sat, 20 May 2006 02:22:56 +0000 (02:22 +0000)
committerwessels <>
Sat, 20 May 2006 02:22:56 +0000 (02:22 +0000)
src/Store.h
src/client_side_reply.cc
src/fs/coss/store_dir_coss.cc
src/fs/coss/store_io_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/fs/ufs/ufscommon.cc
src/ftp.cc
src/http.cc
src/store.cc
src/store_rebuild.cc

index 195315c15f86dbca12f43c1cf982f349aa15145e..14f32837c384cf9aa56ad427dc341f6c7a966b98 100644 (file)
@@ -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);
index 866b1837b4f3c8573234ef4354f35172302dfddc..f9dd5c8e9e318d44ed1a05dbf4ffe3cbba3dcdb8 100644 (file)
@@ -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;
         }
     }
index 9dff81de45d808a403d66e880d0c5e90eadb56aa..b97a06746ecec16aa4805bd4f914e4ef857f728f 100644 (file)
@@ -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--;
index e3ef13a6119cdf58fe919279ebd17c055d0d6f99..482359fa6973ccb9036b0cbc4731f4ca977bd1aa 100644 (file)
@@ -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;
index 32712e6263320f77a95e8ffef863403c6f115de1..4aea6c549ada9d1a2af7172b5060ea0f37f51dc1 100644 (file)
@@ -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);
index 67d3b1c97a21231218a12b0e87a815c41e9a8df0..08412c4a40e5141961e7edd5613024ac002eb20e 100644 (file)
@@ -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 */
index af2f7a0c695154f3c6425e2c06f139b3443a116e..f51f960fb593623d2a326e70628cb49bdcb16bcd 100644 (file)
@@ -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();
     }
 }
 
index 990b527a1aba8b8f6cae0b3070705e5a63878ac0..6c0fd89fc3386e0702c826eb267a4cff951f7015 100644 (file)
@@ -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;
index 532d1509b01e3abe96b521b26854d75d93468dce..a3b3dbc7163593245b893689984d62be39980a37 100644 (file)
@@ -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<hash_link *>(e));
+            destroyStoreEntry(static_cast<hash_link *>(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<hash_link *>(e));
+    storeSetMemStatus(this, NOT_IN_MEMORY);
+    destroyStoreEntry(static_cast<hash_link *>(this));
     PROF_stop(storeRelease);
 }
 
index b65a7e6b2adf44ade577e7d9e85ba1df38f73889..64889398e35ce504894b3dc88a3ef74a238ba4c5 100644 (file)
@@ -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)