/*
- * $Id: fd.cc,v 1.33 1999/01/19 17:41:02 wessels Exp $
+ * $Id: fd.cc,v 1.34 1999/01/21 21:10:32 wessels Exp $
*
* DEBUG: section 51 Filedescriptor Functions
* AUTHOR: Duane Wessels
F->flags.open = 0;
fdUpdateBiggest(fd, 0);
Number_FD--;
- if (F->type == FD_FILE)
- open_disk_fd--;
commUpdateReadBits(fd, NULL);
commUpdateWriteBits(fd, NULL);
memset(F, '\0', sizeof(fde));
if (desc)
xstrncpy(F->desc, desc, FD_DESC_SZ);
Number_FD++;
- if (type == FD_FILE)
- open_disk_fd++;
}
void
/*
- * $Id: globals.h,v 1.75 1999/01/19 20:26:32 wessels Exp $
+ * $Id: globals.h,v 1.76 1999/01/21 21:10:33 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
extern int refresh_nocache_hack; /* 0 */
#endif
extern request_flags null_request_flags;
-extern int open_disk_fd; /* 0 */
+extern int store_open_disk_fd; /* 0 */
/*
- * $Id: stat.cc,v 1.310 1999/01/19 17:41:05 wessels Exp $
+ * $Id: stat.cc,v 1.311 1999/01/21 21:10:34 wessels Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
storeAppendPrintf(sentry, "\tNumber of file desc currently in use: %4d\n",
Number_FD);
storeAppendPrintf(sentry, "\tAvailable number of file descriptors: %4d\n",
- Squid_MaxFD - Number_FD);
+ fdNFree());
storeAppendPrintf(sentry, "\tReserved number of file descriptors: %4d\n",
RESERVED_FD);
- storeAppendPrintf(sentry, "\tDisk files open: %4d\n",
- open_disk_fd);
+ storeAppendPrintf(sentry, "\tStore Disk files open: %4d\n",
+ store_open_disk_fd);
storeAppendPrintf(sentry, "Internal Data Structures:\n");
storeAppendPrintf(sentry, "\t%6d StoreEntries\n",
/*
- * $Id: store.cc,v 1.484 1999/01/19 02:24:33 wessels Exp $
+ * $Id: store.cc,v 1.485 1999/01/21 21:10:36 wessels Exp $
*
* DEBUG: section 20 Storage Manager
* AUTHOR: Harvest Derived
{
if (Config.max_open_disk_fds == 0)
return 0;
- if (open_disk_fd > Config.max_open_disk_fds)
+ if (store_open_disk_fd > Config.max_open_disk_fds)
return 1;
return 0;
}
} else if (EBIT_TEST(e->flags, KEY_PRIVATE)) {
debug(20, 3) ("storeCheckCachable: NO: private key\n");
store_check_cachable_hist.no.private_key++;
+ } else if (e->swap_status != SWAPOUT_NONE) {
+ /*
+ * here we checked the swap_status because the remaining
+ * cases are only relevant only if we haven't started swapping
+ * out the object yet.
+ */
+ return 1;
} 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 (fdNFree() < RESERVED_FD) {
- debug(20, 2) ("storeCheckCachable: NO: too FD's open\n");
+ debug(20, 2) ("storeCheckCachable: NO: too many FD's open\n");
store_check_cachable_hist.no.too_many_open_fds++;
} else if (storeExpiredReferenceAge() < 300) {
debug(20, 2) ("storeCheckCachable: NO: LRU Age = %d\n",
/*
- * $Id: store_rebuild.cc,v 1.54 1999/01/12 23:38:39 wessels Exp $
+ * $Id: store_rebuild.cc,v 1.55 1999/01/21 21:10:37 wessels Exp $
*
* DEBUG: section 20 Store Rebuild Routines
* AUTHOR: Duane Wessels
debug(20, 1) ("storeRebuildFromDirectory: fstat(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
+ store_open_disk_fd--;
fd = -1;
continue;
}
debug(20, 1) ("storeRebuildFromDirectory: read(FD %d): %s\n",
fd, xstrerror());
file_close(fd);
+ store_open_disk_fd--;
fd = -1;
continue;
}
file_close(fd);
+ store_open_disk_fd--;
fd = -1;
swap_hdr_len = 0;
#if USE_TRUNCATE_NOT_UNLINK
if (fd < 0)
debug(50, 1) ("storeGetNextFile: %s: %s\n", d->fullfilename, xstrerror());
continue;
+ store_open_disk_fd++;
}
d->in_dir = 0;
if (++d->curlvl2 < Config.cacheSwap.swapDirs[d->dirn].l2)
/*
- * $Id: store_swapin.cc,v 1.16 1999/01/19 17:41:07 wessels Exp $
+ * $Id: store_swapin.cc,v 1.17 1999/01/21 21:10:38 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapin Functions
* AUTHOR: Duane Wessels
}
ctrlp->path = xstrdup(storeSwapFullPath(e->swap_file_number, NULL));
debug(20, 3) ("storeSwapInValidateComplete: Opening %s\n", ctrlp->path);
+ store_open_disk_fd++;
file_open(ctrlp->path,
O_RDONLY,
storeSwapInFileOpened,
if (fd == -2 && errcode == -2) {
xfree(ctrlp->path);
xfree(ctrlp);
+ store_open_disk_fd--;
return;
}
assert(mem != NULL);
"\tFile:\t'%s'\n\t URL:\t'%s'\n",
ctrlp->path, storeUrl(e));
storeEntryDump(e, 3);
+ store_open_disk_fd--;
} else if (e->swap_status != SWAPOUT_DONE) {
(void) 0;
} else if (fstat(fd, &sb) < 0) {
debug(20, 1) ("storeSwapInFileOpened: fstat() FD %d: %s\n", fd, xstrerror());
file_close(fd);
+ store_open_disk_fd--;
fd = -1;
} else if (sb.st_size == 0 || sb.st_size != e->swap_file_sz) {
debug(20, 1) ("storeSwapInFileOpened: %s: Size mismatch: %d(fstat) != %d(object)\n", ctrlp->path, (int) sb.st_size, e->swap_file_sz);
file_close(fd);
+ store_open_disk_fd--;
fd = -1;
}
if (fd < 0) {
/*
- * $Id: store_swapout.cc,v 1.44 1999/01/19 17:41:08 wessels Exp $
+ * $Id: store_swapout.cc,v 1.45 1999/01/21 21:10:39 wessels Exp $
*
* DEBUG: section 20 Storage Manager Swapout Functions
* AUTHOR: Duane Wessels
ctrlp->oldswapstatus = e->swap_status;
e->swap_status = SWAPOUT_OPENING;
e->mem_obj->swapout.ctrl = ctrlp;
+ store_open_disk_fd++;
file_open(ctrlp->swapfilename,
O_WRONLY | O_CREAT | O_TRUNC,
storeSwapOutFileOpened,
}
ctrlp = mem->swapout.ctrl;
file_close(mem->swapout.fd);
+ store_open_disk_fd--;
mem->swapout.fd = -1;
xfree(ctrlp->swapfilename);
cbdataFree(ctrlp);
xfree(ctrlp->swapfilename);
cbdataFree(ctrlp);
mem->swapout.ctrl = NULL;
+ store_open_disk_fd--;
return;
}
assert(e->swap_status == SWAPOUT_OPENING);
xfree(ctrlp->swapfilename);
cbdataFree(ctrlp);
mem->swapout.ctrl = NULL;
+ store_open_disk_fd--;
return;
}
mem->swapout.fd = (short) fd;