]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Remove MEM_STMEM_BUF from the scene, and statically define the stmem
authoradrian <>
Sat, 8 Sep 2001 00:02:44 +0000 (00:02 +0000)
committeradrian <>
Sat, 8 Sep 2001 00:02:44 +0000 (00:02 +0000)
buffer into the mem_node struct. This should cut down on the number
of allocation requests made per HTTP request.

src/enums.h
src/mem.cc
src/stmem.cc
src/store.cc
src/structs.h

index 2478c3bcd20d58db2ab39c1c7c9d0f9806f0e816..02a51e5c791f2d4638ff372caed9fef3a280f92d 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: enums.h,v 1.194 2001/08/03 15:13:04 adrian Exp $
+ * $Id: enums.h,v 1.195 2001/09/07 18:02:44 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -605,7 +605,6 @@ typedef enum {
     MEM_NET_DB_NAME,
     MEM_RELIST,
     MEM_REQUEST_T,
-    MEM_STMEM_BUF,
     MEM_STOREENTRY,
     MEM_WORDLIST,
 #if !USE_DNSSERVERS
index 28e84a3300d1aa3c28c8a2320ebf23d234f2f2c0..776ac2cdeb8752477e3d7bdb6ae56e42f7e66b65 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: mem.cc,v 1.58 2001/04/20 21:34:39 hno Exp $
+ * $Id: mem.cc,v 1.59 2001/09/07 18:02:45 adrian Exp $
  *
  * DEBUG: section 13    High Level Memory Pool Management
  * AUTHOR: Harvest Derived
@@ -231,8 +231,6 @@ memInit(void)
     memDataInit(MEM_RELIST, "relist", sizeof(relist), 0);
     memDataInit(MEM_REQUEST_T, "request_t", sizeof(request_t),
        Squid_MaxFD >> 3);
-    memDataInit(MEM_STMEM_BUF, "Store Mem Buffer", SM_PAGE_SIZE,
-       Config.memMaxSize / SM_PAGE_SIZE);
     memDataInit(MEM_STOREENTRY, "StoreEntry", sizeof(StoreEntry), 0);
     memDataInit(MEM_WORDLIST, "wordlist", sizeof(wordlist), 0);
     memDataInit(MEM_CLIENT_INFO, "ClientInfo", sizeof(ClientInfo), 0);
index 8d63121c271b342b19855e914aaeb88d35ccd9b1..b5704ff44a8eaf3abe1279782d4d048c3449395a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: stmem.cc,v 1.68 2001/01/12 00:37:21 wessels Exp $
+ * $Id: stmem.cc,v 1.69 2001/09/07 18:02:45 adrian Exp $
  *
  * DEBUG: section 19    Store Memory Primitives
  * AUTHOR: Harvest Derived
@@ -41,7 +41,6 @@ stmemFree(mem_hdr * mem)
     mem_node *p;
     while ((p = mem->head)) {
        mem->head = p->next;
-       memFree(p->data, MEM_STMEM_BUF);
        store_mem_size -= SM_PAGE_SIZE;
        if (p) {
            memFree(p, MEM_MEM_NODE);
@@ -68,7 +67,6 @@ stmemFreeDataUpto(mem_hdr * mem, int target_offset)
            lastp = p;
            p = p->next;
            current_offset += lastp->len;
-           memFree(lastp->data, MEM_STMEM_BUF);
            store_mem_size -= SM_PAGE_SIZE;
            if (lastp) {
                memFree(lastp, MEM_MEM_NODE);
@@ -111,7 +109,6 @@ stmemAppend(mem_hdr * mem, const char *data, int len)
        p = memAllocate(MEM_MEM_NODE);
        p->next = NULL;
        p->len = len_to_copy;
-       p->data = memAllocate(MEM_STMEM_BUF);
        store_mem_size += SM_PAGE_SIZE;
        xmemcpy(p->data, data, len_to_copy);
        if (!mem->head) {
index 16ae2d99fd60f950306d2bc5df46813804344a73..ce70b6e6818dac0bf406907588ccb5e3123eadd4 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.540 2001/06/29 14:31:34 hno Exp $
+ * $Id: store.cc,v 1.541 2001/09/07 18:02:46 adrian Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -781,7 +781,7 @@ storeGetMemSpace(int size)
        return;
     last_check = squid_curtime;
     pages_needed = (size / SM_PAGE_SIZE) + 1;
-    if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_max)
+    if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max)
        return;
     debug(20, 2) ("storeGetMemSpace: Starting, need %d pages\n", pages_needed);
     /* XXX what to set as max_scan here? */
@@ -789,7 +789,7 @@ storeGetMemSpace(int size)
     while ((e = walker->Next(walker))) {
        storePurgeMem(e);
        released++;
-       if (memInUse(MEM_STMEM_BUF) + pages_needed < store_pages_max)
+       if (memInUse(MEM_MEM_NODE) + pages_needed < store_pages_max)
            break;
     }
     walker->Done(walker);
index 560a24d30ee5ada1c3be4cba7993f852e436c8a6..74a1f325cceb221b2ea51ec4eeb7237d1748b70a 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: structs.h,v 1.398 2001/09/03 10:33:02 robertc Exp $
+ * $Id: structs.h,v 1.399 2001/09/07 18:02:48 adrian Exp $
  *
  *
  * SQUID Web Proxy Cache          http://www.squid-cache.org/
@@ -1373,7 +1373,7 @@ struct _iostats {
 };
 
 struct _mem_node {
-    char *data;
+    char data[SM_PAGE_SIZE];
     int len;
     mem_node *next;
 };