convert the diskqueue mutex into a kmutex

This commit is contained in:
mrg 2011-05-05 06:04:09 +00:00
parent 19742b4964
commit ec1c557b57
2 changed files with 16 additions and 10 deletions

View File

@ -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 @@ static const RF_DiskQueueSW_t diskqueuesw[] = {
/* 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 @@ rf_ConfigureDiskQueue(RF_Raid_t *raidPtr, RF_DiskQueue_t *diskqueue,
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);
}

View File

@ -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_DiskQueueSW_s {
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 @@ struct RF_DiskQueue_s {
#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_) \