From: wessels <> Date: Sat, 25 Jul 1998 10:47:27 +0000 (+0000) Subject: Changed storeExpireNow to move expired objects to the TAIL of the LRU X-Git-Tag: SQUID_3_0_PRE1~2975 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b2329b6ab6da9d8ef6e8469bc05b7b130b5c2b29;p=thirdparty%2Fsquid.git Changed storeExpireNow to move expired objects to the TAIL of the LRU list so they'll get removed by storeMaintainSwapSpace. Similarly, it has no effect to call storeRelease from storeCleanup because we're still in store_rebuilding state. --- diff --git a/src/protos.h b/src/protos.h index c6fea1da16..2eb0983729 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.242 1998/07/25 00:16:28 wessels Exp $ + * $Id: protos.h,v 1.243 1998/07/25 04:47:29 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -983,6 +983,7 @@ extern int asnMatchIp(void *, struct in_addr); extern void asnInit(void); extern void asnFreeMemory(void); extern void dlinkAdd(void *data, dlink_node *, dlink_list *); +extern void dlinkAddTail(void *data, dlink_node *, dlink_list *); extern void dlinkDelete(dlink_node * m, dlink_list * list); extern void kb_incr(kb_t *, size_t); extern double gb_to_double(const gb_t *); diff --git a/src/store.cc b/src/store.cc index e8f8e36f21..06cbdf8cc1 100644 --- a/src/store.cc +++ b/src/store.cc @@ -1,6 +1,6 @@ /* - * $Id: store.cc,v 1.433 1998/07/23 19:57:54 wessels Exp $ + * $Id: store.cc,v 1.434 1998/07/25 04:47:27 wessels Exp $ * * DEBUG: section 20 Storage Manager * AUTHOR: Harvest Derived @@ -361,6 +361,8 @@ storeExpireNow(StoreEntry * e) { debug(20, 3) ("storeExpireNow: '%s'\n", storeKeyText(e->key)); e->expires = squid_curtime; + dlinkDelete(m, &inmem_list); + dlinkAddTail(e, m, &inmem_list); } /* Append incoming data from a primary server to an entry. */ diff --git a/src/store_rebuild.cc b/src/store_rebuild.cc index d7d5cbf93e..cd48c29144 100644 --- a/src/store_rebuild.cc +++ b/src/store_rebuild.cc @@ -1,5 +1,5 @@ /* - * $Id: store_rebuild.cc,v 1.43 1998/07/25 03:46:12 wessels Exp $ + * $Id: store_rebuild.cc,v 1.44 1998/07/25 04:47:28 wessels Exp $ * * DEBUG: section 20 Store Rebuild Routines * AUTHOR: Duane Wessels @@ -595,10 +595,10 @@ storeCleanup(void *datanotused) e = (StoreEntry *) link_ptr; if (EBIT_TEST(e->flag, ENTRY_VALIDATED)) continue; - if (EBIT_TEST(e->flag, RELEASE_REQUEST)) { - storeRelease(e); - continue; - } + /* + * Calling storeRelease() has no effect because we're + * still in 'store_rebuilding' state + */ if (e->swap_file_number < 0) continue; if (opt_store_doublecheck) { diff --git a/src/tools.cc b/src/tools.cc index 2897f55796..627fb6373c 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -1,6 +1,6 @@ /* - * $Id: tools.cc,v 1.165 1998/07/25 00:16:30 wessels Exp $ + * $Id: tools.cc,v 1.166 1998/07/25 04:47:29 wessels Exp $ * * DEBUG: section 21 Misc Functions * AUTHOR: Harvest Derived @@ -741,6 +741,19 @@ dlinkAdd(void *data, dlink_node * m, dlink_list * list) list->tail = m; } +void +dlinkAddTail(void *data, dlink_node * m, dlink_list * list) +{ + m->data = data; + m->next = NULL; + m->prev = list->tail; + if (list->tail) + list->tail->next = m; + list->tail = m; + if (list->head == NULL) + list->head = m; +} + void dlinkDelete(dlink_node * m, dlink_list * list) {