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 stripelocks to kmutex.



details:   https://anonhg.NetBSD.org/src/rev/d8b87e1734e2
branches:  trunk
changeset: 764804:d8b87e1734e2
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu May 05 08:21:29 2011 +0000

description:
convert stripelocks to kmutex.

diffstat:

 sys/dev/raidframe/rf_stripelocks.c |  27 +++++++++++++++++++--------
 sys/dev/raidframe/rf_stripelocks.h |   4 ++--
 2 files changed, 21 insertions(+), 10 deletions(-)

diffs (108 lines):

diff -r 15f77255685e -r d8b87e1734e2 sys/dev/raidframe/rf_stripelocks.c
--- a/sys/dev/raidframe/rf_stripelocks.c        Thu May 05 08:21:09 2011 +0000
+++ b/sys/dev/raidframe/rf_stripelocks.c        Thu May 05 08:21:29 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $  */
+/*     $NetBSD: rf_stripelocks.c,v 1.32 2011/05/05 08:21:29 mrg Exp $  */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -57,7 +57,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.31 2011/04/30 01:44:36 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_stripelocks.c,v 1.32 2011/05/05 08:21:29 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -182,6 +182,17 @@
        return (0);
 }
 
+static void
+rf_DestroyLockTable(RF_LockTableEntry_t *lockTable)
+{
+       int     i;
+
+       for (i = 0; i < rf_lockTableSize; i++) {
+               rf_destroy_mutex2(lockTable[i].mutex);
+       }
+       RF_Free(lockTable, rf_lockTableSize * sizeof(RF_LockTableEntry_t));
+}
+
 static RF_LockTableEntry_t *
 rf_MakeLockTable(void)
 {
@@ -194,7 +205,7 @@
        if (lockTable == NULL)
                return (NULL);
        for (i = 0; i < rf_lockTableSize; i++) {
-               rf_mutex_init(&lockTable[i].mutex);
+               rf_init_mutex2(lockTable[i].mutex, IPL_VM);
        }
        return (lockTable);
 }
@@ -208,7 +219,7 @@
                PrintLockedStripes(lockTable);
        }
 #endif
-       RF_Free(lockTable, rf_lockTableSize * sizeof(RF_LockTableEntry_t));
+       rf_DestroyLockTable(lockTable);
 }
 
 static void
@@ -268,7 +279,7 @@
        lockReqDesc->next = NULL;       /* just to be sure */
        newlockDesc = AllocStripeLockDesc(stripeID);
 
-       RF_LOCK_MUTEX(lockTable[hashval].mutex);
+       rf_lock_mutex2(lockTable[hashval].mutex);
        for (lockDesc = lockTable[hashval].descList; lockDesc;
             lockDesc = lockDesc->next) {
                if (lockDesc->stripeID == stripeID)
@@ -354,7 +365,7 @@
                }
        }
 
-       RF_UNLOCK_MUTEX(lockTable[hashval].mutex);
+       rf_unlock_mutex2(lockTable[hashval].mutex);
        return (retcode);
 }
 
@@ -387,7 +398,7 @@
        if (stripeID == -1)
                return;
 
-       RF_LOCK_MUTEX(lockTable[hashval].mutex);
+       rf_lock_mutex2(lockTable[hashval].mutex);
 
        /* find the stripe lock descriptor */
        for (ld_t = NULL, lockDesc = lockTable[hashval].descList;
@@ -600,7 +611,7 @@
                FreeStripeLockDesc(lockDesc);
                lockDesc = NULL;/* only for the ASSERT below */
        }
-       RF_UNLOCK_MUTEX(lockTable[hashval].mutex);
+       rf_unlock_mutex2(lockTable[hashval].mutex);
 
        /* now that we've unlocked the mutex, invoke the callback on
         * all the descriptors in the list */
diff -r 15f77255685e -r d8b87e1734e2 sys/dev/raidframe/rf_stripelocks.h
--- a/sys/dev/raidframe/rf_stripelocks.h        Thu May 05 08:21:09 2011 +0000
+++ b/sys/dev/raidframe/rf_stripelocks.h        Thu May 05 08:21:29 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_stripelocks.h,v 1.7 2005/12/11 12:23:37 christos Exp $      */
+/*     $NetBSD: rf_stripelocks.h,v 1.8 2011/05/05 08:21:29 mrg Exp $   */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -75,7 +75,7 @@
 };
 
 struct RF_LockTableEntry_s {
-       RF_DECLARE_MUTEX(mutex) /* mutex on this hash chain */
+       rf_declare_mutex2(mutex);       /* mutex on this hash chain */
        RF_StripeLockDesc_t *descList;  /* hash chain of lock descriptors */
 };
 /*



Home | Main Index | Thread Index | Old Index