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 the diskqueue mutex into a kmutex



details:   https://anonhg.NetBSD.org/src/rev/e1105b2d7bb1
branches:  trunk
changeset: 764800:e1105b2d7bb1
user:      mrg <mrg%NetBSD.org@localhost>
date:      Thu May 05 06:04:09 2011 +0000

description:
convert the diskqueue mutex into a kmutex

diffstat:

 sys/dev/raidframe/rf_diskqueue.c |  16 ++++++++++++----
 sys/dev/raidframe/rf_diskqueue.h |  10 ++++------
 2 files changed, 16 insertions(+), 10 deletions(-)

diffs (75 lines):

diff -r 50f2fdb66ccc -r e1105b2d7bb1 sys/dev/raidframe/rf_diskqueue.c
--- a/sys/dev/raidframe/rf_diskqueue.c  Thu May 05 05:58:14 2011 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.c  Thu May 05 06:04:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_diskqueue.c,v 1.52 2009/03/23 18:38:54 oster Exp $  */
+/*     $NetBSD: rf_diskqueue.c,v 1.53 2011/05/05 06:04:09 mrg Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -66,7 +66,7 @@
  ****************************************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.52 2009/03/23 18:38:54 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.53 2011/05/05 06:04:09 mrg Exp $");
 
 #include <dev/raidframe/raidframevar.h>
 
@@ -154,6 +154,14 @@
 
 /* configures a single disk queue */
 
+static void
+rf_ShutdownDiskQueue(void *arg)
+{
+       RF_DiskQueue_t *diskqueue = arg;
+
+       rf_destroy_mutex2(diskqueue->mutex);
+}
+
 int
 rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue,
                      RF_RowCol_t c, const RF_DiskQueueSW_t *p,
@@ -172,8 +180,8 @@
        diskqueue->flags = 0;
        diskqueue->raidPtr = raidPtr;
        diskqueue->rf_cinfo = &raidPtr->raid_cinfo[c];
-       rf_mutex_init(&diskqueue->mutex);
-       diskqueue->cond = 0;
+       rf_init_mutex2(diskqueue->mutex, IPL_VM);
+       rf_ShutdownCreate(listp, rf_ShutdownDiskQueue, diskqueue);
        return (0);
 }
 
diff -r 50f2fdb66ccc -r e1105b2d7bb1 sys/dev/raidframe/rf_diskqueue.h
--- a/sys/dev/raidframe/rf_diskqueue.h  Thu May 05 05:58:14 2011 +0000
+++ b/sys/dev/raidframe/rf_diskqueue.h  Thu May 05 06:04:09 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_diskqueue.h,v 1.23 2009/03/23 18:38:54 oster Exp $  */
+/*     $NetBSD: rf_diskqueue.h,v 1.24 2011/05/05 06:04:09 mrg Exp $    */
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -102,9 +102,7 @@
 struct RF_DiskQueue_s {
        const RF_DiskQueueSW_t *qPtr;   /* access point to queue functions */
        void   *qHdr;           /* queue header, of whatever type */
-        RF_DECLARE_MUTEX(mutex)        /* mutex locking data structures */
-        RF_DECLARE_COND(cond)  /* condition variable for
-                                * synchronization */
+       rf_declare_mutex2(mutex);/* mutex locking data structures */
        long    numOutstanding; /* number of I/Os currently outstanding on
                                 * disk */
        long    maxOutstanding; /* max # of I/Os that can be outstanding on a
@@ -127,8 +125,8 @@
 #define RF_QUEUE_EMPTY(_q)                  ((_q)->numOutstanding == 0)
 #define RF_QUEUE_FULL(_q)                   ((_q)->numOutstanding == (_q)->maxOutstanding)
 
-#define RF_LOCK_QUEUE_MUTEX(_q_,_wh_)   RF_LOCK_MUTEX((_q_)->mutex)
-#define RF_UNLOCK_QUEUE_MUTEX(_q_,_wh_) RF_UNLOCK_MUTEX((_q_)->mutex)
+#define RF_LOCK_QUEUE_MUTEX(_q_,_wh_)   rf_lock_mutex2((_q_)->mutex)
+#define RF_UNLOCK_QUEUE_MUTEX(_q_,_wh_) rf_unlock_mutex2((_q_)->mutex)
 
 /* whether it is ok to dispatch a regular request */
 #define RF_OK_TO_DISPATCH(_q_,_r_) \



Home | Main Index | Thread Index | Old Index