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 reintMutex to a kmutex.



details:   https://anonhg.NetBSD.org/src/rev/826d1c5b5218
branches:  trunk
changeset: 764897:826d1c5b5218
user:      mrg <mrg%NetBSD.org@localhost>
date:      Wed May 11 03:38:32 2011 +0000

description:
convert reintMutex to a kmutex.

diffstat:

 sys/dev/raidframe/rf_paritylog.c        |  18 +++++++++---------
 sys/dev/raidframe/rf_paritylog.h        |   4 ++--
 sys/dev/raidframe/rf_paritylogDiskMgr.c |   8 ++++----
 sys/dev/raidframe/rf_paritylogging.c    |   7 ++++---
 4 files changed, 19 insertions(+), 18 deletions(-)

diffs (161 lines):

diff -r 0e4b92126b59 -r 826d1c5b5218 sys/dev/raidframe/rf_paritylog.c
--- a/sys/dev/raidframe/rf_paritylog.c  Wed May 11 03:23:26 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.c  Wed May 11 03:38:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylog.c,v 1.15 2011/05/11 03:23:26 mrg Exp $    */
+/*     $NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 mrg Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.15 2011/05/11 03:23:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylog.c,v 1.16 2011/05/11 03:38:32 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -548,7 +548,7 @@
         * specified region (regionID) to indicate that reintegration is in
         * progress for this region. NON-BLOCKING */
 
-       RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+       rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
        raidPtr->regionInfo[regionID].reintInProgress = RF_TRUE;        /* cleared when reint
                                                                         * complete */
 
@@ -558,7 +558,7 @@
        rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
        log->next = raidPtr->parityLogDiskQueue.reintQueue;
        raidPtr->parityLogDiskQueue.reintQueue = log;
-       RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+       rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
        rf_signal_cond2(raidPtr->parityLogDiskQueue.cond);
        rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
 }
@@ -612,7 +612,7 @@
        RF_ASSERT(log->next == NULL);
 
        /* if reintegration is in progress, must queue work */
-       RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+       rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
        if (raidPtr->regionInfo[regionID].reintInProgress) {
                /* Can not proceed since this region is currently being
                 * reintegrated. We can not block, so queue remaining work and
@@ -625,10 +625,10 @@
                        RequeueParityLogData(logData, &raidPtr->parityLogDiskQueue.reintBlockHead, &raidPtr->parityLogDiskQueue.reintBlockTail);
                else
                        EnqueueParityLogData(logData, &raidPtr->parityLogDiskQueue.reintBlockHead, &raidPtr->parityLogDiskQueue.reintBlockTail);
-               RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+               rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
                return (1);     /* relenquish control of this thread */
        }
-       RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+       rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
        raidPtr->regionInfo[regionID].coreLog = NULL;
        if ((raidPtr->regionInfo[regionID].diskCount) < raidPtr->regionInfo[regionID].capacity)
                /* IMPORTANT!! this loop bound assumes region disk holds an
@@ -695,13 +695,13 @@
        if (clearReintFlag) {
                /* Enable flushing for this region.  Holding both locks
                 * provides a synchronization barrier with DumpParityLogToDisk */
-               RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+               rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
                /* XXXmrg need this? */
                rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
                RF_ASSERT(raidPtr->regionInfo[regionID].reintInProgress == RF_TRUE);
                raidPtr->regionInfo[regionID].diskCount = 0;
                raidPtr->regionInfo[regionID].reintInProgress = RF_FALSE;
-               RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);      /* flushing is now
+               rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);     /* flushing is now
                                                                                 * enabled */
                /* XXXmrg need this? */
                rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
diff -r 0e4b92126b59 -r 826d1c5b5218 sys/dev/raidframe/rf_paritylog.h
--- a/sys/dev/raidframe/rf_paritylog.h  Wed May 11 03:23:26 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylog.h  Wed May 11 03:38:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylog.h,v 1.7 2011/05/11 03:23:26 mrg Exp $     */
+/*     $NetBSD: rf_paritylog.h,v 1.8 2011/05/11 03:38:32 mrg Exp $     */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -146,7 +146,7 @@
 struct RF_RegionInfo_s {
        RF_DECLARE_MUTEX(mutex) /* protects: diskCount, diskMap,
                                 * loggingEnabled, coreLog */
-       RF_DECLARE_MUTEX(reintMutex)    /* protects: reintInProgress */
+       rf_declare_mutex2(reintMutex);  /* protects: reintInProgress */
        int     reintInProgress;/* flag used to suspend flushing operations */
        RF_SectorCount_t capacity;      /* capacity of this region in sectors */
        RF_SectorNum_t regionStartAddr; /* starting disk address for this
diff -r 0e4b92126b59 -r 826d1c5b5218 sys/dev/raidframe/rf_paritylogDiskMgr.c
--- a/sys/dev/raidframe/rf_paritylogDiskMgr.c   Wed May 11 03:23:26 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogDiskMgr.c   Wed May 11 03:38:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylogDiskMgr.c,v 1.25 2011/05/11 03:23:26 mrg Exp $     */
+/*     $NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 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.25 2011/05/11 03:23:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogDiskMgr.c,v 1.26 2011/05/11 03:38:32 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -535,13 +535,13 @@
                         * locks provides a synchronization barrier with
                         * DumpParityLogToDisk */
                        RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
-                       RF_LOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);
+                       rf_lock_mutex2(raidPtr->regionInfo[regionID].reintMutex);
                        /* XXXmrg: don't need this? */
                        rf_lock_mutex2(raidPtr->parityLogDiskQueue.mutex);
                        raidPtr->regionInfo[regionID].diskCount = 0;
                        raidPtr->regionInfo[regionID].reintInProgress = RF_FALSE;
                        RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
-                       RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].reintMutex);      /* flushing is now
+                       rf_unlock_mutex2(raidPtr->regionInfo[regionID].reintMutex);     /* flushing is now
                                                                                         * enabled */
                        /* XXXmrg: don't need this? */
                        rf_unlock_mutex2(raidPtr->parityLogDiskQueue.mutex);
diff -r 0e4b92126b59 -r 826d1c5b5218 sys/dev/raidframe/rf_paritylogging.c
--- a/sys/dev/raidframe/rf_paritylogging.c      Wed May 11 03:23:26 2011 +0000
+++ b/sys/dev/raidframe/rf_paritylogging.c      Wed May 11 03:38:32 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_paritylogging.c,v 1.30 2011/05/11 03:23:26 mrg Exp $        */
+/*     $NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 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.30 2011/05/11 03:23:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_paritylogging.c,v 1.31 2011/05/11 03:38:32 mrg Exp $");
 
 #include "rf_archs.h"
 
@@ -411,7 +411,7 @@
                          raidPtr);
        for (i = 0; i < rf_numParityRegions; i++) {
                rf_mutex_init(&raidPtr->regionInfo[i].mutex);
-               rf_mutex_init(&raidPtr->regionInfo[i].reintMutex);
+               rf_init_mutex2(raidPtr->regionInfo[i].reintMutex, IPL_VM);
                raidPtr->regionInfo[i].reintInProgress = RF_FALSE;
                raidPtr->regionInfo[i].regionStartAddr =
                        raidPtr->regionLogCapacity * i;
@@ -513,6 +513,7 @@
                RF_ASSERT(raidPtr->regionInfo[regionID].diskCount == 0);
        }
        RF_UNLOCK_MUTEX(raidPtr->regionInfo[regionID].mutex);
+       rf_destroy_mutex2(raidPtr->regionInfo[regionID].reintMutex);
 }
 
 



Home | Main Index | Thread Index | Old Index