]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
If we are over the FD limit, and we can read more on the server-side
authorwessels <>
Fri, 11 Sep 1998 01:50:55 +0000 (01:50 +0000)
committerwessels <>
Fri, 11 Sep 1998 01:50:55 +0000 (01:50 +0000)
without deferring, then postpone the swapout open until the FD usage
goes down.

src/protos.h
src/store.cc
src/store_swapout.cc

index 0d16e67714ec0a28df17bafc3045c223686ea6e7..5c27cb335a9ddde5f2f079b0a42f0c572a628908 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.260 1998/09/03 03:48:38 wessels Exp $
+ * $Id: protos.h,v 1.261 1998/09/10 19:50:55 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -793,6 +793,7 @@ extern void storeSetPrivateKey(StoreEntry *);
 extern int objectLen(const StoreEntry * e);
 extern int contentLen(const StoreEntry * e);
 extern HttpReply *storeEntryReply(StoreEntry *);
+extern int storeTooManyDiskFilesOpen(void);
 
 /*
  * store_log.c
index 62a1bebb8996517d13014b666d18fb117952c5a2..848486b8bee68e696f8b37fff2fc73fc756628cd 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.455 1998/09/09 20:05:52 wessels Exp $
+ * $Id: store.cc,v 1.456 1998/09/10 19:50:56 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -464,6 +464,16 @@ struct _store_check_cachable_hist {
     } yes;
 } store_check_cachable_hist;
 
+int
+storeTooManyDiskFilesOpen(void)
+{
+    if (Config.max_open_disk_fds == 0)
+       return 0;
+    if (open_disk_fd > Config.max_open_disk_fds)
+       return 1;
+    return 0;
+}
+
 int
 storeCheckCachable(StoreEntry * e)
 {
@@ -492,7 +502,7 @@ storeCheckCachable(StoreEntry * e)
     } else if (EBIT_TEST(e->flag, KEY_PRIVATE)) {
        debug(20, 3) ("storeCheckCachable: NO: private key\n");
        store_check_cachable_hist.no.private_key++;
-    } else if (Config.max_open_disk_fds && open_disk_fd > Config.max_open_disk_fds) {
+    } else if (storeTooManyDiskFilesOpen()) {
        debug(20, 2) ("storeCheckCachable: NO: too many disk files open\n");
        store_check_cachable_hist.no.too_many_open_files++;
     } else if (storeExpiredReferenceAge() < 300) {
index 8ce6cd4b56debdfd18d0fecf7978facbbd28d0b5..27dd27b1117089efc75c3f7b58037a8af5e27549 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store_swapout.cc,v 1.29 1998/09/10 02:55:59 wessels Exp $
+ * $Id: store_swapout.cc,v 1.30 1998/09/10 19:50:58 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager Swapout Functions
  * AUTHOR: Duane Wessels
@@ -198,8 +198,17 @@ storeCheckSwapOut(StoreEntry * e)
        }
        return;
     }
-    if (e->store_status == STORE_PENDING && swapout_size < VM_WINDOW_SZ)
-       return;                 /* wait for a full block */
+    if (e->store_status == STORE_PENDING) {
+       /* wait for a full block to write */
+       if (swapout_size < VM_WINDOW_SZ)
+           return;
+       /*
+        * Wait until we are below the disk FD limit, only if the
+        * next server-side read won't be deferred.
+        */
+       if (storeTooManyDiskFilesOpen() && !fwdCheckDeferRead(-1, e))
+           return;
+    }
     /* Ok, we have stuff to swap out.  Is there a swapout.fd open? */
     if (e->swap_status == SWAPOUT_NONE) {
        assert(mem->swapout.fd == -1);