--------------------- PatchSet 963 Date: 2000/12/18 22:14:49 Author: adri Branch: modio Tag: (none) Log: More stuff * storeGet() will always return NULL, simulating a proxy only. * Enforce (through assert()s) that only one store client will exist attached to any given MemObject. * Remove the stmem/inmem_hi/inmem_lo crud from MemObject. Squid is now only a proxy. Its internal objects are highly broken (which is to be expected), and it passes 50req/sec datacomm-1 runs over 30 or so minutes without any problems. Next: Unify StoreEntry/MemObject .. Members: src/stat.c:1.2.2.2->1.2.2.3 src/store.c:1.2.2.5->1.2.2.6 src/store_client.c:1.2.2.3->1.2.2.4 src/store_swapout.c:1.2.2.2->1.2.2.3 src/structs.h:1.2.2.4->1.2.2.5 Index: squid/src/stat.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/stat.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/stat.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 +++ squid/src/stat.c 18 Dec 2000 22:14:49 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: stat.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ + * $Id: stat.c,v 1.2.2.3 2000/12/18 22:14:49 adri Exp $ * * DEBUG: section 18 Cache Manager Statistics * AUTHOR: Harvest Derived @@ -275,11 +275,6 @@ if (mem != NULL) { storeAppendPrintf(s, "\tInMem_LoOffset: %d\n", (int) storeMemLoOffset(e)); storeAppendPrintf(s, "\tInMem_HiOffset: %d\n", (int) storeMemHiOffset(e)); - storeAppendPrintf(s, "\tswapout: %d bytes queued\n", - (int) mem->swapout.queue_offset); - if (mem->swapout.sio) - storeAppendPrintf(s, "\tswapout: %d bytes written\n", - (int) storeOffset(mem->swapout.sio)); for (i = 0, node = mem->clients.head; node; node = node->next, i++) { sc = (store_client *) node->data; if (sc->callback_data == NULL) @@ -375,8 +370,10 @@ { if (e->mem_obj == NULL) return 0; +#if 0 if (e->mem_obj->swapout.sio == NULL) return 0; +#endif return 1; } Index: squid/src/store.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store.c,v retrieving revision 1.2.2.5 retrieving revision 1.2.2.6 diff -u -r1.2.2.5 -r1.2.2.6 --- squid/src/store.c 18 Dec 2000 19:10:58 -0000 1.2.2.5 +++ squid/src/store.c 18 Dec 2000 22:14:49 -0000 1.2.2.6 @@ -1,6 +1,6 @@ /* - * $Id: store.c,v 1.2.2.5 2000/12/18 19:10:58 adri Exp $ + * $Id: store.c,v 1.2.2.6 2000/12/18 22:14:49 adri Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -86,7 +86,6 @@ static void storeEntryReferenced(StoreEntry *); static void storeEntryDereferenced(StoreEntry *); static int getKeyCounter(void); -static int storeKeepInMemory(const StoreEntry *); static OBJH storeCheckCachableStats; static EVH storeLateRelease; @@ -150,16 +149,12 @@ #if URL_CHECKSUM_DEBUG assert(mem->chksum == url_checksum(mem->url)); #endif - if (!shutting_down) - assert(mem->swapout.sio == NULL); /* Free the reply .. */ storeDetachReply(e); e->mem_obj = NULL; - stmemFree(&mem->data_hdr); - mem->inmem_hi = 0; /* * There is no way to abort FD-less clients, so they might * still have mem->clients set if mem->fd == -1 @@ -301,12 +296,15 @@ assert(storePendingNClients(e) == 0); if (EBIT_TEST(e->flags, RELEASE_REQUEST)) storeRelease(e); +#if 0 else if (storeKeepInMemory(e)) { storeEntryDereferenced(e); storeSetMemStatus(e, IN_MEMORY); requestUnlink(e->mem_obj->request); e->mem_obj->request = NULL; } else { +#endif + else { storePurgeMem(e); storeEntryDereferenced(e); if (EBIT_TEST(e->flags, KEY_PRIVATE)) @@ -321,7 +319,12 @@ storeGet(const cache_key * key) { debug(20, 3) ("storeGet: looking up %s\n", storeKeyText(key)); + return NULL; + + /* XXX we will perform a FS lookup here .. */ +#if 0 return (StoreEntry *) hash_lookup(store_table, key); +#endif } StoreEntry * @@ -413,6 +416,8 @@ e->lock_count = 1; /* Note lock here w/o calling storeLock() */ mem = e->mem_obj; mem->method = method; + +#if 0 if (neighbors_do_private_keys || !flags.hierarchical) storeSetPrivateKey(e); else @@ -424,6 +429,11 @@ EBIT_CLR(e->flags, ENTRY_CACHABLE); storeReleaseRequest(e); } +#endif + + /* All StoreEntry's are private now! */ + storeSetPrivateKey(e); + e->store_status = STORE_PENDING; storeSetMemStatus(e, NOT_IN_MEMORY); e->swap_status = SWAPOUT_NONE; @@ -687,7 +697,6 @@ /* Notify the client side */ InvokeHandlers(e); /* Close any swapout file */ - storeSwapOutFileClose(e); storeUnlockObject(e); /* unlock */ } @@ -948,17 +957,6 @@ store_pages_max = Config.memMaxSize / SM_PAGE_SIZE; } -static int -storeKeepInMemory(const StoreEntry * e) -{ - MemObject *mem = e->mem_obj; - if (mem == NULL) - return 0; - if (mem->data_hdr.head == NULL) - return 0; - return storeMemLoOffset(e) == 0; -} - void storeNegativeCache(StoreEntry * e) { @@ -1049,19 +1047,9 @@ void storeMemObjectDump(MemObject * mem) { - debug(20, 1) ("MemObject->data.head: %p\n", - mem->data_hdr.head); - debug(20, 1) ("MemObject->data.tail: %p\n", - mem->data_hdr.tail); - debug(20, 1) ("MemObject->data.origin_offset: %d\n", - mem->data_hdr.origin_offset); debug(20, 1) ("MemObject->start_ping: %d.%06d\n", (int) mem->start_ping.tv_sec, (int) mem->start_ping.tv_usec); - debug(20, 1) ("MemObject->inmem_hi: %d\n", - (int) mem->inmem_hi); - debug(20, 1) ("MemObject->inmem_lo: %d\n", - (int) mem->inmem_lo); debug(20, 1) ("MemObject->clients: %p\n", mem->clients); debug(20, 1) ("MemObject->nclients: %d\n", @@ -1196,9 +1184,7 @@ { MemObject *mem = e->mem_obj; debug(20, 3) ("storeEntryReset: %s\n", storeUrl(e)); - assert(mem->swapout.sio == NULL); - stmemFree(&mem->data_hdr); - mem->inmem_hi = mem->inmem_lo = 0; + /* XXX hrm, we have to reset the reply object? -- adrian */ httpReplyDestroy(mem->reply); mem->reply = httpReplyCreate(); e->expires = e->lastmod = e->timestamp = -1; Index: squid/src/store_client.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_client.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -r1.2.2.3 -r1.2.2.4 --- squid/src/store_client.c 18 Dec 2000 19:10:58 -0000 1.2.2.3 +++ squid/src/store_client.c 18 Dec 2000 22:14:49 -0000 1.2.2.4 @@ -1,6 +1,6 @@ /* - * $Id: store_client.c,v 1.2.2.3 2000/12/18 19:10:58 adri Exp $ + * $Id: store_client.c,v 1.2.2.4 2000/12/18 22:14:49 adri Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -89,6 +89,7 @@ assert(1 == 0); /* XXX die! */ #endif e->refcount++; + assert(mem->nclients == 0); mem->nclients++; sc = memAllocate(MEM_STORE_CLIENT); cbdataAdd(sc, memFree, MEM_STORE_CLIENT); /* sc is callback_data for file_read */ @@ -98,12 +99,6 @@ sc->copy_offset = 0; sc->flags.disk_io_pending = 0; sc->entry = e; - /* sc->type = storeClientType(e); */ - sc->type = -1; /* XXX shouldn't matter from now on! */ - if (sc->type == STORE_DISK_CLIENT) - /* assert we'll be able to get the data we want */ - /* maybe we should open swapin_fd here */ - assert(e->swap_filen > -1 || storeSwapOutAble(e)); dlinkAdd(sc, &sc->node, &mem->clients); #if DELAY_POOLS sc->delay_id = 0; @@ -172,7 +167,9 @@ sc); } else { if (sc->entry->swap_status == SWAPOUT_WRITING) +#if 0 assert(storeOffset(mem->swapout.sio) > sc->copy_offset + mem->swap_hdr_sz); +#endif storeRead(sc->swapin_sio, sc->copy_buf, sc->copy_size, @@ -328,8 +325,7 @@ } dlinkDelete(&sc->node, &mem->clients); mem->nclients--; - if (e->store_status == STORE_OK && e->swap_status != SWAPOUT_DONE) - storeSwapOut(e); + assert(mem->nclients == 0); if (sc->swapin_sio) { storeClose(sc->swapin_sio); cbdataUnlock(sc->swapin_sio); Index: squid/src/store_swapout.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/store_swapout.c,v retrieving revision 1.2.2.2 retrieving revision 1.2.2.3 diff -u -r1.2.2.2 -r1.2.2.3 --- squid/src/store_swapout.c 13 Dec 2000 09:45:03 -0000 1.2.2.2 +++ squid/src/store_swapout.c 18 Dec 2000 22:14:49 -0000 1.2.2.3 @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.c,v 1.2.2.2 2000/12/13 09:45:03 rbcollins Exp $ + * $Id: store_swapout.c,v 1.2.2.3 2000/12/18 22:14:49 adri Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -40,6 +40,12 @@ static STIOCB storeSwapOutFileClosed; static STIOCB storeSwapOutFileNotify; + + +#if 0 + + + /* start swapping object to disk */ static void storeSwapOutStart(StoreEntry * e) @@ -362,3 +368,7 @@ return 0; return EBIT_TEST(e->flags, ENTRY_CACHABLE); } + + + +#endif Index: squid/src/structs.h =================================================================== RCS file: /cvsroot/squid-sf//squid/src/structs.h,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.5 diff -u -r1.2.2.4 -r1.2.2.5 --- squid/src/structs.h 18 Dec 2000 19:10:58 -0000 1.2.2.4 +++ squid/src/structs.h 18 Dec 2000 22:14:49 -0000 1.2.2.5 @@ -1,6 +1,6 @@ /* - * $Id: structs.h,v 1.2.2.4 2000/12/18 19:10:58 adri Exp $ + * $Id: structs.h,v 1.2.2.5 2000/12/18 22:14:49 adri Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -1286,19 +1286,8 @@ struct _MemObject { method_t method; char *url; - - /* The next three entries are going away soon .. -- adrian */ - mem_hdr data_hdr; - off_t inmem_hi; - off_t inmem_lo; - dlink_list clients; int nclients; - struct { - off_t queue_offset; /* relative to in-mem data */ - mem_node *memnode; /* which node we're currently paging out */ - storeIOState *sio; - } swapout; HttpReply *reply; request_t *request; struct timeval start_ping;