]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
tighten store_client->type assignments. Its probably okay to have
authorwessels <>
Sun, 20 Sep 1998 07:14:24 +0000 (07:14 +0000)
committerwessels <>
Sun, 20 Sep 1998 07:14:24 +0000 (07:14 +0000)
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.

src/protos.h
src/store_client.cc
src/store_swapout.cc

index 918189236583033cd1877c2888aa3744f0babc07..c90dabb61d782c00e1ea4bb9e7162bac2d9f9a44 100644 (file)
@@ -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
index ddc14e481cf62bb194e3c68e135d7ed423d7224f..d0d17d83ccdd7952590eedbe501b5e10af7935bb 100644 (file)
@@ -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;
 }
index 5491ee46a2d16813d7cd908317ecbec09cfe3a24..2d1c6a63b5f284b8def8984996580f2d22c7ab8c 100644 (file)
@@ -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);
 }