--------------------- PatchSet 10323 Date: 2007/12/27 13:39:08 Author: adri Branch: s27_adri Tag: (none) Log: Restore the buffer / memnode separation; preparation for the buf_t use. Members: src/stmem.c:1.10.2.4.4.2->1.10.2.4.4.3 src/store_swapout.c:1.22->1.22.24.1 src/structs.h:1.158.2.5.4.7->1.158.2.5.4.8 Index: squid/src/stmem.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stmem.c,v retrieving revision 1.10.2.4.4.2 retrieving revision 1.10.2.4.4.3 diff -u -r1.10.2.4.4.2 -r1.10.2.4.4.3 --- squid/src/stmem.c 27 Dec 2007 13:23:57 -0000 1.10.2.4.4.2 +++ squid/src/stmem.c 27 Dec 2007 13:39:08 -0000 1.10.2.4.4.3 @@ -1,6 +1,6 @@ /* - * $Id: stmem.c,v 1.10.2.4.4.2 2007/12/27 13:23:57 adri Exp $ + * $Id: stmem.c,v 1.10.2.4.4.3 2007/12/27 13:39:08 adri Exp $ * * DEBUG: section 19 Store Memory Primitives * AUTHOR: Harvest Derived @@ -39,8 +39,10 @@ stmemNodeFree(void *buf) { mem_node *p = (mem_node *) buf; - if (!p->uses) + if (!p->uses) { + memFree(p->data, MEM_4K_BUF); memFree(p, MEM_MEM_NODE); + } else p->uses--; } @@ -117,8 +119,10 @@ while (len > 0) { len_to_copy = XMIN(len, SM_PAGE_SIZE); p = memAllocate(MEM_MEM_NODE); /* This is a non-zero'ed buffer; make sure you fully initialise it */ + p->data = memAllocate(MEM_4K_BUF); p->next = NULL; p->len = len_to_copy; + p->size = 4096; p->uses = 0; store_mem_size += SM_PAGE_SIZE; xmemcpy(p->data, data, len_to_copy); Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.22 retrieving revision 1.22.24.1 diff -u -r1.22 -r1.22.24.1 --- squid/src/store_swapout.c 22 Sep 2006 03:52:45 -0000 1.22 +++ squid/src/store_swapout.c 27 Dec 2007 13:39:08 -0000 1.22.24.1 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.22 2006/09/22 03:52:45 squidadm Exp $ + * $Id: store_swapout.c,v 1.22.24.1 2007/12/27 13:39:08 adri Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -284,6 +284,9 @@ debug(20, 3) ("storeSwapOut: swapping out %d bytes from %" PRINTF_OFF_T "\n", (int) swap_buf_len, mem->swapout.queue_offset); mem->swapout.queue_offset += swap_buf_len; + /* XXX for now, this is disabled. the whole FREE * overloading to unref the stmem node is just plain + * XXX stupid and must be fleshed out to be a proper completion callback. [ahc] */ + assert(1==0); storeWrite(mem->swapout.sio, stmemNodeGet(mem->swapout.memnode), swap_buf_len, stmemNodeFree); /* the storeWrite() call might generate an error */ if (e->swap_status != SWAPOUT_WRITING) Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.158.2.5.4.7 retrieving revision 1.158.2.5.4.8 diff -u -r1.158.2.5.4.7 -r1.158.2.5.4.8 --- squid/src/structs.h 22 Dec 2007 14:32:13 -0000 1.158.2.5.4.7 +++ squid/src/structs.h 27 Dec 2007 13:39:08 -0000 1.158.2.5.4.8 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.158.2.5.4.7 2007/12/22 14:32:13 adri Exp $ + * $Id: structs.h,v 1.158.2.5.4.8 2007/12/27 13:39:08 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1627,8 +1627,9 @@ }; struct _mem_node { - char data[SM_PAGE_SIZE]; + char *data; int len; + int size; int uses; mem_node *next; };