Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/raidframe convert regionBufferPool.mutex/cond and pa...



details:   https://anonhg.NetBSD.org/src/rev/9c1da503a127
branches:  trunk
changeset: 764900:9c1da503a127
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed May 11 06:20:33 2011 +0000

description:
convert regionBufferPool.mutex/cond and parityBufferPool.mutex/cond
to kmutex/cv.

diffstat:

 sys/dev/raidframe/rf_paritylog.h        |   6 +++---
 sys/dev/raidframe/rf_paritylogDiskMgr.c |  19 +++++++++++--------
 sys/dev/raidframe/rf_paritylogging.c    |  18 +++++++++---------
 3 files changed, 23 insertions(+), 20 deletions(-)

diffs (149 lines):

diff -r 514a0fc66f89 -r 9c1da503a127 sys/dev/raidframe/rf_paritylog.h
--- a/sys/dev/raidframe/rf_paritylog.h  Wed May 11 06:03:06 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.h  Wed May 11 06:20:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylog.h,v 1.10 2011/05/11 06:03:06 mrg Exp $    */
+/*     $NetBSD: rf_paritylog.h,v 1.11 2011/05/11 06:20:33 mrg Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -94,8 +94,8 @@
 };
 
 struct RF_RegionBufferQueue_s {
-       RF_DECLARE_MUTEX(mutex)
-       RF_DECLARE_COND(cond)
+       rf_declare_mutex2(mutex);
+       rf_declare_cond2(cond);
        int     bufferSize;
        int     totalBuffers;   /* size of array 'buffers' */
        int     availableBuffers;       /* num available 'buffers' */
diff -r 514a0fc66f89 -r 9c1da503a127 sys/dev/raidframe/rf_paritylogDiskMgr.c
--- a/sys/dev/raidframe/rf_paritylogDiskMgr.c   Wed May 11 06:03:06 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c   Wed May 11 06:20:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $     */
+/*     $NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 mrg Exp $     */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.27 2011/05/11 05:14:07 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.28 2011/05/11 06:20:33 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -67,18 +67,18 @@
        /* Return a region buffer from the free list (pool). If the free list
         * is empty, WAIT. BLOCKING */
 
-       RF_LOCK_MUTEX(pool->mutex);
+       rf_lock_mutex2(pool->mutex);
        if (pool->availableBuffers > 0) {
                bufPtr = pool->buffers[pool->availBuffersIndex];
                pool->availableBuffers--;
                pool->availBuffersIndex++;
                if (pool->availBuffersIndex == pool->totalBuffers)
                        pool->availBuffersIndex = 0;
-               RF_UNLOCK_MUTEX(pool->mutex);
+               rf_unlock_mutex2(pool->mutex);
        } else {
                RF_PANIC();     /* should never happen in correct config,
                                 * single reint */
-               RF_WAIT_COND(pool->cond, pool->mutex);
+               rf_wait_cond2(pool->cond, pool->mutex);
        }
        return (bufPtr);
 }
@@ -91,15 +91,18 @@
        /* Insert a region buffer (bufPtr) into the free list (pool).
         * NON-BLOCKING */
 
-       RF_LOCK_MUTEX(pool->mutex);
+       rf_lock_mutex2(pool->mutex);
        pool->availableBuffers++;
        pool->buffers[pool->emptyBuffersIndex] = bufPtr;
        pool->emptyBuffersIndex++;
        if (pool->emptyBuffersIndex == pool->totalBuffers)
                pool->emptyBuffersIndex = 0;
        RF_ASSERT(pool->availableBuffers <= pool->totalBuffers);
-       RF_UNLOCK_MUTEX(pool->mutex);
-       RF_SIGNAL_COND(pool->cond);
+       /*
+        * XXXmrg this signal goes with the above "shouldn't happen" wait?
+        */
+       rf_signal_cond2(pool->cond);
+       rf_unlock_mutex2(pool->mutex);
 }
 
 
diff -r 514a0fc66f89 -r 9c1da503a127 sys/dev/raidframe/rf_paritylogging.c
--- a/sys/dev/raidframe/rf_paritylogging.c      Wed May 11 06:03:06 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogging.c      Wed May 11 06:20:33 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylogging.c,v 1.33 2011/05/11 06:03:06 mrg Exp $        */
+/*     $NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 mrg Exp $        */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.33 2011/05/11 06:03:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.34 2011/05/11 06:20:33 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -293,8 +293,8 @@
        }
        rf_ShutdownCreate(listp, rf_ShutdownParityLoggingPool, raidPtr);
        /* build pool of region buffers */
-       rf_mutex_init(&raidPtr->regionBufferPool.mutex);
-       raidPtr->regionBufferPool.cond = 0;
+       rf_init_mutex2(raidPtr->regionBufferPool.mutex, IPL_VM);
+       rf_init_cond2(raidPtr->regionBufferPool.cond, "rfrbpl");
        raidPtr->regionBufferPool.bufferSize = raidPtr->regionLogCapacity *
                raidPtr->bytesPerSector;
        printf("regionBufferPool.bufferSize %d\n",
@@ -342,8 +342,8 @@
                          raidPtr);
        /* build pool of parity buffers */
        parityBufferCapacity = maxRegionParityRange;
-       rf_mutex_init(&raidPtr->parityBufferPool.mutex);
-       raidPtr->parityBufferPool.cond = 0;
+       rf_init_mutex2(raidPtr->parityBufferPool.mutex, IPL_VM);
+       rf_init_cond2(raidPtr->parityBufferPool.cond, "rfpbpl");
        raidPtr->parityBufferPool.bufferSize = parityBufferCapacity *
                raidPtr->bytesPerSector;
        printf("parityBufferPool.bufferSize %d\n",
@@ -392,7 +392,7 @@
                          raidPtr);
        /* initialize parityLogDiskQueue */
        rf_init_mutex2(raidPtr->parityLogDiskQueue.mutex, IPL_VM);
-       rf_init_cond2(raidPtr->parityLogDiskQueue.cond, "rfdskq");
+       rf_init_cond2(raidPtr->parityLogDiskQueue.cond, "rfpldq");
        raidPtr->parityLogDiskQueue.flushQueue = NULL;
        raidPtr->parityLogDiskQueue.reintQueue = NULL;
        raidPtr->parityLogDiskQueue.bufHead = NULL;
@@ -538,7 +538,6 @@
 {
        int     i;
 
-       RF_LOCK_MUTEX(queue->mutex);
        if (queue->availableBuffers != queue->totalBuffers) {
                printf("Attempt to free region queue which is still in use!\n");
                RF_ASSERT(0);
@@ -546,7 +545,8 @@
        for (i = 0; i < queue->totalBuffers; i++)
                RF_Free(queue->buffers[i], queue->bufferSize);
        RF_Free(queue->buffers, queue->totalBuffers * sizeof(void *));
-       RF_UNLOCK_MUTEX(queue->mutex);
+       rf_destroy_mutex2(queue->mutex);
+       rf_destroy_cond2(queue->cond);
 }
 
 static void



Home | Main Index | Thread Index | Old Index