From: wessels <> Date: Sun, 20 Sep 1998 07:14:24 +0000 (+0000) Subject: tighten store_client->type assignments. Its probably okay to have X-Git-Tag: SQUID_3_0_PRE1~2686 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5f25e839f7c2b545b436107a88bd16358d1bd322;p=thirdparty%2Fsquid.git tighten store_client->type assignments. Its probably okay to have a STORE_DISK_CLIENT and swap_file_number == -1, so long as a swapout file WILL be opened in the future. damn, had to make storeSwapOutAble public. --- diff --git a/src/protos.h b/src/protos.h index 9181892365..c90dabb61d 100644 --- a/src/protos.h +++ b/src/protos.h @@ -1,6 +1,6 @@ /* - * $Id: protos.h,v 1.267 1998/09/15 19:37:56 wessels Exp $ + * $Id: protos.h,v 1.268 1998/09/20 01:14:24 wessels Exp $ * * * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ @@ -895,6 +895,7 @@ extern void storeSwapOutHandle(int fdnotused, int flag, size_t len, void *data); extern void storeCheckSwapOut(StoreEntry * e); extern void storeSwapOutFileClose(StoreEntry * e); extern int storeSwapOutWriteQueued(MemObject * mem); +extern int storeSwapOutAble(const StoreEntry * e); /* * store_client.c diff --git a/src/store_client.cc b/src/store_client.cc index ddc14e481c..d0d17d83cc 100644 --- a/src/store_client.cc +++ b/src/store_client.cc @@ -1,6 +1,6 @@ /* - * $Id: store_client.cc,v 1.45 1998/09/19 23:10:30 wessels Exp $ + * $Id: store_client.cc,v 1.46 1998/09/20 01:14:25 wessels Exp $ * * DEBUG: section 20 Storage Manager Client-Side Interface * AUTHOR: Duane Wessels @@ -127,7 +127,7 @@ storeClientListAdd(StoreEntry * e, void *data) 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_file_number > -1); + assert(e->swap_file_number > -1 || storeSwapOutAble(e)); for (T = &mem->clients; *T; T = &(*T)->next); *T = sc; } diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 5491ee46a2..2d1c6a63b5 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -1,6 +1,6 @@ /* - * $Id: store_swapout.cc,v 1.33 1998/09/19 17:06:16 wessels Exp $ + * $Id: store_swapout.cc,v 1.34 1998/09/20 01:14:25 wessels Exp $ * * DEBUG: section 20 Storage Manager Swapout Functions * AUTHOR: Duane Wessels @@ -43,7 +43,6 @@ typedef struct swapout_ctrl_t { static FOCB storeSwapOutFileOpened; static off_t storeSwapOutObjectBytesOnDisk(const MemObject *); -static int storeSwapOutAble(const StoreEntry * e); /* start swapping object to disk */ void @@ -368,9 +367,10 @@ storeSwapOutObjectBytesOnDisk(const MemObject * mem) /* * Is this entry a candidate for writing to disk? */ -static int +int storeSwapOutAble(const StoreEntry * e) { + store_client *sc; if (e->swap_status == SWAPOUT_OPENING) return 1; if (e->mem_obj->swapout.fd > -1) @@ -378,5 +378,12 @@ storeSwapOutAble(const StoreEntry * e) if (e->mem_obj->inmem_lo > 0) return 0; /* swapout.fd == -1 && inmem_lo == 0 */ + /* + * If there are DISK clients, we must write to disk + * even if its not cachable + */ + for (sc = e->mem_obj->clients; sc; sc=sc->next) + if (sc->type == STORE_DISK_CLIENT) + return 1; return EBIT_TEST(e->flags, ENTRY_CACHABLE); }