From: wessels <> Date: Fri, 11 Sep 1998 01:50:55 +0000 (+0000) Subject: If we are over the FD limit, and we can read more on the server-side X-Git-Tag: SQUID_3_0_PRE1~2747 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c47511fd6ec3310bd60b50844f0427ebc493445a;p=thirdparty%2Fsquid.git If we are over the FD limit, and we can read more on the server-side without deferring, then postpone the swapout open until the FD usage goes down. --- diff --git a/src/protos.h b/src/protos.h index 0d16e67714..5c27cb335a 100644 --- a/src/protos.h +++ b/src/protos.h @@ -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 diff --git a/src/store.cc b/src/store.cc index 62a1bebb89..848486b8be 100644 --- a/src/store.cc +++ b/src/store.cc @@ -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) { diff --git a/src/store_swapout.cc b/src/store_swapout.cc index 8ce6cd4b56..27dd27b111 100644 --- a/src/store_swapout.cc +++ b/src/store_swapout.cc @@ -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);