mempools conversions, more ..

From: Adrian Chadd <adrian@dont-contact.us>
Date: Thu, 5 Oct 2000 20:22:58 +0800

ok. This makes the aio stat request pool use a memPool. I think I'm going
to end up being flogging boy on converting things to mempools here. :-)

I'll go in and commit my comm.c mempool additions since I've been running
them here without any mishaps.

*puts on mempool hat and wonders how much ram squid will stop chewing ..*

Adrian

Index: aiops.c
===================================================================
RCS file: /server/cvs-server/squid/squid/src/fs/aufs/aiops.c,v
retrieving revision 1.2
diff -u -r1.2 aiops.c
--- aiops.c 2000/06/27 08:33:53 1.2
+++ aiops.c 2000/10/05 12:16:53
@@ -142,6 +142,7 @@
 
 static int request_queue_len = 0;
 static MemPool *aio_request_pool = NULL;
+static MemPool *aio_stat_pool = NULL;
 static aio_request_t *request_queue_head = NULL;
 static aio_request_t *request_queue_tail = NULL;
 static aio_request_t *request_done_head = NULL;
@@ -206,6 +207,7 @@
 
     /* Create request pool */
     aio_request_pool = memPoolCreate("aio_request", sizeof(aio_request_t));
+ aio_stat_pool = memPoolCreate("aio_stat", sizeof(struct stat));
 
     aio_initialised = 1;
 }
@@ -464,6 +466,7 @@
         if (!cancelled && requestp->ret == 0)
             xmemcpy(requestp->statp, requestp->tmpstatp, sizeof(struct stat));
         xfree(requestp->tmpstatp);
+ memFree(aio_stat_pool, requestp->tmpstatp);
     case _AIO_OP_OPEN:
         if (cancelled && requestp->ret >= 0)
             /* The open() was cancelled but completed */
@@ -689,12 +692,7 @@
     }
     strncpy(requestp->path, path, len);
     requestp->statp = sb;
- if ((requestp->tmpstatp = (struct stat *) xmalloc(sizeof(struct stat))) == NULL) {
- xfree(requestp->path);
- memPoolFree(aio_request_pool, requestp);
- errno = ENOMEM;
- return -1;
- }
+ requestp->tmpstatp = memPoolAlloc(aio_stat_pool);
     requestp->resultp = resultp;
     requestp->request_type = _AIO_OP_STAT;
     requestp->cancelled = 0;

-- 
Adrian Chadd			"If a butterfly flaps its wings in China,
<adrian@creative.net.au>	    will a woman get naked in Amsterdam?"
				      -- Ashley Penney on Chaos Theory
Received on Thu Oct 05 2000 - 06:23:08 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:41 MST