--------------------- PatchSet 10438 Date: 2008/01/28 13:52:25 Author: adri Branch: s27_adri Tag: (none) Log: Restore the swapout code; use a temporary copy again. Members: ADRIAN_TODO:1.1.2.22->1.1.2.23 src/store_swapout.c:1.22.24.4->1.22.24.5 src/structs.h:1.158.2.5.4.18->1.158.2.5.4.19 Index: squid/ADRIAN_TODO =================================================================== RCS file: /cvsroot/squid-sf//squid/Attic/ADRIAN_TODO,v retrieving revision 1.1.2.22 retrieving revision 1.1.2.23 diff -u -r1.1.2.22 -r1.1.2.23 --- squid/ADRIAN_TODO 23 Jan 2008 14:47:49 -0000 1.1.2.22 +++ squid/ADRIAN_TODO 28 Jan 2008 13:52:25 -0000 1.1.2.23 @@ -155,8 +155,11 @@ reference!) Pick one, probably pointer-based, and convert all the string using routines to pass strings in by pointer unless absolutely necessary not to. +* I've gone off and put the copy back into the store swapout path; this'll need to + stay until the write path is converted to use buf_t or bufref_t chains.. ==== STUFF TO TEST ==== * NTLM proxy authentication! * SSL Tunneling +* Swapin/Swapout! Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.22.24.4 retrieving revision 1.22.24.5 diff -u -r1.22.24.4 -r1.22.24.5 --- squid/src/store_swapout.c 2 Jan 2008 17:29:34 -0000 1.22.24.4 +++ squid/src/store_swapout.c 28 Jan 2008 13:52:26 -0000 1.22.24.5 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.22.24.4 2008/01/02 17:29:34 adri Exp $ + * $Id: store_swapout.c,v 1.22.24.5 2008/01/28 13:52:26 adri Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -255,31 +255,17 @@ if (NULL == mem->swapout.sio) return; do { - /* - * Evil hack time. - * We are paging out to disk in page size chunks. however, later on when - * we update the queue position, we might not have a page (I *think*), - * so we do the actual page update here. - */ + char *sbuf = NULL; - if (mem->swapout.memnode == NULL) { - /* We need to swap out the first page */ - mem->swapout.memnode = mem->data_hdr.head; - } else { - /* We need to swap out the next page */ - mem->swapout.memnode = mem->swapout.memnode->next; - } /* - * Get the length of this buffer. We are assuming(!) that the buffer - * length won't change on this buffer, or things are going to be very - * strange. I think that after the copy to a buffer is done, the buffer - * size should stay fixed regardless so that this code isn't confused, - * but we can look at this at a later date or whenever the code results - * in bad swapouts, whichever happens first. :-) + * This was how things were once done - and I removed the extra copy; + * but for the time being the copy is back until I can push buf_t lists + * to the storefs code. -adrian */ - fatal("swapout path isn't working yet; it needs to be converted!\n"); - //swap_buf_len = buf_len(mem->swapout.memnode->buf); + /* Do the writes in SM_PAGE_SIZE chunks */ + sbuf = xcalloc(1, SM_PAGE_SIZE); + swap_buf_len = stmemCopy(&mem->data_hdr, mem->swapout.queue_offset, sbuf, SM_PAGE_SIZE); debug(20, 3) ("storeSwapOut: swap_buf_len = %d\n", (int) swap_buf_len); assert(swap_buf_len > 0); debug(20, 3) ("storeSwapOut: swapping out %d bytes from %" PRINTF_OFF_T "\n", @@ -287,9 +273,7 @@ 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] */ -#if 0 - storeWrite(mem->swapout.sio, stmemNodeGet(mem->swapout.memnode), swap_buf_len, stmemNodeFree); -#endif + storeWrite(mem->swapout.sio, sbuf, swap_buf_len, xfree); /* the storeWrite() call might generate an error */ if (e->swap_status != SWAPOUT_WRITING) break; Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.158.2.5.4.18 retrieving revision 1.158.2.5.4.19 diff -u -r1.158.2.5.4.18 -r1.158.2.5.4.19 --- squid/src/structs.h 20 Jan 2008 01:22:29 -0000 1.158.2.5.4.18 +++ squid/src/structs.h 28 Jan 2008 13:52:26 -0000 1.158.2.5.4.19 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.158.2.5.4.18 2008/01/20 01:22:29 adri Exp $ + * $Id: structs.h,v 1.158.2.5.4.19 2008/01/28 13:52:26 adri Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -1687,7 +1687,6 @@ int nclients; struct { squid_off_t queue_offset; /* relative to in-mem data */ - mem_node *memnode; /* which node we're currently paging out */ storeIOState *sio; } swapout; HttpReply *reply;