]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
From: Henrik Nordstrom <hno@hem.passagen.se>
authorwessels <>
Fri, 22 Jan 1999 04:13:00 +0000 (04:13 +0000)
committerwessels <>
Fri, 22 Jan 1999 04:13:00 +0000 (04:13 +0000)
* Changed async_io.c and aiops.c to use MemPool pools for their
"request" structures.

* Fix for a odd situation where I/O operations could get stuck in the
queue if there was no new I/O activity. Symptoms seen was: 1. The
shutdown code could trigger some assertions which seemed impossible. 2.
Some times a number of files could be kept open until the next swapout.

* Changed the log message shown when running low on I/O threads, and
also changed logging of this message to only occur if out of threads for
more than one second.

* Moved some aiops.c log messages to lower priorities.

* Removed that special low-priority queue for unlinks. I had some
strange effects from it, and the number of queued unlinks fluctuaded a
bit to much when under heavy load. If store maintaince is a problem then
this should it be corrected at a higher level, and not by delaying the
unlinks.

* Minor preparations for making NUMTHREADS a squid.conf tunable.

* moved memClean later in the shutdown procedure, to allow async-io to
use MemPool..

src/disk.cc
src/fd.cc
src/main.cc
src/protos.h

index 50b5de79333e12a7051e6c513c88652aa8b66b4f..0e6480c8b55ceb06f59b504d887993c54be813d8 100644 (file)
@@ -1,7 +1,7 @@
 
 
 /*
- * $Id: disk.cc,v 1.139 1999/01/13 23:24:11 wessels Exp $
+ * $Id: disk.cc,v 1.140 1999/01/21 21:13:00 wessels Exp $
  *
  * DEBUG: section 6     Disk I/O Routines
  * AUTHOR: Harvest Derived
@@ -161,6 +161,7 @@ file_close(int fd)
      * leaking write state data by closing the descriptor
      */
     assert(F->write_handler == NULL);
+    F->flags.closing = 1;
 #if USE_ASYNC_IO
     aioClose(fd);
 #else
@@ -171,7 +172,9 @@ file_close(int fd)
 #endif
     debug(6, F->flags.close_request ? 2 : 5)
        ("file_close: FD %d, really closing\n", fd);
+#if !USE_ASYNC_IO
     fd_close(fd);
+#endif
     Counter.syscalls.disk.closes++;
 }
 
index b1890f0bc285e69360c25b070699fadb32fd86a1..caee0cbb9491a6140a947e9e7e6cf6daf4f9a25c 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -1,6 +1,6 @@
 
 /*
- * $Id: fd.cc,v 1.34 1999/01/21 21:10:32 wessels Exp $
+ * $Id: fd.cc,v 1.35 1999/01/21 21:13:01 wessels Exp $
  *
  * DEBUG: section 51    Filedescriptor Functions
  * AUTHOR: Duane Wessels
@@ -90,11 +90,27 @@ fd_close(int fd)
     F->timeout = 0;
 }
 
+#if USE_ASYNC_IO
+void
+fd_was_closed(int fd)
+{
+    fde *F = &fd_table[fd];
+    if (F->flags.closing)
+       fd_close(fd);
+}
+#endif
+
 void
 fd_open(int fd, unsigned int type, const char *desc)
 {
     fde *F = &fd_table[fd];
     assert(fd >= 0);
+#if USE_ASYNC_IO
+    if (F->flags.closing) {
+       /* Reuse of a closed FD before we have noticed it is closed */
+       fd_close(fd);
+    }
+#endif
     if (F->flags.open) {
        debug(51, 1) ("WARNING: Closing open FD %4d\n", fd);
        fd_close(fd);
index 83dc43386a6adf252363549df9aa602728c88e3b..bd01309cf4b18587378f8ab6ff7ceaeb2d9ed26f 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: main.cc,v 1.286 1999/01/19 02:24:28 wessels Exp $
+ * $Id: main.cc,v 1.287 1999/01/21 21:13:02 wessels Exp $
  *
  * DEBUG: section 1     Startup and Main Loop
  * AUTHOR: Harvest Derived
@@ -747,11 +747,20 @@ SquidShutdown(void *unused)
     releaseServerSockets();
     commCloseAllSockets();
     unlinkdClose();
+#if USE_ASYNC_IO
+    aioSync();                 /* flush pending object writes / unlinks */
+#endif
     storeDirWriteCleanLogs(0);
     PrintRusage();
     dumpMallocStats();
+#if USE_ASYNC_IO
+    aioSync();                 /* flush log writes */
+#endif
     storeLogClose();
     accessLogClose();
+#if USE_ASYNC_IO
+    aioSync();                 /* flush log close */
+#endif
 #if PURIFY || XMALLOC_TRACE
     configFreeMemory();
     storeFreeMemory();
@@ -767,7 +776,6 @@ SquidShutdown(void *unused)
     mimeFreeMemory();
     errorClean();
 #endif
-    memClean();
 #if !XMALLOC_TRACE
     if (opt_no_daemon) {
        file_close(0);
@@ -777,6 +785,7 @@ SquidShutdown(void *unused)
 #endif
     fdDumpOpen();
     fdFreeMemory();
+    memClean();
 #if XMALLOC_TRACE
     xmalloc_find_leaks();
     debug(1, 0) ("Memory used after shutdown: %d\n", xmalloc_total);
index 3b4ed7c876cb982506bfe44f888b008492935b4e..935a18067d6a74284cecf03f29c722c37d54e986 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: protos.h,v 1.308 1999/01/19 23:18:00 wessels Exp $
+ * $Id: protos.h,v 1.309 1999/01/21 21:13:04 wessels Exp $
  *
  *
  * SQUID Internet Object Cache  http://squid.nlanr.net/Squid/
@@ -75,6 +75,7 @@ extern int aio_stat(const char *, struct stat *, aio_result_t *);
 extern int aio_unlink(const char *, aio_result_t *);
 extern int aio_opendir(const char *, aio_result_t *);
 extern aio_result_t *aio_poll_done(void);
+extern int aio_operations_pending(void);
 
 extern void aioCancel(int, void *);
 extern void aioOpen(const char *, int, mode_t, AIOCB *, void *, void *);
@@ -84,6 +85,7 @@ extern void aioRead(int, int offset, char *, int size, AIOCB *, void *);
 extern void aioStat(char *, struct stat *, AIOCB *, void *, void *);
 extern void aioUnlink(const char *, AIOCB *, void *);
 extern void aioCheckCallbacks(void);
+extern void aioSync(void);
 #endif
 
 extern int parseConfigFile(const char *file_name);
@@ -218,6 +220,9 @@ extern void eventFreeMemory(void);
 extern int eventFind(EVH *, void *);
 
 extern void fd_close(int fd);
+#if USE_ASYNC_IO
+extern void fd_was_closed(int fd);
+#endif
 extern void fd_open(int fd, unsigned int type, const char *);
 extern void fd_note(int fd, const char *);
 extern void fd_bytes(int fd, int len, unsigned int type);