/*
- * $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/
extern int objectLen(const StoreEntry * e);
extern int contentLen(const StoreEntry * e);
extern HttpReply *storeEntryReply(StoreEntry *);
+extern int storeTooManyDiskFilesOpen(void);
/*
* store_log.c
/*
- * $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
} 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)
{
} 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) {
/*
- * $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
}
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);