Add a 'waitflag' argument to rf_CreateDiskQueueData() and use it to
determine if we are willing to wait for memory to come from the diskqueuedata (dqd) and bufpool pools. Cleanup the mess related to code calling rf_CreateDiskQueueData() with different expectations (and/or blatent disregard) of what might happen if there were insufficient pool resources.
This commit is contained in:
parent
ef57c7b216
commit
0b15470982
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_copyback.c,v 1.28 2004/03/04 02:49:58 oster Exp $ */
|
||||
/* $NetBSD: rf_copyback.c,v 1.29 2005/02/12 03:27:33 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -38,7 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.28 2004/03/04 02:49:58 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.29 2005/02/12 03:27:33 oster Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -337,11 +337,13 @@ rf_CopybackOne(RF_CopybackDesc_t *desc, int typ, RF_RaidAddr_t addr,
|
|||
desc->readreq = rf_CreateDiskQueueData(RF_IO_TYPE_READ, spOffs,
|
||||
sectPerSU, desc->databuf, 0L, 0,
|
||||
(int (*) (void *, int)) rf_CopybackReadDoneProc, desc,
|
||||
NULL, NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL);
|
||||
NULL, NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL,
|
||||
PR_WAITOK);
|
||||
desc->writereq = rf_CreateDiskQueueData(RF_IO_TYPE_WRITE, testOffs,
|
||||
sectPerSU, desc->databuf, 0L, 0,
|
||||
(int (*) (void *, int)) rf_CopybackWriteDoneProc, desc,
|
||||
NULL, NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL);
|
||||
NULL, NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL,
|
||||
PR_WAITOK);
|
||||
desc->fcol = testCol;
|
||||
|
||||
/* enqueue the read. the write will go out as part of the callback on
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_dagfuncs.c,v 1.20 2004/03/04 00:54:30 oster Exp $ */
|
||||
/* $NetBSD: rf_dagfuncs.c,v 1.21 2005/02/12 03:27:33 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -48,7 +48,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.20 2004/03/04 00:54:30 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.21 2005/02/12 03:27:33 oster Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
@ -296,7 +296,7 @@ rf_DiskReadFuncForThreads(RF_DagNode_t *node)
|
|||
#else
|
||||
NULL,
|
||||
#endif
|
||||
(void *) (node->dagHdr->raidPtr), 0, b_proc);
|
||||
(void *) (node->dagHdr->raidPtr), 0, b_proc, PR_NOWAIT);
|
||||
if (!req) {
|
||||
(node->wakeFunc) (node, ENOMEM);
|
||||
} else {
|
||||
|
@ -337,7 +337,7 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t *node)
|
|||
NULL,
|
||||
#endif
|
||||
(void *) (node->dagHdr->raidPtr),
|
||||
0, b_proc);
|
||||
0, b_proc, PR_NOWAIT);
|
||||
|
||||
if (!req) {
|
||||
(node->wakeFunc) (node, ENOMEM);
|
||||
|
@ -371,7 +371,7 @@ rf_DiskUndoFunc(RF_DagNode_t *node)
|
|||
NULL,
|
||||
#endif
|
||||
(void *) (node->dagHdr->raidPtr),
|
||||
RF_UNLOCK_DISK_QUEUE, NULL);
|
||||
RF_UNLOCK_DISK_QUEUE, NULL, PR_NOWAIT);
|
||||
if (!req)
|
||||
(node->wakeFunc) (node, ENOMEM);
|
||||
else {
|
||||
|
@ -402,7 +402,7 @@ rf_DiskUnlockFuncForThreads(RF_DagNode_t *node)
|
|||
NULL,
|
||||
#endif
|
||||
(void *) (node->dagHdr->raidPtr),
|
||||
RF_UNLOCK_DISK_QUEUE, NULL);
|
||||
RF_UNLOCK_DISK_QUEUE, NULL, PR_NOWAIT);
|
||||
if (!req)
|
||||
(node->wakeFunc) (node, ENOMEM);
|
||||
else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_diskqueue.c,v 1.37 2005/02/05 23:53:44 oster Exp $ */
|
||||
/* $NetBSD: rf_diskqueue.c,v 1.38 2005/02/12 03:27:33 oster 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.37 2005/02/05 23:53:44 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.38 2005/02/12 03:27:33 oster Exp $");
|
||||
|
||||
#include <dev/raidframe/raidframevar.h>
|
||||
|
||||
|
@ -446,22 +446,25 @@ rf_CreateDiskQueueData(RF_IoType_t typ, RF_SectorNum_t ssect,
|
|||
int (*wakeF) (void *, int), void *arg,
|
||||
RF_DiskQueueData_t *next,
|
||||
RF_AccTraceEntry_t *tracerec, RF_Raid_t *raidPtr,
|
||||
RF_DiskQueueDataFlags_t flags, void *kb_proc)
|
||||
RF_DiskQueueDataFlags_t flags, void *kb_proc,
|
||||
int waitflag)
|
||||
{
|
||||
RF_DiskQueueData_t *p;
|
||||
int s;
|
||||
|
||||
p = pool_get(&rf_pools.dqd, PR_WAITOK);
|
||||
p = pool_get(&rf_pools.dqd, waitflag);
|
||||
if (p == NULL)
|
||||
return (NULL);
|
||||
|
||||
memset(p, 0, sizeof(RF_DiskQueueData_t));
|
||||
/* Need to be at splbio to access bufpool! */
|
||||
s = splbio();
|
||||
p->bp = pool_get(&bufpool, PR_NOWAIT); /* XXX: make up our minds here.
|
||||
WAITOK, or NOWAIT?? */
|
||||
p->bp = pool_get(&bufpool, waitflag);
|
||||
splx(s);
|
||||
if (p->bp == NULL) {
|
||||
/* no memory for the buffer!?!? */
|
||||
pool_put(&rf_pools.dqd, p);
|
||||
return(NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
memset(p->bp, 0, sizeof(struct buf));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_diskqueue.h,v 1.17 2005/02/05 23:53:44 oster Exp $ */
|
||||
/* $NetBSD: rf_diskqueue.h,v 1.18 2005/02/12 03:27:33 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -160,7 +160,7 @@ RF_DiskQueueData_t *rf_CreateDiskQueueData(RF_IoType_t, RF_SectorNum_t,
|
|||
void *, RF_DiskQueueData_t *,
|
||||
RF_AccTraceEntry_t *, RF_Raid_t *,
|
||||
RF_DiskQueueDataFlags_t,
|
||||
void *);
|
||||
void *, int);
|
||||
void rf_FreeDiskQueueData(RF_DiskQueueData_t *);
|
||||
int rf_ConfigureDiskQueue(RF_Raid_t *, RF_DiskQueue_t *,
|
||||
RF_RowCol_t, const RF_DiskQueueSW_t *,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rf_reconstruct.c,v 1.84 2005/02/06 02:29:36 oster Exp $ */
|
||||
/* $NetBSD: rf_reconstruct.c,v 1.85 2005/02/12 03:27:33 oster Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -33,7 +33,7 @@
|
|||
************************************************************/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.84 2005/02/06 02:29:36 oster Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.85 2005/02/12 03:27:33 oster Exp $");
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/buf.h>
|
||||
|
@ -1190,9 +1190,7 @@ TryToRead(RF_Raid_t *raidPtr, RF_RowCol_t col)
|
|||
#else
|
||||
NULL,
|
||||
#endif
|
||||
(void *) raidPtr, 0, NULL);
|
||||
|
||||
RF_ASSERT(req); /* XXX -- fix this -- XXX */
|
||||
(void *) raidPtr, 0, NULL, PR_WAITOK);
|
||||
|
||||
ctrl->rbuf->arg = (void *) req;
|
||||
rf_DiskIOEnqueue(&raidPtr->Queues[col], req, RF_IO_RECON_PRIORITY);
|
||||
|
@ -1380,9 +1378,7 @@ IssueNextWriteRequest(RF_Raid_t *raidPtr)
|
|||
#else
|
||||
NULL,
|
||||
#endif
|
||||
(void *) raidPtr, 0, NULL);
|
||||
|
||||
RF_ASSERT(req); /* XXX -- fix this -- XXX */
|
||||
(void *) raidPtr, 0, NULL, PR_WAITOK);
|
||||
|
||||
rbuf->arg = (void *) req;
|
||||
RF_LOCK_MUTEX(raidPtr->reconControl->rb_mutex);
|
||||
|
@ -1706,10 +1702,7 @@ rf_ForceOrBlockRecon(RF_Raid_t *raidPtr, RF_AccessStripeMap_t *asmap,
|
|||
* should be in kernel space */
|
||||
req = rf_CreateDiskQueueData(RF_IO_TYPE_READ, offset + which_ru * sectorsPerRU, sectorsPerRU, new_rbuf->buffer,
|
||||
psid, which_ru, (int (*) (void *, int)) ForceReconReadDoneProc, (void *) new_rbuf, NULL,
|
||||
NULL, (void *) raidPtr, 0, NULL);
|
||||
|
||||
RF_ASSERT(req); /* XXX -- fix this --
|
||||
* XXX */
|
||||
NULL, (void *) raidPtr, 0, NULL, PR_WAITOK);
|
||||
|
||||
new_rbuf->arg = req;
|
||||
rf_DiskIOEnqueue(&raidPtr->Queues[diskno], req, RF_IO_NORMAL_PRIORITY); /* enqueue the I/O */
|
||||
|
|
Loading…
Reference in New Issue