diff options
| author | ad <ad@NetBSD.org> | 2007-11-07 14:04:27 +0000 |
|---|---|---|
| committer | ad <ad@NetBSD.org> | 2007-11-07 14:04:27 +0000 |
| commit | 54221c3e0f2d875ec00adc13fc740a2230cee541 (patch) | |
| tree | 4aeb6f3872c9862757c11ad41e56aeb2266517d7 /sys/dev/dmover | |
| parent | d4fdb655f875d4b4162578fa085406366b888c3a (diff) | |
- Make it compile again.
- Don't call pool_cache_init with a held simplelock.
Diffstat (limited to 'sys/dev/dmover')
| -rw-r--r-- | sys/dev/dmover/dmover_request.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/sys/dev/dmover/dmover_request.c b/sys/dev/dmover/dmover_request.c index a28bdc8f7b3..0cd2b34638f 100644 --- a/sys/dev/dmover/dmover_request.c +++ b/sys/dev/dmover/dmover_request.c @@ -1,4 +1,4 @@ -/* $NetBSD: dmover_request.c,v 1.3 2007/11/07 00:23:18 ad Exp $ */ +/* $NetBSD: dmover_request.c,v 1.4 2007/11/07 14:04:27 ad Exp $ */ /* * Copyright (c) 2002 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dmover_request.c,v 1.3 2007/11/07 00:23:18 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dmover_request.c,v 1.4 2007/11/07 14:04:27 ad Exp $"); #include <sys/param.h> #include <sys/lock.h> @@ -58,18 +58,26 @@ static struct simplelock initialized_slock = SIMPLELOCK_INITIALIZER; void dmover_request_initialize(void) { + pool_cache_t pc; int s; + if (initialized == 0) { + pc = pool_cache_init(sizeof(struct dmover_request), 0, 0, 0, + "dmreq", NULL, IPL_BIO, NULL, NULL, NULL); + } + s = splbio(); simple_lock(&initialized_slock); if (__predict_true(initialized == 0)) { - dmover_request_cache = - pool_cache_init(sizeof(struct dmover_request), 0, 0, 0, - "dmreq", NULL, IPL_BIO, NULL, NULL, NULL); + dmover_request_cache = pc + pc = NULL; initialized = 1; } simple_unlock(&initialized_slock); splx(s); + + if (pc != NULL) + pool_cache_destroy(pc); } /* @@ -83,18 +91,8 @@ dmover_request_alloc(struct dmover_session *dses, dmover_buffer *inbuf) struct dmover_request *dreq; int inputs = dses->dses_ninputs; - if (__predict_false(initialized == 0)) { - int error; - - s = splbio(); - simple_lock(&initialized_slock); - error = (initialized == 0); - simple_unlock(&initialized_slock); - splx(s); - - if (error) - return (NULL); - } + if (__predict_false(initialized == 0)) + return (NULL); dreq = pool_cache_get(dmover_request_cache, PR_NOWAIT); if (dreq == NULL) |
