From cb4a59f1884ba5147e91ece5ea664b52236e5d6f Mon Sep 17 00:00:00 2001 From: wessels <> Date: Fri, 17 Apr 1998 00:14:54 +0000 Subject: [PATCH] make the filemap size dependent on the cache dir size and average object size --- src/cache_cf.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index 303a5c47b9..a97cd39e41 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -1,6 +1,6 @@ /* - * $Id: cache_cf.cc,v 1.275 1998/04/09 00:39:36 wessels Exp $ + * $Id: cache_cf.cc,v 1.276 1998/04/16 18:14:54 wessels Exp $ * * DEBUG: section 3 Configuration File Parsing * AUTHOR: Harvest Derived @@ -193,6 +193,7 @@ configDoConfigure(void) { LOCAL_ARRAY(char, buf, BUFSIZ); int i; + SwapDir *SD; memset(&Config2, '\0', sizeof(SquidConfig2)); /* init memory as early as possible */ memConfigure(); @@ -201,8 +202,11 @@ configDoConfigure(void) fatal("No cache_dir's specified in config file"); /* calculate Config.Swap.maxSize */ Config.Swap.maxSize = 0; - for (i = 0; i < Config.cacheSwap.n_configured; i++) - Config.Swap.maxSize += Config.cacheSwap.swapDirs[i].max_size; + for (i = 0; i < Config.cacheSwap.n_configured; i++) { + SD = &Config.cacheSwap.swapDirs[i];; + Config.Swap.maxSize += SD->max_size; + SD->map = file_map_create(2 * SD->max_size / Config.Store.avgObjectSize); + } if (Config.Swap.maxSize < (Config.Mem.maxSize >> 10)) fatal("cache_swap is lower than cache_mem"); if (Config.Announce.period > 0) { @@ -608,7 +612,6 @@ parse_cachedir(cacheSwap * swap) tmp->l1 = l1; tmp->l2 = l2; tmp->read_only = readonly; - tmp->map = file_map_create(MAX_FILES_PER_DIR); tmp->swaplog_fd = -1; swap->n_configured++; } -- 2.47.3